From 3c3880d31759ea371e491176f6bac2bc802ae8bf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 19:59:20 +0800 Subject: [PATCH 0001/3057] TSL --- ...7 10 resources to boost your Git skills.md | 68 ------------------- ...7 10 resources to boost your Git skills.md | 57 ++++++++++++++++ 2 files changed, 57 insertions(+), 68 deletions(-) delete mode 100644 sources/tech/20191227 10 resources to boost your Git skills.md create mode 100644 translated/tech/20191227 10 resources to boost your Git skills.md diff --git a/sources/tech/20191227 10 resources to boost your Git skills.md b/sources/tech/20191227 10 resources to boost your Git skills.md deleted file mode 100644 index 6012455ab6..0000000000 --- a/sources/tech/20191227 10 resources to boost your Git skills.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 resources to boost your Git skills) -[#]: via: (https://opensource.com/article/19/12/git-resources) -[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) - -10 resources to boost your Git skills -====== -Wrap up the year with a review of the best in Git. Here are the top 10 -articles about surprising ways you can use Git in the new year. -![open source button on keyboard][1] - -As we near the end of 2019, it is time to look back at the top 10 articles we published about Git this year. - -These articles range from use cases and tutorials to some very interesting, if somewhat unconventional, ways to use Git. All of these articles can help you improve your Git skills, but if you really need a Git 101 introduction, be sure to check out our _[Getting started with Git: Terminology 101][2]_ article and download our [Git cheat sheet][3]. - - 1. _[How GNOME uses Git][4]_ by Molly de Blanc looks at the GNOME project’s adoption of a self-hosted GitLab instance as the GNOME project’s centralized location for contributing to GNOME. De Blanc works in a non-coding position, so her article also explores how the switch to GitLab benefits contributors whose primary role is not writing code. - - 2. Ahmad Awais’ _[Emoji-Log: A new way to write Git commit messages][5]_ explains how to use Emoji-Log, "a straightforward, open source Git commit log standard," to write better, more user-friendly, Git commit messages. The article contains an overview of the theory behind Emoji-Log and configuration examples that can be added to **.bashrc, .zshrc, or .gitconfig** to quickly start using Emoji-Log. - - 3. In _[Manage your daily schedule with Git][6]_, Seth Kenlon explains how to use Git to manage your calendar. By combining Org mode, Git, and a few other tools, Kenlon describes how to create a Git-based calendar workflow that can be synced across devices. - - 4. [_Use Git as the backend for chat_][7] by Seth Kenlon explores another unconventional way to use Git. In this article, he explores GIC, which is a chat client written in Node.js with Git functioning as the backend database. GIC is proof of concept, not something intended for production use, but it provides an interesting example of a really unique way to use Git. - - 5. Alan Formy-Duval’s _[A practical learning exercise for Git][8]_ is a chronicle of his effort to improve his Git skills. He shares his experience for others to benefit from what he learned, and Git novices will gain a lot from this excellent overview of Git’s core functionality. - - 6. _[How writers can get work done better with Git][9]_ by Seth Kenlon looks at how writers can benefit from a Git-based workflow. The article explains how to use Git and Atom to write using Markdown. By following the examples in this article, writers can easily add a complex revision control system to their writing workflow. - - 7. In _[How to use Magit to manage Git projects][10]_, Sachin Patil explains how to use Emacs’ Magit extension to manage Git repositories. The article provides clear examples of how to perform a selection of key Git tasks inside Emacs. The examples are supported by screenshots illustrating the various tasks. - - 8. _[Move your dotfiles to version control][11]_ by Matthew Broberg shows how to use Git to store the dotfiles in your home directory. Storing your dotfiles in a Git repository makes it easier to share your system configuration between computers and, if you so choose, share your configurations with others. The article does come with a warning about what not to share because sharing the wrong dotfiles can expose others. - - 9. Austin Dewey’s _[4 secrets management tools for Git encryption][12]_ compares Git-crypt, BlackBox, SOPS, and Transcrypt in this article examining tools for storing secrets in Git. The article covers four major areas: encryption types supported, the goals of each project, the projects’ workflows and differences, and other features. - - 10. _[Run a server with Git][13]_ by Seth Kenlon explains how Gitolite can be used to manage a Git server. Gitolite is "a backend application managing the fiddly bits" involved in using Git to manage a Git server. The article demonstrates how to install, configure, and use Gitolite, with clear examples detailing each step the process. - - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/git-resources - -作者:[Joshua Allen Holm][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/holmja -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard) -[2]: https://opensource.com/article/19/2/git-terminology -[3]: https://opensource.com/downloads/cheat-sheet-git -[4]: https://opensource.com/article/19/10/how-gnome-uses-git -[5]: https://opensource.com/article/19/2/emoji-log-git-commit-messages -[6]: https://opensource.com/article/19/4/calendar-git -[7]: https://opensource.com/article/19/4/git-based-chat -[8]: https://opensource.com/article/19/5/practical-learning-exercise-git -[9]: https://opensource.com/article/19/4/write-git -[10]: https://opensource.com/article/19/1/how-use-magit -[11]: https://opensource.com/article/19/3/move-your-dotfiles-version-control -[12]: https://opensource.com/article/19/2/secrets-management-tools-git -[13]: https://opensource.com/article/19/4/server-administration-git diff --git a/translated/tech/20191227 10 resources to boost your Git skills.md b/translated/tech/20191227 10 resources to boost your Git skills.md new file mode 100644 index 0000000000..eee2be8848 --- /dev/null +++ b/translated/tech/20191227 10 resources to boost your Git skills.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 resources to boost your Git skills) +[#]: via: (https://opensource.com/article/19/12/git-resources) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +10 个提高 Git 技能的资源 +====== + +> 年末总结一下 Git 的最佳表现。以下是在新的一年中以新奇的方式使用 Git 的十篇文章。 + +![open source button on keyboard][1] + +快到 2019 年底了,是时候回顾一下我们今年发表的有关 Git 的前 10 篇文章了。 + +这些文章包括从用例和教程到一些非常有趣的(甚至有些非常规的)使用 Git 的方法。所有这些文章都可以帮助你提高 Git 技能,但是,如果你确实需要 Git 入门介绍,请务必查看我们的《[Git 入门:术语入门][2]》文章,并下载我们的 [Git 备忘单][3]。 + +1. Molly de Blanc 写的《[GNOME 如何使用 Git][4]》考察了 GNOME 项目采用的自托管 GitLab 实例的做法,该实例作为 GNOME 项目集中保存为 GNOME 做出的贡献的位置。De Blanc 从事于非编码职位,因此她的文章还探讨了切换到 GitLab 如何使主要角色不是编写代码的贡献者受益。 +2. Ahmad Awais 写的《[Emoji-Log:编写 Git 提交信息的新方法][5]》解释了如何使用 Emoji-Log(一种直白的、开源的 Git 提交日志标准)来编写更好、更用户友好的 Git 提交消息。本文概述了 Emoji-Log 背后的理论以及可添加到 `.bashrc`、`.zshrc` 或 `.gitconfig` 中的配置示例,以便你快速开始使用 Emoji-Log。 +3. 在《[用 Git 管理你的每日行程][6]》中,Seth Kenlon 解释了如何使用 Git 来管理日历。通过结合 Org 模式、Git 和其他一些工具,Kenlon 描述了如何创建可在设备之间同步的基于 Git 的日历工作流。 +4. 《[用 Git 作为聊天应用的后端][7]》,Seth Kenlon 探索了另一种使用 Git 的非常规方式。在本文中,他探讨了 GIC,这是一个用 Node.js 编写的聊天客户端,其中 Git 用作后端数据库。GIC 是一个概念验证模型,不是供产品环境使用的东西,但是它提供了一个有趣的示例,说明了使用 Git 的真正独特方法。 +5. Alan Formy-Duval 的《[Git 学习实用练习][8]》是一份他为提高 Git 技能而努力的编年史。他分享了自己的经验,以使其他人受益于他所学,而 Git 新手将从这篇对 Git 核心功能的出色概述中受益匪浅。 +6. 《[用 Git 帮助写作者更好地完成工作][9]》的作者 Seth Kenlon 着眼于写作者如何从基于 Git 的工作流中受益。本文介绍了如何使用 Git 和 Atom 利用 Markdown 进行书写。通过遵循本文中的示例,写作者可以轻松地将复杂的修订控制系统添加到其编写工作流中。 +7. Sachin Patil 在《[如何使用 Magit 管理 Git 项目][10]》中,解释了如何使用 Emacs 的 Magit 扩展来管理 Git 存储库。本文提供了有关如何在 Emacs 中执行一系列关键 Git 任务的清晰示例。这些示例由说明各种任务的屏幕截图支持。 +8. 《[把“点文件”放到版本控制中][11]》的作者 Matthew Broberg 演示了如何使用 Git 存储放在主目录中的点文件。将你的点文件存储在 Git 存储库中,可以更轻松地在计算机之间共享系统配置,并且,如果你愿意的话,也可以与其他人共享配置。这篇文章也有什么不要共享的警告,因为共享错误的点文件会暴露给其他人。 +9. Austin Dewey 的《[4 种用于 Git 加密的机密管理工具][12]》在本文中比较了 Git-crypt、BlackBox、SOPS 和 Transcrypt,研究了在 Git 中存储机密的工具。本文涵盖四个主要领域:支持的加密类型、每个项目的目标、项目的工作流和差异以及其他功能。 +10. Seth Kenlon 的《[使用 Git 管理 Git 服务器][13]》解释了如何使用 Gitolite 管理 Git 服务器。Gitolite 是使用 Git 来管理 Git 服务器的“管理杂项的后端应用程序”。本文演示了如何安装、配置和使用 Gitolite,并提供了清晰的示例详细说明了该过程的每个步骤。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/git-resources + +作者:[Joshua Allen Holm][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard) +[2]: https://opensource.com/article/19/2/git-terminology +[3]: https://opensource.com/downloads/cheat-sheet-git +[4]: https://opensource.com/article/19/10/how-gnome-uses-git +[5]: https://linux.cn/article-10627-1.html +[6]: https://linux.cn/article-11320-1.html +[7]: https://linux.cn/article-11342-1.html +[8]: https://opensource.com/article/19/5/practical-learning-exercise-git +[9]: https://linux.cn/article-11499-1.html +[10]: https://opensource.com/article/19/1/how-use-magit +[11]: https://linux.cn/article-11419-1.html +[12]: https://opensource.com/article/19/2/secrets-management-tools-git +[13]: https://opensource.com/article/19/4/server-administration-git From 65d17132c3e768ba812c5933771776d6c3f8cc11 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 20:41:08 +0800 Subject: [PATCH 0002/3057] APL --- sources/tech/20191204 Fedora Desktops - Memory Footprints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md b/sources/tech/20191204 Fedora Desktops - Memory Footprints.md index f9a3ea0f3b..f69a975a37 100644 --- a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md +++ b/sources/tech/20191204 Fedora Desktops - Memory Footprints.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ba98913fbc23359ede2cc125a751956f3b0fb6d5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 21:07:54 +0800 Subject: [PATCH 0003/3057] TSL --- ...204 Fedora Desktops - Memory Footprints.md | 82 ------------------- ...204 Fedora Desktops - Memory Footprints.md | 82 +++++++++++++++++++ 2 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 sources/tech/20191204 Fedora Desktops - Memory Footprints.md create mode 100644 translated/tech/20191204 Fedora Desktops - Memory Footprints.md diff --git a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md b/sources/tech/20191204 Fedora Desktops - Memory Footprints.md deleted file mode 100644 index f69a975a37..0000000000 --- a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md +++ /dev/null @@ -1,82 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fedora Desktops – Memory Footprints) -[#]: via: (https://fedoramagazine.org/fedora-desktops-memory-footprints/) -[#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) - -Fedora Desktops – Memory Footprints -====== - -![][1] - -There are over 40 desktops in Fedora. Each desktop has it’s own strengths and weaknesses. Usually picking a desktop is a very personal preference based on features, looks, and other qualities. Sometimes, what you pick for a desktop is limited by hardware constraints. - -This article is to help people compare Fedora desktops based on the desktop baseline memory. To narrow the scope, we are only looking at the desktops that have an official Fedora Live image. - -### Installation and Setup - -Each of the desktops was installed on it’s own KVM virtual machine. Each virtual machine had 1 CPU, 4GB of memory, 15 GB virtio solid state disk, and everything else that comes standard on RHEL 8.0 kvm. - -The images for installation were the standard Fedora 31 Live images. For GNOME, that image was the Fedora Workstation. For the other desktops, the corresponding Spin was used. Sugar On A Stick (SOAS) was not tested because it does not install easily onto a local drive. - -The virtual machine booted into the Live CD. “Install to Hard Disk” was selected. During the install, only the defaults were used. A root user, and a regular users were created. After installation and reboot, the Live image was verified to not be in the virtual CDROM. - -The settings for each desktop was not touched. They each ran whatever settings came default from the Live CD installation. Each desktop was logged into via the regular user. A terminal was opened. Using sudo each machine ran “dnf -y update”. After update, in that sudo terminal, each machine ran “/sbin/shutdown -h now” to shut down. - -### Testing - -Each machine was started up. The desktop was logged into via the regular user. Three of the desktop terminals were opened. xterm was never used, it was always the terminal for that desktop, such as konsole. - -In one terminal, top was started and M pressed, showing the processes sorted by memory. In another terminal, a simple while loop showed “free -m” every 30 seconds. The third terminal was idle. - -I then waited 5 minutes. This allowed any startup services to finish. I recorded the final free result, as well as the final top three memory consumers from top. - -### Results - - * Cinnamon - * 624 MB Memory used - * cinnamon 4.8% / Xorg 2.2% / dnfdragora 1.8% - * GNOME - * 612 MB Memory used - * gnome-shell 6.9% / gnome-software 1.8% / ibus-x11 1.5% - * KDE - * 733 MB Memory used - * plasmashell 6.2% / kwin_x11 3.6% / akonadi_mailfil 2.9% - * LXDE - * 318 MB Memory used - * Xorg 1.9% / nm-applet 1.8% / dnfdragora 1.8% - * LXQt - * 391 MB Memory used - * lxqt-panel 2.2% / pcmanfm-qt 2.1% / Xorg 2.1% - * MATE - * 465 MB Memory used - * Xorg 2.5% / dnfdragora 1.8% / caja 1.5% - * XFCE - * 448 MB Memory used - * Xorg 2.3% / xfwm4 2.0% / dnfdragora 1.8% - - - -### Conclusion - -I will let the numbers speak for themselves. - -Remember that these numbers are from a default Live install. If you remove, or add services and features, your memory usage will change. But this is a good baseline to look at if you are determining your desktop based on memory consumption. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/fedora-desktops-memory-footprints/ - -作者:[Troy Dawson][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/tdawson/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/desktop-memory-footprint-816x346.jpg diff --git a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md b/translated/tech/20191204 Fedora Desktops - Memory Footprints.md new file mode 100644 index 0000000000..0fe78be674 --- /dev/null +++ b/translated/tech/20191204 Fedora Desktops - Memory Footprints.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora Desktops – Memory Footprints) +[#]: via: (https://fedoramagazine.org/fedora-desktops-memory-footprints/) +[#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) + +Fedora 上的桌面环境内存占用测试 +====== + +![][1] + +Fedora 中有 40 多中桌面环境。每种桌面环境都有自己的优点和缺点。通常,根据功能、外观和其他品质,选择桌面是非常个人的偏爱。但有时,你选择的桌面环境还会受到硬件限制。 + +本文旨在帮助人们根据桌面环境占用的基准内存来比较 Fedora 桌面环境。为了缩小范围,我们仅查看具有正式 Fedora Live 镜像的桌面环境。 + +### 安装与系统配置 + +每个桌面环境都安装在自己的 KVM 虚拟机上。每个虚拟机都有 1 个 CPU、4GB 内存、15GB virtio 固态磁盘,以及 RHEL 8.0 kvm 上所有其他标准配置。 + +用于安装的镜像是标准的 Fedora 31 Live 镜像。对于 GNOME,该镜像是 Fedora 工作站。对于其他桌面,使用了相应的 Spin 版本。未对“糖葫芦Sugar On A Stick”(SOAS)进行测试,因为它不容易安装到本地驱动器上。 + +用 Live CD 启动虚拟机,然后选择“安装到硬盘”。在安装过程中,仅使用默认值。创建一个 root 用户和一个普通用户。安装并重新启动后,live 镜像已确认不在虚拟 CDROM 中。 + +每个桌面环境的设置都没有改动。它们每个都以 Live CD 安装中默认的设置运行。每个桌面环境都是通过普通用户登录的。打开了一个终端,在每台虚拟机中都使用 `sudo` 运行了 `dnf -y update`。在更新后,在该 sudo 终端中,每台虚拟机都运行 `/sbin/shutdown -h now` 以关闭。 + +### 测试方式 + +每台机器都已启动。桌面环境已通过普通用户登录。打开了三个桌面终端。xterm 从未使用过,始终用的是该桌面环境的终端,例如 konsole。 + +在一个终端中,启动 `top` 并按下 `M`,以显示按内存排序的进程。在另一个终端中,一个简单的 `while` 循环每 30 秒显示一次 `free -m`。第三个终端闲置。 + +然后,我等待了 5 分钟。这样就可以让所有启动的服务都启动完成。我记录了最终的 `free` 结果,以及 `top` 中最终的前三名内存使用者。 + +### 结果 + + * Cinnamon + * 使用了624 MB + * cinnamon 4.8% / Xorg 2.2% / dnfdragora 1.8% + * GNOME + * 使用了 612 MB + * gnome-shell 6.9% / gnome-software 1.8% / ibus-x11 1.5% + * KDE + * 使用了 733 MB + * plasmashell 6.2% / kwin_x11 3.6% / akonadi_mailfil 2.9% + * LXDE + * 使用了 318 MB + * Xorg 1.9% / nm-applet 1.8% / dnfdragora 1.8% + * LXQt + * 使用了 391 MB + * lxqt-panel 2.2% / pcmanfm-qt 2.1% / Xorg 2.1% + * MATE + * 使用了 465 MB + * Xorg 2.5% / dnfdragora 1.8% / caja 1.5% + * XFCE + * 使用了 448 MB + * Xorg 2.3% / xfwm4 2.0% / dnfdragora 1.8% + + + +### 结论 + +我会让数字说明一切。 + +请记住,这些数字来自默认的 Live 安装环境。如果删除或添加服务和功能,则内存使用量将发生变化。但是,如果要根据内存消耗确定桌面环境,这是一个很好的基准。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-desktops-memory-footprints/ + +作者:[Troy Dawson][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/tdawson/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/desktop-memory-footprint-816x346.jpg From 2d1507f24ab878d7ab5eb4af873dad57da2c8b95 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 30 Dec 2019 00:53:06 +0800 Subject: [PATCH 0004/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191230=20Fixi?= =?UTF-8?q?ng=20=E2=80=9CVLC=20is=20Unable=20to=20Open=20the=20MRL?= =?UTF-8?q?=E2=80=9D=20Error=20[Quick=20Tip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md --- ...nable to Open the MRL- Error -Quick Tip.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md diff --git a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md new file mode 100644 index 0000000000..d8bbaf3185 --- /dev/null +++ b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) +[#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Fixing “VLC is Unable to Open the MRL” Error [Quick Tip] +====== + +One of the [VLC tips][1] is to play YouTube and other online videos with [VLC][2]. This could help you [watch online videos with subtitles][3]. + +But things may not always be simple because at times you’ll encounter this error when trying to open YouTube video with VLC: + +**Your input can’t be opened: +VLC is unable to open the MRL ‘. Check the log for details.** + +![VLC error while playing YouTube videos][4] + +The thing here is that Google doesn’t want you to use any third party application for watching YouTube because then they cannot collect data properly. + +So, they keep changing stuff from their side to make it harder for third party devs to work with YouTube. + +Take [youtube-dl][5] for example. You’ll notice that you cannot [download YouTube videos][6] with it all of a sudden and the simplest solution is to have the latest version of youtube-dl installed. + +Same goes for VLC. If you [install the latest VLC in Ubuntu][7] or whichever operating system you are using, you probably won’t see this error. + +### Fixing “VLC is unable to open the MRL” error + +Let me show you the steps to fix this problem for YouTube at least. + +Go to this page and use Ctrl+S to save the file from the official GitHub repository of VLC media player: + +[Download youtube.lua file][8] + +Now, what you need to do is to replace the youtube.luac (mind the ‘c’ in luac) in lib/vlc/lua/playlist directory with this downloaded file. + +#### Steps for Linux + +If you are using Linux, open the terminal and use the [locate command][9] to find the exact location of youtube.luac file: + +``` +locate youtube.luac +``` + +When you get the path of the file, you just replace that file with your downloaded file. I trust you to handle this simple task. + +For me, it showed the path of the file here: + +``` +[email protected]:~$ locate youtube.lua +/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac +``` + +So all I did was to move the downloaded file to this location and replace the content of the file: + +``` +sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac +``` + +You should be able to play the YouTube videos in VLC now. + +#### Steps for Windows + +If you are using Windows, you should follow these steps: + + * Rename the downloaded youtube.lua file to youtube.luac + * Now copy this file and paste it to C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\ + + + +That’s it. + +If you have trouble with Dailymotion or other video streaming websites, you can download their respective lua files from the VLC repository [here][10] and replace the existing one in your VLC install. + +I hope this quick tip fixed the problem with VLC unable to play YouTube videos for you. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/simple-vlc-tips/ +[2]: https://www.videolan.org/index.html +[3]: https://itsfoss.com/penguin-subtitle-player/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc_error_input_cant_be_played.png?ssl=1 +[5]: https://itsfoss.com/download-youtube-linux/ +[6]: https://itsfoss.com/download-youtube-videos-ubuntu/ +[7]: https://itsfoss.com/install-latest-vlc/ +[8]: https://raw.githubusercontent.com/videolan/vlc/master/share/lua/playlist/youtube.lua +[9]: https://linuxhandbook.com/locate-command/ +[10]: https://github.com/videolan/vlc/tree/master/share/lua/playlist From 65b8a6879bbc03c98d1d0327710589a894fd6c75 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 30 Dec 2019 00:53:57 +0800 Subject: [PATCH 0005/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191229=20The?= =?UTF-8?q?=20best=20resources=20for=20agile=20software=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191229 The best resources for agile software development.md --- ...esources for agile software development.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20191229 The best resources for agile software development.md diff --git a/sources/tech/20191229 The best resources for agile software development.md b/sources/tech/20191229 The best resources for agile software development.md new file mode 100644 index 0000000000..2e504f3d45 --- /dev/null +++ b/sources/tech/20191229 The best resources for agile software development.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The best resources for agile software development) +[#]: via: (https://opensource.com/article/19/12/agile-resources) +[#]: author: (Leigh Griffin https://opensource.com/users/lgriffin) + +The best resources for agile software development +====== +Read our top articles that highlight the discussion around agile's past, +present, and what it may look like in the future. +![Women programming][1] + +It has been a great year for agile topics on Opensource.com. As we approach the end of 2019, reviewed our top agile-related articles, as read by you, our readers! + +### Small Scale Scrum guide + +Opensource.com's six-part guide to [Small Scale Scrum][2] (which I helped co-author) advises smaller teams on how to bring agile into their work. The traditional scrum framework outlined in the official [Scrum Guide][3] recommends a minimum of three people for the framework to realize its full potential. However, it provides no guidance for how teams of one or two people can follow scrum successfully. Our six-part series aims to formalize Small Scale Scrum and examines our experience with it in the real world. The series was received very warmly by our readers—so much such that the six individual articles comprise 60% of our Top 10 list. So, if you haven't already, make sure to download them from our [_Introduction to Small Scale Scrum_ page][2]. + +### A comprehensive guide to agile project management + +Teams following traditional project management approaches, initially skeptical about agile, have warmed up to the agile way of working. Now agile has reached acceptance, and a more flexible, hybrid style has found a home. [_A comprehensive guide to agile project management_][4] by Matt Shealy covers 12 guiding principles of agile project management and is perfect for traditional project managers looking to bring some agility to their projects. + +### 4 steps to becoming an awesome agile developer + +A DevOps culture has emerged in many modern software teams that embrace agile software development principles that leverage cutting-edge tooling and automation. But this mechanically agile approach does not guarantee that developers are following agile practices in their day-to-day work. In [_4 steps to becoming an awesome agile developer_][5], Daniel Oh gives great tips for increasing your agility by focusing on design thinking, using predictable approaches, putting quality at the center, and continuously learning and exploring. Complementing these methods with your agile tooling will create very flexible and strong agile developers. + +### Scrum vs. kanban: Which agile framework is better? + +Scrum and kanban are two of the most popular approaches for teams running in an agile manner, and in [_Scrum vs. kanban: Which agile framework is better?_][6] Taz Brown explores the history and purpose of both. While reading this article, a great saying came to my mind: "If the only tool in your toolbox is a hammer, every problem looks like a nail." Knowing when to use kanban and when to use scrum is important, and this article helps show that both have a place, depending on your team, your challenge, and your goals. + +### 4 ways developers can have a say in what agile looks like + +Developers often have a fear of having a workstyle imposed upon them when the topic of adopting agile comes up. In [_4 ways developers can have a say in what agile looks like_][7], [Clément Verna][8] looks at ways that developers can flip that narrative by helping to determine what agile looks like on their team. Examining the origins and the basics of agile is a great starting point, but the real value is in having metrics to help guide your journey. Knowing what challenges you can expect to have will give you a firm ground to move forward. And making decisions empirically not only empowers teams but gives them a sense of ownership of the journey. Verna's article also examines the importance of putting people over processes and working as a team to achieve your goals. + +### Agile now and later + +This year, Opensource.com authors created a lot of discussion around agile's past, present, and what it may look like in the future. Thank you to all of them, and be sure to [share your own agile story][9] here in 2020. + +A look back at the tools Opensource.com covered in 2014 and 2015 , with updates on new releases,... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/agile-resources + +作者:[Leigh Griffin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lgriffin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard2.png?itok=WnKfsl-G (Women programming) +[2]: https://opensource.com/downloads/small-scale-scrum +[3]: https://scrumguides.org/scrum-guide.html +[4]: https://opensource.com/article/19/8/guide-agile-project-management +[5]: https://opensource.com/article/19/2/steps-agile-developer +[6]: https://opensource.com/article/19/8/scrum-vs-kanban +[7]: https://opensource.com/article/19/10/ways-developers-what-agile +[8]: https://twitter.com/clemsverna +[9]: https://opensource.com/how-submit-article From c54ad8e3352a78b284f4ffcc41986ef216189ea3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 30 Dec 2019 09:01:26 +0800 Subject: [PATCH 0006/3057] translated --- ...Falkon Open Source Web Browser from KDE.md | 121 ------------------ ...Falkon Open Source Web Browser from KDE.md | 121 ++++++++++++++++++ 2 files changed, 121 insertions(+), 121 deletions(-) delete mode 100644 sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md create mode 100644 translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md diff --git a/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md deleted file mode 100644 index 7f3ec34562..0000000000 --- a/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ /dev/null @@ -1,121 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) -[#]: via: (https://itsfoss.com/falkon-browser/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -App Highlight: Falkon Open Source Web Browser from KDE -====== - -_**Formerly known as Qupzilla, Falkon is a web browser based on QtWebEngine. In this week’s App Highlight, we take a look at this open source software.**_ - -### Falkon: Open Source Web Browser for Linux (and Windows) - -![][1] - -First thing first, [Falkon][2] is not a new web browser. It has been in development since 2010 but it was known as Qupzilla. - -In 2017, QupZilla moved under KDE umbrella and changed its name to Falkon. Being under KDE umbrella means that project is actively maintained following KDE standards. - -It uses the [QtWebEngine][3] rendering engine – which is a striped down version of Chromium core. - -In this article, I shall take a closer look at what it offers and how it’s different than other dominant web browsers on Linux out there. - -### Features of Falkon Browser - -Thought it may not be a popular browser, I did find it capable enough to browse modern web services. - -Let me highlight the key features of Falkon and if you find it interesting enough, give it a try. - -#### Simple User Interface - -![][4] - -I know it’s not exactly a “feature” but the user experience (UX) matters a lot. Despite being a lightweight browser, you have a decent looking interface here. You won’t feel like you are using a browser from the early 2000’s. - -#### AdBlock Extension - -![][5] - -It comes packed in with the AdBlock extension that works pretty well if you want to get rid of the advertisements while browsing a website. You can also customize the behavior of the AdBlock extension. - -#### DuckDuckGo Default Search Engine - -It’s a good thing to have one of the [privacy-oriented search engines][6] as the default search engine if you do not like using Google. - -#### Session Manager - -![][7] - -Falkon includes a useful session manager from the available options in the browser menu. You can restore a specific recent session using this – which should come in handy. - -#### Extension Support - -![][8] - -It does support adding extensions but you cannot add extensions from Chrome/Firefox add-on marketplace. You have a limited set of extensions to choose from. - -#### Theme Support - -Falkon also lets you customize the appearance to some extent. You can try them out if you want to change the appearance of the browser. - -![][9] - -#### Other Essential Settings - -![][10] - -I also explored other settings/functionalities like adding a bookmark or being able to manage the passwords. - -Or, maybe manage the notification access of a webpage. - -Oh, I also tried using YouTube – with no problems whatsoever. - -Of course, this isn’t an extensive review – but yes, Falkon does have all the essential options that you will need in a browser (unless you have a specific requirements). - -### Installing Falkon Browser - -You can easily find Falkon browser available in your Software Center. - -In case you don’t, you can find Flatpak/Snap packages available from its [official download page][11]. You’ll also find Windows installer files on the download page. - -[Download Falkon Browser][11] - -**Wrapping Up** - -As a KDE product, Falkon is tailored for KDE desktop environment. Some KDE distributions like OpenMandriva use Falkon as the default web browser. - -Falkon browser is for the ones looking for a lightweight and feature-rich web browser. An alternative worth taking a look is [Midori][12]. - -In my opinion, it is a good alternative browser – unless you need tons of extensions, cross-platform synchronization and require to access some browser-specific websites. - -What do you think about the Falkon browser? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/falkon-browser/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-screenshot.jpg?ssl=1 -[2]: https://www.falkon.org/ -[3]: https://wiki.qt.io/QtWebEngine -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser.png?ssl=1 -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-adblock.jpg?ssl=1 -[6]: https://itsfoss.com/privacy-search-engines/ -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/session-manager-falkon.jpg?ssl=1 -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-extensions.png?ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-theme.png?ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-preference.png?ssl=1 -[11]: https://www.falkon.org/download/ -[12]: https://itsfoss.com/midori-browser/ diff --git a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md new file mode 100644 index 0000000000..18d42af58a --- /dev/null +++ b/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) +[#]: via: (https://itsfoss.com/falkon-browser/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +应用推荐:来自 KDE 的 Falkon 开源 Web 浏览器 +====== + +_**它以前称为 Qupzilla,Falkon 是基于 QtWebEngine 的 Web 浏览器。在本周的“应用推荐”中,我们来看看这个开源软件。**_ + +### Falkon:适用于 Linux(和 Windows)的开源 Web 浏览器 + +![][1] + +首先,[Falkon][2] 不是新的 Web 浏览器。它自 2010 年以来一直在开发中,但被称为 Qupzilla。 + +2017 年,QupZilla 移到 KDE 旗下,并更名为 Falkon。处于 KDE 旗下意味着项目会按照 KDE 标准积极维护。 + +它使用 [QtWebEngine][3] 渲染引擎,这是 Chromium 核心的简化版本。 + +在本文中,我将仔细研究它提供的功能以及与 Linux 上其他主流 Web 浏览器的不同之处。 + +### Falkon 浏览器的功能 + +我认为它可能不是流行的浏览器,但我发现它足以浏览现代 Web 服务。 + +让我重点介绍 Falkon 的主要功能,如果你觉得它很有趣,请尝试一下。 + +#### 简单的用户界面 + +![][4] + +我知道这不完全是一项“功能”,但是用户体验 (UX) 至关重要。尽管是轻量级的浏览器,但你会拥有一个不错的界面。你不会觉得使用的是 2000 年早期的浏览器。 + +#### AdBlock 扩展 + +![][5] + +它附带了 AdBlock 扩展程序,如果你想在浏览网站时摆脱广告,它大的效果很好。你还可以自定义 AdBlock 扩展的行为。 + +#### DuckDuckGo 作为默认搜索引擎 + +如果你不喜欢使用 Google,那么最好将[主打隐私的搜索引擎][6]之一设为默认搜索引擎。 + +#### 会话管理器 + +![][7] + +Falkon 在浏览器菜单的可用选项中包含了一个有用的会话管理器。你可以用它还原特定的近期会话,这应该能派上用场。 + +#### 扩展支持 + +![][8] + +它确实支持添加扩展,但你不能从 Chrome/Firefox 插件市场添加扩展。你只能选择有限的一组扩展。 + +#### 主题支持 + +Falkon 还允许你在某种程度上自定义外观。如果要更改浏览器的外观,可以尝试一下。 + +![][9] + +#### 其他基本设置 + +![][10] + +我还尝试了其他设置/功能,例如添加书签或管理密码。 + +或者,管理网页的通知。 + +我还试了 YouTube,没有任何问题。 + +当然,这不是一个详尽的评测。但是,Falkon 确实拥有浏览器中需要的所有基本功能(除非你有特定要求)。 + +### 安装 Falkon 浏览器 + +你可以在软件中心轻松找到 Falkon 浏览器。 + +如果没有,你可以从它的[官方下载页面][11]中找到 Flatpak/Snap 包。你还可以在下载页面上找到 Windows 的安装程序。 + +[Download Falkon Browser][11] + +**总结** + +作为 KDE 产品,Falkon 是为 KDE 桌面环境量身定制的。一些 KDE 发行版(例如 OpenMandriva)使用 Falkon 作为默认的 Web 浏览器。 + +Falkon 浏览器适合那些正在寻求轻巧且功能丰富的 Web 浏览器的人。值得尝试的一个替代是 [Midori][12]。 + +我认为,除非你需要大量的扩展、跨平台同步并且需要访问某些特定于浏览器的网站,不然它是一个很好的替代浏览器,。 + +你如何看待 Falkon 浏览器?请在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/falkon-browser/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-screenshot.jpg?ssl=1 +[2]: https://www.falkon.org/ +[3]: https://wiki.qt.io/QtWebEngine +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-adblock.jpg?ssl=1 +[6]: https://itsfoss.com/privacy-search-engines/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/session-manager-falkon.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-extensions.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-theme.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-preference.png?ssl=1 +[11]: https://www.falkon.org/download/ +[12]: https://itsfoss.com/midori-browser/ From 4f52933f2e7e3246e017175ae0d2625920a1de0e Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 30 Dec 2019 09:08:34 +0800 Subject: [PATCH 0007/3057] translating --- ...226 Darktable 3 Released With GUI Rework and New Features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md index 9463a07712..665f5f585a 100644 --- a/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md +++ b/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From beabd728b8c7fb0fe791ef2636a499b712ea17c6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 30 Dec 2019 09:35:49 +0800 Subject: [PATCH 0008/3057] PRF @geekpi --- ...mize your Linux desktop with KDE Plasma.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md b/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md index 402fcd0e3b..c4a3f64a24 100644 --- a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md +++ b/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Customize your Linux desktop with KDE Plasma) @@ -9,12 +9,14 @@ 使用 KDE Plasma 定制 Linux 桌面 ====== -本文是 24 天 Linux 桌面特别系列的一部分。如果你认为没有太多机会进行自定义桌面,KDE Plasma 可能适合你。 + +> 本文是 24 天 Linux 桌面特别系列的一部分。如果你认为没有太多自定义桌面的需要,KDE Plasma 可能适合你。 + ![5 pengiuns floating on iceburg][1] -KDE 社区的 Plasma 桌面是开源桌面中的巅峰之作。KDE 很早就进入了 Linux 桌面市场,但是由于它的 基础 Qt 工具包当时没有完全开放的许可证,因此才有 [GNOME][2] 桌面。在此之后,Qt 开源了,并且 KDE(及其衍生产品,例如 [Trinity桌面][3])开始蓬勃发展。 +KDE 社区的 Plasma 桌面是开源桌面环境中的巅峰之作。KDE 很早就进入了 Linux 桌面环境市场,但是由于它的基础 Qt 工具包当时没有完全开放的许可证,因此才有 [GNOME][2] 桌面。在此之后,Qt 开源了,并且 KDE(及其衍生产品,例如 [Trinity 桌面][3])开始蓬勃发展。 -你可能会在发行版的软件仓库中找到 KDE 桌面,或者可以下载并安装将 KDE 作为默认桌面的发行版。在安装之前,请注意,KDE 提供了完整、集成且强大的桌面体验,因此会同时安装几个 KDE 应用。如果你已经在运行其他桌面,那么将发现有几个冗余的应用(两个 PDF 阅读器、多个媒体播放器、两个或多个文件管理器,等等)。如果你只想尝试而不是一直使用 KDE 桌面,那么可以在虚拟机,如[GNOME Boxes][4]中安装基于 KDE 的发行版,也可以尝试使用可引导的操作系统,例如 [Porteus][5]。 +你可能会在发行版的软件仓库中找到 KDE 桌面,或者可以下载并安装将 KDE 作为默认桌面的发行版。在安装之前,请注意,KDE 提供了完整、集成且强大的桌面体验,因此会同时安装几个 KDE 应用。如果你已经在运行其他桌面,那么将发现有几个冗余的应用(两个 PDF 阅读器、多个媒体播放器、两个或多个文件管理器,等等)。如果你只想尝试而不是一直使用 KDE 桌面,那么可以在虚拟机,如 [GNOME Boxes][4] 中安装基于 KDE 的发行版,也可以尝试使用可引导的操作系统,例如 [Porteus][5]。 ### KDE 桌面之旅 @@ -22,15 +24,15 @@ KDE 社区的 Plasma 桌面是开源桌面中的巅峰之作。KDE 很早就进 ![KDE Plasma desktop][7] -但是,使 KDE 与众不同的是,你几乎可以更改任何想要的东西。Qt 工具包可以以令人惊讶的方式分割和重新排列,这意味着你实质上可以使用 KDE 的部件作为基础来设计自己的桌面。桌面行为的可用设置也很多。KDE 可以充当标准桌面,平铺窗口管理器以及两者之间的任意形式。你可以通过窗口类、角色、类型、标题或它们的任意组合来创建自己的窗口规则,因此,如果希望特定应用的行为不同于其他行为,那么可以创建全局设置的例外。 +但是,使 KDE 与众不同的是,你几乎可以更改任何想要的东西。Qt 工具包可以以令人惊讶的方式分割和重新排列,这意味着你实质上可以使用 KDE 的部件作为基础来设计自己的桌面。桌面行为的可用设置也很多。KDE 可以充当标准桌面、平铺窗口管理器以及两者之间的任意形式。你可以通过窗口类、角色、类型、标题或它们的任意组合来创建自己的窗口规则,因此,如果希望特定应用的行为不同于其他行为,那么可以创建全局设置的例外。 -此外,它还有丰富的小部件集合,使你可以自定义与桌面交互的方式。它有一个类似 GNOME 的全屏应用启动器,一个类似 Unity 的 dock 启动器和仅有图标的任务栏,一个传统的任务栏。你可以在屏幕的任何边缘上创建和放置面板。 +此外,它还有丰富的小部件集合,使你可以自定义与桌面交互的方式。它有一个类似 GNOME 的全屏应用启动器,一个类似 Unity 的 dock 启动器和仅有图标的任务栏,以及一个传统的任务栏。你可以在屏幕的任何边缘上创建和放置面板。 ![A slightly customized KDE desktop][8] -实际上,它有太多的自定义项了,因此 KDE 最常见的批评之一是它的_太过可定制化_,所以请记住,自定义项是可选的。你可以在默认配置下使用 Plasma 桌面,并仅在你认为必要时逐步进行更改。Plasma 桌面配置选项最重要的不是它们的数目,而是它们容易发现和直观,它们都在系统设置应用或者右键单击中。 +实际上,它有太多的自定义项了,因此 KDE 最常见的批评之一是它的*太过可定制化*,所以请记住,自定义项是可选的。你可以在默认配置下使用 Plasma 桌面,并仅在你认为必要时逐步进行更改。Plasma 桌面配置选项最重要的不是它们的数目,而是它们容易发现和直观,它们都在系统设置应用或者右键单击中。 -事实是,在 KDE 上,几乎绝不会只有一种方法可以完成任何给定的任务,并且它的用户将其视为其最大的优势。KDE 中没有隐含的工作流,只有默认的。并且可以更改所有默认设置,直到你需要桌面做的成为你的习惯。 +事实是,在 KDE 上,几乎绝不会只有一种方法可以完成任何给定的任务,并且它的用户将这个视为其最大的优势。KDE 中没有隐含的工作流,只有默认的。并且可以更改所有默认设置,直到你需要桌面做的成为你的习惯。 ### 一致性和集成 @@ -42,8 +44,6 @@ KDE 社区以一致性和集成为荣,出色的开发人员、社区管理以 KDE 适合所有人。使用其默认设置可获得流畅、原始的桌面体验,或对其进行自定义以使其成为自己专属。它是一个稳定、有吸引力且强大的桌面环境,可能有你想要在 Linux 完成要做的事的一切。 -KDE 最初代表 Kool Desktop Environment,但现在被许多人称为 K Desktop。 - -------------------------------------------------------------------------------- via: https://opensource.com/article/19/12/linux-kde-plasma @@ -51,7 +51,7 @@ via: https://opensource.com/article/19/12/linux-kde-plasma 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -67,4 +67,4 @@ via: https://opensource.com/article/19/12/linux-kde-plasma [8]: https://opensource.com/sites/default/files/uploads/advent-kde-dock.jpg (A slightly customized KDE desktop) [9]: https://kde.org/applications/ [10]: https://opensource.com/life/16/5/how-use-digikam-photo-management -[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus) \ No newline at end of file +[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus) From 27a8309da928f8c80bd1a779951709db944121ee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 30 Dec 2019 09:36:24 +0800 Subject: [PATCH 0009/3057] PUB @geekpi https://linux.cn/article-11728-1.html --- .../20191221 Customize your Linux desktop with KDE Plasma.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191221 Customize your Linux desktop with KDE Plasma.md (98%) diff --git a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md b/published/20191221 Customize your Linux desktop with KDE Plasma.md similarity index 98% rename from translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md rename to published/20191221 Customize your Linux desktop with KDE Plasma.md index c4a3f64a24..23f83f5d41 100644 --- a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md +++ b/published/20191221 Customize your Linux desktop with KDE Plasma.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11728-1.html) [#]: subject: (Customize your Linux desktop with KDE Plasma) [#]: via: (https://opensource.com/article/19/12/linux-kde-plasma) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From e527b584873e3b2838a4bf93f82cc291d03d4e32 Mon Sep 17 00:00:00 2001 From: algzjh Date: Mon, 30 Dec 2019 14:08:24 +0800 Subject: [PATCH 0010/3057] translating by algzjh --- ...0191229 The best resources for agile software development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191229 The best resources for agile software development.md b/sources/tech/20191229 The best resources for agile software development.md index 2e504f3d45..84c8c09548 100644 --- a/sources/tech/20191229 The best resources for agile software development.md +++ b/sources/tech/20191229 The best resources for agile software development.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (algzjh) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 31b79577a8c9c3510734778f15e389f2236cfb4f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 30 Dec 2019 21:08:04 +0800 Subject: [PATCH 0011/3057] APL --- .../20191113 How to cohost GitHub and GitLab with Ansible.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md index a635054dae..e71aed34ce 100644 --- a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md +++ b/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 02beba8457b17969a9c75c3f4332fe306511bc88 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 30 Dec 2019 23:31:08 +0800 Subject: [PATCH 0012/3057] TSL --- ...o cohost GitHub and GitLab with Ansible.md | 175 ------------------ ...o cohost GitHub and GitLab with Ansible.md | 168 +++++++++++++++++ 2 files changed, 168 insertions(+), 175 deletions(-) delete mode 100644 sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md create mode 100644 translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md diff --git a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md deleted file mode 100644 index e71aed34ce..0000000000 --- a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md +++ /dev/null @@ -1,175 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to cohost GitHub and GitLab with Ansible) -[#]: via: (https://opensource.com/article/19/11/how-host-github-gitlab-ansible) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to cohost GitHub and GitLab with Ansible -====== -Protect your access to important projects by mirroring Git repositories -with Ansible. -![Hands programming][1] - -Open source is everywhere. It's in your computer at home, it's in your computer at work, it's on the internet, and a lot of it is managed with [Git][2]. Because Git is decentralized, many people also think of it as a kind of crowdsourced backup solution. The theory is that each time someone clones a Git repository to their local computer, they are creating a backup of the project's source code. If 100 people do that, then there are 100 backup copies of a repository. - -This, in theory, mitigates "disasters" such as a project maintainer [suddenly deciding to remove a repository][3] or [inexplicably blocking all traffic][4] and leaving developers scrambling to figure out who has the latest version of the master branch. Similarly, entire code-hosting sites have disappeared in the past. Nobody anticipated the closure of Google Code, Microsoft CodePlex, or Gitorious when they were at their peak. - -In short, if the internet has taught us anything over the past few decades, it's that relying on the internet to magically create backups isn't the most reliable road to redundancy. - -Besides, it's a problem for a lot of people that many open source projects are hosted on GitHub, which is not an open platform. Many developers and users would prefer to support and interact with a stack such as GitLab, which has an open source community edition. - -### Using Ansible for Git - -Git's decentralization is useful in solving this problem. Using pure Git, you can easily push to two or more repositories with a single **push** command. However, for that to be useful against unexpected failure, you must be interacting (and pushing, specifically) with a Git repository frequently. Furthermore, there may be repositories out there that you want to back up, even though you may never push or pull the code yourself. - -But using Ansible, you can automate Git pulls of a project's master branch (or any other branch, for that matter) and then automate Git pushes of the repository to an "offsite" mirror. In other words, you can have your computer regularly pull from GitHub and push to GitLab or [Gitolite][5] or Gitea (or whatever Git host you prefer). - -### Ansible modules - -There wouldn't be much to Ansible if it weren't for its excellent collection of modules. Like third-party libraries for Python or applications for Linux, the technical _driver_ of the useful and surprisingly easy tricks Ansible is famous for are the parts that other people have already figured out for you. Because this article is tackling how to effectively and reliably backup a Git repository, the modules used here are the [Git module][6] and the [ini_file][7] module. - -To begin, create a file called **mirror.yaml** to serve as the playbook. You can start mostly as you usually do with Ansible, with **name** and **task** entries. This example adds **localhost** to the **hosts** list so that the play runs on the controller machine (the computer you're sitting at right now), but in real life, you would probably run this on a specific host or group of hosts on your network. - - -``` -\--- -\- name: "Mirror a Git repo with Ansible" -  hosts: localhost -  tasks: -``` - -### Git pull and clone - -If you're going to make a backup, then you need a copy of the latest code. The obvious way to make that happen with a Git repository is to perform a **git pull**. However, **pull** assumes that a clone already exists, and a well-written Ansible _play_ (an Ansible script) assumes as little as possible. It's better to tell Ansible to **clone** a repository first. - -Add your first task to your playbook: - - -``` -\--- -\- name: "Mirror a Git repo with Ansible" -  hosts: localhost -  vars: -    git_dir: /tmp/soso.git -  tasks: - -  - name: "Clone the git repo" -    git: -       repo: '' -       dest: '{{ git_dir }}' -       clone: yes -       update: yes -``` - -This example uses the open source, Unix-like operating system **soso** as the repository I want to mirror. This is a completely arbitrary choice and in no way implies a lack of confidence in this repository's future. It also uses a variable to refer to the destination folder, **/tmp/soso.git**, which is convenient now and also beneficial later should you want to scale this out to be a generic mirroring script. In real life, you would probably have a more permanent location than **/tmp**, such as **/home/gitmirrors/soso.git** or **/opt/gitmirrors/soso.git**, on your worker machine. - -Run your playbook: - - -``` -`$ ansible-playbook mirror.yaml` -``` - -The first time you run the playbook, Ansible correctly detects that the Git repository does not yet exist locally, so it clones it. - - -``` -PLAY [Ansible Git mirror] ******** - -TASK [Gathering Facts] *********** -ok: [localhost] - -TASK [Clone git repo] ************ -changed: [localhost] - -PLAY RECAP *********************** -localhost: ok=2 changed=1 failed=0 [...] -``` - -Should you run the playbook again, Ansible correctly detects that there have been no changes since the last time it was run and it reports that no actions were performed: - - -``` -`localhost: ok=2 changed=0 failed=0 [...]` -``` - -Next, Ansible must be instructed to push the repository to another Git server. - -### Git push - -The Git module in Ansible doesn't provide a **push** function, so that part of the process is manual. However, before you can push the repo to an alternate mirror, you have to have a mirror, and you have to configure the mirror as an alternate remote. - -First, you must add an alternate remote to your Git configuration. Because the Git config file is an INI-style configuration, you can use the **ini_file** Ansible module to append the required information easily. Add this to your playbook: - - -``` - - name: "Add alternate remote" -    ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='[git@gitlab.com][8]:example/soso-mirror.git' -    tags: configuration -``` - -For this to work, you must have an empty repository on your destination server (in this case, [GitLab.com][9]). If you need to create destination repositories in your playbook, you can do that by following Steve Ovens' excellent article "[How to use Ansible to set up a Git server over SSH][10]." - -Finally, use Git directly to push HEAD to your alternate remote: - - -``` - - name: "Push the repo to alternate remote" -    shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' -``` - -Run the playbook as usual, and then automate the process so that you never have to run it directly again. You can adjust the script with variables and specific Git commands to suit your needs, but with regular pulls and pushes, you can be sure that an important project that lives on one server is safely mirrored on another. - -Here is the full playbook for reference: - - -``` -\--- -\- name: "Mirror a Git repository with Ansible" -  hosts: localhost -  vars: -    git_dir: /tmp/soso.git - -  tasks: - -  - name: "Clone the Git repo" -    git: -       repo: '' -       dest: '{{ git_dir }}' -       clone: yes -       update: yes - -  - name: "Add alternate remote" -    ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='[git@gitlab.com][8]:example/soso-mirror.git' -    tags: configuration -  -  - name: "Push the repo to alternate remote" -    shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/how-host-github-gitlab-ansible - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) -[2]: https://opensource.com/resources/what-is-git -[3]: https://github.com/AntiMicro/antimicro/issues/3 -[4]: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons -[5]: https://opensource.com/article/19/4/server-administration-git -[6]: https://docs.ansible.com/ansible/latest/modules/git_module.html -[7]: https://docs.ansible.com/ansible/latest/modules/ini_file_module.html -[8]: mailto:git@gitlab.com -[9]: http://GitLab.com -[10]: https://opensource.com/article/17/8/ansible-environment-management diff --git a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md new file mode 100644 index 0000000000..4d9193d930 --- /dev/null +++ b/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to cohost GitHub and GitLab with Ansible) +[#]: via: (https://opensource.com/article/19/11/how-host-github-gitlab-ansible) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何使用 Ansible 同步 GitHub 和 GitLab +====== + +> 通过使用 Ansible 镜像 Git 存储库,保护对重要项目的访问。 + +![Hands programming][1] + +开源无处不在。它在家里的计算机上、在工作场所的计算机上、在互联网上,并且很多都由 [Git][2] 管理。由于 Git 是分布式的,因此许多人也将其视为一种众包的备份解决方案。从理论上讲,每当有人将 Git 存储库克隆到其本地计算机时,他们就是创建了项目源代码的备份。如果有 100 个人这样做,则存储库就有 100 个备份副本。 + +从理论上讲,这可以缓解“灾难”,例如项目维护者[突然决定删除存储库][3]或[莫名其妙地阻止所有流量][4],导致开发人员们无头苍蝇般地寻找谁拥有主分支的最新版本。类似的,整个代码托管站点也会消失。没有人会想到 Google Code、Microsoft CodePlex 或 Gitorious 会在鼎盛时期将被关闭。 + +简而言之,如果在过去的几十年中互联网教给了我们一些东西,那就是依靠互联网神奇地创建备份并不是冗余的最可靠途径。 + +此外,对于许多人来说,很多开源项目都托管在 GitHub 上是个问题,而 GitHub 不是开放平台。许多开发人员和用户都希望支持诸如 GitLab 之类的堆栈并与之交互,它具有开源社区版本。 + +### 使用 Ansible 管理 Git + +Git 的去中心方式对于解决这个问题很有用。使用纯 Git,你可以使用一个 `push` 命令轻松地将其推到两个或多个存储库。但是,为了使其在发生意外故障时有用,你必须经常与 Git 存储库进行交互(特别是推送)。此外,即使你可能永远不会自己推送或拉出代码,也可能有一些要备份的存储库。 + +但是,使用 Ansible,你可以自动执行项目主分支(或其他任何分支)的 Git 拉取,然后自动存储库到“异地”镜像的 Git 推送。换句话说,你可以让你的计算机定期从 GitHub 拉取并推送到 GitLab 或 [Gitolite][5] 或 Gitea(或你喜欢的任何 Git 主机)。 + +### Ansible 模块 + +如果 Ansible 并不是因为其出色的模块集合,那么它就没那么出色。像 Python 的第三方库或 Linux 的应用程序一样,这个技术驱动器有用而令人惊讶的简单技巧是,Ansible 以其他人贡献的组件而闻名。因为本文正在研究如何有效和可靠地备份 Git 存储库,所以这里使用的模块是 [Git 模块][6]和 [ini_file][7] 模块。 + +首先,创建一个名为 `mirror.yaml` 的文件作为剧本playbook。你可以像通常使用 Ansible 一样,从 `name` 和 `task` 条目开始。本示例将 `localhost` 添加到 `hosts` 列表中,以便在控制器计算机(你现在坐在前面的计算机)上运行动作play,但是在现实生活中,你可能会在特定的主机或一组网络上的主机上运行。 + +``` +--- +- name: "Mirror a Git repo with Ansible" + hosts: localhost + tasks: +``` + +### Git 拉取和克隆 + +如果要进行备份,则需要最新代码的副本。在 Git 仓库中实现这一目标的明显方法是执行 `git pull`。 但是,`pull` 会假定克隆已经存在,而写得很好的 Ansible 动作(Ansible 脚本)则尽可能少的假定。 最好先告诉 Ansible `clone` 存储库。 + +将你的第一个任务添加到剧本: + +``` +--- +- name: "Mirror a Git repo with Ansible" + hosts: localhost + vars: + git_dir: /tmp/soso.git + tasks: + + - name: "Clone the git repo" + git: + repo: 'https://github.com/ozkl/soso.git' + dest: '{{ git_dir }}' + clone: yes + update: yes +``` + +这个例子使用了开源的,类似于 Unix 的操作系统 soso 作为我要镜像的存储库。这是一个完全任意的选择,绝不意味着对该存储库的未来缺乏信心。它还使用变量来引用目标文件夹 `/tmp/soso.git`,这很方便,并且如果以后你希望将它扩展为一个通用的镜像脚本也会受益。在现实生活中,你的工作机上可能会比 `/tmp` 具有更永久的位置,例如 `/home/gitmirrors/soso.git` 或 `/opt/gitmirrors/soso.git`。 + +运行你的剧本: + +``` +$ ansible-playbook mirror.yaml +``` + +首次运行该剧本时,Ansible 会正确检测到 Git 存储库在本地尚不存在,因此将其克隆。 + +``` +PLAY [Ansible Git mirror] ******** + +TASK [Gathering Facts] *********** +ok: [localhost] + +TASK [Clone git repo] ************ +changed: [localhost] + +PLAY RECAP *********************** +localhost: ok=2 changed=1 failed=0 [...] +``` + +如果你再次运行该剧本,Ansible 会正确检测到自上次运行以来没有任何更改,并且会报告未执行任何操作: + +``` +localhost: ok=2 changed=0 failed=0 [...] +``` + +接下来,必须指示 Ansible 将存储库推送到另一个 Git 服务器。 + +### Git 推送 + +Ansible 中的 Git 模块不提供 `push` 功能,因此该过程的一部分是手动的。但是,在将存储库推送到备用镜像之前,你必须具有一个镜像,并且必须将镜像配置为备用远程服务器remote。 + +首先,必须将备用的远程服务器添加到 Git 配置。因为 Git 配置文件是 INI 样式的配置,所以你可以使用 `ini_file` Ansible 模块轻松地添加所需的信息。将此添加到你的剧本: + +``` + - name: "Add alternate remote" + ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='git@gitlab.com:example/soso-mirror.git' + tags: configuration +``` + +为此,你必须在目标服务器上有一个空的存储库(在本例中为 [GitLab.com][9])。如果需要在剧本中创建目标存储库,可以按照 Steve Ovens 的出色文章《[如何使用 Ansible 通过 SSH 设置 Git 服务器][10]》来完成。 + +最后,直接使用 Git 将 HEAD 推送到备用远程服务器: + +``` + - name: "Push the repo to alternate remote" + shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' +``` + +像往常一样运行该剧本,然后使该过程自动化,这样你就不必再次直接运行它了。你可以使用变量和特定的 Git 命令来调整脚本以适应你的需求,但是通过常规的拉取和推送操作,可以确保驻留在一台服务器上的重要项目可以安全地镜像到另一台服务器上。 + +这是完整的剧本,供参考: + +``` +--- +- name: "Mirror a Git repository with Ansible" + hosts: localhost + vars: + git_dir: /tmp/soso.git + + tasks: + + - name: "Clone the Git repo" + git: + repo: 'https://github.com/ozkl/soso.git' + dest: '{{ git_dir }}' + clone: yes + update: yes + + - name: "Add alternate remote" + ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='git@gitlab.com:example/soso-mirror.git' + tags: configuration + + - name: "Push the repo to alternate remote" + shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/how-host-github-gitlab-ansible + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/resources/what-is-git +[3]: https://github.com/AntiMicro/antimicro/issues/3 +[4]: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons +[5]: https://opensource.com/article/19/4/server-administration-git +[6]: https://docs.ansible.com/ansible/latest/modules/git_module.html +[7]: https://docs.ansible.com/ansible/latest/modules/ini_file_module.html +[8]: mailto:git@gitlab.com +[9]: http://GitLab.com +[10]: https://opensource.com/article/17/8/ansible-environment-management From 5f1725dca61cce9890bdce61d3a0866fbe191b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 31 Dec 2019 08:08:05 +0800 Subject: [PATCH 0013/3057] Translated --- ... chapter template in LibreOffice Writer.md | 118 ----------------- ... chapter template in LibreOffice Writer.md | 124 ++++++++++++++++++ 2 files changed, 124 insertions(+), 118 deletions(-) delete mode 100644 sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md create mode 100644 translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md diff --git a/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md deleted file mode 100644 index 0d8bfed9ce..0000000000 --- a/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md +++ /dev/null @@ -1,118 +0,0 @@ -Translating by robsean -How to create an e-book chapter template in LibreOffice Writer -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_colorbooks.png?itok=vNhsYYyC) -For many people, using a word processor is the fastest, easiest, and most familiar way to write and publish an e-book. But firing up your word processor and typing away isn't enough--you need to follow a format. - -That's where a template comes in. A template ensures that your book has a consistent look and feel. Luckily, creating a template is quick and easy, and the time and effort you spend on it will give you a better-looking book. - -In this article, I'll walk you through how to create a simple template for writing individual chapters of an e-book using LibreOffice Writer. You can use this template for both PDF and EPUB books and modify it to suit your needs. - -### My approach - -Why am I focusing on creating a template for a chapter rather than one for an entire book? Because it's easier to write and manage individual chapters than it is to work on a single monolithic document. - -By focusing on individual chapters, you can focus on what you need to write. You can easily move those chapters around, and it's less cumbersome to send a reviewer a single chapter rather than your full manuscript. When you've finished writing a chapter, you can simply stitch your chapters together to publish the book (I'll discuss how to do that below). But don't feel that you're stuck with this approach--if you prefer to write in single file, simply adapt the steps described in this article to doing so. - -Let's get started. - -### Setting up the page - -This is important only if you plan to publish your e-book as a PDF. Setting up the page means your book won't comprise a mass of eye-straining text running across the screen. - -Select **Format > Page** to open the **Page Style** window. My PDF e-books are usually 5x8 inches tall (about 13x20cm, for those of us in the metric world). I also set the margins to half an inch (around 1.25 cm). These are my preferred dimensions; use whatever size suits you. - -![LibreOffice Page Style window][2] - - -The Page Style window in LibreOffice Writer lets you set margins and format the page. - -Next, add a footer to display a page number. Keep the Page Style window open and click the **Footer** tab. Select **Footer on** and click **OK**. - -On the page, click in the footer, then select **Insert > Field > Page Number**. Don't worry about the position and appearance of the page number; we'll take care of that next. - -### Setting up your styles - -Like the template itself, styles provide a consistent look and feel for your documents. If you want to change the font or the size of a heading, for example, you need do it in only one place rather than manually applying formatting to each heading. - -The standard LibreOffice template comes with a number of styles that you can fiddle with to suit your needs. To do that, press **F11** to open the **Styles and Formatting** window. - - -![LibreOffice styles and formatting][4] - - -Change fonts and other details using the Styles and Formatting window. - -Right-click on a style and select **Modify** to edit it. Here are the main styles that I use in every book I write: - -Style Font Spacing/Alignment Heading 1 Liberation Sans, 36 pt 36 pt above, 48 pt below, aligned left Heading 2 Liberation Sans, 18 pt 12 pt above, 12 pt below, aligned left Heading 3 Liberation Sans, 14 pt 12 pt above, 12 pt below, aligned left Text Body Liberation Sans, 12 pt 12 pt above, 12 pt below, aligned left Footer Liberation Sans, 10 pt Aligned center - - -![LibreOffice styles in action][6] - - -Here's what a selected style looks like when applied to ebook content. - -That's usually the bare minimum you need for most books. Feel free to change the fonts and spacing to suit your needs. - -Depending on the type of book you're writing, you might also want to create or modify styles for bullet and number lists, quotes, code samples, figures, etc. Just remember to use fonts and their sizes consistently. - -### Saving your template - -Select **File > Save As**. In the Save dialog box, select _ODF Text Document Template (.ott)_ from the formats list. This saves the document as a template, which you'll be able to quickly call up later. - -The best place to save it is in your LibreOffice templates folder. In Linux, for example, that's in your **/home** directory, under . **config/libreoffice/4/user/template**. - -### Writing your book - -Before you start writing, create a folder on your computer that will hold all the files--chapters, images, notes, etc.--for your book. - -When you're ready to write, fire up LibreOffice Writer and select **File > New > Templates**. Then select your template from the list and click **Open**. - - -![LibreOffice Writer template list][8] - - -Select your template from the list you set up in LibreOffice Writer and begin writing. - -Then save the document with a descriptive name. - -Avoid using conventions like _Chapter 1_ and _Chapter 2_ --at some point, you might decide to shuffle your chapters around, and it can get confusing when you're trying to manage those chapters. You could, however, put chapter numbers, like _Chapter 1_ or _Ch1,_ in the file name. It's easier to rename a file like that if you do wind up rearranging the chapters of your book. - -With that out of the way, start writing. Remember to use the styles in the template to format the text--that's why you created the template, right? - -### Publishing your e-book - -Once you've finished writing a bunch of chapters and are ready to publish them, create a master document. Think of a master document as a container for the chapters you've written. Using a master document, you can quickly assemble your book and rearrange your chapters at will. The LibreOffice help offers detailed instructions for working with [master documents][9]. - -Assuming you want to generate a PDF, don't just click the **Export Directly to PDF** button. That will create a decent PDF, but you might want to optimize it. To do that, select **File > Export as PDF** and tweak the settings in the PDF options window. You can learn more about that in the [LibreOffice Writer documentation][10]. - -If you want to create an EPUB instead of, or in addition to, a PDF, install the [Writer2EPUB][11] extension. Opensource.com's Bryan Behrenshausen [shares some useful instructions][12] for the extension. - -### Final thoughts - -The template we've created here is bare-bones, but you can use it for a simple book, or as the starting point for building a more complex template. Either way, this template will quickly get you started writing and publishing your e-book. - -### About The Author -Scott Nesbitt;I'M A Long-Time User Of Free Open Source Software;Write Various Things For Both Fun;Profit. I Don'T Take Myself Too Seriously;I Do All Of My Own Stunts. You Can Find Me At These Fine Establishments On The Web - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/10/creating-ebook-chapter-template-libreoffice-writer - -作者:[Scott Nesbitt][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/scottnesbitt -[2]:https://opensource.com/sites/default/files/images/life-uploads/lo-page-style.png (LibreOffice Page Style window) -[4]:https://opensource.com/sites/default/files/images/life-uploads/lo-paragraph-style.png (LibreOffice styles and formatting window) -[5]:/file/374466 -[6]:https://opensource.com/sites/default/files/images/life-uploads/lo-styles-in-action.png (Example of LibreOffice styles) -[8]:https://opensource.com/sites/default/files/images/life-uploads/lo-template-list.png (Template list - LibreOffice Writer) -[9]:https://help.libreoffice.org/Writer/Working_with_Master_Documents_and_Subdocuments -[10]:https://help.libreoffice.org/Common/Export_as_PDF -[11]:http://writer2epub.it/en/ -[12]:https://opensource.com/life/13/8/how-create-ebook-open-source-way diff --git a/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md new file mode 100644 index 0000000000..c73f774162 --- /dev/null +++ b/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md @@ -0,0 +1,124 @@ +如何在 LibreOffice Writer 中创建一个电子书章节模板 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_colorbooks.png?itok=vNhsYYyC) + +对于很多人来说,使用 word 程序来写和发布一本电子书是一种最好的,最容易的,最熟悉的方法。但是,启动你的 word 程序和打字是不够的--你需要遵循一种格式。 + +这就是模板的来源。一个模板确保你的电子书有一个一致的外观和体验。幸运的是,创建一个模板是快速和容易的,并你在其上花费的时间和努力将给你一本更好感官的书。 + +在这片文章中,我将陪伴你走过如何使用 LibreOffice Writer 创建一个简单的用于写一本电子书的各个章节的模板。你可以将这个模板用于 PDF 和 EPUB 书籍,并假以修改来满足你的需要。 + +### 我的方法 + +为什么我聚焦于为一个章节创建一个模板,而不是为一整本书创建一个模板?因为编写和管理单独的章节比编写和管理单个庞大而僵化的文档更容易。 + +通过聚焦于单独的章节,你可以聚焦于你需要编写的东西。你可以容易地向各处移动这些章节,给审阅者发单独一章节比发你完整的原稿更简单而高效。当你写完一章后,你可以简单地把你的章节拼凑在一起来出版这本书(我将在下面讨论如何做到这一点)。但是不要觉得你被这种方法所束缚 --如果你更喜欢在单个文件中编写,简单地调整在这篇文章中描述的步骤来做做成这样。 + +让我们开始吧。 + +### 设置页面 + +仅当你计划发布你的电子书为一本 PDF 书时,这是很重要的。设置页面意味着你的书将不包含大量的穿越屏幕的让眼睛疲劳的文本。 + +选择 **格式 > 页面** 来打开 **页面样式** 窗口。我的 PDF 电子书通常是 5x8 英寸高(大约 13x20cm ,对于我们这些生活在米制世界的人来说)。我也设置页边距为半英寸(约 1.25 cm)。这些是我较喜欢的尺寸;使用任何适合你的尺寸。 + +![LibreOffice Page Style window][2] + + +在 LibreOffice Writer 中的页面样式窗口让你设置页边距和页格式。 + +接下来,添加页脚以显示页码。保持页面样式窗口打开着,并单击 **页脚** 选项卡。选择 **在页脚上** 并单击 **确定** 。 + +在该页面上,在页脚中单击,然后选择 **插入 > 字段 > 页码**。不要担心页码的位置和外观;我们接下来会处理。 + +### 设置你的样式 + +像模板本身一样,样式为你的文档提供一种一致的外观和体验。如果你想更改一个标题的字体或大小,例如,你只需要在一个地方完成它,而不是手动应用格式化到每个标题。 + +标准化的 LibreOffice 模板带有许多样式,你可以调整它们以适应你的需要。为此,按 **F11** 来打开 **样式和格式** 窗口。 + + +![LibreOffice styles and formatting][4] + + +使用样式和格式窗口更改字体和其它细节。 + +在一个样式上右键单击,并选择 **修改** 来编辑它。 这里是我在每本中使用的主要样式: + + 样式 | 字体 | 间距 / 对齐方式 + :-: | :-: | :-: + 标题 1 | Liberation Sans, 36 pt | 上面 36 pt ,下面 48 pt ,左对齐 + 标题 2 | Liberation Sans, 18 pt | 上面 12 pt ,下面 12 pt ,左对齐 + 标题 3 | Liberation Sans, 14 pt | 上面 12 pt ,下面 12 pt ,左对齐 + 正文 | Liberation Sans, 12 pt | 上面 12 pt ,下面 12 pt ,左对齐 + 页脚 | Liberation Sans, 10 pt | 居中对齐 + + +![LibreOffice styles in action][6] + + +这是当我们应用到电子书内容时的一个选择的样式外观。 + +对于大多数书来说,这通常是最小量要求。可以随便更改字体和空格来适应你的要求。 + +根据你正在编写书的类型,你可能也想创建或修改项目符合样式,以及数字列表,引号、代码示例,数字符号等等。只需要记住始终如一地使用字体以及其大小。 + +### 保存你的模板 + +选择 **文件 > 另存为** 。在保持对话框中,从格式列表中选择 _ODF 文本文档模板 (.ott)_ 。这将保存模板为一个模板,以后你可以快速调用该模板。 + +保存模板的最佳位置是 LibreOffice 模板文件夹。例如,在 Linux 中,那是在你的 **/home** 目录下,在 . **config/libreoffice/4/user/template** 下。 + +### 编写你的书 + +在你开始编写前,在你的计算机上创建一个文件夹,它将为你的书保存所有的文件--章节,图像,笔记等等。 + +当你准备编写时,启动 LibreOffice Writer 并选择 **文件 > 新建 > 模板** 。然后从列表中选择你的模板,并单击 **打开**。 + + +![LibreOffice Writer template list][8] + + +从你在 LibreOffice Writer 中设置的列表中选择你的模板,并开始编写。 + +然后用一个描述性名称保存文档。 + +建议使用像 _章节 1_ 和 _章节 2_ 这样的惯例--在某些时候,你可能决定重新编排你的章节,当你尝试管理这些章节时,它可能会变得混乱。然而,你可以在文件名称中放置章节数字,像 _章节 1_ 或 _Ch1 。很容易重命名一个文件,_ 。如果你完成重新排版书的章节,像这样重命名更容易。 + +别再碍事,开始编写。记住在模板中使用样式来格式化文本--这就是为什么你要创建模板,对吧? + +### 发布你的电子书 + +在完成编写一堆章节后,并准备发布它们时,创建一个主控文档。把一个主控文档作为你所编写章节的一个容器。使用一个主控文档,你可以快速地组装你的书,并任意重新排序你的章节。LibreOffice 帮助提供使用[主控文档][9]的详细信息。 + +假设你想生成一个 PDF ,不要只是单击**直接导出到 PDF** 按钮。这将创建一个相当不错的 PDF ,但是你可能想优化它。为此,选择 **文件 > 导出为 PDF** ,并在 PDF 窗口中轻微调整。你可以在 [LibreOffice Writer 文档][10] 中学到更多东西。 + +如果你想创建一个 EPUB 而不是 一个PDF ,或者除了一个 PDF 以外,另外创建一个 EPUB,安装 [Writer2EPUB][11] 扩展。Opensource.com 的 Bryan Behrenshausen 为这个扩展[分享一些有用的说明][12] 。 + +### 结束语 + +我们在这里创建的模板是极简单的,但是你将其用于一本简单的书,或者作为构建一个复杂模板的起点。不管怎样,这个模板都会让你快速地开始编写和发布你的电子书。 + +### 关于作者About The Author +Scott Nesbitt ;我是一个长期使用自由开放源码软件的人;写各种东西都是为了玩;盈利。我不太看重我自己;我做我自己的特效。你可以在网上的一些高质量的大型组装找到我的踪迹。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/10/creating-ebook-chapter-template-libreoffice-writer + +作者:[Scott Nesbitt][a] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/scottnesbitt +[2]:https://opensource.com/sites/default/files/images/life-uploads/lo-page-style.png (LibreOffice Page Style window) +[4]:https://opensource.com/sites/default/files/images/life-uploads/lo-paragraph-style.png (LibreOffice styles and formatting window) +[5]:/file/374466 +[6]:https://opensource.com/sites/default/files/images/life-uploads/lo-styles-in-action.png (Example of LibreOffice styles) +[8]:https://opensource.com/sites/default/files/images/life-uploads/lo-template-list.png (Template list - LibreOffice Writer) +[9]:https://help.libreoffice.org/Writer/Working_with_Master_Documents_and_Subdocuments +[10]:https://help.libreoffice.org/Common/Export_as_PDF +[11]:http://writer2epub.it/en/ +[12]:https://opensource.com/life/13/8/how-create-ebook-open-source-way From 78974b2caeaab7c4bd48012d11366adb70a08c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 31 Dec 2019 08:15:47 +0800 Subject: [PATCH 0014/3057] translating --- ...App Highlight- Open Source Disk Partitioning Tool GParted.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md index 6c78a12ecb..fe72f5695a 100644 --- a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md +++ b/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cb8f1da5653ede53266c00f859a84020c8abc920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 31 Dec 2019 08:17:27 +0800 Subject: [PATCH 0015/3057] Translating --- sources/tech/20191215 How to Add Border Around Text in GIMP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191215 How to Add Border Around Text in GIMP.md b/sources/tech/20191215 How to Add Border Around Text in GIMP.md index d691bafb41..0b2e3858f2 100644 --- a/sources/tech/20191215 How to Add Border Around Text in GIMP.md +++ b/sources/tech/20191215 How to Add Border Around Text in GIMP.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 93d7c5fdc1cef4e8de5c17202aab97bdc0266b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 31 Dec 2019 08:24:49 +0800 Subject: [PATCH 0016/3057] Translated --- .../20191016 Open source interior design with Sweet Home 3D.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md b/sources/tech/20191016 Open source interior design with Sweet Home 3D.md index bc5a17c51c..309b816f81 100644 --- a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md +++ b/sources/tech/20191016 Open source interior design with Sweet Home 3D.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f7de60aabef2eedd4f50271abd1ace60dc27e55a Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 31 Dec 2019 08:45:17 +0800 Subject: [PATCH 0017/3057] translated --- ...h the Linux Equinox Desktop Environment.md | 95 ------------------- ...h the Linux Equinox Desktop Environment.md | 92 ++++++++++++++++++ 2 files changed, 92 insertions(+), 95 deletions(-) delete mode 100644 sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md create mode 100644 translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md diff --git a/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md deleted file mode 100644 index 59abeb92b8..0000000000 --- a/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md +++ /dev/null @@ -1,95 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Chill out with the Linux Equinox Desktop Environment) -[#]: via: (https://opensource.com/article/19/12/ede-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Chill out with the Linux Equinox Desktop Environment -====== -This article is part of a special series of 24 days of Linux desktops. -EDE is not the most glamorous, minimal, nor efficient desktop. But its -soft, muted tones are calming, its familiarity soothing, and its icon -theme fun. -![Linux penguin at the north pole beside an igloo][1] - -I haven't used the Fast Light Toolkit ([FLTK][2]) for anything serious yet, but I'm a fan of the C++ GUI toolkit that's pretty simple to learn and (in my experience) reliable even across updates. When I found out that there was a desktop environment built with FLTK, I was eager to try it—and I was quickly glad I did. The [Equinox Desktop Environment (EDE)][3] is a fast and simple desktop written in C++ and FLTK for Unix desktops. It uses common desktop conventions, so it looks and feels familiar right away, and after only a few days of using it, I found its simplicity provides a minimal elegance that I enjoy. - -![EDE desktop][4] - -### Installing EDE - -You are likely to find EDE included in your distribution's software repository, but you can also find it in its [SourceForge repository][5]. If you're already running a different desktop, it's safe to install EDE on the same system because it brings along just a few extra applications, which are specific to EDE so they won't get in your way on other desktops. - -EDE is only the desktop, and it uses the [Pekwm][6] window manager to handle layout. - -After installing EDE, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -With GDM: - -![][7] - -With SDDM: - -![][8] - -When EDE first boots, you might be prompted to confirm some startup tasks. On my Slackware workstation, KDE had marked some services as startup tasks (such as the HPLIP print monitor and a Bluetooth daemon), and EDE imported them with just one confirmation box. - -![Importing desktop services in EDE][9] - -After setting it up once, you won't need to do it again. - -### EDE desktop tour - -EDE's layout is exactly what most people expect from a desktop: application menu on the left, taskbar in the middle, system tray on the right. It's the standard off-the-shelf layout that confuses nobody; this is a desktop that's safe to install on a Linux computer and hand over, with confidence, to someone who's never used Linux in their life. They'll fall right into this desktop with a soft and gentle landing. - -You can bring up a small desktop menu with a right-click. This allows you to make an application launcher on the desktop, create a folder, and set some theme options. - -The panel at the bottom of the screen is retractable, so you can work full-screen if you prefer. Click the clock in the bottom-right of the screen to bring up a calendar and time-zone settings. - -EDE has a small Configuration Place application that provides access to a few simple preferences: - - * Background and icon settings - * Screensaver settings - * Time and clock - * System bell - * Keyboard - * Preferred applications - - - -![EDE Configuration Place][10] - -There's not much more to EDE. There's no file manager, no text editor, or paint program, or game of solitaire. You must bring anything you want to run on your desktop. That means you get to pick and choose from the wide array of Linux applications and use whatever you love the most. - -### EDE as a statement - -I found the simplicity of EDE oddly comforting, at least as a kind of "holiday" desktop; it's a nice place to visit. It's not the most glamorous desktop available, nor the most minimal, nor the most efficient. But its soft, muted tones are calming, its familiarity soothing, and its icon theme fun and exuberant. EDE is a desktop that's proud of its slow and steady pace. - -If you're in the mood to put your feet up and enjoy a clean and pleasant interface, try EDE. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/ede-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/penguin.igloo_.png?itok=K92O7H6b (Linux penguin at the north pole beside an igloo) -[2]: https://www.fltk.org/ -[3]: https://sourceforge.net/projects/ede/ -[4]: https://opensource.com/sites/default/files/uploads/advent-ede.jpg (EDE desktop) -[5]: http://ede.sf.net -[6]: https://opensource.com/article/19/12/pekwm-linux-desktop -[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg -[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg -[9]: https://opensource.com/sites/default/files/uploads/advent-ede-init.jpg (Importing desktop services in EDE) -[10]: https://opensource.com/sites/default/files/uploads/advent-ede-conf.jpg (EDE Configuration Place) diff --git a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md new file mode 100644 index 0000000000..cfa8489c40 --- /dev/null +++ b/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Chill out with the Linux Equinox Desktop Environment) +[#]: via: (https://opensource.com/article/19/12/ede-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +轻松使用 Linux Equinox 桌面环境 +====== +本文是 24 天 Linux 桌面特别系列的一部分。EDE 不是最迷人、最小或效率最高的桌面。但它的柔和、静音让人平静,它让人感到熟悉舒缓,它的图标主题有趣。 +![Linux penguin at the north pole beside an igloo][1] + +我还没有认真用过 Fast Light Toolkit([FLTK] [2]),但我是 C++ GUI 工具箱的粉丝,它非常易于学习,并且即使跨更新时也很可靠。当我发现有一个用 FLTK 构建的桌面环境时,我很想尝试一下,并且我很快为我的决定感到高兴。[Equinox 桌面环境(EDE)][3] 是用 C++ 和 FLTK 为 Unix 桌面编写的快速、简单的桌面。它使用通用的桌面约定,因此外观和感觉都非常熟悉,并且在使用几天后,我发现它的简单性提供了我所喜欢的最低限度的优雅。 + +![EDE desktop][4] + +### 安装 EDE + +你可能会发现 EDE 包含在发行版的软件仓库中,但你也可以在它的 [SourceForge 仓库][5]中找到它。如果你已经在运行其他桌面,你可以安全地在同一系统上安装 EDE,因为它仅带来了一些额外的应用,这些应用程序特定于 EDE,因此它们不会妨碍你的其他桌面。 + +EDE 只是桌面,它使用 [Pekwm][6] 窗口管理器来处理布局。 + +安装 EDE 之后,注销当前的桌面会话,以便你可以登录到新的会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 + +在 GDM 中: + +![][7] + +在 SDDM 中: + +![][8] + +首次启动 EDE 时,可能会提示你确认一些启动任务。在我的 Slackware 工作站上,KDE 将某些服务标记为启动任务(例如 HPLIP 打印监视器和蓝牙守护程序),并且 EDE 在一个确认框中显示了它们。 + +![Importing desktop services in EDE][9] + +设置一次后,你无需再次进行设置。 + +### EDE 桌面之旅 + +EDE 的布局恰恰是大多数人在桌面上所期望的布局:左侧的应用菜单、中间的任务栏、右侧的系统托盘。这是标准的现成布局,不会让任何人感到困惑。这是一个可以安全地装在 Linux 上并且可以自信地给任何没有使用过 Linux 的人使用的桌面。他们将以舒适的方式很快地适应这个桌面。 + +你可以单击鼠标右键打开一个小型桌面菜单。这可以让你在桌面上创建应用启动器、创建文件夹并设置一些主题选项。 + +屏幕底部的面板是可伸缩的,因此你可以根据需要在全屏模式下工作。单击屏幕右下角的时钟来调出日历和时区设置。 + +EDE 有一个小的配置应用,可用于设置一些简单的选项: + + * 背景和图标设置 +  * 屏幕保护程序设置 +  * 时间和时钟 +  * 系统铃声 +  * 键盘 +  * 偏好应用 + + + +![EDE Configuration Place][10] + +EDE 的功能不多。没有文件管理器、文本编辑器、绘画程序或纸牌游戏。你必须安装你想在桌面运行的程序。这意味着你可以从各种各样的 Linux 应用中进行选择,并使用你最喜欢的。 + +### EDE 总结 + +我发现 EDE 至少作为一种”假日“桌面而言,它的简单性令人舒适。它值得一看。它不是最迷人的桌面,也不是最小的、也不是最高效的。但它的柔和、静音让人平静,它让人感到熟悉舒缓,并且它的图标主题充满乐趣和生气。EDE 是一个以其缓慢而稳定的步调而自豪的桌面。 + +如果你想放松心情使用一个干净和令人愉悦的界面,请试试 EDE。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ede-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/penguin.igloo_.png?itok=K92O7H6b (Linux penguin at the north pole beside an igloo) +[2]: https://www.fltk.org/ +[3]: https://sourceforge.net/projects/ede/ +[4]: https://opensource.com/sites/default/files/uploads/advent-ede.jpg (EDE desktop) +[5]: http://ede.sf.net +[6]: https://opensource.com/article/19/12/pekwm-linux-desktop +[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg +[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg +[9]: https://opensource.com/sites/default/files/uploads/advent-ede-init.jpg (Importing desktop services in EDE) +[10]: https://opensource.com/sites/default/files/uploads/advent-ede-conf.jpg (EDE Configuration Place) From 6b402b9fa0e0233319bb3074be5a718a5ac95474 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 31 Dec 2019 08:53:59 +0800 Subject: [PATCH 0018/3057] translating --- ...0 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md index d8bbaf3185..b8314533cf 100644 --- a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md +++ b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b5871344bd0d89a1d3788b179a966f8103307779 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:13:03 +0800 Subject: [PATCH 0019/3057] PRF --- ...ry Kubernetes job candidate should know.md | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md b/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md index b7a6fa9c1d..94ae41a3e9 100644 --- a/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md +++ b/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md @@ -1,64 +1,66 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 interview questions every Kubernetes job candidate should know) [#]: via: (https://opensource.com/article/19/12/kubernetes-interview-questions) [#]: author: (Jessica Repka https://opensource.com/users/jrepka) -每个 Kubernetes 应聘者应该知道的5个面试题 +每个 Kubernetes 应聘者应该知道的 5 个面试题 ====== -如果你要面试Kubernetes相关的应聘者,这里给出了要提问的问题以及这些问题的重要性。 -![Pair programming][1] + +> 如果你是要面试 Kubernetes 相关职位的应聘者,这里给出了要提问的问题以及这些问题的重要性。 + +![](https://img.linux.net.cn/data/attachment/album/201912/31/101229mmjumsesrzhh6rhk.jpg) 面试对面试官及候选人来说都很不容易。最近,我发现面试 Kubernetes 相关工作的候选人似乎尤其困难。为什么呢?一方面,很难找到可以回答他们问题的人。而且,不管回答者回答的怎样,都很难确定他们是否有正确的经验。 -跳过这个问题,让我们来看看面试[Kubernetes][2]求职者时应该提问的一些问题。 +跳过这个问题,让我们来看看面试 [Kubernetes][2] 求职者时应该提问的一些问题。 ### Kubernetes 是什么? -我发现这个问题是面试中最好的问题之一。我经常听到有人说“我用Kubernetes工作”,但是当我问道“Kubernetes 是什么时,从来都没有得到过一个满意答案。 +我发现这个问题是面试中最好的问题之一。我经常听到有人说“我用 Kubernetes 工作”,但是当我问道“Kubernetes 是什么”时,从来都没有得到过一个满意答案。 -我最喜欢克里斯•肖特[Chris Short][3]给出的答案:“Kubernetes 就是带有一些 YAML 文件的 API 。” +我最喜欢 [Chris Short][3] 给出的答案:“Kubernetes 就是带有一些 YAML 文件的 API 。” -虽然他的回答没有错,但我会给你更详细的解释。 Kubernetes 是一个便携式容器编排工具,用于自动执行管理,监控,扩展和部署容器化应用程序。 +虽然他的回答没有错,但我会给你更详细的解释。 Kubernetes 是一个可移植容器的编排工具,用于自动执行管理、监控、扩展和部署容器化应用程序。 -我认为“用于部署容器化应用程序的编排工具”这个回答可能与你期望的答案差不多了。能回答出这个,我觉得已经很不错了。尽管许多人相信 Kubernetes 可以增加很多,但总的来说,它提供了许多API来增加其核心功能:容器编排。 +我认为“用于部署容器化应用程序的编排工具”这个回答可能与你期望的答案差不多了。能回答出这个,我觉得已经很不错了。尽管许多人认为 Kubernetes 做了更多更棒的工作,但总的来说,它为其核心功能——容器编排——添加了许多 API。 我认为,这是你在面试中可以提问的最好的问题之一,因为它至少证明了候选人是否知道 Kubernetes 是什么。 -### Kubernetes 的 node(节点)和 Pod 有什么区别? +### Kubernetes 的节点和 Pod 有什么区别? -该问题揭示了候选人对 Kubernetes 复杂性的初步了解。它将对话转换为体系结构概述,并可能导向许多有趣的后续细节问题。我已经听到了无数次关于该问题的错误解释了。 +该问题揭示了候选人对 Kubernetes 复杂性的初步了解。它将面试对话转换为对体系结构的概述,并可能导向许多有趣的后续细节问题。我已经听到了无数次关于该问题的错误解释了。 -[node][4] 是工作计算机。该计算机可以是虚拟机(VM)或物理计算机,具体取决于你是在虚拟机监控程序上运行还是在裸机上运行。该节点包含用于运行容器的服务,包括 kubelet,kube-proxy 和容器运行时。 +[节点][4] 是工作计算机。该计算机可以是虚拟机(VM)或物理计算机,具体取决于你是在虚拟机监控程序上运行还是在裸机上运行。该节点包含用于运行容器的服务,包括 kubelet、kube-proxy 和容器运行时。 -[pod][5] pod 包括(1)一个或多个具有共享网络(3)和存储(4)的容器(2)以及有关如何运行一起部署的容器的规范。这四个细节都很重要。更进一步,申请人应从技术层面解释,pod 是Kubernetes 可以创建和管理的最小可部署单元,而不是容器。 +[Pod][5] 包括:一个或多个**容器**、具有共享**网络**和**存储**,以及有关如何运行一起部署的容器的**规范**。这四个细节都很重要。更进一步,职位申请人应从技术层面解释,Pod 是 Kubernetes 可以创建和管理的最小可部署单元,而不是容器。 -对于这个问题,我听到的最好的简答是:“node 是计算机,而 pod 是容器中的东西。” 区别很重要。 Kubernetes 管理员的大部分工作是知道什么时间要部署什么,而节点可能非常非常昂贵,具体取决于它们的运行位置。我不希望有人一遍又一遍地部署节点,他们需要做的就是部署一堆Pod。 +对于这个问题,我听到的最好的简答是:“节点是计算机,而 Pod 是容器运行于其中的东西。”这个区别很重要。Kubernetes 管理员的大部分工作是知道什么时间要部署什么,而节点的部署成本可能非常非常高,具体取决于它们的运行位置。我不希望有人一遍又一遍地部署节点,他们需要做的就是部署一堆 Pod。 -### kubectl 是什么? (你怎么发音?) +### kubectl 是什么?(你怎么发音?) -这个问题是我的优先级中较高的问题之一,但可能与你和你的团队无关。在我的团队中,我们不会使用图形化界面来管理Kubernetes环境,我们使用命令行操作。 +这个问题是我优先级较高的问题之一,但可能与你和你的团队无关。在我的团队中,我们不会使用图形化界面来管理 Kubernetes 环境,我们使用命令行操作。 -那么什么是[kubectl][6]?它是 Kubernetes 的命令行界面。你可以从该界面获取并设置任何内容,从收集日志和事件到编辑部署环境和机密文件。随机提问候选人关于如何使用此工具对测试候选人对 kubectl 的熟悉度是很有帮助的。 +那么什么是 [kubectl][6]?它是 Kubernetes 的命令行界面。你可以从该界面获取并设置任何内容,从收集日志和事件到编辑部署环境和机密文件。随机提问候选人关于如何使用此工具对测试候选人对 kubectl 的熟悉度是很有帮助的。 -你是怎么读的?好吧,你随便吧(对此有很大的分歧),但是我很高兴向你介绍我朋友[Waldo][7]的精彩视频演示。 +你是怎么读的?好吧,你随便吧(对此有很大的分歧),但是我很高兴向你介绍我朋友 [Waldo][7] 的精彩视频演示。 -### 名称空间是什么? +### 命名空间是什么? -在多次面试中,我都没有得到关于这个问题的答案。我不确定在其他环境中使用的名称空间是否会在我所在的团队经常使用。我在这里给出一个简短的答案:名称空间是Pod中的虚拟集群。这种抽象可以使你将多个虚拟群集保留在各种环境中以此来进行隔离。 +在多次面试中,我都没有得到关于这个问题的答案。我不确定在其他环境中使用的命名空间是否会在我所在的团队经常使用。我在这里给出一个简短的答案:命名空间是 Pod 中的虚拟集群。这种抽象可以使你将多个虚拟集保留在多个环境中以此来进行隔离。 ### 容器是什么? -了解 Pod 中正在部署的内容总是有帮助的,因为如果都不知道其中部署的是什么,何谈部署?容器是打包代码及其所有依赖项的软件的标准单元。我收到了两个可以接收的答案,其中包括:a)精简的操作系统映像,以及b)在受限的 OS 环境中运行的应用程序。如果你可以命名使用[Docker][8]以外的其他容器的编排软件(例如你最喜欢的公共云的容器服务),则可以得到加分。 + +了解 Pod 中正在部署的内容总是有帮助的,因为如果都不知道其中部署的是什么,何谈部署?容器是打包代码及其所有依赖项的软件的标准单元。我收到了两个可以接受的答案,其中包括:a)精简的操作系统镜像,以及 b)在受限的操作系统环境中运行的应用程序。如果你可以叫得出使用 [Docker][8] 以外的其他容器的编排软件(例如你最喜欢的公共云的容器服务),则可以得到加分。 ### 其他问题 -如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。 -**[阅读更多:如何准备 Kubernetes 相关的面试?]][9]** +如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。当你仔细研究这些内容时,尝试寻找有关技术如何相互作用的有趣问题,以了解人们如何应对基础架构挑战。考虑一下你的团队最近遇到的挑战(中断),要求逐步进行部署,或者考虑改善团队积极想要改进的策略(例如减少部署时间)。问题越不抽象,对面试后真正重要的技能的询问就越多。 -没有两个环境是完全相同的。这也适用于面试中。我在每次面试中都会混合提问。 我也有一个测试面试者的小环境。我经常发现回答问题是最容易的部分,而你所做的工作才是对你的真正的考验。 +没有两个环境是完全相同的。这也适用于面试中。我在每次面试中都会混合提问。我也有一个测试面试者的小环境。我经常发现回答问题是最容易的部分,而你所做的工作才是对你的真正的考验。 我给面试官的最后一点建议是:如果你遇到一个很有潜力但没有经验的候选人时,请给他们一个证明自己的机会。如果当初没有人看到我的潜力,没有给我机会的话,我不会拥有今天的知识和经验。 @@ -70,8 +72,8 @@ via: https://opensource.com/article/19/12/kubernetes-interview-questions 作者:[Jessica Repka][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1d21973e3b172b38ecaf12396c6d5f73cc043952 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:13:47 +0800 Subject: [PATCH 0020/3057] PUB @Morisun029 https://linux.cn/article-11730-1.html --- ...ew questions every Kubernetes job candidate should know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191217 5 interview questions every Kubernetes job candidate should know.md (99%) diff --git a/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md b/published/20191217 5 interview questions every Kubernetes job candidate should know.md similarity index 99% rename from translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md rename to published/20191217 5 interview questions every Kubernetes job candidate should know.md index 94ae41a3e9..f6d0f6685f 100644 --- a/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md +++ b/published/20191217 5 interview questions every Kubernetes job candidate should know.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11730-1.html) [#]: subject: (5 interview questions every Kubernetes job candidate should know) [#]: via: (https://opensource.com/article/19/12/kubernetes-interview-questions) [#]: author: (Jessica Repka https://opensource.com/users/jrepka) From 5aac22f376dcdac37e57533b79d7162eacb215d2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:48:00 +0800 Subject: [PATCH 0021/3057] PRF @geekpi --- ...Falkon Open Source Web Browser from KDE.md | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md index 18d42af58a..5e04937565 100644 --- a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ b/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) @@ -10,15 +10,13 @@ 应用推荐:来自 KDE 的 Falkon 开源 Web 浏览器 ====== -_**它以前称为 Qupzilla,Falkon 是基于 QtWebEngine 的 Web 浏览器。在本周的“应用推荐”中,我们来看看这个开源软件。**_ +> Falkon 是基于 QtWebEngine 的 Web 浏览器,它以前称为 Qupzilla。在本周的“应用推荐”中,我们来看看这个开源软件。 ### Falkon:适用于 Linux(和 Windows)的开源 Web 浏览器 ![][1] -首先,[Falkon][2] 不是新的 Web 浏览器。它自 2010 年以来一直在开发中,但被称为 Qupzilla。 - -2017 年,QupZilla 移到 KDE 旗下,并更名为 Falkon。处于 KDE 旗下意味着项目会按照 KDE 标准积极维护。 +首先,[Falkon][2] 并不是一款新的 Web 浏览器。它自 2010 年以来一直在开发中,但被称为 Qupzilla。2017 年,QupZilla 移到 KDE 旗下,并更名为 Falkon。处于 KDE 旗下意味着项目会按照 KDE 标准积极维护。 它使用 [QtWebEngine][3] 渲染引擎,这是 Chromium 核心的简化版本。 @@ -26,25 +24,23 @@ _**它以前称为 Qupzilla,Falkon 是基于 QtWebEngine 的 Web 浏览器。 ### Falkon 浏览器的功能 -我认为它可能不是流行的浏览器,但我发现它足以浏览现代 Web 服务。 - -让我重点介绍 Falkon 的主要功能,如果你觉得它很有趣,请尝试一下。 +我认为它可能不是流行的浏览器,但我发现它足以浏览现代 Web 服务。让我重点介绍 Falkon 的主要功能,如果你觉得它很有趣,请尝试一下。 #### 简单的用户界面 ![][4] -我知道这不完全是一项“功能”,但是用户体验 (UX) 至关重要。尽管是轻量级的浏览器,但你会拥有一个不错的界面。你不会觉得使用的是 2000 年早期的浏览器。 +我知道这不完全是一项“功能”,但是用户体验(UX)至关重要。尽管是轻量级的浏览器,但你会拥有一个不错的界面。你不会觉得使用的是一款源自 2000 年早期的浏览器。 #### AdBlock 扩展 ![][5] -它附带了 AdBlock 扩展程序,如果你想在浏览网站时摆脱广告,它大的效果很好。你还可以自定义 AdBlock 扩展的行为。 +它附带了 AdBlock 扩展程序,如果你想在浏览网站时摆脱广告,它的效果很好。你还可以自定义 AdBlock 扩展的行为。 #### DuckDuckGo 作为默认搜索引擎 -如果你不喜欢使用 Google,那么最好将[主打隐私的搜索引擎][6]之一设为默认搜索引擎。 +如果你不喜欢使用 Google,那么这是一件好事,它将这个[主打隐私的搜索引擎][6]设为默认搜索引擎。 #### 会话管理器 @@ -68,29 +64,23 @@ Falkon 还允许你在某种程度上自定义外观。如果要更改浏览器 ![][10] -我还尝试了其他设置/功能,例如添加书签或管理密码。 - -或者,管理网页的通知。 - -我还试了 YouTube,没有任何问题。 +我还尝试了其他设置/功能,例如添加书签或管理密码。或者,管理网页的通知。我还试了 YouTube,没有任何问题。 当然,这不是一个详尽的评测。但是,Falkon 确实拥有浏览器中需要的所有基本功能(除非你有特定要求)。 ### 安装 Falkon 浏览器 -你可以在软件中心轻松找到 Falkon 浏览器。 - -如果没有,你可以从它的[官方下载页面][11]中找到 Flatpak/Snap 包。你还可以在下载页面上找到 Windows 的安装程序。 +你可以在软件中心轻松找到 Falkon 浏览器。如果没有,你可以从它的[官方下载页面][11]中找到 Flatpak/Snap 包。你还可以在下载页面上找到 Windows 的安装程序。 [Download Falkon Browser][11] -**总结** +### 总结 作为 KDE 产品,Falkon 是为 KDE 桌面环境量身定制的。一些 KDE 发行版(例如 OpenMandriva)使用 Falkon 作为默认的 Web 浏览器。 -Falkon 浏览器适合那些正在寻求轻巧且功能丰富的 Web 浏览器的人。值得尝试的一个替代是 [Midori][12]。 +Falkon 浏览器适合那些正在寻求轻巧且功能丰富的 Web 浏览器的人。值得尝试的另一个替代是 [Midori][12]。 -我认为,除非你需要大量的扩展、跨平台同步并且需要访问某些特定于浏览器的网站,不然它是一个很好的替代浏览器,。 +我认为,除非你需要大量的扩展、跨平台同步并且需要访问某些特定于浏览器的网站,不然它是一个很好的替代浏览器。 你如何看待 Falkon 浏览器?请在下面的评论中让我知道你的想法。 @@ -101,7 +91,7 @@ via: https://itsfoss.com/falkon-browser/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0e0b96babd5f3cead1afb0f06d1c60310dabb8cb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:48:50 +0800 Subject: [PATCH 0022/3057] PUB @geekpi https://linux.cn/article-11732-1.html --- ... App Highlight- Falkon Open Source Web Browser from KDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md (98%) diff --git a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md similarity index 98% rename from translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md rename to published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md index 5e04937565..7bd221d6f8 100644 --- a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ b/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11732-1.html) [#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) [#]: via: (https://itsfoss.com/falkon-browser/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 8139d5e08b1c92f197d807237851db92ad3c0a1e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:51:03 +0800 Subject: [PATCH 0023/3057] PRF --- ...24 App Highlight- Falkon Open Source Web Browser from KDE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md index 7bd221d6f8..bd4a26bc8e 100644 --- a/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ b/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -12,6 +12,8 @@ > Falkon 是基于 QtWebEngine 的 Web 浏览器,它以前称为 Qupzilla。在本周的“应用推荐”中,我们来看看这个开源软件。 +![](https://img.linux.net.cn/data/attachment/album/201912/31/105027tblfjlzn9xx8keud.png) + ### Falkon:适用于 Linux(和 Windows)的开源 Web 浏览器 ![][1] From 5d8cacfd0a1b8e7f1f1d770e84e0ac7756249421 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 11:00:55 +0800 Subject: [PATCH 0024/3057] PRF --- .../20191204 Fedora Desktops - Memory Footprints.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md b/translated/tech/20191204 Fedora Desktops - Memory Footprints.md index 0fe78be674..967b172a63 100644 --- a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md +++ b/translated/tech/20191204 Fedora Desktops - Memory Footprints.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Fedora Desktops – Memory Footprints) @@ -12,7 +12,7 @@ Fedora 上的桌面环境内存占用测试 ![][1] -Fedora 中有 40 多中桌面环境。每种桌面环境都有自己的优点和缺点。通常,根据功能、外观和其他品质,选择桌面是非常个人的偏爱。但有时,你选择的桌面环境还会受到硬件限制。 +Fedora 中有 40 多种桌面环境(DE)。每种桌面环境都有自己的优点和缺点。通常,根据功能、外观和其它品质,选择桌面是一件非常个人的偏好。但有时,你选择的桌面环境还会受到硬件限制。 本文旨在帮助人们根据桌面环境占用的基准内存来比较 Fedora 桌面环境。为了缩小范围,我们仅查看具有正式 Fedora Live 镜像的桌面环境。 @@ -20,11 +20,11 @@ Fedora 中有 40 多中桌面环境。每种桌面环境都有自己的优点和 每个桌面环境都安装在自己的 KVM 虚拟机上。每个虚拟机都有 1 个 CPU、4GB 内存、15GB virtio 固态磁盘,以及 RHEL 8.0 kvm 上所有其他标准配置。 -用于安装的镜像是标准的 Fedora 31 Live 镜像。对于 GNOME,该镜像是 Fedora 工作站。对于其他桌面,使用了相应的 Spin 版本。未对“糖葫芦Sugar On A Stick”(SOAS)进行测试,因为它不容易安装到本地驱动器上。 +用于安装的镜像是标准的 Fedora 31 Live 镜像。对于 GNOME,该镜像是 “Fedora 工作站”。对于其它桌面,使用了相应的 Spin 版本。未对“糖葫芦Sugar On A Stick”(SOAS)进行测试,因为它不容易安装到本地驱动器上。 -用 Live CD 启动虚拟机,然后选择“安装到硬盘”。在安装过程中,仅使用默认值。创建一个 root 用户和一个普通用户。安装并重新启动后,live 镜像已确认不在虚拟 CDROM 中。 +用 Live CD 启动虚拟机,然后选择“安装到硬盘”。在安装过程中,仅使用默认值。创建了一个 root 用户和一个普通用户。安装并重新启动后,live 镜像已确认不在虚拟 CDROM 中。 -每个桌面环境的设置都没有改动。它们每个都以 Live CD 安装中默认的设置运行。每个桌面环境都是通过普通用户登录的。打开了一个终端,在每台虚拟机中都使用 `sudo` 运行了 `dnf -y update`。在更新后,在该 sudo 终端中,每台虚拟机都运行 `/sbin/shutdown -h now` 以关闭。 +每个桌面环境的设置都没有改动。它们每个都以 Live CD 环境中默认的设置运行。每个桌面环境都是通过普通用户登录的。打开了一个终端,在每台虚拟机中都使用 `sudo` 运行了 `dnf -y update`。在更新后,在该 sudo 终端中,每台虚拟机都运行 `/sbin/shutdown -h now` 以关闭。 ### 测试方式 @@ -73,7 +73,7 @@ via: https://fedoramagazine.org/fedora-desktops-memory-footprints/ 作者:[Troy Dawson][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a359e68dfa931102f16e5b60568cced1ecda85c4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 11:01:26 +0800 Subject: [PATCH 0025/3057] PUB @geekpi https://linux.cn/article-11733-1.html --- .../20191204 Fedora Desktops - Memory Footprints.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191204 Fedora Desktops - Memory Footprints.md (98%) diff --git a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md b/published/20191204 Fedora Desktops - Memory Footprints.md similarity index 98% rename from translated/tech/20191204 Fedora Desktops - Memory Footprints.md rename to published/20191204 Fedora Desktops - Memory Footprints.md index 967b172a63..c11f1ea98f 100644 --- a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md +++ b/published/20191204 Fedora Desktops - Memory Footprints.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11733-1.html) [#]: subject: (Fedora Desktops – Memory Footprints) [#]: via: (https://fedoramagazine.org/fedora-desktops-memory-footprints/) [#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) From c024e1d20427996ffa85a97315ee5cb71a258320 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 11:05:24 +0800 Subject: [PATCH 0026/3057] PRF --- published/20191204 Fedora Desktops - Memory Footprints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20191204 Fedora Desktops - Memory Footprints.md b/published/20191204 Fedora Desktops - Memory Footprints.md index c11f1ea98f..21ae866e77 100644 --- a/published/20191204 Fedora Desktops - Memory Footprints.md +++ b/published/20191204 Fedora Desktops - Memory Footprints.md @@ -44,7 +44,7 @@ Fedora 中有 40 多种桌面环境(DE)。每种桌面环境都有自己的 * gnome-shell 6.9% / gnome-software 1.8% / ibus-x11 1.5% * KDE * 使用了 733 MB - * plasmashell 6.2% / kwin_x11 3.6% / akonadi_mailfil 2.9% + * plasmashell 6.2% / kwin\_x11 3.6% / akonadi\_mailfil 2.9% * LXDE * 使用了 318 MB * Xorg 1.9% / nm-applet 1.8% / dnfdragora 1.8% From a6d3519379bb8e69ecc88cb1753b3e721f9786b2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 20:44:47 +0800 Subject: [PATCH 0027/3057] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2019 年过去了 --- ... And Upload Files To Compatible Hosting Sites Automatically.md | 0 .../20180207 23 open source audio-visual production tools.md | 0 ...k global- How to overcome cultural communication challenges.md | 0 ...ad Text Snippets To Pastebin-like Services From Commandline.md | 0 ...90217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md | 0 published/{ => 201912}/20190225 Netboot a Fedora Live CD.md | 0 published/{ => 201912}/20190322 Easy means easy to debug.md | 0 .../20190513 How To Set Password Complexity On Linux.md | 0 ...stall LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md | 0 published/{ => 201912}/20190711 DevOps for introverted people.md | 0 ...0190725 24 sysadmin job interview questions you should know.md | 0 published/{ => 201912}/20190827 curl exercises.md | 0 published/{ => 201912}/20190927 5 tips for GNU Debugger.md | 0 published/{ => 201912}/20191004 What-s in an open source name.md | 0 published/{ => 201912}/20191007 Using the Java Persistence API.md | 0 published/{ => 201912}/20191017 How to type emoji on Linux.md | 0 published/{ => 201912}/20191017 Using multitail on Linux.md | 0 ...14 SCP Command Examples to Securely Transfer Files in Linux.md | 0 ...o program with Bash- Logical operators and shell expansions.md | 0 .../{ => 201912}/20191023 How to program with Bash- Loops.md | 0 .../20191024 Get sorted with sort at the command line.md | 0 .../{ => 201912}/20191028 6 signs you might be a Linux user.md | 0 .../20191028 How to remove duplicate lines from files with awk.md | 0 ...1101 Awk one-liners and scripts to help you sort text files.md | 0 .../20191113 Edit images on Fedora easily with GIMP.md | 0 .../20191114 Debugging Software Deployments with strace.md | 0 .../{ => 201912}/20191115 How to port an awk script to Python.md | 0 ...ly Check if a Website is up or down from the Linux Terminal.md | 0 .../20191118 How internet security works- TLS, SSL, and CA.md | 0 ...19 Top 10 Vim plugins for programming in multiple languages.md | 0 ... Switching from Python 2 to Python 3- What you need to know.md | 0 ...w System Information on Linux Every Time You Log into Shell.md | 0 ...How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md | 0 published/{ => 201912}/20191125 How to use loops in awk.md | 0 published/{ => 201912}/20191125 The many faces of awk.md | 0 ...ds to Find the IP Address of a Domain in the Linux Terminal.md | 0 .../20191127 Create virtual machines with Cockpit in Fedora.md | 0 .../20191127 How to write a Python web API with Flask.md | 0 ...a quietly unveils faster, lower power Tesla GPU accelerator.md | 0 .../20191129 A quick introduction to Toolbox on Fedora.md | 0 .../20191202 Use the Window Maker desktop on Linux.md | 0 ... Kubernetes, low-code developers, and other industry trends.md | 0 .../20191203 Using Ansible to organize your SSH keys in AWS.md | 0 ...191203 Why use the Pantheon desktop for Linux Elementary OS.md | 0 ...XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md | 0 .../{ => 201912}/20191204 Fedora Desktops - Memory Footprints.md | 0 .../20191204 Java vs. Python- Which should you choose.md | 0 .../{ => 201912}/20191206 5 cool terminal pagers in Fedora.md | 0 .../20191206 6 Ways to Send Email from the Linux Command Line.md | 0 .../{ => 201912}/20191206 Pekwm- A lightweight Linux desktop.md | 0 .../20191207 Getting started with the GNOME Linux desktop.md | 0 .../{ => 201912}/20191209 Counting down the days using bash.md | 0 .../20191210 3 easy steps to update your apps to Python 3.md | 0 ...210 Breaking Linux files into pieces with the split command.md | 0 .../20191210 Customize your Linux desktop with FVWM.md | 0 .../20191211 Annotate screenshots on Linux with Ksnip.md | 0 ...0191211 How to Find High CPU Consumption Processes in Linux.md | 0 .../20191212 How to configure Openbox for your Linux desktop.md | 0 ...0191213 What GNOME 2 fans love about the Mate Linux desktop.md | 0 .../20191214 Get started with Lumina for your Linux desktop.md | 0 ...erview questions every Kubernetes job candidate should know.md | 0 .../20191217 Build a retro Apple desktop with the Linux MLVWM.md | 0 published/{ => 201912}/20191218 How tracking pixels work.md | 0 ... - Restart Services in Ubuntu and Other Linux Distributions.md | 0 .../20191221 Customize your Linux desktop with KDE Plasma.md | 0 ... How to Update Grub on Ubuntu and Other Linux Distributions.md | 0 ...222 Why your Python code needs to be beautiful and explicit.md | 0 ...1224 App Highlight- Falkon Open Source Web Browser from KDE.md | 0 .../20191224 Unix is turning 50. What does that mean.md | 0 69 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201912}/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md (100%) rename published/{ => 201912}/20180207 23 open source audio-visual production tools.md (100%) rename published/{ => 201912}/20181018 Think global- How to overcome cultural communication challenges.md (100%) rename published/{ => 201912}/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md (100%) rename published/{ => 201912}/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md (100%) rename published/{ => 201912}/20190225 Netboot a Fedora Live CD.md (100%) rename published/{ => 201912}/20190322 Easy means easy to debug.md (100%) rename published/{ => 201912}/20190513 How To Set Password Complexity On Linux.md (100%) rename published/{ => 201912}/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md (100%) rename published/{ => 201912}/20190711 DevOps for introverted people.md (100%) rename published/{ => 201912}/20190725 24 sysadmin job interview questions you should know.md (100%) rename published/{ => 201912}/20190827 curl exercises.md (100%) rename published/{ => 201912}/20190927 5 tips for GNU Debugger.md (100%) rename published/{ => 201912}/20191004 What-s in an open source name.md (100%) rename published/{ => 201912}/20191007 Using the Java Persistence API.md (100%) rename published/{ => 201912}/20191017 How to type emoji on Linux.md (100%) rename published/{ => 201912}/20191017 Using multitail on Linux.md (100%) rename published/{ => 201912}/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md (100%) rename published/{ => 201912}/20191022 How to program with Bash- Logical operators and shell expansions.md (100%) rename published/{ => 201912}/20191023 How to program with Bash- Loops.md (100%) rename published/{ => 201912}/20191024 Get sorted with sort at the command line.md (100%) rename published/{ => 201912}/20191028 6 signs you might be a Linux user.md (100%) rename published/{ => 201912}/20191028 How to remove duplicate lines from files with awk.md (100%) rename published/{ => 201912}/20191101 Awk one-liners and scripts to help you sort text files.md (100%) rename published/{ => 201912}/20191113 Edit images on Fedora easily with GIMP.md (100%) rename published/{ => 201912}/20191114 Debugging Software Deployments with strace.md (100%) rename published/{ => 201912}/20191115 How to port an awk script to Python.md (100%) rename published/{ => 201912}/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md (100%) rename published/{ => 201912}/20191118 How internet security works- TLS, SSL, and CA.md (100%) rename published/{ => 201912}/20191119 Top 10 Vim plugins for programming in multiple languages.md (100%) rename published/{ => 201912}/20191120 Switching from Python 2 to Python 3- What you need to know.md (100%) rename published/{ => 201912}/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md (100%) rename published/{ => 201912}/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md (100%) rename published/{ => 201912}/20191125 How to use loops in awk.md (100%) rename published/{ => 201912}/20191125 The many faces of awk.md (100%) rename published/{ => 201912}/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md (100%) rename published/{ => 201912}/20191127 Create virtual machines with Cockpit in Fedora.md (100%) rename published/{ => 201912}/20191127 How to write a Python web API with Flask.md (100%) rename published/{ => 201912}/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md (100%) rename published/{ => 201912}/20191129 A quick introduction to Toolbox on Fedora.md (100%) rename published/{ => 201912}/20191202 Use the Window Maker desktop on Linux.md (100%) rename published/{ => 201912}/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md (100%) rename published/{ => 201912}/20191203 Using Ansible to organize your SSH keys in AWS.md (100%) rename published/{ => 201912}/20191203 Why use the Pantheon desktop for Linux Elementary OS.md (100%) rename published/{ => 201912}/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md (100%) rename published/{ => 201912}/20191204 Fedora Desktops - Memory Footprints.md (100%) rename published/{ => 201912}/20191204 Java vs. Python- Which should you choose.md (100%) rename published/{ => 201912}/20191206 5 cool terminal pagers in Fedora.md (100%) rename published/{ => 201912}/20191206 6 Ways to Send Email from the Linux Command Line.md (100%) rename published/{ => 201912}/20191206 Pekwm- A lightweight Linux desktop.md (100%) rename published/{ => 201912}/20191207 Getting started with the GNOME Linux desktop.md (100%) rename published/{ => 201912}/20191209 Counting down the days using bash.md (100%) rename published/{ => 201912}/20191210 3 easy steps to update your apps to Python 3.md (100%) rename published/{ => 201912}/20191210 Breaking Linux files into pieces with the split command.md (100%) rename published/{ => 201912}/20191210 Customize your Linux desktop with FVWM.md (100%) rename published/{ => 201912}/20191211 Annotate screenshots on Linux with Ksnip.md (100%) rename published/{ => 201912}/20191211 How to Find High CPU Consumption Processes in Linux.md (100%) rename published/{ => 201912}/20191212 How to configure Openbox for your Linux desktop.md (100%) rename published/{ => 201912}/20191213 What GNOME 2 fans love about the Mate Linux desktop.md (100%) rename published/{ => 201912}/20191214 Get started with Lumina for your Linux desktop.md (100%) rename published/{ => 201912}/20191217 5 interview questions every Kubernetes job candidate should know.md (100%) rename published/{ => 201912}/20191217 Build a retro Apple desktop with the Linux MLVWM.md (100%) rename published/{ => 201912}/20191218 How tracking pixels work.md (100%) rename published/{ => 201912}/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md (100%) rename published/{ => 201912}/20191221 Customize your Linux desktop with KDE Plasma.md (100%) rename published/{ => 201912}/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md (100%) rename published/{ => 201912}/20191222 Why your Python code needs to be beautiful and explicit.md (100%) rename published/{ => 201912}/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md (100%) rename published/{ => 201912}/20191224 Unix is turning 50. What does that mean.md (100%) diff --git a/published/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md b/published/201912/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md similarity index 100% rename from published/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md rename to published/201912/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md diff --git a/published/20180207 23 open source audio-visual production tools.md b/published/201912/20180207 23 open source audio-visual production tools.md similarity index 100% rename from published/20180207 23 open source audio-visual production tools.md rename to published/201912/20180207 23 open source audio-visual production tools.md diff --git a/published/20181018 Think global- How to overcome cultural communication challenges.md b/published/201912/20181018 Think global- How to overcome cultural communication challenges.md similarity index 100% rename from published/20181018 Think global- How to overcome cultural communication challenges.md rename to published/201912/20181018 Think global- How to overcome cultural communication challenges.md diff --git a/published/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/published/201912/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md similarity index 100% rename from published/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md rename to published/201912/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md diff --git a/published/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md b/published/201912/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md similarity index 100% rename from published/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md rename to published/201912/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md diff --git a/published/20190225 Netboot a Fedora Live CD.md b/published/201912/20190225 Netboot a Fedora Live CD.md similarity index 100% rename from published/20190225 Netboot a Fedora Live CD.md rename to published/201912/20190225 Netboot a Fedora Live CD.md diff --git a/published/20190322 Easy means easy to debug.md b/published/201912/20190322 Easy means easy to debug.md similarity index 100% rename from published/20190322 Easy means easy to debug.md rename to published/201912/20190322 Easy means easy to debug.md diff --git a/published/20190513 How To Set Password Complexity On Linux.md b/published/201912/20190513 How To Set Password Complexity On Linux.md similarity index 100% rename from published/20190513 How To Set Password Complexity On Linux.md rename to published/201912/20190513 How To Set Password Complexity On Linux.md diff --git a/published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/published/201912/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md similarity index 100% rename from published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md rename to published/201912/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md diff --git a/published/20190711 DevOps for introverted people.md b/published/201912/20190711 DevOps for introverted people.md similarity index 100% rename from published/20190711 DevOps for introverted people.md rename to published/201912/20190711 DevOps for introverted people.md diff --git a/published/20190725 24 sysadmin job interview questions you should know.md b/published/201912/20190725 24 sysadmin job interview questions you should know.md similarity index 100% rename from published/20190725 24 sysadmin job interview questions you should know.md rename to published/201912/20190725 24 sysadmin job interview questions you should know.md diff --git a/published/20190827 curl exercises.md b/published/201912/20190827 curl exercises.md similarity index 100% rename from published/20190827 curl exercises.md rename to published/201912/20190827 curl exercises.md diff --git a/published/20190927 5 tips for GNU Debugger.md b/published/201912/20190927 5 tips for GNU Debugger.md similarity index 100% rename from published/20190927 5 tips for GNU Debugger.md rename to published/201912/20190927 5 tips for GNU Debugger.md diff --git a/published/20191004 What-s in an open source name.md b/published/201912/20191004 What-s in an open source name.md similarity index 100% rename from published/20191004 What-s in an open source name.md rename to published/201912/20191004 What-s in an open source name.md diff --git a/published/20191007 Using the Java Persistence API.md b/published/201912/20191007 Using the Java Persistence API.md similarity index 100% rename from published/20191007 Using the Java Persistence API.md rename to published/201912/20191007 Using the Java Persistence API.md diff --git a/published/20191017 How to type emoji on Linux.md b/published/201912/20191017 How to type emoji on Linux.md similarity index 100% rename from published/20191017 How to type emoji on Linux.md rename to published/201912/20191017 How to type emoji on Linux.md diff --git a/published/20191017 Using multitail on Linux.md b/published/201912/20191017 Using multitail on Linux.md similarity index 100% rename from published/20191017 Using multitail on Linux.md rename to published/201912/20191017 Using multitail on Linux.md diff --git a/published/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/published/201912/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md similarity index 100% rename from published/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md rename to published/201912/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md diff --git a/published/20191022 How to program with Bash- Logical operators and shell expansions.md b/published/201912/20191022 How to program with Bash- Logical operators and shell expansions.md similarity index 100% rename from published/20191022 How to program with Bash- Logical operators and shell expansions.md rename to published/201912/20191022 How to program with Bash- Logical operators and shell expansions.md diff --git a/published/20191023 How to program with Bash- Loops.md b/published/201912/20191023 How to program with Bash- Loops.md similarity index 100% rename from published/20191023 How to program with Bash- Loops.md rename to published/201912/20191023 How to program with Bash- Loops.md diff --git a/published/20191024 Get sorted with sort at the command line.md b/published/201912/20191024 Get sorted with sort at the command line.md similarity index 100% rename from published/20191024 Get sorted with sort at the command line.md rename to published/201912/20191024 Get sorted with sort at the command line.md diff --git a/published/20191028 6 signs you might be a Linux user.md b/published/201912/20191028 6 signs you might be a Linux user.md similarity index 100% rename from published/20191028 6 signs you might be a Linux user.md rename to published/201912/20191028 6 signs you might be a Linux user.md diff --git a/published/20191028 How to remove duplicate lines from files with awk.md b/published/201912/20191028 How to remove duplicate lines from files with awk.md similarity index 100% rename from published/20191028 How to remove duplicate lines from files with awk.md rename to published/201912/20191028 How to remove duplicate lines from files with awk.md diff --git a/published/20191101 Awk one-liners and scripts to help you sort text files.md b/published/201912/20191101 Awk one-liners and scripts to help you sort text files.md similarity index 100% rename from published/20191101 Awk one-liners and scripts to help you sort text files.md rename to published/201912/20191101 Awk one-liners and scripts to help you sort text files.md diff --git a/published/20191113 Edit images on Fedora easily with GIMP.md b/published/201912/20191113 Edit images on Fedora easily with GIMP.md similarity index 100% rename from published/20191113 Edit images on Fedora easily with GIMP.md rename to published/201912/20191113 Edit images on Fedora easily with GIMP.md diff --git a/published/20191114 Debugging Software Deployments with strace.md b/published/201912/20191114 Debugging Software Deployments with strace.md similarity index 100% rename from published/20191114 Debugging Software Deployments with strace.md rename to published/201912/20191114 Debugging Software Deployments with strace.md diff --git a/published/20191115 How to port an awk script to Python.md b/published/201912/20191115 How to port an awk script to Python.md similarity index 100% rename from published/20191115 How to port an awk script to Python.md rename to published/201912/20191115 How to port an awk script to Python.md diff --git a/published/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md b/published/201912/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md similarity index 100% rename from published/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md rename to published/201912/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md diff --git a/published/20191118 How internet security works- TLS, SSL, and CA.md b/published/201912/20191118 How internet security works- TLS, SSL, and CA.md similarity index 100% rename from published/20191118 How internet security works- TLS, SSL, and CA.md rename to published/201912/20191118 How internet security works- TLS, SSL, and CA.md diff --git a/published/20191119 Top 10 Vim plugins for programming in multiple languages.md b/published/201912/20191119 Top 10 Vim plugins for programming in multiple languages.md similarity index 100% rename from published/20191119 Top 10 Vim plugins for programming in multiple languages.md rename to published/201912/20191119 Top 10 Vim plugins for programming in multiple languages.md diff --git a/published/20191120 Switching from Python 2 to Python 3- What you need to know.md b/published/201912/20191120 Switching from Python 2 to Python 3- What you need to know.md similarity index 100% rename from published/20191120 Switching from Python 2 to Python 3- What you need to know.md rename to published/201912/20191120 Switching from Python 2 to Python 3- What you need to know.md diff --git a/published/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md b/published/201912/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md similarity index 100% rename from published/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md rename to published/201912/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md diff --git a/published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/published/201912/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md similarity index 100% rename from published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md rename to published/201912/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md diff --git a/published/20191125 How to use loops in awk.md b/published/201912/20191125 How to use loops in awk.md similarity index 100% rename from published/20191125 How to use loops in awk.md rename to published/201912/20191125 How to use loops in awk.md diff --git a/published/20191125 The many faces of awk.md b/published/201912/20191125 The many faces of awk.md similarity index 100% rename from published/20191125 The many faces of awk.md rename to published/201912/20191125 The many faces of awk.md diff --git a/published/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/published/201912/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md similarity index 100% rename from published/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md rename to published/201912/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md diff --git a/published/20191127 Create virtual machines with Cockpit in Fedora.md b/published/201912/20191127 Create virtual machines with Cockpit in Fedora.md similarity index 100% rename from published/20191127 Create virtual machines with Cockpit in Fedora.md rename to published/201912/20191127 Create virtual machines with Cockpit in Fedora.md diff --git a/published/20191127 How to write a Python web API with Flask.md b/published/201912/20191127 How to write a Python web API with Flask.md similarity index 100% rename from published/20191127 How to write a Python web API with Flask.md rename to published/201912/20191127 How to write a Python web API with Flask.md diff --git a/published/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/published/201912/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md similarity index 100% rename from published/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md rename to published/201912/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md diff --git a/published/20191129 A quick introduction to Toolbox on Fedora.md b/published/201912/20191129 A quick introduction to Toolbox on Fedora.md similarity index 100% rename from published/20191129 A quick introduction to Toolbox on Fedora.md rename to published/201912/20191129 A quick introduction to Toolbox on Fedora.md diff --git a/published/20191202 Use the Window Maker desktop on Linux.md b/published/201912/20191202 Use the Window Maker desktop on Linux.md similarity index 100% rename from published/20191202 Use the Window Maker desktop on Linux.md rename to published/201912/20191202 Use the Window Maker desktop on Linux.md diff --git a/published/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md b/published/201912/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md similarity index 100% rename from published/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md rename to published/201912/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md diff --git a/published/20191203 Using Ansible to organize your SSH keys in AWS.md b/published/201912/20191203 Using Ansible to organize your SSH keys in AWS.md similarity index 100% rename from published/20191203 Using Ansible to organize your SSH keys in AWS.md rename to published/201912/20191203 Using Ansible to organize your SSH keys in AWS.md diff --git a/published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/published/201912/20191203 Why use the Pantheon desktop for Linux Elementary OS.md similarity index 100% rename from published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md rename to published/201912/20191203 Why use the Pantheon desktop for Linux Elementary OS.md diff --git a/published/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md b/published/201912/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md similarity index 100% rename from published/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md rename to published/201912/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md diff --git a/published/20191204 Fedora Desktops - Memory Footprints.md b/published/201912/20191204 Fedora Desktops - Memory Footprints.md similarity index 100% rename from published/20191204 Fedora Desktops - Memory Footprints.md rename to published/201912/20191204 Fedora Desktops - Memory Footprints.md diff --git a/published/20191204 Java vs. Python- Which should you choose.md b/published/201912/20191204 Java vs. Python- Which should you choose.md similarity index 100% rename from published/20191204 Java vs. Python- Which should you choose.md rename to published/201912/20191204 Java vs. Python- Which should you choose.md diff --git a/published/20191206 5 cool terminal pagers in Fedora.md b/published/201912/20191206 5 cool terminal pagers in Fedora.md similarity index 100% rename from published/20191206 5 cool terminal pagers in Fedora.md rename to published/201912/20191206 5 cool terminal pagers in Fedora.md diff --git a/published/20191206 6 Ways to Send Email from the Linux Command Line.md b/published/201912/20191206 6 Ways to Send Email from the Linux Command Line.md similarity index 100% rename from published/20191206 6 Ways to Send Email from the Linux Command Line.md rename to published/201912/20191206 6 Ways to Send Email from the Linux Command Line.md diff --git a/published/20191206 Pekwm- A lightweight Linux desktop.md b/published/201912/20191206 Pekwm- A lightweight Linux desktop.md similarity index 100% rename from published/20191206 Pekwm- A lightweight Linux desktop.md rename to published/201912/20191206 Pekwm- A lightweight Linux desktop.md diff --git a/published/20191207 Getting started with the GNOME Linux desktop.md b/published/201912/20191207 Getting started with the GNOME Linux desktop.md similarity index 100% rename from published/20191207 Getting started with the GNOME Linux desktop.md rename to published/201912/20191207 Getting started with the GNOME Linux desktop.md diff --git a/published/20191209 Counting down the days using bash.md b/published/201912/20191209 Counting down the days using bash.md similarity index 100% rename from published/20191209 Counting down the days using bash.md rename to published/201912/20191209 Counting down the days using bash.md diff --git a/published/20191210 3 easy steps to update your apps to Python 3.md b/published/201912/20191210 3 easy steps to update your apps to Python 3.md similarity index 100% rename from published/20191210 3 easy steps to update your apps to Python 3.md rename to published/201912/20191210 3 easy steps to update your apps to Python 3.md diff --git a/published/20191210 Breaking Linux files into pieces with the split command.md b/published/201912/20191210 Breaking Linux files into pieces with the split command.md similarity index 100% rename from published/20191210 Breaking Linux files into pieces with the split command.md rename to published/201912/20191210 Breaking Linux files into pieces with the split command.md diff --git a/published/20191210 Customize your Linux desktop with FVWM.md b/published/201912/20191210 Customize your Linux desktop with FVWM.md similarity index 100% rename from published/20191210 Customize your Linux desktop with FVWM.md rename to published/201912/20191210 Customize your Linux desktop with FVWM.md diff --git a/published/20191211 Annotate screenshots on Linux with Ksnip.md b/published/201912/20191211 Annotate screenshots on Linux with Ksnip.md similarity index 100% rename from published/20191211 Annotate screenshots on Linux with Ksnip.md rename to published/201912/20191211 Annotate screenshots on Linux with Ksnip.md diff --git a/published/20191211 How to Find High CPU Consumption Processes in Linux.md b/published/201912/20191211 How to Find High CPU Consumption Processes in Linux.md similarity index 100% rename from published/20191211 How to Find High CPU Consumption Processes in Linux.md rename to published/201912/20191211 How to Find High CPU Consumption Processes in Linux.md diff --git a/published/20191212 How to configure Openbox for your Linux desktop.md b/published/201912/20191212 How to configure Openbox for your Linux desktop.md similarity index 100% rename from published/20191212 How to configure Openbox for your Linux desktop.md rename to published/201912/20191212 How to configure Openbox for your Linux desktop.md diff --git a/published/20191213 What GNOME 2 fans love about the Mate Linux desktop.md b/published/201912/20191213 What GNOME 2 fans love about the Mate Linux desktop.md similarity index 100% rename from published/20191213 What GNOME 2 fans love about the Mate Linux desktop.md rename to published/201912/20191213 What GNOME 2 fans love about the Mate Linux desktop.md diff --git a/published/20191214 Get started with Lumina for your Linux desktop.md b/published/201912/20191214 Get started with Lumina for your Linux desktop.md similarity index 100% rename from published/20191214 Get started with Lumina for your Linux desktop.md rename to published/201912/20191214 Get started with Lumina for your Linux desktop.md diff --git a/published/20191217 5 interview questions every Kubernetes job candidate should know.md b/published/201912/20191217 5 interview questions every Kubernetes job candidate should know.md similarity index 100% rename from published/20191217 5 interview questions every Kubernetes job candidate should know.md rename to published/201912/20191217 5 interview questions every Kubernetes job candidate should know.md diff --git a/published/20191217 Build a retro Apple desktop with the Linux MLVWM.md b/published/201912/20191217 Build a retro Apple desktop with the Linux MLVWM.md similarity index 100% rename from published/20191217 Build a retro Apple desktop with the Linux MLVWM.md rename to published/201912/20191217 Build a retro Apple desktop with the Linux MLVWM.md diff --git a/published/20191218 How tracking pixels work.md b/published/201912/20191218 How tracking pixels work.md similarity index 100% rename from published/20191218 How tracking pixels work.md rename to published/201912/20191218 How tracking pixels work.md diff --git a/published/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md b/published/201912/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md similarity index 100% rename from published/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md rename to published/201912/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md diff --git a/published/20191221 Customize your Linux desktop with KDE Plasma.md b/published/201912/20191221 Customize your Linux desktop with KDE Plasma.md similarity index 100% rename from published/20191221 Customize your Linux desktop with KDE Plasma.md rename to published/201912/20191221 Customize your Linux desktop with KDE Plasma.md diff --git a/published/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md b/published/201912/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md similarity index 100% rename from published/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md rename to published/201912/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md diff --git a/published/20191222 Why your Python code needs to be beautiful and explicit.md b/published/201912/20191222 Why your Python code needs to be beautiful and explicit.md similarity index 100% rename from published/20191222 Why your Python code needs to be beautiful and explicit.md rename to published/201912/20191222 Why your Python code needs to be beautiful and explicit.md diff --git a/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/published/201912/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md similarity index 100% rename from published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md rename to published/201912/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md diff --git a/published/20191224 Unix is turning 50. What does that mean.md b/published/201912/20191224 Unix is turning 50. What does that mean.md similarity index 100% rename from published/20191224 Unix is turning 50. What does that mean.md rename to published/201912/20191224 Unix is turning 50. What does that mean.md From dcb5b04648c41f26caf577f53b03a12e5e8d512b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 22:04:33 +0800 Subject: [PATCH 0028/3057] PRF @geekpi --- ...e the Herbstluftwm Linux window manager.md | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md index cba33f5166..91bb816e93 100644 --- a/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md +++ b/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md @@ -1,22 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11734-1.html) [#]: subject: (Why Vim fans love the Herbstluftwm Linux window manager) [#]: via: (https://opensource.com/article/19/12/herbstluftwm-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) 为什么 Vim 爱好者喜欢 Herbstluftwm Linux 窗口管理器 ====== -本文是 24 天 Linux 桌面特别系列的一部分。如果你是Vim爱好者,请试试 Herbstluftwm,这是一个受到 ”Vim 方式“启发的基于平铺的 Linux 窗口管理器。 -![OpenStack source code \(Python\) in VIM][1] -每个人都喜欢 Vim(除了 Dvorak 和 Emacs 用户)。Vim 非常流行,以至于有整个 Web 浏览器都使用 Vim 键绑定来浏览网页,非常流行的 [Zsh][2] 终端仿真器中的 Vim 模式,甚至是文本编辑器。 还有一个名为 [herbstluftwm][3] 的窗口管理器,它部分模仿了 “Vim 方式”。Herbstluftwm 取消了窗口,在程序载入和使用时使用平铺或者象限代替。 你可以使用键盘(**Alt+h**、**Alt+j**、**Alt+k** 和 **Alt+l**)从一个平铺块移动到另一个平铺块。 +> 本文是 24 天 Linux 桌面特别系列的一部分。如果你是 Vim 爱好者,请试试 Herbstluftwm,这是一个受到 “Vim 方式”启发的平铺式 Linux 窗口管理器。 -![Herbstluftwm][4] +![](https://img.linux.net.cn/data/attachment/album/201912/31/215943pisvzwkm8mvsefhm.jpg) -从发行版软件仓库安装 Herbstluftwm。安装后,请退出当前桌面会话,以便可以登录到新会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,具体取决于你的设置)将继续登录到以前的桌面,因此在登录之前必须覆盖它。 +每个人都喜欢 Vim(除了 Dvorak 和 Emacs 用户)。Vim 非常流行,它不仅仅是个编辑器,还有整个都使用 Vim 键绑定来浏览网页的 Web 浏览器,在非常流行的 [Zsh][2] 终端仿真器中也有 Vim 模式。此外,还有一个名为 [herbstluftwm][3] 的窗口管理器,它部分模仿了 “Vim 方式”。Herbstluftwm 取消了窗口,而是在程序载入和使用时使用平铺的贴片或者象限代替。你可以使用键盘(`Alt+h`、`Alt+j`、`Alt+k` 和 `Alt+l`)从一个平铺贴片移动到另一个平铺贴片。 + +可以从发行版软件仓库安装 Herbstluftwm。安装后,请退出当前桌面会话,以便可以登录到新会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,具体取决于你的设置)将继续登录到以前的桌面,因此在登录之前必须覆盖它。 在 GDM 中: @@ -28,59 +28,56 @@ ### Herbstluftwm 桌面之旅 -第一次登录 Herbstluftwm 时,你只会看到绿屏,边缘有深绿色边框。你所看到的是初始平铺,其中没有加载任何应用程序。要启动默认应用,请按 **Alt+回车**。 - -文档中强调使用 **$HOME/.config/herbstluftwm/autostart** 作为登录时启动应用的配置文件。对于不必在每次登录时启动的应用,可以使用 xterm 作为启动守护进程。与往常一样,在命令将 shell 的控制权返回给你后加一个 **amp;** 符号。例如,要启动 Emacs: +第一次登录 Herbstluftwm 时,你只会看到一个绿屏,边缘有深绿色边框。你所看到的是初始的平铺贴片,其中没有加载任何应用程序。要启动默认应用,请按 `Alt+Enter`。 +![][4] +文档中强调使用 `$HOME/.config/herbstluftwm/autostart` 作为登录时启动重要应用的配置文件。对于不必在每次登录时启动的应用,可以使用 xterm 作为启动守护进程。与往常一样,在命令后加一个 `&` 符号会将 shell 的控制权返回给你。例如,要启动 Emacs: ``` -`% emacs &` +% emacs & ``` -这将在新平铺中启动 Emacs 窗口,然后返回命令行。 +这将在新的平铺贴片中启动 Emacs 窗口,然后返回命令行。 ![Emacs running in Herbstluftwm][7] -#### 切换平铺 +#### 切换平铺贴片 -要从一个平铺块移动到另一个平铺块,请使用经典的 **h**、**j**、**k** 或 **l** 与 **Alt** 的 Vim 导航组合键。例如,要从终端切换到其下方平铺中的应用(即屏幕底部),请按 **Alt+j**。要返回,请按 **Alt+k**。左移和右移分别为 **Alt+h** 和 **Alt+l**。 +要从一个平铺贴片移动到另一个平铺贴片,请使用经典的 `h`、`j`、`k` 或 `l` 与 `Alt` 的 Vim 导航组合键。例如,要从终端切换到其下方的平铺贴片中的应用(即屏幕底部),请按 `Alt+j`。要返回,请按 `Alt+k`。左移和右移分别为 `Alt+h` 和 `Alt+l`。 #### 分割屏幕 -你可以使用 **Alt+o** 垂直分割屏幕,使用 **Alt+u** 水平分割屏幕。 +你可以使用 `Alt+o` 垂直分割屏幕,使用 `Alt+u` 水平分割屏幕。 -要删除空白平铺块,请移动到该平铺块,然后按 **Alt+r**。 +要删除空白平铺贴片,请移动到该平铺贴片,然后按 `Alt+r`。 ### 配置 herbstluftwm -除了 **Alt** 键绑定外,你还可通过 **herbstclient** 命令与 Herbstluftwm 进行通信。此命令可以在 shell 中交互,或者你可在配置文件中保留你的首选项。 +除了 `Alt` 键绑定外,你还可通过 `herbstclient` 命令与 Herbstluftwm 进行通信。此命令可以在 shell 中交互,或者你可在配置文件中保留你的首选项。 你可以查看 Herbstluftwm 中的所有可用属性: - ``` -`$ herbstclient attr` +$ herbstclient attr ``` -Herbstluftwm 的默认行为在默认配置文件中定义,你可以将其复制到家目录并进行修改。启动后,Herbstluftwm 执行配置文件中包含的命令。例如,你觉得使用以 **Alt** 为中心的键绑定很笨拙(它传统上是应用内保留快捷键),那你可以在配置文件中更改触发 Herbstluftwm 操作的键: - +Herbstluftwm 的默认行为定义在其默认配置文件中,你可以将其复制到你的家目录并进行修改。启动后,Herbstluftwm 执行配置文件中包含的命令。例如,你觉得使用以 `Alt` 为中心的键绑定很笨拙(它传统上是应用内保留快捷键),那你可以在配置文件中更改触发 Herbstluftwm 操作的键: ``` % mkdir ~/.config/herbstluftwm -% cp /usr/xdg/herbstluftwm/autostart \ -~/.config/herbstluftwm +% cp /usr/xdg/herbstluftwm/autostart ~/.config/herbstluftwm % sed -i 's/Mod=Mod1/Mod=Mod4/' ~/.config/herbstluftwm % herbstclient reload ``` -这将使 Herbstluftwm 的修饰键更改为 Super 键(”Windows“或 ”Tux“ 键,具体取决于你的键盘)。 +这将使 Herbstluftwm 的修饰键更改为 `Super` 键(“Windows” 或 “Tux” 键,具体取决于你的键盘)。 -使用自动启动文件,你可以设置自定义键绑定,为特定类型的应用创建标签,以便以一致的方式平铺应用,并执行更多操作。 +使用 `autostart` 文件,你可以设置自定义键绑定,为特定类型的应用创建标签,以便以一致的方式平铺应用,并执行更多操作。 ### 为何你要尝试 herbstluftwm -Herbstluftwm 是一个平铺窗口管理器的很好例子。它默认平铺窗口,并允许用户定义全局规则例外。它使用类似 Vim 的导航,但可以快速简单地覆盖它。你可能是你一直在寻找的平铺管理器,所以请尽快尝试一下。 +Herbstluftwm 是一个平铺窗口管理器的很好例子。它默认平铺窗口,并允许用户定义全局规则的例外。它使用类似 Vim 的导航方式,但可以快速简单地覆盖它。它可能是你一直在寻找的平铺管理器,所以请马上尝试一下。 -------------------------------------------------------------------------------- @@ -89,7 +86,7 @@ via: https://opensource.com/article/19/12/herbstluftwm-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 00fd6dc8c46dd4496de0263851c4b12ca97b087c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 22:04:43 +0800 Subject: [PATCH 0029/3057] PUB @geekpi https://linux.cn/article-11734-1.html --- ...220 Why Vim fans love the Herbstluftwm Linux window manager.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md (100%) diff --git a/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/published/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md similarity index 100% rename from translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md rename to published/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md From 67ecaf1a65908b22b9697e50ab0afd9c59d01259 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 31 Dec 2019 23:05:33 +0800 Subject: [PATCH 0030/3057] translating by lxbwolf --- sources/tech/20191017 Intro to the Linux useradd command.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191017 Intro to the Linux useradd command.md b/sources/tech/20191017 Intro to the Linux useradd command.md index b2befd4650..ab23c72db5 100644 --- a/sources/tech/20191017 Intro to the Linux useradd command.md +++ b/sources/tech/20191017 Intro to the Linux useradd command.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2e5996fdc49832db9741b05177624359300e57b3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:06:36 +0800 Subject: [PATCH 0031/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200101=20Sign?= =?UTF-8?q?al:=20A=20Secure,=20Open=20Source=20Messaging=20App?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md --- ...al- A Secure, Open Source Messaging App.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md diff --git a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md new file mode 100644 index 0000000000..4dd4037627 --- /dev/null +++ b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Signal: A Secure, Open Source Messaging App) +[#]: via: (https://itsfoss.com/signal-messaging-app/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Signal: A Secure, Open Source Messaging App +====== + +**_Brief: Signal is a secure open-source messaging app for smartphones. It also offers a standalone desktop app for Linux, Windows, and macOS_. _Here, we take a look at its features and usability._** + +### Signal is an Excellent Alternative to WhatsApp (and Telegram) for Privacy Concerned People + +![Signal App On Linux][1] + +Signal is an open source application with a keen focus on privacy. It is recommended by privacy advocates like [Edward Snowden][2]. + +It may not have as many features as Telegram or WhatsApp – but if you want to enhance your privacy while having a conversation, this is a solid open-source solution. + +You can install it on your smartphone ([iOS][3]/[Android][4]) and it is also available for Linux, Windows, and macOS. + +### Features of Signal Messenger + +**Note:** _Some of the features are specific/exclusive to smartphones. You may not observe all the features mentioned in the desktop app._ + +As I already mentioned, this is tailored to enhance your privacy. So, the user experience may not be the “best” you’ve ever seen. But, privacy/security-wise, I think it is a good option to have. + +![Signal Features][5] + +#### Disappearing Messages + +You can set a timer for messages in a conversation – so that it will be automatically deleted as per the timer. + +Essentially, anyone in the conversation can activate this feature. So, you control if the messages should stay in a conversation or disappear. + +#### Use it As Default SMS App + +If you want to utilize an open-source app for all your SMSs, you can simply go to Signal’s app settings and set it as the default for SMS and MMS. + +#### Screen Security + +There’s a neat feature to block screenshots in-app, “Screen Security”. + +If you enable it, you won’t be able to take a screenshot of any conversation in the app. You can find the option to enable or disable it from the app settings. + +It may not be useful to everyone – but you can try it out. + +#### Safety Number + +If you want to verify the security of your encryption with a friend, you can simply tap on the profile and scroll down to find “View Safety Number”. + +You can either scan it to verify or simply take a look at it to mark it verified. + +#### Locked Messages + +If you protect the app with a lock (pin/fingerprint), even if your device has been unlocked, you won’t be able to see the messages on your notifications. + +So, when you get a notification while Signal is locked, you will notice the content of the notification as “**Locked Message**” – which is a plus for privacy-oriented users. + +#### Other Features + +![][6] + +As you would expect in a messaging app – you get a couple of stickers to utilize and you can also create a group if you want. + +However, you won’t have the ability to moderate your group – you can just add members and change the profile picture. + +In addition to this, Signal also supports biometric security for its app. + +### Installing Signal on Ubuntu/Linux + +Unfortunately, you don’t get a .**deb** or .**AppImage** to install it on your Linux distro. So, you will need to utilize the terminal as per the [official installation instructions][7]. + +Here’s what you have to type in the terminal: + +``` +curl -s https://updates.signal.org/desktop/apt/keys.asc | sudo apt-key add - +echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/signal-xenial.list +sudo apt update && sudo apt install signal-desktop +``` + +Simply copy-paste the commands one by one in the terminal and you should be good to go. + +[Download Signal for Other Devices][7] + +### My Thoughts On Signal + +I’ve been using Signal for a few years now and it has improved with what it offers. However, I still feel that the user experience can be improved. + +Privacy-wise, it is definitely a good alternative to what we already have (in my opinion). You can give it a try and see how well it works for your usage. + +You can also take a look at their [GitHub page][8] for the latest developments and beta releases if you want to try them out. + +Signal app may not be a popular messaging app when compared to WhatsApp or even [Telegram on Linux][9]. But, you can try it for yourself and encourage your friends to use an open-source messaging app. + +Have you tried it yet? Let me know what you think about the ‘Signal’ app in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/signal-messaging-app/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot.jpg?ssl=1 +[2]: https://en.wikipedia.org/wiki/Edward_Snowden +[3]: https://apps.apple.com/us/app/signal-private-messenger/id874139669 +[4]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&hl=en_IN +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-phone.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot-1.jpg?ssl=1 +[7]: https://signal.org/download/ +[8]: https://github.com/signalapp +[9]: https://itsfoss.com/install-telegram-desktop-linux/ From bef234c00747c8c4eb7baecaa210db4c15f8bee5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:07:31 +0800 Subject: [PATCH 0032/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191231=2012?= =?UTF-8?q?=20programming=20resources=20for=20coders=20of=20all=20levels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191231 12 programming resources for coders of all levels.md --- ...ming resources for coders of all levels.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20191231 12 programming resources for coders of all levels.md diff --git a/sources/tech/20191231 12 programming resources for coders of all levels.md b/sources/tech/20191231 12 programming resources for coders of all levels.md new file mode 100644 index 0000000000..5da5148542 --- /dev/null +++ b/sources/tech/20191231 12 programming resources for coders of all levels.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (12 programming resources for coders of all levels) +[#]: via: (https://opensource.com/article/19/12/programming-resources) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +12 programming resources for coders of all levels +====== +No matter where you are in your programming journey, there are things +for you to learn in Opensource.com's top 12 programming articles from +2019. +![Woman sitting in front of her computer][1] + +> "The best time to learn computer programming was 20 years ago. The second best time is now." +> — A computer science proverb, maybe. + +Are you a new programmer, an experienced web dev, a backend wizard, a grizzled system programmer, or some other yet-to-be-discovered species of computer geek? Wherever you land in the vast ecosystem of software developers, the only constant in our field is the need to learn about new technologies and how to apply them. Here is an ensemble of the most-read Opensource.com articles from the past year that inform and entertain, and I'm excited to share them with you here. + +### For the noble newbie + +Whatever your skillset or interests, learning how to write computer programs turns that domain-specific knowledge into a superpower. Unfortunately, it isn't possible to learn how to program from the bite of a radioactive computer, at least not yet. Until that's a thing, I recommend these excellent articles to help bootstrap your programming skills. They address important questions like which languages to consider learning and different ways to get started. + + * [Which programming languages should you learn?][2] + * [A dozen ways to learn Python][3] + * [Three popular programming languages you can learn with Raspberry Pi][4] + * [Introducing kids to computational thinking with Python][5] + + + +### Keeping up with emerging technologies + +Experienced programmers know that the only thing harder than learning to program is keeping your skills and knowledge up to date. But we are an [autodidactic][6] breed, always looking to level up our expertise and understanding. Even if we don't anticipate using a new technology, we know that eventually, someone will ask about it. These articles on Rust, WebAssembly, and Podman are great places to start learning about just a few of the upcoming trends in software technology. + + * [Why should you use Rust in WebAssembly?][7] + * [Level up command-line playgrounds with WebAssembly][8] + * [How does rootless Podman work?][9] + * [Why to choose Rust as your next programming language][10] + + + +### Old programs never die + +Despite the never-ending cascade of new technologies, it never hurts to look back to help you look forward. Today's amazing technologies are built on top of yesterday's tools, and it will serve us well to understand the abilities and limitations of those tools, even if we never write a line of code in these languages of legend. This collection of articles focuses on the C language, a practical application written in AWK, and an interesting discussion of computer languages that are declining in popularity, but perhaps not dead yet. + + * [The monumental impact of C][11] + * [How to write a good C main function][12] + * [Drinking coffee with AWK][13] + * [What's your favorite "dead" language?][14] + + + +### Keep on learning + +No matter where you are in your programming journey, there will always be more to learn. I hope these top resources from 2019 will get you ready for 2020. Thanks to the authors and you, the reader. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/programming-resources + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_3.png?itok=qw2A18BM (Woman sitting in front of her computer) +[2]: https://opensource.com/article/19/2/which-programming-languages-should-you-learn +[3]: https://opensource.com/article/19/8/dozen-ways-learn-python +[4]: https://opensource.com/article/19/3/programming-languages-raspberry-pi +[5]: https://opensource.com/article/19/2/break-down-stereotypes-python +[6]: https://en.wikipedia.org/wiki/Autodidacticism +[7]: https://opensource.com/article/19/2/why-use-rust-webassembly +[8]: https://opensource.com/article/19/4/command-line-playgrounds-webassembly +[9]: https://opensource.com/article/19/2/how-does-rootless-podman-work +[10]: https://opensource.com/article/19/10/choose-rust-programming-language +[11]: https://opensource.com/article/19/10/command-line-heroes-c +[12]: https://opensource.com/article/19/5/how-write-good-c-main-function +[13]: https://opensource.com/article/19/2/drinking-coffee-awk +[14]: https://opensource.com/article/19/6/favorite-dead-language From 45412c36e320ff7b81f913a3da4e4002a4c9eaa4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:08:01 +0800 Subject: [PATCH 0033/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191231=207=20?= =?UTF-8?q?resources=20to=20grow=20your=20Java=20skills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191231 7 resources to grow your Java skills.md --- ...31 7 resources to grow your Java skills.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20191231 7 resources to grow your Java skills.md diff --git a/sources/tech/20191231 7 resources to grow your Java skills.md b/sources/tech/20191231 7 resources to grow your Java skills.md new file mode 100644 index 0000000000..e3ce14f901 --- /dev/null +++ b/sources/tech/20191231 7 resources to grow your Java skills.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 resources to grow your Java skills) +[#]: via: (https://opensource.com/article/19/12/java-resources) +[#]: author: (Stephon Brown https://opensource.com/users/stephb) + +7 resources to grow your Java skills +====== +Java is still evolving and going strong decades after its launch. Catch +up with our hottest Java articles from 2019. +![Coffee beans and a cup of coffee][1] + +Java is still one of the most influential programming languages today. It only recently dropped from #2 to the third most used [programming language on GitHub][2]. You may say usage is not everything, but Java also remains popular. According to [Stack Overflow's Developer Survey Results for 2019][3], Java is the fifth most popular programming language. It was first released to the public in 1998, and it stays high on the usage and popularity scale after all this time. A big reason for that fact is that Java has grown and evolved significantly since its release. As a strongly-typed language, Java continues to push the envelope of the object-oriented programming (OOP) paradigm and is continually used to implement new concepts and technologies. + +Testifying to its ongoing popularity, Opensource.com publishes many excellent articles about the language. The following seven are Opensource.com's top read Java articles of 2019. + +### What is an object in Java? + +Chris Hermansen provides an in-depth look at the OOP paradigm and its importance to Java development in [_What is an object in Java?_][4] OOP is based on the idea that data and programs should all be viewed as "objects." Each object has properties and behaviors that describe how it is used in a program. + +There are a number of principals that define OOP and its use of objects for all aspects of programming. These include: + + * **Inheritance:** This is the hierarchical use of objects for mutating and reusing object properties and behaviors from parent objects to child objects. + * **Typing:** Static and strong typing express the idea that, at compile time, the type should be defined and constant unless explicitly converted or changed, which helps with both debugging and consistent functionality. + * **Classes and primitives:** Objects natively implemented into OOP languages are called "primitives," including int, long, etc.; however, objects designed and implemented using class declarations and by assigning properties and behaviors to primitives are called classes. + * **Object class:** In Java, the Object class is the parent class that all classes inherit from. It allows the use of basic functions and properties, including comparison and **hashCode** functionality. + + + +Overall, objects are the basis of Java development, and Chris expounds upon them in his in-depth article. + +### What is a Java constructor? + +As a great follow-up to Chris Hermansen's overview of the Java object, I recommend reading [_What is a Java constructor?_][5] The constructor is an important concept to understand when working within the realms of OOP and Java, and Seth Kenlon introduces it in this easy-to-understand guide. The constructor in Java (and most OOP languages) is where you instantiate or create an instance of an object you have defined. In many languages, an instance is created with the **new** keyword and the object you want to create. For example, **Dog fluffy = new Dog();** will create a new instance of **Dog**. Constructors can also set properties within the object you are instantiating; therefore, if you have an implementation for a constructor to set your object's size, height, and type, you can set those all from the constructor. By default, Java allows objects to be instantiated with the **new** keyword without having an explicit constructor defined and creates them at compilation time. + +### Initializing arrays in Java + +An array is a longstanding data structure that originates in early math concepts. In computer science, as Chris Hermansen says in [_Initializing arrays in Java_][6], it represents "…a contiguous block of memory where each location is a certain type," which can be any type—from primitives (int, long, etc.) to custom objects (Dog, Cat, Car). An array is initialized with a specific type of constructor that reserves the fixed length of the array; in other words, it is a defined amount of memory that the array is reserving. It looks like this: **int[] a = new int[15]**. Much like instantiating a new object, arrays are similar in form and functions. In addition, because arrays inherit from the Object class, they can utilize methods and properties associated with the Object class, including **GetClass()**. + +In addition to simple arrays, Java implements **ArrayLists** and **Map** objects by default. Both of these collection types allow elements to be added or removed dynamically; there is no need to set the size of each manually. The ArrayList allows the addition, retrieval, and removal of elements dynamically as your code runs. These lists must be of one type, which is defined when it is instantiated. The Map allows a dictionary object to be created, which means each index, or "key," is connected to another object. For example, **Map<string, Integer> scores = new Map<String, Integer>()** would allow you to insert a student's score, with the key being their name, with **scores.put("Stephon", 50)**. Arrays, ArrayLists, and Maps are excellent ways to store, retrieve, and manipulate data within your Java application. + +### Getting started with blockchain for Java developers + +Blockchain is an amalgamation of cryptography, computer science, cryptocurrency, and many other fields. It is the technology at the heart of Bitcoin and other cryptocurrencies, but it can stand alone and is powerful when implemented with other concepts. As Bilgin Ibrayam writes in [_Getting started with blockchain for Java developers_][7], "the technologies most people know, such as Java, .NET, and relational databases, are not common in the blockchain space; instead, blockchain is primarily dominated by C, Go, and Rust on the server side, and JavaScript on the client side." However, this should not deter you from using Java for developing blockchain projects, and Ibrayam provides seven Java-based open source technologies that leverage the Java language and the Java Virtual Machine (JVM) for blockchain development. + +The seven technologies he presents are: Corda, a business-focused, blockchain technology that focuses on building smart contracts to process and streamline business transactions on the chain; Hyperledger's Pantheon (or Besu), an Ethereum client that enables use of private and public networks and was created to introduce Java developers to blockchain development; Bitcoinj, a Java implementation of the Bitcoin protocol that allows the use of a wallet and transactions without Bitcoin Core; Web3j, a lightweight Ethereum client that has implementations for both Android and Java for smart contract development; Hyperledger Fabric SDK, a complete solution for building and providing security for a localized or distributed blockchain; FundRequest, a decentralized platform/marketplace that enables requesting open source work and is completely implemented in Java on top of the Ethereum network; and Eventeum, which allows monitoring of the Ethereum network and storage of events and their details on a messaging server like Kafka or RabbitMQ. + +### 7 Java tips for new developers + +When learning a new language, there are always obstacles, whether they be syntactical differences or entire development paradigm shifts. Seth Kenlon provides [_7 Java tips for new developers_][8], focusing on what to look for when diving into Java programming. Installing Java and the Java Development Kit (JDK) are the first steps to developing in Java. Most computers may already have Java and JVM installed, but you will need JDK to begin programming. + +In brief, Seth's tips are: + + * Most other languages allow importing and exporting libraries or other code that you may require when developing a project. Java packages are external or internal libraries that need to be managed. The packages are separated and organized by namespaces, which are like buckets for organizing code. + * Packages are imported with the simple syntax of **import** with the library's namespace. + * Declaring a class allows you to create an object in your program. These classes can use different access modifiers; within the classes are properties and methods or functions that also can have access modifiers that define whether they can be used only inside of the class, outside of the class with inherited classes, or by any other class. + * The class modifier **Static** allows the use of properties or functions without having to instantiate or create an instance of an object. + * Code will eventually have bugs; it is inevitable. "Try and catch" flow control allows you to catch errors and exceptions and implement recovery and logging mechanisms. + * To run a Java application outside an integrated development environment (IDE), such as Netbeans or Eclipse, navigate to your Java project folders from the command line and type **java <filename.java>** or, if the application is already compiled into a .jar file, **java -jar <filename.jar>**. + + + +### Using the Java Persistence API + +[_Using the Java Persistence API_][9] (JPA) is my introduction to connecting Java to various data persistence solutions, whether they be relational, NoSQL, or basic file representations in a system. Java provides a broad interface that allows connection to generally any type of persistence solution. This tutorial walks through creating an application with common libraries, including Spring Boot, a module/template for quickly configuring applications in Java; Maven, a package manager for Java; Lombok, a library that simplifies defining object accessors/mutators; and Netbeans, a popular IDE for developing in Java. + +The tutorial uses these libraries to create models for a fictitious bike shop's database. The models' accessors/mutators are defined with Lombok and provide data annotations that are used when persisting to the chosen database. Then the database is set up and configured through the **application.properties** file, which the JPA reads to connect and persist data. The persisting and fetching implementation is done mostly with the Spring framework for Mongo; however, you can also override functions for more control of what should be fetched when finding, updating, or persisting objects. In a matter of minutes, you will be able to define objects and call basic functions on local databases without much boilerplate. + +### How to compare strings in Java + +Flexibility is often considered a gift, and while there are tradeoffs between statically typed and dynamically typed languages, one of Java's strengths is its ability to compare types and equality of types. In fact, Girish Managoli explains in [_How to compare strings in Java_][10], there six different ways to compare the immutable string type in Java. + +The double-equal operator (**==**) compares memory location rather than string content. When the compiler sees two strings that are equal, it will allocate the same memory for both. If a new string is instantiated, it will not share the same memory location or object reference. + +The **equals** method compares the case-sensitive content of the string, not the object information. For example, if you use **equals** to compare **Dog** and **Dog**, the result would be true, even if they are two different objects; however, **dog** and **Dog** would be false because the function is case-sensitive. The **equalsIgnoreCase** function is the same as **equals**, except that it removes case-sensitivity; therefore, comparing **dog** and **Dog** would be true. The **compareTo** and **compareToIgnoreCase** functions compare strings based on the Unicode value of each character in the string; they compare the total value to the other string and return the total lexical value difference between the two (with case-sensitivity and case-insensitivity, respectively). Last but not least, the **Objects equals** function allows the comparison of two string object references and of null values. + +### Java: Still growing and evolving + +Java is still going strong, evolving, and staying relevant after all this time, and there is continued optimism in its growth. Since its release, the Java platform has continued to change with the times, from OpenJDK to release schedule changes, and push the envelope of what you can accomplish with it. + +As you can see from the top Java articles on Opensource.com in 2019, it never hurts to know the language, because you never know where you can use it for your next project. These (and other) Opensource.com articles have been really helpful to me as a [new developer transitioning from higher education][11]. I look forward to reading and sharing more in 2020, and I hope you'll join me. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/java-resources + +作者:[Stephon Brown][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stephb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee) +[2]: https://octoverse.github.com/#top-languages +[3]: https://insights.stackoverflow.com/survey/2019 +[4]: https://opensource.com/article/19/8/what-object-java +[5]: https://opensource.com/article/19/6/what-java-constructor +[6]: https://opensource.com/article/19/10/initializing-arrays-java +[7]: https://opensource.com/article/19/4/blockchain-java-developers +[8]: https://opensource.com/article/19/10/java-basics +[9]: https://opensource.com/article/19/10/using-java-persistence-api +[10]: https://opensource.com/article/19/9/compare-strings-java +[11]: https://opensource.com/article/19/6/5-transferable-higher-education-skills From 6aa74361f167f7cda6eeba1cca25d953efda8ce8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:08:36 +0800 Subject: [PATCH 0034/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191231=20How?= =?UTF-8?q?=20to=20be=20a=20better=20organization:=20Top=2010=20reads=20fo?= =?UTF-8?q?r=20leaders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md --- ... organization- Top 10 reads for leaders.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md diff --git a/sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md b/sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md new file mode 100644 index 0000000000..762f6b6c08 --- /dev/null +++ b/sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to be a better organization: Top 10 reads for leaders) +[#]: via: (https://opensource.com/article/19/12/open-leadership) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +How to be a better organization: Top 10 reads for leaders +====== +Get tips and strategies to help you leverage open principles in your +organization. +![Shaking hands, networking][1] + +Modern organizations are adopting key elements from open source software. By leveraging the "open" in open source, leaders can help shape a more responsive and productive enterprise. Check out these top 10 articles from 2019 that can help you develop your own path in open leadership. + +### 19 resolutions of an open leader + +Open organizations succeed when leaders are open and transparent, demonstrating open skills, including transparency, inclusivity, adaptability, collaboration, and community. In [_19 resolutions of an open leader_][2], Angela Robertson shares her plan for continuing on the path of an open leader. + +### The psychology behind a blameless retrospective + +"One of the Agile Manifesto's principles suggests all teams regularly reflect on how to become more effective," writes Dominika Bula in [_The psychology behind a blameless retrospective_][3]. She says the main goals of a retrospective are to promote self-improvement, improve processes, and advance team members' skills. She also outlines the three foundational pillars that will "ensure your blameless retrospective truly is successful." + +### A guide to human communication for sysadmins + +The job of a systems administrator is no longer defined simply by running racks of servers and poking bits to optimize performance. In modern organizations, sysadmins can and should increase the value they deliver to the organization they work for. In [_A guide to human communication for sysadmins_][4], Maxim Burgerhout describes the best way to increase your value to an organization: getting to know the people around you. + +### The innovation delusion + +Red Hat CEO Jim Whitehurst observes that organizations (and especially leaders) like to think success is always planned—that they've become masters of chaos and can almost predict the future. But these assessments are often made with the benefit of hindsight. In [_The innovation delusion_][5], Jim advises that different kinds of challenges require different kinds of approaches, and we need to get better at building flexible organizations capable of responding to the unforeseen or unknowable. + +### The power of being vulnerable in the workplace + +In open organizations, high-performing teams must feel comfortable taking risks and appearing vulnerable in front of each other. These are necessary ingredients for creativity, curiosity, and diversity of ideas. In [_The power of being vulnerable in the workplace_][6], Kathleen Hayes explains psychological safety and explores some real-life examples where new mindsets and behaviors have helped teams thrive. + +### Let's be real: Diversity and inclusion is a business issue + +"If the problem is a struggle to innovate, then the solution is greater diversity and inclusion," DeLisa Alexander writes in [_Let's be real: Diversity and inclusion is a business issue_][7]. She says when diversity and inclusion are solutions to problems that affect us every day, we all do better work and generate value for customers. + +### How to plan your next IT career move + +Like many people in open source, being part of technology-oriented communities has been an essential part of Matthew Broberg's career development. In [_How to plan your next IT career move_][8], Matthew challenges us to ask essential career questions about the cloud, DevOps, coding, and where you're going next in IT. + +**[Read next: [The new rules of CIO leadership][9]]** + +### How to advance your career by contributing to open source projects + +After working as a recruiter for 10 years at Red Hat, Josh Wulf decided it was time for a change. He quit his job as a recruiter, contributed to open source software, and landed a job as a software engineer. Josh explains in [_How to advance your career by contributing to open source projects_][10] how he did it and how you can, too. + +### 7 tips to ace your tech job interview + +In [_7 tips to ace your tech job interview_][11], Jessica Repka shares an insightful list of interviewing tips that should help you stand out in a good way. Based on her own job interviews and what she's seen in person while interviewing others, Jessica's tips can give you the edge you need to find your next job. + +### Why DevOps is the most important tech strategy today + +"Many people first learn about DevOps when they see one of its outcomes and ask how it happened. It's not necessary to understand why something is part of DevOps to implement it," Kelly Albrecht writes in [_Why DevOps is the most important tech strategy today_][12]. Albrecht clears up some of the confusion about DevOps and explains how a DevOps strategy can mean the difference between being a leader or a follower in an industry. + +### Open leadership in 2020 + +What do you want to know about open leadership in the coming year? Please share your ideas for article topics in the comments—or even share your own experiences with open leadership by [writing an article for Opensource.com][13]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/open-leadership + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/network_team_career_hand.png?itok=_ztl2lk_ (Shaking hands, networking) +[2]: https://opensource.com/open-organization/19/1/leadership-goals +[3]: https://opensource.com/article/19/4/psychology-behind-blameless-retrospective +[4]: https://opensource.com/article/19/9/communication-sysadmins +[5]: https://opensource.com/open-organization/19/6/innovation-delusion +[6]: https://opensource.com/open-organization/19/3/introduction-psychological-safety +[7]: https://opensource.com/open-organization/19/5/inclusivity-solution-innovation +[8]: https://opensource.com/article/19/8/plan-next-IT-career-move +[9]: https://enterprisersproject.com/cio-new-rules-report +[10]: https://opensource.com/article/19/5/how-get-job-doing-open-source +[11]: https://opensource.com/article/19/1/job-interviewing-tips +[12]: https://opensource.com/article/19/3/devops-most-important-tech-strategy +[13]: https://opensource.com/how-submit-article From 29442beb945e4a3b0820cbb5a558f16bec9ad0cf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:08:54 +0800 Subject: [PATCH 0035/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191231=2010?= =?UTF-8?q?=20Ansible=20resources=20to=20accelerate=20your=20automation=20?= =?UTF-8?q?skills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md --- ...es to accelerate your automation skills.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md diff --git a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md new file mode 100644 index 0000000000..a522f0c869 --- /dev/null +++ b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Ansible resources to accelerate your automation skills) +[#]: via: (https://opensource.com/article/19/12/ansible-resources) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +10 Ansible resources to accelerate your automation skills +====== +Gear up and get crackin' with awesome Ansible automation skills this +year. +![Gears above purple clouds][1] + +This year saw a wide range of really helpful Ansible articles. Whether you are just starting out with Ansible or a seasoned pro, there is something for everyone here to learn from. + +A good number of these articles are worthy of your bookmarking and perhaps a cron (or maybe a Tower/AWX job) reminder to reread them periodically. + +If you are new to Ansible, start with the following articles: + + * [_A quickstart guide to Ansible_][2] has some good starter information as well as deeper dives into more advanced topics + * [_10 Ansible modules you need to know_][3] and [_5 ops tasks to do with Ansible_][4] review some of the more fundamental functions that every Ansible admin should be familiar with + * [_How to use Ansible to document procedures_][5] also presents a survey of additional topics you might find it interesting to follow up on + + + +The remainder of these articles cover more advanced topics like Windows management, testing, hardware, cloud, and containers—and even a case study in managing the demands of tech-curious children. + +I hope you enjoyed this Ansible year as much as I did. Never stop learning! + + 1. _[How Ansible brought peace to my home][6]_ is a whimsical case study in applying Ansible skills to quickly provision new (or rather old) laptops for my children. + 2. _[Ansible for the Windows admin][7]_ by Taz Brown and Abner Malivert: Did you know Ansible can manage Windows nodes as well? This piece reviews basic Ansible server and Windows client setups with an example on how to deploy an IIS server. + 3. _[10 Ansible modules you need to know][3]_ by Shashank Hegde is a great place to start for some of the most common and basic Ansible modules all admins should know. Running commands, installing packages, and handling files are the basis for many useful automation plays. + 4. _[How to use Ansible to document procedures][5]_ by Marco Bravo: Ansible’s YAML files make for easy reading, so much so that they can be used to document the manual steps needed to accomplish a task. This makes your work easier to debug and extend later on. Also contained in this article are pointers on related topics like testing and analysis. + 5. _[Using Testinfra with Ansible to verify server state][8]_ by Clement Verna: Testing is an integral part of any CI/CD DevOps pipeline, so why not test Ansible’s results as well? This primer on Testinfra can be used to help check the configuration results you need. + 6. _[Hardware bootstrapping with Ansible][9]_ by Mark Phillips: Not all the world is containers and virtual machines. Many of us sysadmins still have significant hardware deployments to manage. With a little PXE dust and DHCP magic (among other tidbits), you can create a convenient framework using Ansible to get real hardware up and running easily. + 7. _[What you need to know about Ansible modules][10]_ by Jairo da Silva Junior: Modules bring real power to Ansible. Many modules are already available, but when there is none, you may need to roll your own. Read this article to look a bit deeper into how modules are made. + 8. _[5 ops tasks to do with Ansible][4]_ by Mark Phillips: This is another more basic review of Ansible use to manage common system operations tasks. The draw here is the list of examples given in Tower (or AWX) instead of the old familiar command line. + 9. _[A quickstart guide to Ansible][2]_ by Chris Short is a great PDF download that you should keep on hand and reread from time to time. It begins with a great primer to get started in Ansible. It also covers other areas of interest including Molecule testing, sysadmin tasks, and Kubernetes object management, to name a few. + 10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ by Mark Phillips: This is a monthly round-up article full of interesting links to follow. Topics span Ansible basics, managing Netapp E-Series storage, debugging, patching, and more. Videos are included here as well as some pointers to Ansible meetup groups. Check it out! + + + +Let us know if you had a favorite Ansible article this year and why in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ansible-resources + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) +[2]: https://opensource.com/article/19/2/quickstart-guide-ansible +[3]: https://opensource.com/article/19/9/must-know-ansible-modules +[4]: https://opensource.com/article/19/8/ops-tasks-ansible +[5]: https://opensource.com/article/19/4/ansible-procedures +[6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops +[7]: https://opensource.com/article/19/2/ansible-windows-admin +[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state +[9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible +[10]: https://opensource.com/article/19/3/developing-ansible-modules +[11]: https://opensource.com/article/19/7/ansible-news-edition-one From adf802b41304ef5608a981381d7c68143cb01a32 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:09:12 +0800 Subject: [PATCH 0036/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191230=2010?= =?UTF-8?q?=20articles=20to=20enhance=20your=20security=20aptitude?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191230 10 articles to enhance your security aptitude.md --- ...icles to enhance your security aptitude.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/tech/20191230 10 articles to enhance your security aptitude.md diff --git a/sources/tech/20191230 10 articles to enhance your security aptitude.md b/sources/tech/20191230 10 articles to enhance your security aptitude.md new file mode 100644 index 0000000000..7c4314b7ad --- /dev/null +++ b/sources/tech/20191230 10 articles to enhance your security aptitude.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 articles to enhance your security aptitude) +[#]: via: (https://opensource.com/article/19/12/security-resources) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +10 articles to enhance your security aptitude +====== +Whether you're learning the first steps or looking to add to your +skills, there's something for you in Opensource.com's top 10 security +articles of 2019. +![A secure lock.][1] + +If security is a process (and it is), then it stands to reason that different projects (and contributors) are in different places. Some applications have years of security testing, with design done by people who have worked in information security for decades. Others are brand new projects by developers working on their first open source project. It comes as no surprise that Opensource.com's top security articles of 2019 represent this range of experience. We have articles that introduce basic security practices as well as deep dives into more advanced topics. + +Whether you're learning the first steps or looking to add to your skills acquired over a storied career, there's something for you in the top 10 security articles of 2019. + +### 7 steps to securing your Linux server + +Security is like a house: if the foundation is bad, the rest is at risk. Patrick H. Mullins' excellent _[7 steps to securing your Linux server][2]_ gets you started with basic security steps for Linux servers. Even if you have a lot of experience administering servers, this article provides a good checklist to make sure you have the basics covered. From there, you can begin adding additional layers of security. + +### Make Linux stronger with firewalls + +One of the seven steps to securing your server is enabling a firewall. But what _is_ a firewall, and how does it work? Seth Kenlon answers these questions and then describes in detail how to configure your firewall for better security in _[Make Linux stronger with firewalls][3]_. Using firewalld and Network Manager, you can set different firewall configurations for different networks. This allows you to have a trusting configuration on your home network, for example, and a more paranoid configuration on your favorite coffee shop's WiFi network. + +### Reducing security risks with centralized logging + +Once you've secured your system, you're not done: security is a process, not a state. Part of _keeping_ systems secure is keeping an eye on what goes on. One way to do that, especially with multiple systems, is to centralize your logging. In _[Reducing security risks with centralized logging][4]_, Hannah Suarez shares how to get started (she based this article on her lightning talk at FOSDEM '19). + +### Using GPG keys for SSH + +Most people who use key-based authentication for SSH use SSH keys. And why wouldn't you? It's right there in the name. These are perfectly fine from a security standpoint, but if you want to make some forms of key distribution and backup easier, there's another way. Brian Exelbierd's three-part series walks through _[How to enable SSH access with a GPG subkey][5]_, _[How to import existing SSH keys][6]_, and _[How to reduce your backup needs to a single key file][7]_. + +### Graphically manage SSH keys with Seahorse + +Using GPG for SSH keys isn't everyone's cup of tea, but that doesn't mean you're out of luck when it comes to key management. Seahorse is a graphical tool for managing SSH keys (and other authentication methods) that is included in the GNOME desktop. Alan Formy-Duval's [_Graphically manage SSH keys with Seahorse_][8], is particularly helpful to the novice user. + +### Security scanning your DevOps pipeline + +Containers are everywhere these days. But what's in them? Knowing that containers meet your security policies is an important part of staying secure. Fortunately, you can use open source tools to help automate compliance checking. Jessica Cherry's (formly Repka) [_Security scanning your DevOps pipeline_][9] is a step-by-step tutorial that shows you how to use the Jenkins build system and the Anchore inspection service to create a scanning pipeline for container images and registries. + +### 4 open source cloud security tools + +One of the great things about cloud services is that your data can be accessed from anywhere. One of the downsides to cloud services is that your data can be accessed from anywhere. If you're using "-as-a-Service" offerings, you want to make sure they're securely configured. Anderson Silva, Alison Naylor, Travis McPeak, and Rich Monk join forces to introduce [_4 open source cloud security tools_][10] to help improve security when using GitHub and AWS. If you're looking for accidentally committed secrets—or trying to prevent them from being committed in the first place—this article has tools you can use. + +### How to use OpenSSL: hashes, digital signatures, and more + +Much of information security is based on math: specifically, the cryptographic functions used to encrypt data and authenticate users or file contents. After providing an introduction in [_Getting started with OpenSSL: Cryptography basics_][11], Marty Kalin digs deeper into the details of _[How to use OpenSSL: Hashes, digital signatures, and more][12]_, explaining how to use the OpenSSL utility to explore these commonly used but uncommonly understood concepts. + +### Learn about computer security with the Raspberry Pi and Kali Linux + +Cheap hardware and open source software make a great combination, especially for people looking to learn by doing. In this article, Anderson Silva introduces the security-oriented Kali Linux distribution in _[Learn about computer security with the Raspberry Pi and Kali Linux][13]_. It's a short article, but it's full of useful links to documentation and security-related projects that you can use with your own Raspberry Pi. + +### Will quantum computing break security? + +Has the rest of this article been a waste? Will quantum computing render everything we know about security obsolete? The good news is that the answer is "no," but quantum computing can still have a profound impact on security and the computing world more broadly. In _[Will quantum computing break security?][14]_ Mike Bursell examines its potential impacts—both the good news and the bad. And of course, quantum computing may make it easier to break encryption, but that doesn't matter if the baddies can't get your data in the first place. + +### Looking to 2020 + +Security will always be important, and (as the quantum computing article suggests) the next few years will be an interesting time in the field. In 2020, Opensource.com articles will look at the leading edge of open source security and help explain the basics to the ever-growing open source community. If you have a topic you want us to cover, please share it in the comments, or—better yet— if you have an article in mind, [write for us][15]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/security-resources + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko (A secure lock.) +[2]: https://opensource.com/article/19/10/linux-server-security +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging +[5]: https://opensource.com/article/19/4/gpg-subkeys-ssh +[6]: https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples +[7]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage +[8]: https://opensource.com/article/19/4/ssh-keys-seahorse +[9]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[10]: https://opensource.com/article/19/9/open-source-cloud-security +[11]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 +[12]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 +[13]: https://opensource.com/article/19/3/computer-security-raspberry-pi +[14]: https://opensource.com/article/19/1/will-quantum-computing-break-security +[15]: https://opensource.com/how-submit-article From 2da940ad6fcc5ae1d4f168a530fce7cc2f7624f8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:10:46 +0800 Subject: [PATCH 0037/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191230=208=20?= =?UTF-8?q?must-read=20DevOps=20articles=20for=20success=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191230 8 must-read DevOps articles for success in 2020.md --- ...ead DevOps articles for success in 2020.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sources/tech/20191230 8 must-read DevOps articles for success in 2020.md diff --git a/sources/tech/20191230 8 must-read DevOps articles for success in 2020.md b/sources/tech/20191230 8 must-read DevOps articles for success in 2020.md new file mode 100644 index 0000000000..3ea0d05f72 --- /dev/null +++ b/sources/tech/20191230 8 must-read DevOps articles for success in 2020.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 must-read DevOps articles for success in 2020) +[#]: via: (https://opensource.com/article/19/12/devops-resources) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +8 must-read DevOps articles for success in 2020 +====== +Get up to speed on DevOps with our eight most popular DevOps articles +this year. +![Brick wall between two people, a developer and an operations manager][1] + +I am an avid reader, but I go through periods where I'm so busy that it's hard to find the time to keep up with my reading list. Even during my busiest times, I try to stay up to date on DevOps news since it's one of my areas of focus. + +Here, I've summarized key takeaways from the top eight DevOps articles Opensource.com published this year so you can increase your knowledge even if you don't have time to read all of them. Since DevOps is about **people**, **processes**, and **tools**, I've categorized the top eight articles around those themes. + +### People + +#### 5 essential values for the DevOps mindset + +Conversations about IT problems and solutions often focus on the technology or the tools. But often, the people and processes are harder and more important to get right than the technology and tools. In [_5 essential values for the DevOps mindset_][2], Brent Aaron Reed and Willy-Peter Schaub outline the foundation for establishing the right processes and hiring the right people. + + * Create a continuous feedback loop with stakeholders (customers, business teams, partners, etc.). Ensure changes are being made for the right reasons and that they benefit all stakeholders. + * Processes should be continuously improved. Having a repeatable framework and process is good, but look for ways to make it better. + * Don't replace existing silos with new silos. Teamwork is essential; changing the name of a team or creating a new team does not help. You should be working to break down silos, not create new silos with new names. + * Your primary stakeholder is the customer. Every department in the organization needs to work together to make sure the customer's needs are met. + * Learning is infectious. When you learn something new, share it with others. + + + +#### The case for making the transition from sysadmin to DevOps engineer + +Making the leap from system administrator (sysadmin) to DevOps engineer requires shifting your mindset and learning new tools and technology. In [_The case for making the transition from sysadmin to DevOps engineer_][3], [Correspondent][4] Taz Brown covers this experience and the things you should do if you are considering taking on a DevOps engineer role. + + * Learn a scripting language like Python, Perl, Bash, or Powershell. You don't need to become an expert; learn the basics, and build up your skills over time. + * Think strategically and consider the business impact of your day-to-day tasks. + * Learn a programming language like Ruby, Go, or Python. + * Understand CI/CD pipelines and how and where to automate tasks within the pipeline. + * Become familiar with configuration and orchestration tools. + * Learn common Git commands as well as the fundamentals of version control. + + + +### Processes + +#### Don't test in production? Test in production! + +The notion of testing in production is a sticky subject, but Ann Marie Fred covers it well in [_Don't test in production? Test in production!_][5] Historically, development, test, and production systems were treated differently from the perspective of security, compliance, and risk management. The risks are much higher if data in production systems becomes corrupted than if it happens in a test environment. + +There are pros and cons to testing in production. The majority of the cons boil down to risk and compliance concerns like corrupted or leaked data, unintended side effects, and overloaded systems. Many of the pros can be lumped into two categories: improving the user experience (UX) and gaining new knowledge about your architecture. Improving UX includes things like usability testing, UX research, real-user monitoring, canary testing, and regression testing. Testing in production also enables you to learn more about your environment by running A/B tests, experimenting, chaos engineering, and failover testing. + +By testing in production, you gain feedback you would not otherwise get into quality, performance, availability, resiliency, user experience, and changes. Testing on real data can reveal things you would not see with mock or test data. You should test in production, but before you begin, put mechanisms in place to keep your systems safe and minimize risk. + + * Test all systems thoroughly with automated tests before you start testing in production. + * Review the risks associated with bug hunt days and put appropriate guardrails in place from the start. + * Follow the principles of chaos engineering: plan ahead; contain the blast radius; scale or squash. + + + +Yes, there are risks associated with testing in production, but you can minimize them with proper safeguards. + +#### 8 principles to achieve DevOps at scale + +Processes are a vital aspect of a successful DevOps initiative. The most important part is building processes suited to your organization rather than copying what worked somewhere else. The guidelines Matthieu Fronton lists in [_8 principles to achieve DevOps at scale_][6] ensure you will implement strategies focused on your business needs. + + * Teams create silos. Instead of building a DevOps team, create a DevOps task force of highly skilled and diverse members. Its objective is to help other projects and departments identify slow processes, automate processes, improve performance, and ensure effectiveness. + * Reduce overhead when collaborating and syncing on tasks. Make status updates and team availability publicly available, make work visible by putting everything in shared collaboration tools, and work on one task at a time to avoid context switching. + * Get outside help; hire an agile coach to be your advocate. + * Schedule regular team training on needed job skills, ranging from soft skills to how to use specific tools. + * Empower teams to make their own decisions and learn from their mistakes. + * Embrace uncertainty. Failures will happen, so run blameless post-mortems and determine how to improve and reduce uncertainty the next time around. + * DevOps is about people, processes, and tools. It is not just about the technical implementation of a product. + * Always be learning. Stay up to date on trends in the DevOps space. + + + +#### Small scale scrum vs. large scale scrum + +In [_Small scale scrum vs. large scale scrum_][7], Agnieszka Gancarczyk shares her analysis of 54 early responses to a survey on agile adoption. + + * 96% work in distributed teams, think scrum principles help them reduce development complexity, and believe agile contributes to the success of their projects. + * The most popular length of a sprint is three weeks (62%). + * Participants take on additional roles on their projects when needed, such as business analyst, project manager, and quality engineer. When changing roles, they lose an average of one to two hours. + * The majority of teams don't have a definition of "ready" to ensure that user stories are actionable, testable, and clear. + * Participants ask for help and mentoring when a task is complex. + + + +#### Scrum vs. kanban: Which agile framework is better? + +Agile is a process of iterative development and continuous feedback. While both scrum and kanban are classified as agile frameworks, they are not the same thing. In [_Scrum vs. kanban: Which agile framework is better?_][8] Taz Brown explores the differences. + +Kanban is an agile framework that utilizes a visual method for managing a project's creation through set steps, and the emphasis is on continuous flow through the steps. Tasks can be color-coded to identify different types of tasks. Work-in-progress limits can be used to restrict the maximum number of work items allowed in a single stage. The goal is to see progress and bottlenecks at a glance. Any team (not just software developers) can use the kanban methodology. + +The goal of scrum is to create a shippable product. Scrum involves daily standups, planning, reviews, retrospectives, and a two- to four-week cadence. Since its goal is to ship a product, scrum is primarily used by software development teams. + +Choosing which methodology is best for you depends on the state of your organization, the team, the people on the team, and the end product or service. + +### Tools + +#### Automate user acceptance testing with your DevOps pipeline + +User acceptance testing (UAT) determines whether a system satisfies user needs, business requirements, and authorized entity requirements. These tests need to be run whenever there is a new design in the application, which is why it's so valuable to automate them. In [_Automate user acceptance testing with your DevOps pipeline_][9], Daniel Oh shares how to skip manually validating test cases and automate them with Selenium. + +You can build WebDriver scripts with Selenium to execute test cases programmatically, then automate them by integrating the Selenium tool with your DevOps pipeline. + +#### A beginner's guide to building DevOps pipelines with open source tools + +Saving the best for last, Bryant Son's [_A beginner's guide to building DevOps pipelines with open source tools_][10] is a comprehensive overview of one critical category of DevOps tooling: continuous integration/continuous deployment (CI/CD) pipelines. The CI/CD pipeline is the process of taking code and configuration from a repository and moving it to production. + +Bryant describes some of the tools in a typical CI/CD pipeline. + + * A CI/CD tool like Jenkins talks to many different services and tools to configure and orchestrate them. + * Source control management (SCM) stores code in repositories, versions code, and facilitates collaboration with project members. (CI/CD can automate checking source code in and out among team members.) + * Build-automation tools compile and create a deployable package format from the source code. + * A web application server is the location where an executable will be deployed so the application can be used. + * Code testing coverage catches errors early on and ensures users are satisfied with the application. Code test frameworks help write the tests, and code-quality suggestion tools help improve the quality of the code. + + + +### More in 2020 + +Opensource.com's most widely read DevOps articles of 2019 covered a diverse range of topics under the umbrella of people, processes, and tools. We appreciate these writers for sharing their knowledge, and I look forward to reading more from them in 2020. + +What DevOps topics would you like us to cover in the coming months? Feel free to leave a comment or, better yet, [submit an article proposal][11]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/devops-resources + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devops_confusion_wall_questions.png?itok=zLS7K2JG (Brick wall between two people, a developer and an operations manager) +[2]: https://opensource.com/article/19/5/values-devops-mindset +[3]: https://opensource.com/article/19/7/devops-vs-sysadmin +[4]: https://opensource.com/correspondent-program +[5]: https://opensource.com/article/19/5/dont-test-production +[6]: https://opensource.com/article/19/4/principles-achieve-devops-scale +[7]: https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum +[8]: https://opensource.com/article/19/8/scrum-vs-kanban +[9]: https://opensource.com/article/19/4/devops-pipeline-acceptance-testing +[10]: https://opensource.com/article/19/4/devops-pipeline +[11]: https://opensource.com/how-submit-article From c9eb1a2820e678d78f6bcbd78db5047e36557bdb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:11:16 +0800 Subject: [PATCH 0038/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191227=202019?= =?UTF-8?q?:=20Year=20in=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191227 2019- Year in review.md --- sources/tech/20191227 2019- Year in review.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/tech/20191227 2019- Year in review.md diff --git a/sources/tech/20191227 2019- Year in review.md b/sources/tech/20191227 2019- Year in review.md new file mode 100644 index 0000000000..12b423b903 --- /dev/null +++ b/sources/tech/20191227 2019- Year in review.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (2019: Year in review) +[#]: via: (https://jvns.ca/blog/2019-year-in-review/) +[#]: author: (Julia Evans https://jvns.ca/) + +2019: Year in review +====== + +It’s the end of the year again! Here are a few things that happened in 2019. + +### I have a business instead of a job! + +The biggest change this year is that I left my job in August after working there for 5.5 years and now I don’t have a job! Now I have a [business][1] (wizard zines). + +This has been exciting (I can do anything I want with my time! No rules! Wow!) and also disorienting (I can do anything I… want? Wait, what do I want to do exactly?). Obviously this is a good problem to have but it’s a big adjustment from the structure I had when I had a job. + +My plan for now is to give myself a year (until August 2020) to see how this new way of existing goes and then reevaluate. + +I wanted to write some reflections on my 5 years at Stripe here but it’s been such a huge part of my life for so long that I couldn’t figure out how to summarize it. I was in a much worse place in my career 6 years ago before I started working there and it really changed everything for me. + +### !!Con + +2019 was [!!Con][2]’s 6th year! It’s a conference about the joy, excitement, and surprise of programming. And !!Con also expanded to the [west coast][3]!! I wasn’t part of organizing the west coast conference at all but I got to attend and it was wonderful. + +Running a conference is a ton of work and I feel really lucky to get to do it with such great co-organizers – there have been at least 20 people involved in organizing over the years and I only do a small part (right now I organize sponsorships for the east coast conference). + +This year we also incorporated the [Exclamation Foundation][4] which is the official entity which runs both conferences which is going to make organizing money things a lot easier. + +### I understand how the business works a little better + +Earlier this year I signed up for a business course called [30x500][5] by Amy Hoy and Alex Hillman. They’ve influenced me a lot this year. Basically I signed up for it because I had a business that had made $100,000 in revenue already but I didn’t really understand how the business _worked_ and it felt like it could just evaporate at any point. So $2000 (the cost at the time of 30x500) was worth it to help me understand what was going on. + +Amy and Alex both just the other day wrote 100-tweet threads that have some of the ideas that I learned this year in them: [Alex on creating sustainable businesses][6] and [Amy on design][7]. + +I was hoping to build a system for selling printed zines in 2019 and I didn’t get to it – that’s probably my one concrete business goal for 2020. I tried out Lulu for printing in the hopes that I could experiment with print-on-demand but the quality was awful so it’s going to be a bit more work. + +### blog posts and things + +In 2019 I: + + * wrote 29 blog posts + * published 2 [zines][8] (Bite Size Networking, HTTP: Learn Your Browser’s Language) and wrote most of a third + * published 1 box set of my zines ([Your Linux Toolbox][9], it’s in Real Physical Bookstores!!) + * did some experiments in interactive SQL/server exercises, which I’m excited about but are sort of on the back burner right now. Maybe I’ll go back to them in 2020! + * made the same business [revenue][1] as in 2018 (which I was thrilled about) + * gave 0 talks (which was a goal of mine) + + + +The blog post I’m happiest to have published this year is definitely [Get your work recognized: write a brag document][10]. I’ve seen quite a few people saying that it helped them track their work and it makes me really happy. A bunch of people at my old job adopted it and it’s one of the non-engineering projects I’m most proud of having done there. + +Publishing this post about my [business revenue][1] was also important to me – in the past I loved blogging, but I didn’t think it was possible to make a living by explaining computer things online. And I was totally wrong! It is possible! So I think it’s important to tell other people that it’s a possibility. + +Having a Real Traditionally Published Book out is also really cool, I could not have imagined [4 years ago][11] that I could go to an actual bookstore and buy the little 16-page zine I wrote about how much I love strace. + +### what went well + +some things that were good this year: + + * spending time understanding why the business works the way it does instead of just guessing + * collaborating with many great people on !!Con to do a big thing together + * I’m happy to have given myself the time/space to do whatever it is I want, even though it’s a big adjustment + * writing things that help people a little bit with their careers (the brag documents post) is nice + + + +some things that are harder: + + * I used to have a lot of really amazing coworkers at my job, and right now I’m working much more by myself. I definitely miss having so many great people right there to talk to all the time. + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019-year-in-review/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/blog/2019/10/01/zine-revenue-2019/ +[2]: https://bangbangcon.com +[3]: https://bangbangcon.com/west +[4]: https://exclamation.foundation/ +[5]: https://30x500.com/academy/ +[6]: https://twitter.com/alexhillman/status/1209252239501647874 +[7]: https://twitter.com/amyhoy/status/1209693440872603651 +[8]: https://wizardzines.com +[9]: https://jvns.ca/blog/2019/10/21/print-collection-of-my-first-7-zines/ +[10]: https://jvns.ca/blog/brag-documents/ +[11]: https://jvns.ca/blog/2015/04/14/strace-zine/ From 91354d964012d1a3cfe31e31b06180393c9235ad Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 1 Jan 2020 10:41:15 +0800 Subject: [PATCH 0039/3057] PRF @wxy --- ...o cohost GitHub and GitLab with Ansible.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md index 4d9193d930..41616cd282 100644 --- a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md +++ b/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to cohost GitHub and GitLab with Ansible) @@ -12,27 +12,27 @@ > 通过使用 Ansible 镜像 Git 存储库,保护对重要项目的访问。 -![Hands programming][1] +![](https://img.linux.net.cn/data/attachment/album/202001/01/104040fbdu68wosg8o99wg.jpg) -开源无处不在。它在家里的计算机上、在工作场所的计算机上、在互联网上,并且很多都由 [Git][2] 管理。由于 Git 是分布式的,因此许多人也将其视为一种众包的备份解决方案。从理论上讲,每当有人将 Git 存储库克隆到其本地计算机时,他们就是创建了项目源代码的备份。如果有 100 个人这样做,则存储库就有 100 个备份副本。 +开源无处不在。它在家里的计算机上、在工作场所的计算机上、在互联网上,并且很多都由 [Git][2] 管理。由于 Git 是分布式的,因此许多人也将其视为一种众包的备份解决方案。从理论上讲,每当有人将 Git 存储库克隆到其本地计算机时,他们就创建了该项目源代码的备份。如果有 100 个人这样做,则存储库就有 100 个备份副本。 -从理论上讲,这可以缓解“灾难”,例如项目维护者[突然决定删除存储库][3]或[莫名其妙地阻止所有流量][4],导致开发人员们无头苍蝇般地寻找谁拥有主分支的最新版本。类似的,整个代码托管站点也会消失。没有人会想到 Google Code、Microsoft CodePlex 或 Gitorious 会在鼎盛时期将被关闭。 +从理论上讲,这可以缓解“灾难”的影响,例如当项目维护者[突然决定删除存储库][3]或[莫名其妙地阻止所有流量][4],导致开发人员们无头苍蝇般地寻找谁拥有主分支的最新版本。类似的,整个代码托管站点也会消失。没有人会想到 Google Code、Microsoft CodePlex 或 Gitorious 会在鼎盛时期将被关闭。 简而言之,如果在过去的几十年中互联网教给了我们一些东西,那就是依靠互联网神奇地创建备份并不是冗余的最可靠途径。 -此外,对于许多人来说,很多开源项目都托管在 GitHub 上是个问题,而 GitHub 不是开放平台。许多开发人员和用户都希望支持诸如 GitLab 之类的堆栈并与之交互,它具有开源社区版本。 +此外,对于许多人来说,很多开源项目都托管在 GitHub 上是个问题 —— GitHub 并不是开放平台。许多开发人员和用户都希望支持诸如 GitLab 之类的堆栈并与之交互,它具有开源社区版本。 ### 使用 Ansible 管理 Git Git 的去中心方式对于解决这个问题很有用。使用纯 Git,你可以使用一个 `push` 命令轻松地将其推到两个或多个存储库。但是,为了使其在发生意外故障时有用,你必须经常与 Git 存储库进行交互(特别是推送)。此外,即使你可能永远不会自己推送或拉出代码,也可能有一些要备份的存储库。 -但是,使用 Ansible,你可以自动执行项目主分支(或其他任何分支)的 Git 拉取,然后自动存储库到“异地”镜像的 Git 推送。换句话说,你可以让你的计算机定期从 GitHub 拉取并推送到 GitLab 或 [Gitolite][5] 或 Gitea(或你喜欢的任何 Git 主机)。 +但是,使用 Ansible,你可以自动执行项目主分支(或其他任何分支)的 Git 拉取,然后自动进行存储库到“异地”镜像的 Git 推送。换句话说,你可以让你的计算机定期从 GitHub 拉取并推送到 GitLab 或 [Gitolite][5] 或 Gitea(或你喜欢的任何 Git 托管主机)。 ### Ansible 模块 -如果 Ansible 并不是因为其出色的模块集合,那么它就没那么出色。像 Python 的第三方库或 Linux 的应用程序一样,这个技术驱动器有用而令人惊讶的简单技巧是,Ansible 以其他人贡献的组件而闻名。因为本文正在研究如何有效和可靠地备份 Git 存储库,所以这里使用的模块是 [Git 模块][6]和 [ini_file][7] 模块。 +如果不是因其出色的模块集合,那么 Ansible 就没那么出色。像 Python 的第三方库或 Linux 的应用程序一样,这个技术引擎的一个有用而令人惊讶的简单技巧是,Ansible 以其他人贡献的组件而闻名。因为本文正在研究如何有效和可靠地备份 Git 存储库,所以这里使用的模块是 [Git 模块][6]和 [ini_file][7] 模块。 -首先,创建一个名为 `mirror.yaml` 的文件作为剧本playbook。你可以像通常使用 Ansible 一样,从 `name` 和 `task` 条目开始。本示例将 `localhost` 添加到 `hosts` 列表中,以便在控制器计算机(你现在坐在前面的计算机)上运行动作play,但是在现实生活中,你可能会在特定的主机或一组网络上的主机上运行。 +首先,创建一个名为 `mirror.yaml` 的文件作为剧本playbook。你可以像通常使用 Ansible 一样,从 `name` 和 `task` 条目开始。本示例将 `localhost` 添加到 `hosts` 列表中,以便在控制器计算机(你现在坐在前面的计算机)上运行动作play,但是在现实生活中,你可能会在特定的主机或一组网络上的主机上运行它。 ``` --- @@ -43,7 +43,7 @@ Git 的去中心方式对于解决这个问题很有用。使用纯 Git,你可 ### Git 拉取和克隆 -如果要进行备份,则需要最新代码的副本。在 Git 仓库中实现这一目标的明显方法是执行 `git pull`。 但是,`pull` 会假定克隆已经存在,而写得很好的 Ansible 动作(Ansible 脚本)则尽可能少的假定。 最好先告诉 Ansible `clone` 存储库。 +如果要进行备份,则需要最新代码的副本。明显,在 Git 仓库中实现这一目标的方法是执行 `git pull`。 但是,`pull` 会假定克隆已经存在,而写得很好的 Ansible 动作(Ansible 脚本)则尽可能少的假定。最好告诉 Ansible 先克隆存储库。 将你的第一个任务添加到剧本: @@ -63,7 +63,7 @@ Git 的去中心方式对于解决这个问题很有用。使用纯 Git,你可 update: yes ``` -这个例子使用了开源的,类似于 Unix 的操作系统 soso 作为我要镜像的存储库。这是一个完全任意的选择,绝不意味着对该存储库的未来缺乏信心。它还使用变量来引用目标文件夹 `/tmp/soso.git`,这很方便,并且如果以后你希望将它扩展为一个通用的镜像脚本也会受益。在现实生活中,你的工作机上可能会比 `/tmp` 具有更永久的位置,例如 `/home/gitmirrors/soso.git` 或 `/opt/gitmirrors/soso.git`。 +这个例子使用了开源的、类似于 Unix 的操作系统 soso 作为我要镜像的存储库。这是一个完全任意的选择,绝不意味着我对该存储库的未来缺乏信心。它还使用变量来引用目标文件夹 `/tmp/soso.git`,这很方便,并且如果以后你希望将它扩展为一个通用的镜像脚本也会受益。在现实生活中,你的工作机上可能会比 `/tmp` 具有更永久的位置,例如 `/home/gitmirrors/soso.git` 或 `/opt/gitmirrors/soso.git`。 运行你的剧本: @@ -150,7 +150,7 @@ via: https://opensource.com/article/19/11/how-host-github-gitlab-ansible 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6b20f939ee1b8ba5a1afc8601d38a786b7bd90e1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 1 Jan 2020 10:41:49 +0800 Subject: [PATCH 0040/3057] PUB @wxy https://linux.cn/article-11735-1.html --- .../20191113 How to cohost GitHub and GitLab with Ansible.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191113 How to cohost GitHub and GitLab with Ansible.md (99%) diff --git a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/published/20191113 How to cohost GitHub and GitLab with Ansible.md similarity index 99% rename from translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md rename to published/20191113 How to cohost GitHub and GitLab with Ansible.md index 41616cd282..c9a05d6b40 100644 --- a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md +++ b/published/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11735-1.html) [#]: subject: (How to cohost GitHub and GitLab with Ansible) [#]: via: (https://opensource.com/article/19/11/how-host-github-gitlab-ansible) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 4f1536686af91606a711bcbf4b0e7fa1495735e9 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 1 Jan 2020 15:09:25 +0800 Subject: [PATCH 0041/3057] translated --- .../tech/20191017 Intro to the Linux useradd command.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191017 Intro to the Linux useradd command.md (100%) diff --git a/sources/tech/20191017 Intro to the Linux useradd command.md b/translated/tech/20191017 Intro to the Linux useradd command.md similarity index 100% rename from sources/tech/20191017 Intro to the Linux useradd command.md rename to translated/tech/20191017 Intro to the Linux useradd command.md From d3a447dcf81bd16100590b5eef613b7960558e3a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 1 Jan 2020 20:51:51 +0800 Subject: [PATCH 0042/3057] Rename sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md to sources/talk/20191231 How to be a better organization- Top 10 reads for leaders.md --- ...1 How to be a better organization- Top 10 reads for leaders.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191231 How to be a better organization- Top 10 reads for leaders.md (100%) diff --git a/sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md b/sources/talk/20191231 How to be a better organization- Top 10 reads for leaders.md similarity index 100% rename from sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md rename to sources/talk/20191231 How to be a better organization- Top 10 reads for leaders.md From 99ee33155dcf69405729aa26c01afe369d485440 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 1 Jan 2020 22:14:17 +0800 Subject: [PATCH 0043/3057] APL --- ...0191231 12 programming resources for coders of all levels.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191231 12 programming resources for coders of all levels.md b/sources/tech/20191231 12 programming resources for coders of all levels.md index 5da5148542..669615585c 100644 --- a/sources/tech/20191231 12 programming resources for coders of all levels.md +++ b/sources/tech/20191231 12 programming resources for coders of all levels.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f782f892a97d4cf7da8bec47d50afc56806ca7a4 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 1 Jan 2020 23:00:27 +0800 Subject: [PATCH 0044/3057] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Python interfaces using zope.interface.md | 132 ------------------ ... Python interfaces using zope.interface.md | 125 +++++++++++++++++ 2 files changed, 125 insertions(+), 132 deletions(-) delete mode 100644 sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md create mode 100644 translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md diff --git a/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md deleted file mode 100644 index aa984555d8..0000000000 --- a/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md +++ /dev/null @@ -1,132 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An advanced look at Python interfaces using zope.interface) -[#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package) -[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg) - -An advanced look at Python interfaces using zope.interface -====== -Zope.interface helps declare what interfaces exist, which objects -provide them, and how to query for that information. -![Snake charmer cartoon with a yellow snake and a blue snake][1] - -The **zope.interface** library is a way to overcome ambiguity in Python interface design. Let's take a look at it. - -### Implicit interfaces are not zen - -The [Zen of Python][2] is loose enough and contradicts itself enough that you can prove anything from it. Let's meditate upon one of its most famous principles: "Explicit is better than implicit." - -One thing that traditionally has been implicit in Python is the expected interface. Functions have been documented to expect a "file-like object" or a "sequence." But what is a file-like object? Does it support **.writelines**? What about **.seek**? What is a "sequence"? Does it support step-slicing, such as **a[1:10:2]**? - -Originally, Python's answer was the so-called "duck-typing," taken from the phrase "if it walks like a duck and quacks like a duck, it's probably a duck." In other words, "try it and see," which is possibly the most implicit you could possibly get. - -In order to make those things explicit, you need a way to express expected interfaces. One of the first big systems written in Python was the [Zope][3] web framework, and it needed those things desperately to make it obvious what rendering code, for example, expected from a "user-like object." - -Enter **zope.interface**, which is developed by Zope but published as a separate Python package. **Zope.interface** helps declare what interfaces exist, which objects provide them, and how to query for that information. - -Imagine writing a simple 2D game that needs various things to support a "sprite" interface; e.g., indicate a bounding box, but also indicate when the object intersects with a box. Unlike some other languages, in Python, attribute access as part of the public interface is a common practice, instead of implementing getters and setters. The bounding box should be an attribute, not a method. - -A method that renders the list of sprites might look like: - - -``` -def render_sprites(render_surface, sprites): -    """ -    sprites should be a list of objects complying with the Sprite interface: -    * An attribute "bounding_box", containing the bounding box. -    * A method called "intersects", that accepts a box and returns -      True or False -    """ -    pass # some code that would actually render -``` - -The game will have many functions that deal with sprites. In each of them, you would have to specify the expected contract in a docstring. - -Additionally, some functions might expect a more sophisticated sprite object, maybe one that has a Z-order. We would have to keep track of which methods expect a Sprite object, and which expect a SpriteWithZ object. - -Wouldn't it be nice to be able to make what a sprite is explicit and obvious so that methods could declare "I need a sprite" and have that interface strictly defined? Enter **zope.interface**. - - -``` -from zope import interface - -class ISprite(interface.Interface): - -    bounding_box = interface.Attribute( -        "The bounding box" -    ) - -    def intersects(box): -        "Does this intersect with a box" -``` - -This code looks a bit strange at first glance. The methods do not include a **self**, which is a common practice, and it has an **Attribute** thing. This is the way to declare interfaces in **zope.interface**. It looks strange because most people are not used to strictly declaring interfaces. - -The reason for this practice is that the interface shows how the method will be called, not how it is defined. Because interfaces are not superclasses, they can be used to declare data attributes. - -One possible implementation of the interface can be with a circular sprite: - - -``` -@implementer(ISprite) -@attr.s(auto_attribs=True) -class CircleSprite: -    x: float -    y: float -    radius: float - -    @property -    def bounding_box(self): -        return ( -            self.x - self.radius, -            self.y - self.radius, -            self.x + self.radius, -            self.y + self.radius, -        ) - -    def intersects(self, box): -        # A box intersects a circle if and only if -        # at least one corner is inside the circle. -        top_left, bottom_right = box[:2], box[2:] -        for choose_x_from (top_left, bottom_right): -            for choose_y_from (top_left, bottom_right): -                x = choose_x_from[0] -                y = choose_y_from[1] -                if (((x - self.x) ** 2 + (y - self.y) ** 2) <= -                    self.radius ** 2): -                     return True -        return False -``` - -This _explicitly_ declares that the **CircleSprite** class implements the interface. It even enables us to verify that the class implements it properly: - - -``` -from zope.interface import verify - -def test_implementation(): -    sprite = CircleSprite(x=0, y=0, radius=1) -    verify.verifyObject(ISprite, sprite) -``` - -This is something that can be run by **pytest**, **nose**, or another test runner, and it will verify that the sprite created complies with the interface. The test is often partial: it will not test anything only mentioned in the documentation, and it will not even test that the methods can be called without exceptions! However, it does check that the right methods and attributes exist. This is a nice addition to the unit test suite and—at a minimum—prevents simple misspellings from passing the tests. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/9/zopeinterface-python-package - -作者:[Moshe Zadka][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) -[2]: https://en.wikipedia.org/wiki/Zen_of_Python -[3]: http://zope.org diff --git a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md new file mode 100644 index 0000000000..9827cb9b28 --- /dev/null +++ b/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An advanced look at Python interfaces using zope.interface) +[#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package) +[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg) + +借助 zope.interface 深入了解 Python 接口 +====== +Zope.interface 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 +![Snake charmer cartoon with a yellow snake and a blue snake][1] + +**zope.interface** 库可以克服 Python 接口设计中的歧义性。让我们来研究一下。 + +### 隐式接口不是 Python 之禅 + +[Python 之禅][2] 很宽松,但是有点自相矛盾,你可以从中证明一切。让我们来思考其中最著名的原则之一:“显示胜于隐式”。 + +在 Python 中会隐含的一件事是预期的接口。比如函数已经记录了它期望一个“类文件对象”或“序列”。但是什么是类文件对象呢?它支持 **.writelines** 和 **.seek** 吗?什么是一个“序列”?是否支持分步切片,例如 **a[1:10:2]**? + +最初,Python 的答案是所谓的“鸭子类型”,取自短语“如果它像鸭子一样行走,像鸭子一样嘎嘎叫,那么它可能就是鸭子”。换句话说,“试试看”,这可能是你能得到的最含蓄的表达。 + +为了使这些内容显式地表达出来,你需要一种方法来表达期望的接口。最早用 Python 编写的大型系统之一是 [Zope][3] Web 框架,它迫切需要这些东西来明确地呈现代码,例如,期望从“类似用户的对象”获得什么。 + +**zope.interface** 由 Zope 开发,但作为单独的 Python 包发布。**Zope.interface** 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 + +想象编写一个简单的 2D 游戏,它需要各种东西来支持 sprite 接口(to 校正:这里不知道如何翻译)。例如,表示一个边界框,但也表示对象何时与一个框相交。与一些其他语言不同,在 Python 中,将属性访问作为公共接口一部分是一种常见的做法,而不是实现 getter 和 setter。边界框应该是一个属性,而不是一个方法。 + +呈现外观列表的方法可能类似于: + +``` +def render_sprites(render_surface, sprites): +    """ +    sprites 应该是符合 Sprite 接口的对象列表: +    * 一个属性 "bounding_box",包含了边界框 +    * "intersects" 方法,它接受一个 box 并返回 True 或 False +    """ +    pass # 一些代码会渲染 +``` + +游戏将具有许多处理 sprite 的功能(函数)。在每个功能(函数)中,你都必须在文档中指定预期。 + +此外,某些功能可能期望使用更复杂的 Sprite 对象,例如具有 Z-order 的对象。我们必须跟踪哪些方法需要 Sprite 对象,哪些方法需要 SpriteWithZ 对象。 + +如果能够使 sprite 的内容显式出来,这样方法就可以声明“我需要一个 sprite”,并严格定义接口,这不是很好吗?来看看 **zope.interface**。 + +``` +from zope import interface + +class ISprite(interface.Interface): + +    bounding_box = interface.Attribute( +        "The bounding box" +    ) + +    def intersects(box): +        "它和一个框相交吗?" +``` + +乍看起来,这段代码有点奇怪。这些方法不包括 "self",而包含 "self" 是一种常见的做法,并且它有一个属性。这是在 zope.interface 中声明接口的方法。这看起来很奇怪,因为大多数人不习惯严格声明接口。 + +这样做的原因是接口显示了如何调用方法,而不是如何定义方法。因为接口不是超类,所以它们可以用来声明数据属性。 + +下面是一个可能的接口实现: + +``` +@implementer(ISprite) +@attr.s(auto_attribs=True) +class CircleSprite: +    x: float +    y: float +    radius: float + +    @property +    def bounding_box(self): +        return ( +            self.x - self.radius, +            self.y - self.radius, +            self.x + self.radius, +            self.y + self.radius, +        ) + +    def intersects(self, box): +        # 当且仅当至少一个角在圆内时,方框与圆相交 +        top_left, bottom_right = box[:2], box[2:] +        for choose_x_from (top_left, bottom_right): +            for choose_y_from (top_left, bottom_right): +                x = choose_x_from[0] +                y = choose_y_from[1] +                if (((x - self.x) ** 2 + (y - self.y) ** 2) <= +                    self.radius ** 2): +                     return True +        return False +``` + +这 _显式_ 声明了 **CircleSprite** 类实现接口。它甚至能让我们验证该类是否正确实现了接口: + +``` +from zope.interface import verify + +def test_implementation(): +    sprite = CircleSprite(x=0, y=0, radius=1) +    verify.verifyObject(ISprite, sprite) +``` + +这可以由 **pytest**、**nose** 或其他测试框架运行,它将验证创建的 sprite 是否符合接口。测试通常是局部的:它不会测试文档中没有提及的内容,甚至不会测试方法是否可以在没有异常的情况下被调用!但是,它会检查是否存在正确的方法和属性。这是对单元测试套件一个很好的补充,至少可以防止简单的拼写错误通过测试。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/zopeinterface-python-package + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) +[2]: https://en.wikipedia.org/wiki/Zen_of_Python +[3]: http://zope.org From 5e25ae70948471e49dac7ce10c2418302ff67002 Mon Sep 17 00:00:00 2001 From: nacyro Date: Wed, 1 Jan 2020 23:13:50 +0800 Subject: [PATCH 0045/3057] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= =?UTF-8?q?=20(#16873)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文章: tech/10 articles to enhance your security aptitude 译者: nacyro --- .../20191230 10 articles to enhance your security aptitude.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191230 10 articles to enhance your security aptitude.md b/sources/tech/20191230 10 articles to enhance your security aptitude.md index 7c4314b7ad..ae6c1a9aaf 100644 --- a/sources/tech/20191230 10 articles to enhance your security aptitude.md +++ b/sources/tech/20191230 10 articles to enhance your security aptitude.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (nacyro) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d37d615ed10774676fb269d50674c251b870c996 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 1 Jan 2020 23:42:11 +0800 Subject: [PATCH 0046/3057] TSL --- ...ming resources for coders of all levels.md | 85 ------------------- ...ming resources for coders of all levels.md | 79 +++++++++++++++++ 2 files changed, 79 insertions(+), 85 deletions(-) delete mode 100644 sources/tech/20191231 12 programming resources for coders of all levels.md create mode 100644 translated/tech/20191231 12 programming resources for coders of all levels.md diff --git a/sources/tech/20191231 12 programming resources for coders of all levels.md b/sources/tech/20191231 12 programming resources for coders of all levels.md deleted file mode 100644 index 669615585c..0000000000 --- a/sources/tech/20191231 12 programming resources for coders of all levels.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (12 programming resources for coders of all levels) -[#]: via: (https://opensource.com/article/19/12/programming-resources) -[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) - -12 programming resources for coders of all levels -====== -No matter where you are in your programming journey, there are things -for you to learn in Opensource.com's top 12 programming articles from -2019. -![Woman sitting in front of her computer][1] - -> "The best time to learn computer programming was 20 years ago. The second best time is now." -> — A computer science proverb, maybe. - -Are you a new programmer, an experienced web dev, a backend wizard, a grizzled system programmer, or some other yet-to-be-discovered species of computer geek? Wherever you land in the vast ecosystem of software developers, the only constant in our field is the need to learn about new technologies and how to apply them. Here is an ensemble of the most-read Opensource.com articles from the past year that inform and entertain, and I'm excited to share them with you here. - -### For the noble newbie - -Whatever your skillset or interests, learning how to write computer programs turns that domain-specific knowledge into a superpower. Unfortunately, it isn't possible to learn how to program from the bite of a radioactive computer, at least not yet. Until that's a thing, I recommend these excellent articles to help bootstrap your programming skills. They address important questions like which languages to consider learning and different ways to get started. - - * [Which programming languages should you learn?][2] - * [A dozen ways to learn Python][3] - * [Three popular programming languages you can learn with Raspberry Pi][4] - * [Introducing kids to computational thinking with Python][5] - - - -### Keeping up with emerging technologies - -Experienced programmers know that the only thing harder than learning to program is keeping your skills and knowledge up to date. But we are an [autodidactic][6] breed, always looking to level up our expertise and understanding. Even if we don't anticipate using a new technology, we know that eventually, someone will ask about it. These articles on Rust, WebAssembly, and Podman are great places to start learning about just a few of the upcoming trends in software technology. - - * [Why should you use Rust in WebAssembly?][7] - * [Level up command-line playgrounds with WebAssembly][8] - * [How does rootless Podman work?][9] - * [Why to choose Rust as your next programming language][10] - - - -### Old programs never die - -Despite the never-ending cascade of new technologies, it never hurts to look back to help you look forward. Today's amazing technologies are built on top of yesterday's tools, and it will serve us well to understand the abilities and limitations of those tools, even if we never write a line of code in these languages of legend. This collection of articles focuses on the C language, a practical application written in AWK, and an interesting discussion of computer languages that are declining in popularity, but perhaps not dead yet. - - * [The monumental impact of C][11] - * [How to write a good C main function][12] - * [Drinking coffee with AWK][13] - * [What's your favorite "dead" language?][14] - - - -### Keep on learning - -No matter where you are in your programming journey, there will always be more to learn. I hope these top resources from 2019 will get you ready for 2020. Thanks to the authors and you, the reader. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/programming-resources - -作者:[Erik O'Shaughnessy][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jnyjny -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_3.png?itok=qw2A18BM (Woman sitting in front of her computer) -[2]: https://opensource.com/article/19/2/which-programming-languages-should-you-learn -[3]: https://opensource.com/article/19/8/dozen-ways-learn-python -[4]: https://opensource.com/article/19/3/programming-languages-raspberry-pi -[5]: https://opensource.com/article/19/2/break-down-stereotypes-python -[6]: https://en.wikipedia.org/wiki/Autodidacticism -[7]: https://opensource.com/article/19/2/why-use-rust-webassembly -[8]: https://opensource.com/article/19/4/command-line-playgrounds-webassembly -[9]: https://opensource.com/article/19/2/how-does-rootless-podman-work -[10]: https://opensource.com/article/19/10/choose-rust-programming-language -[11]: https://opensource.com/article/19/10/command-line-heroes-c -[12]: https://opensource.com/article/19/5/how-write-good-c-main-function -[13]: https://opensource.com/article/19/2/drinking-coffee-awk -[14]: https://opensource.com/article/19/6/favorite-dead-language diff --git a/translated/tech/20191231 12 programming resources for coders of all levels.md b/translated/tech/20191231 12 programming resources for coders of all levels.md new file mode 100644 index 0000000000..c3687187b3 --- /dev/null +++ b/translated/tech/20191231 12 programming resources for coders of all levels.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (12 programming resources for coders of all levels) +[#]: via: (https://opensource.com/article/19/12/programming-resources) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +12 个给码农们的编程资源 +====== + +> 无论你身处编程旅程中的何处,这 12 篇编程文章都有你需要学习一些东西。 + +![Woman sitting in front of her computer][1] + +> “学习计算机编程的最佳时间是 20 年前,其次是现在。” +> — (也许是)计算机科学的谚语 + +你是新程序员、经验丰富的 Web 开发人员、后端大师、头发花白的系统程序员,还是其他神秘物种的计算机极客?无论你身处广阔的软件开发人员生态系统中的何处,在我们领域中唯一不变的就是需要了解新技术及其应用方法。这是过去一年来阅读量最大的 Opensource.com 文章的集合,我很高兴在这里与你分享它们。 + +### 好好学习 + +无论你的技能或兴趣是什么,学习如何编写计算机程序都可以将特定领域的知识变成一种超能力。不幸的是,至少从现在开始,还不可能通过坐在计算机前面接受电磁辐射就能学会如何编程。在这之前,我推荐这些出色的文章来帮助激发你的编程技能。它们解决了一些重要的问题,例如考虑学习哪种语言以及不同的入门方式。 + +* [你应该学习哪种编程语言?][2] +* [学习 Python 的 12 个方式][3] +* [你可以使用树莓派学习的三种流行编程语言][4] +* [利用 Python 引导孩子的计算机思维][5] + +### 天天向上 + +经验丰富的程序员知道,与学习编程相比,唯一更难的就是使你的技能和知识保持最新。但是我们是[自学成才][6]的一族,总是希望提高我们的专业知识和理解力。即使我们不期望使用新技术,我们也知道总会有人问起它们。这些有关 Rust、WebAssembly 和 Podman 的文章是开始学习软件技术一些即将出现的趋势的好地方。 + +* [为什么要在 WebAssembly 中使用 Rust?][7] +* [使用 WebAssembly 提升命令行游乐场][8] +* [免 root 的 Podman 如何工作?][9] +* [为什么选择 Rust 作为你的下一种编程语言][10] + +### 老兵不死 + +尽管新技术层出不穷,但回顾过去可以帮助你前进。当今惊人的技术是建立在昨天的工具之上的,即使我们从未使用这些传奇语言编写过代码,它也将使我们很好地理解这些工具的功能和局限性。这一系列文章集中于 C 语言、用 AWK 编写的实际应用程序,以及对流行度下降但也许还没有消亡的计算机语言的有趣讨论。 + +* [C 的巨大影响] [11] +* [如何写好 C main 函数][12] +* [用 AWK 喝咖啡][13] +* [你最喜欢的“死”语言是什么?][14] + +### 学习不止 + +无论你在编程过程中处于何处,总有更多东西需要学习。我希望这些来自 2019 年的顶级资源能帮助你为 2020 年做好准备。感谢作者们和你——读者。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/programming-resources + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_3.png?itok=qw2A18BM (Woman sitting in front of her computer) +[2]: https://linux.cn/article-10769-1.html +[3]: https://linux.cn/article-11280-1.html +[4]: https://linux.cn/article-10661-1.html +[5]: https://linux.cn/article-11116-1.html +[6]: https://en.wikipedia.org/wiki/Autodidacticism +[7]: https://opensource.com/article/19/2/why-use-rust-webassembly +[8]: https://opensource.com/article/19/4/command-line-playgrounds-webassembly +[9]: https://opensource.com/article/19/2/how-does-rootless-podman-work +[10]: https://opensource.com/article/19/10/choose-rust-programming-language +[11]: https://opensource.com/article/19/10/command-line-heroes-c +[12]: https://linux.cn/article-10949-1.html +[13]: https://linux.cn/article-10555-1.html +[14]: https://opensource.com/article/19/6/favorite-dead-language From 3d87a18a7839b10621d87ed1685b4138899f337d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 2 Jan 2020 00:53:37 +0800 Subject: [PATCH 0047/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200101=205=20?= =?UTF-8?q?predictions=20for=20Kubernetes=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200101 5 predictions for Kubernetes in 2020.md --- ...01 5 predictions for Kubernetes in 2020.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20200101 5 predictions for Kubernetes in 2020.md diff --git a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md new file mode 100644 index 0000000000..2032983b78 --- /dev/null +++ b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 predictions for Kubernetes in 2020) +[#]: via: (https://opensource.com/article/20/1/kubernetes-2020) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +5 predictions for Kubernetes in 2020 +====== +Plus, a look back at the most popular Kubernetes articles on the site in +2019. +![Person drinking a hat drink at the computer][1] + +How do you track a wildly popular project like Kubernetes? How do you figure out where it’s going? If you are contributing to the project or participating in Special Interest Groups (SIGs), you might gain insight by osmosis, but for those of you with day jobs that don’t include contributing to Kubernetes, you might like a little help reading the tea leaves. With a fast-moving project like Kubernetes, the end of the year is an excellent time to take a look at the past year to gain insight into the next one. + +This year, Kubernetes made a lot of progress. Aside from inspecting code, documentation, and meeting notes, another good source is blog entries. To gain some insights, I took a look at the top ten Kubernetes articles on Opensource.com. These articles give us insight into what topics people are interested in reading, but just as importantly, what articles people are interested in writing. Let’s dig in! + +(Get the full list of top 10 Kubernetes articles from 2019 at the end.) + +First, I would point out that five of these articles tackle the expansion of workloads and where they can run. This expansion of workloads includes data science, PostgreSQL, InfluxDB, and Grafana (as a workload, not just to monitor the cluster itself) and Edge. Historically, Kubernetes and containers in general have mostly run on top of virtual machines, especially when run on infrastructure provided by cloud providers. With this interest in Kubernetes at the edge, it’s another sign that end users are genuinely interested in Kubernetes on bare metal (see also [Kubernetes on metal with OpenShift][2]). + +Next, there seems to be a lot of hunger for operational knowledge and best practices with Kubernetes. From [Kubernetes Operators][3], to [Kubernetes Controllers][4], from [Secrets][5] to [ConfigMaps][6], developers and operators alike are looking for best practices and ways to simplify workload deployment and management. Often we get caught up in the actual configuration example, or how people do it, and don’t take a step back to realize that all of these fall into the bucket of how to operationalize the deployment of applications (not how to install or run Kubernetes itself). + +Finally, people seem to be really interested in getting started. In fact, there is so much information on how to build Kubernetes that it intimidates people and gets them down the wrong path. A couple of the top articles focus on why you should learn to run applications on Kubernetes instead of concentrating on installing it. Like best practices, people often don’t take a step back to analyze where they should invest their time when getting started. I have always advocated for, where possible, spending limited time and money on using technology instead of building it. + +### 5 predictions for Kubernetes in 2020 + +So, looking back at those themes from 2019, what does this tell us about where 2020 is going? Well, combining insight from these articles with my own broad purview, I want to share my thoughts for 2020 and beyond: + + 1. Expansion of workloads. I would keep my eye on high-performance computing, AI/ML, and stateful workloads using Operators. + + 2. More concrete best practices, especially around mature standards like PCI, HIPAA, NIST, etc. + + 3. Increased security around rootless and higher security [runtimes classes][7] (like [gVisor][8], [Kata Containers][9], etc.) + + 4. Better standardization on Kubernetes manifests as the core artifact for deployment in development and sharing applications between developers. Things like [podman generate kube][10], [podman play kube][11], and all in one Kubernetes environments like [CodeReady Containers (CRC)][12] + + 5. An ever-wider ecosystem of network, storage and specialized hardware (GPUs, etc.) vendors creating best of breed solutions for Kubernetes (in free software, we believe that open ecosystems are better than vertically integrated solutions) + + + + +I'm looking forward to another great year in Kubernetes! + +**Top 10 Kubernetes articles for 2019** + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/kubernetes-2020 + +作者:[Scott McCarty][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://blog.openshift.com/kubernetes-on-metal-with-openshift/ +[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ +[4]: https://kubernetes.io/docs/concepts/architecture/controller/ +[5]: https://kubernetes.io/docs/concepts/configuration/secret/ +[6]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/ +[7]: https://kubernetes.io/docs/concepts/containers/runtime-class/ +[8]: https://gvisor.dev/ +[9]: https://katacontainers.io/ +[10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ +[11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities +[12]: https://developers.redhat.com/products/codeready-containers/overview From 7c36acbcaa8d6a52a508740e7d17d62796bf81dd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 2 Jan 2020 00:54:08 +0800 Subject: [PATCH 0048/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200101=20How?= =?UTF-8?q?=20to=20get=20started=20with=20open=20source=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200101 How to get started with open source in 2020.md --- ...to get started with open source in 2020.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20200101 How to get started with open source in 2020.md diff --git a/sources/tech/20200101 How to get started with open source in 2020.md b/sources/tech/20200101 How to get started with open source in 2020.md new file mode 100644 index 0000000000..35f67c3d28 --- /dev/null +++ b/sources/tech/20200101 How to get started with open source in 2020.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to get started with open source in 2020) +[#]: via: (https://opensource.com/article/20/1/getting-started-open-source) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +How to get started with open source in 2020 +====== +New to open source? Opensource.com's top 10 articles for newcomers will +get you on the right pathway quickly in the new year. +![pipe in a building][1] + +When Opensource.com launched in 2010, Red Hat CEO Jim Whitehurst said the site "is one of the ways in which Red Hat gives something back to the open source community." And that community has always included the growing number of people who are new to open source. + +In 2019, we published many articles about the open source way of thinking, choosing hardware, the contribution process, and other topics geared toward newbies. If you're new to open source, this list of Opensource.com's top 10 articles from 2019 about getting started with open source should put you on the right path. + +### Why I made the switch from Mac to Linux + +Have you ever considered trying out Linux but were not sure how to start? You are not alone! Trying something new is usually a little scary and involves a learning curve. In [_Why I made the switch from Mac to Linux_][2], Matthew Broberg shares his story about adopting Linux and how his initial nervousness was transformed into an awesome feeling of accomplishment. + +### Getting started with Git: Terminology 101 + +Although there are many ways to contribute to open source (including writing about it, like I'm doing here), the most notable contributions come from the developers who provide source code to projects. They usually make their source code contributions to GitHub and GitLab repositories using the Git tool. Matthew Broberg's guide to [_Getting started with Git: Terminology 101_][3] explains how to get started with Git so you can make your first commit to your favorite open source project. + +### Buying a Linux-ready laptop + +Most people who want to try Linux are already familiar with Microsoft Windows or Apple MacOS, and they may know they can install Linux on their existing computer, for example, by using a virtual machine, partitioning their drive to install Linux alongside Windows or Mac, reformatting their drive to erase their old operating system and install Linux, or putting Linux on a second drive. But many may not know they can buy a Linux-by-default laptop from companies like System76, Slimbook, and Tuxedo. In [_Buying a Linux-ready laptop_][4], Richardo Berlasso shares his experience of ordering, receiving, and using a Linux-ready Tuxedo laptop. + +### Getting started with Vim: The basics + +Vim is an improved version of the vi text editor. It's is available by default on most Linux operating systems and competes with Emacs, another popular Linux text editor. Knowing how to use Vim can give you an edge in creating, modifying, and managing text-based files, whether they are programming files or simple words on a screen. In [_Getting started with Vim: The basics_][5], I walk through how to start learning Vim to simplify your open source journey. + +### How to create a pull request in GitHub + +Pull request, often shortened to PR, is a Git term that means something is available to be merged into another branch. Pull requests are an essential part of the open source contribution process: to contribute to an open source project, people fork or clone a branch to work on it, and the PR process is how they later merge their work back to the parent branch. [_How to create a pull request in GitHub_][6] by Kedar Vijay Kulkarni will give you a good foundation of knowledge to make your first pull request. + +### Bash vs. Python: Which language should you use? + +Of the many programming languages out there, Python is definitely one of the hottest, driven mostly by the growth of data science. But for automation engineers, Bash always has been the primary script language to get the job done. So, what can Python do that Bash cannot? What are some Bash tasks that Python can't replace? Learn the differences by reading [_Bash vs. Python: Which language should you use?_][7] by Archit Modi. + +### How to use Ansible to document procedures + +Ansible is a very popular and powerful infrastructure-as-code tool. Many enterprises rely on it to automate tasks in their cloud platforms. Among the countless things Ansible can do, one of the least obvious is the one Marco Bravo explains: [_How to use Ansible to document procedures_][8]. + +### A dozen ways to learn Python + +Learning a programming language is always a daunting task. But Python has a number of features that make the learning process easy. Contributor Don Watkins offers [_A dozen ways to learn Python_][9] to take some of the stress out of the journey from getting started to becoming a Python expert. + +### What's the best Linux distribution for beginners? + +Everyone has probably heard of Android, the most widely used Linux-based mobile operating system. And many have heard of Red Hat Enterprise Linux (RHEL) and Ubuntu. Picking a Linux operating system can be difficult, but Lauren Pritchett's poll [_What's the best Linux distribution for beginners?_][10] might help you pick the right one based on the community's input. By the way, while you're there, make sure to vote for your favorite Linux distro. + +### My first contribution to open source: Impostor Syndrome + +Contributing to open source can change your life in positive ways, but you can't ignore the technical challenges around it. Have you ever heard someone say, "Hey, starting with open source is a piece of cake? Everyone can do it!" Probably not, since it's not exactly true. Galen Corey shares some of the challenges he confronted in [_My first contribution to open source: Impostor Syndrome_][11]. + +### What else do you need to get started? + +There are a lot of topics related to getting started with open source, which also means there are a lot of opportunities for Opensource.com to give back to new users by publishing articles to help them. Do you have ideas for other articles we should cover in 2020? Please share your suggestions in the comments, or even consider [writing an article][12] about your own open source journey. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/getting-started-open-source + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_pipe_red_hat_tower_building.png?itok=8ho3yi7L (pipe in a building) +[2]: https://opensource.com/article/19/10/why-switch-mac-linux +[3]: https://opensource.com/article/19/2/git-terminology +[4]: https://opensource.com/article/19/7/linux-laptop +[5]: https://opensource.com/article/19/3/getting-started-vim +[6]: https://opensource.com/article/19/7/create-pull-request-github +[7]: https://opensource.com/article/19/4/bash-vs-python +[8]: https://opensource.com/article/19/4/ansible-procedures +[9]: https://opensource.com/article/19/8/dozen-ways-learn-python +[10]: https://opensource.com/article/19/10/linux-distribution-beginners +[11]: https://opensource.com/article/19/11/my-first-open-source-contribution-impostor-syndrome +[12]: https://opensource.com/how-submit-article From 2a6dfeb2fa9796231196f4725847e447fe4652b1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 2 Jan 2020 00:54:44 +0800 Subject: [PATCH 0049/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200101=209=20?= =?UTF-8?q?cheat=20sheets=20and=20guides=20to=20enhance=20your=20tech=20sk?= =?UTF-8?q?ills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md --- ... and guides to enhance your tech skills.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md diff --git a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md new file mode 100644 index 0000000000..fb9d954ab5 --- /dev/null +++ b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (9 cheat sheets and guides to enhance your tech skills) +[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +9 cheat sheets and guides to enhance your tech skills +====== +Kick off the new year with our latest programming cheat sheets and +guides for people of all skill levels. Take our poll to let us know what +you'd like to see next! +![a checklist for a team][1] + +Cheat sheets are perfect for the new coder just starting out on the command line. However, even the most experienced programmers need to lean on references every once in a while. If that pesky keyboard shortcut is just at the tip of your finger, a cheat sheet is perfect to have nearby. Here’s a roundup of our downloadable guides that will set you up for success in 2020. + +### Cheat sheets + +#### [Markdown][2] + +Markdown is not just for coders. Anyone can use it to help bring syntax and structure to a plain text document. This cheat sheet provides Markdown foundations using the CommonMark specification. It also includes syntax for GitHub and GitLab.  + +#### [Linux permissions and users][3] + +Keep commands for managing users close at hand with this Linux cheat sheet. Quickly learn how to add users, delete users, show history, and set permissions. + +#### [Bash][4] + +Once you know Bash, the possibilities at the command line are endless. Our Bash cheat sheet helps you become more efficient with keyboard shortcuts. Before you know it, you'll be running scripts in your sleep (literally).   + +#### [Linux common commands][5] + +It's no wonder that our cheat sheet for common Linux commands is so popular. This cheat sheet is packed with the essentials to get started with installing software and navigating file systems. Print this one out for yourself and your colleagues. + +#### [Microservices][6] + +It seems like everyone is talking about microservices and for good reason. Microservices make applications modular so that they are easier to build and maintain. It's no longer just a buzzword with this cheat sheet. Get to know important terms and learn more about the fundamentals of microservices in [A guide to open source for microservices][7]. + +#### [Java][8] + +This cheat sheet is ideal for beginner and intermediate Java programmers. It includes important context along with code for handling imports, variables, classes, and more. + +#### [pip][9] + +Programmers love using pip commands to help install, manage, and use Python software packages. However, pip can do much more than that. This cheat sheet will teach you how to build wheels and record packages. + +### Guides + +#### [7 essential PyPI libraries][10] + +This collection of Python tutorials will help you learn how to write extensions faster, format your code, automate tests, ensure code consistency, and more using PyPI libraries.  + +#### [Getting started with Kubernetes][11] + +In this approachable guide, author [Scott McCarty][12] uses an unexpected analogy to explain the value of Kubernetes and the steps to get started.  + +* * * + +We'd like to hear from you: Do you have an idea for a new cheat sheet or guide? Take our poll and choose from one of the options, or let us know in the comments. Check out all of our downloads [here][13]. Get alerts about new cheat sheets by [signing up][14] for our email newsletter. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cheat-sheets-guides + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://opensource.com/downloads/cheat-sheet-markdown +[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet +[4]: https://opensource.com/downloads/bash-cheat-sheet +[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[6]: https://opensource.com/downloads/microservices-cheat-sheet +[7]: https://opensource.com/article/19/11/microservices-cheat-sheet +[8]: https://opensource.com/downloads/java-cheat-sheet +[9]: https://opensource.com/downloads/pip-cheat-sheet +[10]: https://opensource.com/downloads/7-essential-pypi-libraries +[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook +[12]: https://opensource.com/users/fatherlinux +[13]: https://opensource.com/downloads/cheat-sheets +[14]: https://opensource.com/email-newsletter From 255f8986cce56ee11ddf7619fc2d4fc2c8b40b88 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 2 Jan 2020 08:43:13 +0800 Subject: [PATCH 0050/3057] translated --- ...leased With GUI Rework and New Features.md | 112 ------------------ ...leased With GUI Rework and New Features.md | 111 +++++++++++++++++ 2 files changed, 111 insertions(+), 112 deletions(-) delete mode 100644 sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md create mode 100644 translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md diff --git a/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md deleted file mode 100644 index 665f5f585a..0000000000 --- a/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md +++ /dev/null @@ -1,112 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Darktable 3 Released With GUI Rework and New Features) -[#]: via: (https://itsfoss.com/darktable-3-release/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Darktable 3 Released With GUI Rework and New Features -====== - -Here’s the Christmas gift for the photography enthusiasts. Darktable 3.0 has just released. - -[Darktable][1] is one of the [best applications for editing RAW images on Linux][2]. You can consider it as a [free and open source alternative to Adobe Lightroom][3]. - -Darktable 3 is a major new release with tons of feature improvements and a complete rework of the user interface. The GUI is now completely controlled by GTK+ CSS rules, which makes the whole GUI themable. There are eight themes available by default. - -With the help of over 3000 commits and 553 pull requests, the new release has fixed 66 bugs and added many new features. - -Let’s see what features this new release brings. - -### New features in Darktable 3.0 - -![Darktable 3.0 Screenshot][4] - -Here are the highlighted new features: - - * Reworked UI - * A new module for handling 3D RGB Lut transformations - * Many improvements to the ‘denoise (profiled)’ module - * A new ‘culling’ mode and timeline view added - * Many improvements to the ‘denoise (profiled)’ module - * New tone equalizer’ basic and filmic RGB modules - * Better 4K/5K display support - * Undo/redo support for more operations - * Many code optimizations for CPU and SSE paths - * Support for exporting to Google Photos - * More camera support, white balance presets, and noise profiles - * Plenty of bug fixes and feature improvements - - - -You can read about all the changes in the [release notes on GitHub][5]. - -### Installing Darktable 3.0 on Linux - -Let’s see how to get the latest Darktable release. - -#### Installing Darktable 3.0 on Ubuntu-based distributions - -Darktable is available in Ubuntu but you won’t get the latest release immediately. For the LTS version, it may take months before you have this version update. - -Worry not! Darktable provides its [own PPA][6] to install the latest release on Ubuntu-based distributions. - -Unfortuntaley, That Darktable PPA has not been updated with the new release. - -Worry not (again)! Thanks to our friend [Ji M of Ubuntu Handbook][7], we have an unofficial PPA for easily installing Darktable 3.0 on Ubuntu and other Ubuntu based distributions. - -Open a terminal and use these commands one by one: - -``` -sudo add-apt-repository ppa:ubuntuhandbook1/darktable -sudo apt update -sudo apt install darktable -``` - -#### Uninstall Darktable 3 - -To remove Darktable installed via this PPA, you can first uninstall the application: - -``` -sudo apt remove darktable -``` - -And then [remove the PPA][8] as well: - -``` -sudo add-apt-repository -r ppa:ubuntuhandbook1/darktable -``` - -#### Installing Darktable on other Linux distributions - -You may wait for your distribution to provide this new release through the software manager. - -You may also download the tarball or the entire source code from the GitHub release page (it’s at the bottom of the page). - -[Download Darktable 3.0][5] - -With Darktable 3, you can edit your holiday pictures better :) - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/darktable-3-release/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://www.darktable.org/ -[2]: https://itsfoss.com/raw-image-tools-linux/ -[3]: https://itsfoss.com/open-source-photoshop-alternatives/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/darktable_3_screenshot.jpg?ssl=1 -[5]: https://github.com/darktable-org/darktable/releases/tag/release-3.0.0 -[6]: https://launchpad.net/~pmjdebruijn/+archive/ubuntu/darktable-release -[7]: http://ubuntuhandbook.org/index.php/2019/12/install-darktable-3-0-0-ubuntu-18-04-19-10/ -[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ diff --git a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md new file mode 100644 index 0000000000..d49467438d --- /dev/null +++ b/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Darktable 3 Released With GUI Rework and New Features) +[#]: via: (https://itsfoss.com/darktable-3-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Darktable 3 发布,带来重做的 GUI 及新的功能 +====== + +这是给摄影爱好者的圣诞节礼物。Darktable 3.0 刚刚发布了。 + +[Darktable][1] 是[在 Linux 上编辑 RAW 图像的最佳应用之一] [2]。你可以将其视为 [Adobe Lightroom 的免费开源替代品][3]。 + +Darktable 3 是一个主版本更新,它有许多功能改进和对用户界面的重做。现在,GUI 完全由 GTK+ CSS 规则控制,这使得整个 GUI 都可定制主题。默认它有八个主题。 + +借助 3000 多个提交和 553 个拉取请求,新版本修复了 66 个 bug 并添加了许多新功能。 + +让我们看看这个新版本带来了什么功能。 + +### Darktable 3.0 的新功能 + +![Darktable 3.0 Screenshot][4] + +以下是重要的新功能: + + *重做的 UI +  * 用于处理 3D RGB Lut 变换的新模块 +  * 对“降噪(轮廓化)”模块进行了许多改进 +  * 添加了新的“剔除”模式和时间轴视图 +  * 对“降噪(轮廓化)”模块进行了许多改进 +  * 新色调均衡器的基本和电影 RGB 模块 +  * 更好的 4K/5K 显示支持 +  * 撤消/重做支持更多操作 +  * 针对 CPU 和 SSE 路径的许多代码优化 +  * 支持导出到 Google 相册 +  * 更多的相机支持,白平衡预设和噪点配置 +  * 大量的 bug 修复和功能改进 + + +你可以在 [GitHub 发行说明][5]中了解所有更改。 + +### 在 Linux 上安装 Darktable 3.0 + +让我们看看如何获​​取最新的 Darktable 版本。 + +#### 在基于 Ubuntu 的发行版上安装 Darktable 3.0 + +Ubuntu 仓库中有 Darktable,但你不能得到最新的版本。对于 LTS 版本,它的更新可能需要几个月的时间。 + +不用担心!Darktable 提供了[自己的 PPA][6],来在基于 Ubuntu 的发行版上安装最新版本。 + +不幸的是,此 Darktable PPA 尚未随新版本更新。 + +不用担心了!多亏了我们的朋友 [Ubuntu Handbook 的 Ji M][7],我们有一个非正式的 PPA,可以轻松地在 Ubuntu 和其他基于 Ubuntu 的发行版上安装 Darktable 3.0。 + +打开终端,并使用这些命令: + +``` +sudo add-apt-repository ppa:ubuntuhandbook1/darktable +sudo apt update +sudo apt install darktable +``` + +#### 卸载 Darktable 3 + +要删除通过此 PPA 安装的 Darktable,你可以先卸载该应用: + +``` +sudo apt remove darktable +``` + +接着[删除 PPA][8]: + +``` +sudo add-apt-repository -r ppa:ubuntuhandbook1/darktable +``` + +#### 在其他 Linux 发行版上安装 Darktable + +你可以等待到你的发行版的软件管理器提供新版本。 + +你也可以从 GitHub 发布页面(位于页面底部)下载 tarball 或所有源代码。 + +[Download Darktable 3.0][5] + +使用 Darktable 3,你可以更好地编辑自己的假期照片:) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/darktable-3-release/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.darktable.org/ +[2]: https://itsfoss.com/raw-image-tools-linux/ +[3]: https://itsfoss.com/open-source-photoshop-alternatives/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/darktable_3_screenshot.jpg?ssl=1 +[5]: https://github.com/darktable-org/darktable/releases/tag/release-3.0.0 +[6]: https://launchpad.net/~pmjdebruijn/+archive/ubuntu/darktable-release +[7]: http://ubuntuhandbook.org/index.php/2019/12/install-darktable-3-0-0-ubuntu-18-04-19-10/ +[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ From abcc2e9b79882bca422e20936f7a0caa3681cd07 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 2 Jan 2020 08:52:12 +0800 Subject: [PATCH 0051/3057] translating --- .../20200101 Signal- A Secure, Open Source Messaging App.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md index 4dd4037627..fbb741b9f5 100644 --- a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md +++ b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 00ba46b1be03c83e253938630ab30d9b0260a8fa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 2 Jan 2020 09:24:31 +0800 Subject: [PATCH 0052/3057] Rename sources/tech/20200101 How to get started with open source in 2020.md to sources/talk/20200101 How to get started with open source in 2020.md --- .../20200101 How to get started with open source in 2020.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200101 How to get started with open source in 2020.md (100%) diff --git a/sources/tech/20200101 How to get started with open source in 2020.md b/sources/talk/20200101 How to get started with open source in 2020.md similarity index 100% rename from sources/tech/20200101 How to get started with open source in 2020.md rename to sources/talk/20200101 How to get started with open source in 2020.md From 92a023f51b15e6d41814794fc7360de6694c6289 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 09:40:06 +0800 Subject: [PATCH 0053/3057] PRF @wxy --- ...27 10 resources to boost your Git skills.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20191227 10 resources to boost your Git skills.md b/translated/tech/20191227 10 resources to boost your Git skills.md index eee2be8848..66f23f3e4e 100644 --- a/translated/tech/20191227 10 resources to boost your Git skills.md +++ b/translated/tech/20191227 10 resources to boost your Git skills.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (10 resources to boost your Git skills) @@ -10,22 +10,22 @@ 10 个提高 Git 技能的资源 ====== -> 年末总结一下 Git 的最佳表现。以下是在新的一年中以新奇的方式使用 Git 的十篇文章。 +> 年末总结一下 Git 的最佳表现。以下是告诉你可以在新的一年中以新奇的方式使用 Git 的十篇文章。 -![open source button on keyboard][1] +![](https://img.linux.net.cn/data/attachment/album/202001/02/093934q5ifu46u4nuq4lgi.jpg) -快到 2019 年底了,是时候回顾一下我们今年发表的有关 Git 的前 10 篇文章了。 +2019 年过去了,是时候回顾一下我们(opensource.com)今年发表的有关 Git 的前 10 篇文章了。 这些文章包括从用例和教程到一些非常有趣的(甚至有些非常规的)使用 Git 的方法。所有这些文章都可以帮助你提高 Git 技能,但是,如果你确实需要 Git 入门介绍,请务必查看我们的《[Git 入门:术语入门][2]》文章,并下载我们的 [Git 备忘单][3]。 -1. Molly de Blanc 写的《[GNOME 如何使用 Git][4]》考察了 GNOME 项目采用的自托管 GitLab 实例的做法,该实例作为 GNOME 项目集中保存为 GNOME 做出的贡献的位置。De Blanc 从事于非编码职位,因此她的文章还探讨了切换到 GitLab 如何使主要角色不是编写代码的贡献者受益。 +1. Molly de Blanc 写的《[GNOME 项目如何使用 Git][4]》考察了 GNOME 项目采用的自托管 GitLab 实例的做法,该实例作为 GNOME 项目集中保存对 GNOME 做出的贡献的位置。De Blanc 从事于非编码职位,因此她的文章还探讨了切换到 GitLab 如何使主要角色不是编写代码的贡献者受益。 2. Ahmad Awais 写的《[Emoji-Log:编写 Git 提交信息的新方法][5]》解释了如何使用 Emoji-Log(一种直白的、开源的 Git 提交日志标准)来编写更好、更用户友好的 Git 提交消息。本文概述了 Emoji-Log 背后的理论以及可添加到 `.bashrc`、`.zshrc` 或 `.gitconfig` 中的配置示例,以便你快速开始使用 Emoji-Log。 3. 在《[用 Git 管理你的每日行程][6]》中,Seth Kenlon 解释了如何使用 Git 来管理日历。通过结合 Org 模式、Git 和其他一些工具,Kenlon 描述了如何创建可在设备之间同步的基于 Git 的日历工作流。 4. 《[用 Git 作为聊天应用的后端][7]》,Seth Kenlon 探索了另一种使用 Git 的非常规方式。在本文中,他探讨了 GIC,这是一个用 Node.js 编写的聊天客户端,其中 Git 用作后端数据库。GIC 是一个概念验证模型,不是供产品环境使用的东西,但是它提供了一个有趣的示例,说明了使用 Git 的真正独特方法。 5. Alan Formy-Duval 的《[Git 学习实用练习][8]》是一份他为提高 Git 技能而努力的编年史。他分享了自己的经验,以使其他人受益于他所学,而 Git 新手将从这篇对 Git 核心功能的出色概述中受益匪浅。 -6. 《[用 Git 帮助写作者更好地完成工作][9]》的作者 Seth Kenlon 着眼于写作者如何从基于 Git 的工作流中受益。本文介绍了如何使用 Git 和 Atom 利用 Markdown 进行书写。通过遵循本文中的示例,写作者可以轻松地将复杂的修订控制系统添加到其编写工作流中。 -7. Sachin Patil 在《[如何使用 Magit 管理 Git 项目][10]》中,解释了如何使用 Emacs 的 Magit 扩展来管理 Git 存储库。本文提供了有关如何在 Emacs 中执行一系列关键 Git 任务的清晰示例。这些示例由说明各种任务的屏幕截图支持。 -8. 《[把“点文件”放到版本控制中][11]》的作者 Matthew Broberg 演示了如何使用 Git 存储放在主目录中的点文件。将你的点文件存储在 Git 存储库中,可以更轻松地在计算机之间共享系统配置,并且,如果你愿意的话,也可以与其他人共享配置。这篇文章也有什么不要共享的警告,因为共享错误的点文件会暴露给其他人。 +6. 《[用 Git 帮助写作者更好地完成工作][9]》的作者 Seth Kenlon 着眼于写作者如何从基于 Git 的工作流中受益。本文介绍了如何使用 Git 和 Atom 利用 Markdown 进行书写。通过遵循本文中的示例,写作者可以轻松地将复杂的版本控制系统添加到其编写工作流中。 +7. Sachin Patil 在《[如何使用 Magit 管理 Git 项目][10]》中,解释了如何使用 Emacs 的 Magit 扩展来管理 Git 存储库。本文提供了有关如何在 Emacs 中执行一系列关键 Git 任务的清晰示例。这些示例带有说明各种任务的屏幕截图。 +8. 《[把“点文件”放到版本控制中][11]》的作者 Matthew Broberg 演示了如何使用 Git 存储放在主目录中的点文件。将你的点文件存储在 Git 存储库中,可以更轻松地在计算机之间共享系统配置,并且,如果你愿意的话,也可以与其他人共享配置。这篇文章也有不要共享哪些文件的警告,因为共享错误的点文件会将其暴露给其他人。 9. Austin Dewey 的《[4 种用于 Git 加密的机密管理工具][12]》在本文中比较了 Git-crypt、BlackBox、SOPS 和 Transcrypt,研究了在 Git 中存储机密的工具。本文涵盖四个主要领域:支持的加密类型、每个项目的目标、项目的工作流和差异以及其他功能。 10. Seth Kenlon 的《[使用 Git 管理 Git 服务器][13]》解释了如何使用 Gitolite 管理 Git 服务器。Gitolite 是使用 Git 来管理 Git 服务器的“管理杂项的后端应用程序”。本文演示了如何安装、配置和使用 Gitolite,并提供了清晰的示例详细说明了该过程的每个步骤。 @@ -36,7 +36,7 @@ via: https://opensource.com/article/19/12/git-resources 作者:[Joshua Allen Holm][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c4bb1456b9281b4b79bf269c88c276c1f3e9bdc4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 09:40:56 +0800 Subject: [PATCH 0054/3057] PUB @wxy https://linux.cn/article-11737-1.html --- .../tech/20191227 10 resources to boost your Git skills.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20191227 10 resources to boost your Git skills.md b/translated/tech/20191227 10 resources to boost your Git skills.md index 66f23f3e4e..8dc63c18bf 100644 --- a/translated/tech/20191227 10 resources to boost your Git skills.md +++ b/translated/tech/20191227 10 resources to boost your Git skills.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11737-1.html) [#]: subject: (10 resources to boost your Git skills) [#]: via: (https://opensource.com/article/19/12/git-resources) [#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) From 2cb00c83640323ac3f982963c3e3f39b4b30c657 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 10:30:40 +0800 Subject: [PATCH 0055/3057] PRF @robsean --- ... chapter template in LibreOffice Writer.md | 64 +++++++++---------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md index c73f774162..be6ce008f5 100644 --- a/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md +++ b/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md @@ -1,31 +1,33 @@ 如何在 LibreOffice Writer 中创建一个电子书章节模板 ====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_colorbooks.png?itok=vNhsYYyC) -对于很多人来说,使用 word 程序来写和发布一本电子书是一种最好的,最容易的,最熟悉的方法。但是,启动你的 word 程序和打字是不够的--你需要遵循一种格式。 +> 将电子书分成几章,创建电子书会更容易。这是设置模板的分步指南。 -这就是模板的来源。一个模板确保你的电子书有一个一致的外观和体验。幸运的是,创建一个模板是快速和容易的,并你在其上花费的时间和努力将给你一本更好感官的书。 +![](https://img.linux.net.cn/data/attachment/album/202001/02/102817vmflleeemehetblt.jpg) -在这片文章中,我将陪伴你走过如何使用 LibreOffice Writer 创建一个简单的用于写一本电子书的各个章节的模板。你可以将这个模板用于 PDF 和 EPUB 书籍,并假以修改来满足你的需要。 +对于很多人来说,使用 word 程序来撰写和发布一本电子书是一种最好的、最容易的、最熟悉的方法。但是,启动你的 word 程序和打字是不够的 —— 你需要遵循一种格式。 + +这就是模板的来源。一个模板确保你的电子书有一个一致的外观和体验。幸运的是,创建模板是快速和容易的,并你在其上花费的时间和努力将带给你一本更好感观的书。 + +在这篇文章中,我将陪伴你走过如何使用 LibreOffice Writer 创建一个简单的模板,可以用于一本电子书的各个章节。你可以将这个模板用于 PDF 和 EPUB 书籍,并加以修改来满足你的需要。 ### 我的方法 -为什么我聚焦于为一个章节创建一个模板,而不是为一整本书创建一个模板?因为编写和管理单独的章节比编写和管理单个庞大而僵化的文档更容易。 +为什么我着重于为一个章节创建一个模板,而不是为一整本书创建一个模板?因为编写和管理单独的章节比编写和管理单个庞大而僵化的文档更容易。 -通过聚焦于单独的章节,你可以聚焦于你需要编写的东西。你可以容易地向各处移动这些章节,给审阅者发单独一章节比发你完整的原稿更简单而高效。当你写完一章后,你可以简单地把你的章节拼凑在一起来出版这本书(我将在下面讨论如何做到这一点)。但是不要觉得你被这种方法所束缚 --如果你更喜欢在单个文件中编写,简单地调整在这篇文章中描述的步骤来做做成这样。 +通过关注于单独的章节,你可以专心于你需要编写的东西。你可以很容易地四处移动这些章节,给审阅者发单独一章节比发送你的完整原稿更简单而高效。当你写完一章后,你可以简单地把你的章节拼凑在一起来出版这本书(我将在下面讨论如何做到这一点)。但是不要觉得你被这种方法所束缚 —— 如果你更喜欢在单个文件中编写,简单地调整在这篇文章中描述的步骤就行。 让我们开始吧。 ### 设置页面 -仅当你计划发布你的电子书为一本 PDF 书时,这是很重要的。设置页面意味着你的书将不包含大量的穿越屏幕的让眼睛疲劳的文本。 +仅当你计划发布你的电子书为一本 PDF 书时,这是很重要的。设置页面意味着你的书将不包含大量的跨越屏幕的让眼睛疲劳的文本。 -选择 **格式 > 页面** 来打开 **页面样式** 窗口。我的 PDF 电子书通常是 5x8 英寸高(大约 13x20cm ,对于我们这些生活在米制世界的人来说)。我也设置页边距为半英寸(约 1.25 cm)。这些是我较喜欢的尺寸;使用任何适合你的尺寸。 +选择 **格式 > 页面** 来打开 **页面样式** 窗口。我的 PDF 电子书通常是 5x8 英寸高(大约 13x20cm ,对于我们这些生活在米制世界的人来说)。我也设置页边距为半英寸(约 1.25 cm)。这些是我较喜欢的尺寸;你可以使用任何适合你的尺寸。 ![LibreOffice Page Style window][2] - -在 LibreOffice Writer 中的页面样式窗口让你设置页边距和页格式。 +*在 LibreOffice Writer 中的页面样式窗口让你设置页边距和页格式。* 接下来,添加页脚以显示页码。保持页面样式窗口打开着,并单击 **页脚** 选项卡。选择 **在页脚上** 并单击 **确定** 。 @@ -33,15 +35,13 @@ ### 设置你的样式 -像模板本身一样,样式为你的文档提供一种一致的外观和体验。如果你想更改一个标题的字体或大小,例如,你只需要在一个地方完成它,而不是手动应用格式化到每个标题。 - -标准化的 LibreOffice 模板带有许多样式,你可以调整它们以适应你的需要。为此,按 **F11** 来打开 **样式和格式** 窗口。 +像模板本身一样,样式为你的文档提供一种一致的外观和体验。如果你想更改一个标题的字体或大小,例如,你只需要在一个地方完成它,而不是手动应用格式化到每个标题。 +标准化的 LibreOffice 模板带有许多样式,你可以调整它们以适应你的需要。为此,按 `F11` 来打开 **样式和格式** 窗口。 ![LibreOffice styles and formatting][4] - -使用样式和格式窗口更改字体和其它细节。 +*使用样式和格式窗口更改字体和其它细节。* 在一个样式上右键单击,并选择 **修改** 来编辑它。 这里是我在每本中使用的主要样式: @@ -56,51 +56,45 @@ ![LibreOffice styles in action][6] +*这是当我们应用到电子书内容时的一个选择的样式外观。* -这是当我们应用到电子书内容时的一个选择的样式外观。 +对于大多数书来说,这通常是最小要求。可以随便更改字体和空格来适应你的要求。 -对于大多数书来说,这通常是最小量要求。可以随便更改字体和空格来适应你的要求。 - -根据你正在编写书的类型,你可能也想创建或修改项目符合样式,以及数字列表,引号、代码示例,数字符号等等。只需要记住始终如一地使用字体以及其大小。 +根据你正在编写书的类型,你可能也想创建或修改项目符合样式,以及数字列表、引号、代码示例、数字符号等等。只需要记住始终如一地使用字体以及其大小。 ### 保存你的模板 -选择 **文件 > 另存为** 。在保持对话框中,从格式列表中选择 _ODF 文本文档模板 (.ott)_ 。这将保存模板为一个模板,以后你可以快速调用该模板。 +选择 **文件 > 另存为** 。在保持对话框中,从格式列表中选择 “ODF 文本文档模板 (.ott)” 。这将保存模板为一个模板,以后你可以快速调用该模板。 -保存模板的最佳位置是 LibreOffice 模板文件夹。例如,在 Linux 中,那是在你的 **/home** 目录下,在 . **config/libreoffice/4/user/template** 下。 +保存模板的最佳位置是 LibreOffice 模板文件夹。例如,在 Linux 中,那是在你的家目录下,在 `.config/libreoffice/4/user/template` 下。 ### 编写你的书 -在你开始编写前,在你的计算机上创建一个文件夹,它将为你的书保存所有的文件--章节,图像,笔记等等。 +在你开始编写前,在你的计算机上创建一个文件夹,它将为你的书保存所有的文件 —— 章节、图像、笔记等等。 当你准备编写时,启动 LibreOffice Writer 并选择 **文件 > 新建 > 模板** 。然后从列表中选择你的模板,并单击 **打开**。 - ![LibreOffice Writer template list][8] - -从你在 LibreOffice Writer 中设置的列表中选择你的模板,并开始编写。 +*从你在 LibreOffice Writer 中设置的列表中选择你的模板,并开始编写。* 然后用一个描述性名称保存文档。 -建议使用像 _章节 1_ 和 _章节 2_ 这样的惯例--在某些时候,你可能决定重新编排你的章节,当你尝试管理这些章节时,它可能会变得混乱。然而,你可以在文件名称中放置章节数字,像 _章节 1_ 或 _Ch1 。很容易重命名一个文件,_ 。如果你完成重新排版书的章节,像这样重命名更容易。 +建议使用像 “第 1 章” 和 “第 2 章” 这样的惯例 —— 在某些时候,你可能决定重新编排你的章节,当你尝试管理这些章节时,它可能会变得混乱。然而,你可以在文件名称中放置章节数字,像 “第 1 章” 或 “一” 。如果你最后要重新排列全书的章节,像这样重命名更容易。 -别再碍事,开始编写。记住在模板中使用样式来格式化文本--这就是为什么你要创建模板,对吧? +无需赘言,开始编写吧。记住在模板中使用样式来格式化文本 —— 这就是为什么你要创建模板,对吧? ### 发布你的电子书 -在完成编写一堆章节后,并准备发布它们时,创建一个主控文档。把一个主控文档作为你所编写章节的一个容器。使用一个主控文档,你可以快速地组装你的书,并任意重新排序你的章节。LibreOffice 帮助提供使用[主控文档][9]的详细信息。 +在完成编写一堆章节后,并准备发布它们时,创建一个主控文档。把一个主控文档作为你所编写章节的一个容器。使用一个主控文档,你可以快速地组装你的书,并任意重新排序你的章节。LibreOffice 的帮助提供了使用[主控文档][9]的详细信息。 -假设你想生成一个 PDF ,不要只是单击**直接导出到 PDF** 按钮。这将创建一个相当不错的 PDF ,但是你可能想优化它。为此,选择 **文件 > 导出为 PDF** ,并在 PDF 窗口中轻微调整。你可以在 [LibreOffice Writer 文档][10] 中学到更多东西。 +假设你想生成一个 PDF ,不要只是单击**直接导出到 PDF** 按钮。这将创建一个相当不错的 PDF ,但是你可能想优化它。为此,选择 **文件 > 导出为 PDF** ,并在 PDF 选项窗口中轻微调整。你可以在这篇 [LibreOffice Writer 文档][10] 中学到更多东西。 -如果你想创建一个 EPUB 而不是 一个PDF ,或者除了一个 PDF 以外,另外创建一个 EPUB,安装 [Writer2EPUB][11] 扩展。Opensource.com 的 Bryan Behrenshausen 为这个扩展[分享一些有用的说明][12] 。 +如果你想创建一个 EPUB 而不是一个 PDF,或者除了一个 PDF 以外,另外创建一个 EPUB,请安装 [Writer2EPUB][11] 扩展。Opensource.com 的 Bryan Behrenshausen 为这个扩展[分享了一些有用的说明][12] 。 ### 结束语 -我们在这里创建的模板是极简单的,但是你将其用于一本简单的书,或者作为构建一个复杂模板的起点。不管怎样,这个模板都会让你快速地开始编写和发布你的电子书。 - -### 关于作者About The Author -Scott Nesbitt ;我是一个长期使用自由开放源码软件的人;写各种东西都是为了玩;盈利。我不太看重我自己;我做我自己的特效。你可以在网上的一些高质量的大型组装找到我的踪迹。 +我们在这里创建的模板是极简单的,但是你可以将其用于一本简单的书,或者作为构建一个复杂模板的起点。不管怎样,这个模板都会让你快速地开始编写和发布你的电子书。 -------------------------------------------------------------------------------- @@ -108,7 +102,7 @@ via: https://opensource.com/article/17/10/creating-ebook-chapter-template-libreo 作者:[Scott Nesbitt][a] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 26114119df3e2a5ed4823c1060b9263ee2b4da91 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 10:33:56 +0800 Subject: [PATCH 0056/3057] PUB @robsean https://linux.cn/article-11738-1.html --- ... to create an e-book chapter template in LibreOffice Writer.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171018 How to create an e-book chapter template in LibreOffice Writer.md (100%) diff --git a/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/published/20171018 How to create an e-book chapter template in LibreOffice Writer.md similarity index 100% rename from translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md rename to published/20171018 How to create an e-book chapter template in LibreOffice Writer.md From 52ca2c8a035834c86f048ef314f6bc937173d100 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 22:24:00 +0800 Subject: [PATCH 0057/3057] PRF @geekpi --- ...leased With GUI Rework and New Features.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md index d49467438d..3ae5c19e01 100644 --- a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md +++ b/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Darktable 3 Released With GUI Rework and New Features) [#]: via: (https://itsfoss.com/darktable-3-release/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Darktable 3 发布,带来重做的 GUI 及新的功能 +Darktable 3 发布,带来重新打造的 UI 及新的功能 ====== -这是给摄影爱好者的圣诞节礼物。Darktable 3.0 刚刚发布了。 +> 这是给摄影爱好者的圣诞节礼物。Darktable 3.0 刚刚发布了。 -[Darktable][1] 是[在 Linux 上编辑 RAW 图像的最佳应用之一] [2]。你可以将其视为 [Adobe Lightroom 的免费开源替代品][3]。 +[Darktable][1] 是[在 Linux 上编辑 RAW 图像的最佳应用之一][2]。你可以将其视为 [Adobe Lightroom 的自由开源替代品][3]。 -Darktable 3 是一个主版本更新,它有许多功能改进和对用户界面的重做。现在,GUI 完全由 GTK+ CSS 规则控制,这使得整个 GUI 都可定制主题。默认它有八个主题。 +Darktable 3 是一个主版本更新,它带来了大量的功能改进和重新打造的用户界面。现在,GUI 完全由 GTK+ CSS 规则所控制,这使得整个 GUI 都可定制主题。它默认有八个主题。 借助 3000 多个提交和 553 个拉取请求,新版本修复了 66 个 bug 并添加了许多新功能。 @@ -26,19 +26,18 @@ Darktable 3 是一个主版本更新,它有许多功能改进和对用户界 以下是重要的新功能: - *重做的 UI -  * 用于处理 3D RGB Lut 变换的新模块 -  * 对“降噪(轮廓化)”模块进行了许多改进 -  * 添加了新的“剔除”模式和时间轴视图 -  * 对“降噪(轮廓化)”模块进行了许多改进 -  * 新色调均衡器的基本和电影 RGB 模块 -  * 更好的 4K/5K 显示支持 -  * 撤消/重做支持更多操作 -  * 针对 CPU 和 SSE 路径的许多代码优化 -  * 支持导出到 Google 相册 -  * 更多的相机支持,白平衡预设和噪点配置 -  * 大量的 bug 修复和功能改进 - +* 重新打造的 UI +* 用于处理 3D RGB Lut 变换的新模块 +* 对“降噪(轮廓化)”模块进行了许多改进 +* 添加了新的“剔除”模式和时间轴视图 +* 对“降噪(轮廓化)”模块进行了许多改进 +* 新色调均衡器的基本和电影 RGB 模块 +* 更好的 4K/5K 显示支持 +* 撤消/重做支持更多操作 +* 针对 CPU 和 SSE 路径的许多代码优化 +* 支持导出到 Google 相册 +* 支持更多的相机,白平衡预设和噪点配置 +* 大量的 bug 修复和功能改进 你可以在 [GitHub 发行说明][5]中了解所有更改。 @@ -48,9 +47,9 @@ Darktable 3 是一个主版本更新,它有许多功能改进和对用户界 #### 在基于 Ubuntu 的发行版上安装 Darktable 3.0 -Ubuntu 仓库中有 Darktable,但你不能得到最新的版本。对于 LTS 版本,它的更新可能需要几个月的时间。 +Ubuntu 仓库中有 Darktable,但你不能得到马上最新的版本。对于 LTS 版本,它的更新可能需要几个月的时间。 -不用担心!Darktable 提供了[自己的 PPA][6],来在基于 Ubuntu 的发行版上安装最新版本。 +不用担心!Darktable 提供了[自己的 PPA][6] 来在基于 Ubuntu 的发行版上安装最新版本。 不幸的是,此 Darktable PPA 尚未随新版本更新。 @@ -84,7 +83,7 @@ sudo add-apt-repository -r ppa:ubuntuhandbook1/darktable 你也可以从 GitHub 发布页面(位于页面底部)下载 tarball 或所有源代码。 -[Download Darktable 3.0][5] +- [下载 Darktable 3.0][5] 使用 Darktable 3,你可以更好地编辑自己的假期照片:) @@ -95,7 +94,7 @@ via: https://itsfoss.com/darktable-3-release/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5fdaaa1d3fa3a703208db55ac2d262a91ac55f6f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 22:27:42 +0800 Subject: [PATCH 0058/3057] PUB @geekpi https://linux.cn/article-11741-1.html --- ...6 Darktable 3 Released With GUI Rework and New Features.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191226 Darktable 3 Released With GUI Rework and New Features.md (98%) diff --git a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/published/20191226 Darktable 3 Released With GUI Rework and New Features.md similarity index 98% rename from translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md rename to published/20191226 Darktable 3 Released With GUI Rework and New Features.md index 3ae5c19e01..b7c6b53cbb 100644 --- a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md +++ b/published/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11741-1.html) [#]: subject: (Darktable 3 Released With GUI Rework and New Features) [#]: via: (https://itsfoss.com/darktable-3-release/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From b4c1425446b4f16db2531876f3a2168bcad759c4 Mon Sep 17 00:00:00 2001 From: nacyro Date: Thu, 2 Jan 2020 22:33:17 +0800 Subject: [PATCH 0059/3057] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...icles to enhance your security aptitude.md | 92 ------------------- ...icles to enhance your security aptitude.md | 91 ++++++++++++++++++ 2 files changed, 91 insertions(+), 92 deletions(-) delete mode 100644 sources/tech/20191230 10 articles to enhance your security aptitude.md create mode 100644 translated/tech/20191230 10 articles to enhance your security aptitude.md diff --git a/sources/tech/20191230 10 articles to enhance your security aptitude.md b/sources/tech/20191230 10 articles to enhance your security aptitude.md deleted file mode 100644 index ae6c1a9aaf..0000000000 --- a/sources/tech/20191230 10 articles to enhance your security aptitude.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (nacyro) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 articles to enhance your security aptitude) -[#]: via: (https://opensource.com/article/19/12/security-resources) -[#]: author: (Ben Cotton https://opensource.com/users/bcotton) - -10 articles to enhance your security aptitude -====== -Whether you're learning the first steps or looking to add to your -skills, there's something for you in Opensource.com's top 10 security -articles of 2019. -![A secure lock.][1] - -If security is a process (and it is), then it stands to reason that different projects (and contributors) are in different places. Some applications have years of security testing, with design done by people who have worked in information security for decades. Others are brand new projects by developers working on their first open source project. It comes as no surprise that Opensource.com's top security articles of 2019 represent this range of experience. We have articles that introduce basic security practices as well as deep dives into more advanced topics. - -Whether you're learning the first steps or looking to add to your skills acquired over a storied career, there's something for you in the top 10 security articles of 2019. - -### 7 steps to securing your Linux server - -Security is like a house: if the foundation is bad, the rest is at risk. Patrick H. Mullins' excellent _[7 steps to securing your Linux server][2]_ gets you started with basic security steps for Linux servers. Even if you have a lot of experience administering servers, this article provides a good checklist to make sure you have the basics covered. From there, you can begin adding additional layers of security. - -### Make Linux stronger with firewalls - -One of the seven steps to securing your server is enabling a firewall. But what _is_ a firewall, and how does it work? Seth Kenlon answers these questions and then describes in detail how to configure your firewall for better security in _[Make Linux stronger with firewalls][3]_. Using firewalld and Network Manager, you can set different firewall configurations for different networks. This allows you to have a trusting configuration on your home network, for example, and a more paranoid configuration on your favorite coffee shop's WiFi network. - -### Reducing security risks with centralized logging - -Once you've secured your system, you're not done: security is a process, not a state. Part of _keeping_ systems secure is keeping an eye on what goes on. One way to do that, especially with multiple systems, is to centralize your logging. In _[Reducing security risks with centralized logging][4]_, Hannah Suarez shares how to get started (she based this article on her lightning talk at FOSDEM '19). - -### Using GPG keys for SSH - -Most people who use key-based authentication for SSH use SSH keys. And why wouldn't you? It's right there in the name. These are perfectly fine from a security standpoint, but if you want to make some forms of key distribution and backup easier, there's another way. Brian Exelbierd's three-part series walks through _[How to enable SSH access with a GPG subkey][5]_, _[How to import existing SSH keys][6]_, and _[How to reduce your backup needs to a single key file][7]_. - -### Graphically manage SSH keys with Seahorse - -Using GPG for SSH keys isn't everyone's cup of tea, but that doesn't mean you're out of luck when it comes to key management. Seahorse is a graphical tool for managing SSH keys (and other authentication methods) that is included in the GNOME desktop. Alan Formy-Duval's [_Graphically manage SSH keys with Seahorse_][8], is particularly helpful to the novice user. - -### Security scanning your DevOps pipeline - -Containers are everywhere these days. But what's in them? Knowing that containers meet your security policies is an important part of staying secure. Fortunately, you can use open source tools to help automate compliance checking. Jessica Cherry's (formly Repka) [_Security scanning your DevOps pipeline_][9] is a step-by-step tutorial that shows you how to use the Jenkins build system and the Anchore inspection service to create a scanning pipeline for container images and registries. - -### 4 open source cloud security tools - -One of the great things about cloud services is that your data can be accessed from anywhere. One of the downsides to cloud services is that your data can be accessed from anywhere. If you're using "-as-a-Service" offerings, you want to make sure they're securely configured. Anderson Silva, Alison Naylor, Travis McPeak, and Rich Monk join forces to introduce [_4 open source cloud security tools_][10] to help improve security when using GitHub and AWS. If you're looking for accidentally committed secrets—or trying to prevent them from being committed in the first place—this article has tools you can use. - -### How to use OpenSSL: hashes, digital signatures, and more - -Much of information security is based on math: specifically, the cryptographic functions used to encrypt data and authenticate users or file contents. After providing an introduction in [_Getting started with OpenSSL: Cryptography basics_][11], Marty Kalin digs deeper into the details of _[How to use OpenSSL: Hashes, digital signatures, and more][12]_, explaining how to use the OpenSSL utility to explore these commonly used but uncommonly understood concepts. - -### Learn about computer security with the Raspberry Pi and Kali Linux - -Cheap hardware and open source software make a great combination, especially for people looking to learn by doing. In this article, Anderson Silva introduces the security-oriented Kali Linux distribution in _[Learn about computer security with the Raspberry Pi and Kali Linux][13]_. It's a short article, but it's full of useful links to documentation and security-related projects that you can use with your own Raspberry Pi. - -### Will quantum computing break security? - -Has the rest of this article been a waste? Will quantum computing render everything we know about security obsolete? The good news is that the answer is "no," but quantum computing can still have a profound impact on security and the computing world more broadly. In _[Will quantum computing break security?][14]_ Mike Bursell examines its potential impacts—both the good news and the bad. And of course, quantum computing may make it easier to break encryption, but that doesn't matter if the baddies can't get your data in the first place. - -### Looking to 2020 - -Security will always be important, and (as the quantum computing article suggests) the next few years will be an interesting time in the field. In 2020, Opensource.com articles will look at the leading edge of open source security and help explain the basics to the ever-growing open source community. If you have a topic you want us to cover, please share it in the comments, or—better yet— if you have an article in mind, [write for us][15]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/security-resources - -作者:[Ben Cotton][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bcotton -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko (A secure lock.) -[2]: https://opensource.com/article/19/10/linux-server-security -[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls -[4]: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging -[5]: https://opensource.com/article/19/4/gpg-subkeys-ssh -[6]: https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples -[7]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage -[8]: https://opensource.com/article/19/4/ssh-keys-seahorse -[9]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline -[10]: https://opensource.com/article/19/9/open-source-cloud-security -[11]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 -[12]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 -[13]: https://opensource.com/article/19/3/computer-security-raspberry-pi -[14]: https://opensource.com/article/19/1/will-quantum-computing-break-security -[15]: https://opensource.com/how-submit-article diff --git a/translated/tech/20191230 10 articles to enhance your security aptitude.md b/translated/tech/20191230 10 articles to enhance your security aptitude.md new file mode 100644 index 0000000000..3a86ffc6a0 --- /dev/null +++ b/translated/tech/20191230 10 articles to enhance your security aptitude.md @@ -0,0 +1,91 @@ +[#]: collector: "lujun9972" +[#]: translator: "nacyro" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "10 articles to enhance your security aptitude" +[#]: via: "https://opensource.com/article/19/12/security-resources" +[#]: author: "Ben Cotton https://opensource.com/users/bcotton" + +10 篇文章强化你的安全能力 +====== +无论你是新手还是想要增加技能,Opensource.com 2019 年十大安全文章中都有适合你的内容。 + +![A secure lock.][1] + +如果安全是一个过程(确实如此),那么理所当然的,不同的项目(及其贡献者)情况各有不同。有些应用程序经历了多年的安全测试,由在信息安全领域工作了几十年的人员所设计。其他的则是由开发人员在他们的第一个开源项目中开发的全新项目。毫不奇怪,Opensource.com 2019 年十大安全文章囊括了代表这一范围的经验。我们有介绍基本安全实践的文章,也有深入探讨更高级主题的文章。 + +无论你是新手还是想要增加你在传奇职业生涯中获得的技能,2019 年十大安全文章中都有适合你的内容。 + +### 《七步捍卫你的 Linux 服务器(7 steps to securing your Linux server)》 + +安全如舍,地基不牢,房屋不稳。Patrick H. Mullins 的杰作《[七步捍卫你的 Linux 服务器(7 steps to securing your Linux server)][2]》让您从Linux服务器的基本安全步骤开始。即使您有很多管理服务器的经验,本文也提供了一个很好的清单以确保您掌握了基础知识。在此基础上,您可以开始添加额外的安全层。 + +### 《用防火墙使 Linux 更健壮(Make Linux stronger with firewalls)》 + +七步捍卫你的 Linux 服务器中的一步即是启用防火墙。但什么**是**防火墙,它是如何工作的呢? Seth Kenlon 在《[用防火墙使 Linux 更健壮(Make Linux stronger with firewalls)][3]》一文中回答了这些问题,然后详细描述了为了更好的安全性应如何配置你的防火墙。使用 `firewalld` 与 `Network Manager`,您可以为不同的网络设置不同的防火墙配置。例如,这允许您在您的家庭网络上进行信任配置,并在您最喜欢的咖啡店的 WiFi 网络上进行更多疑的配置。 + +### 《减少集中日志的安全风险(Reducing security risks with centralized logging)》 + +保护系统安全,只有开始,没有结束:安全是一个过程而不是状态。**保持**系统安全工作的一部分即是密切关注所发生的事情。集中化日志是实现这一点的一种方法,尤其是在管理多系统时。在《[减少集中日志的安全风险(Reducing security risks with centralized logging)][4]》中 Hannah Suarez 分享了要如何开始(她这篇文章基于她在 FOSDEM'19 (自由及开源软件开发者欧洲会议) 中的闪电演讲) + +### 《为 SSH 使用 GPG 密钥(Using GPG keys for SSH)》 + +大多数人都会为 `SSH` 的密钥认证使用 `SSH 密钥`。为什么不呢?毕竟就在名字里。从安全的角度来看,这些方法非常好。但若想简化某些形式的密钥分发与备份还有另一种方法,Brian Exelbierd 的三部曲系列介绍了《[如何启用使用 GPG 子钥的 SSH 访问(How to enable SSH access with a GPG subkey)][5]》、《[如何导入现有 SSH 密钥(How to import existing SSH keys)][6]》、《[如何将备份量减少到单个密钥文件(How to reduce your backup needs to a single key file)][7]》 + +### 《使用 `Seahorse` 图形化管理 SSH 密钥(Graphically manage SSH keys with Seahorse)》 + +并不是所有人都喜欢用 `GPG` 作为 `SSH 密钥`,但这并不意味着您在密钥管理上会不顺。`Seahorse` 是一个在 `GNOME` 桌面中用于管理 `SSH 密钥` 及其他身份验证方法的图形化工具。Alan Formy-Duval 的《[使用 `Seahorse` 图形化管理 SSH 密钥(Graphically manage SSH keys with Seahorse)][8]》对新手用户特别有帮助。 + +### 《安全扫描你的 DevOps 管线(Security scanning your DevOps pipeline)》 + +如今到处都是容器。但它们容纳着什么?了解容器满足您的安全策略是保持安全性的重要部分。幸运的是,您可以使用开源工具来帮助自动化符合性检查。Jessica Cherry (原名: Repka) 的《[安全扫描你的 DevOps 管线(Security scanning your DevOps pipeline)][9]》是一个循序渐进的教程,向您展示了如何使用 `Jenkins` 构建系统和 `Anchore` 检查服务为容器镜像和 `registries` 创建扫描管线。 + +### 《四个开源云安全工具(4 open source cloud security tools)》 + +云服务的一大优点是你的数据可以从任何地方访问。云服务的一个缺点是你的数据可以从任何地方访问。如果您使用的是 `"-as-a-Service" (译注: IaaS, PaaS, SaaS)` 产品,那么您需要确保它们是经过安全配置的。Anderson Silva、Alison Naylor、Travis McPeak 和 Rich Monk 联合推出《[四个开源云安全工具(4 open source cloud security tools)][10]》以帮助在使用 `GitHub` 和 `AWS` 时提高安全性。如果你正在寻找被不小心提交的秘密,或尝试从一开始就阻止这些秘密被提交,这篇文章提供了工具。 + +### 《如何使用OpenSSL:哈希,数字签名,等等(How to use OpenSSL: hashes, digital signatures, and more)》 + +许多信息安全是基于数学的:特别是用于加密数据和验证用户或文件内容的加密函数。在《[开始使用 OpenSSL:密码学基础(Getting started with OpenSSL: Cryptography basics)][11]》中进行介绍后,Marty Kalin 深入讨论了《[如何使用 OpenSSL:哈希,数字签名,等等(How to use OpenSSL: hashes, digital signatures, and more)][12]》的细节,解释了如何使用 `OpenSSL` 实用程序来探索这些常用但不常被理解的概念。 + +### 《使用树莓派和 Kali Linux 学习计算机安全(Learn about computer security with the Raspberry Pi and Kali Linux)》 + +廉价硬件与开源软件构成了一个很好的组合,特别是对于那些希望边做边学的人来说。在《[使用树莓派和 Kali Linux 学习计算机安全(Learn about computer security with the Raspberry Pi and Kali Linux)][13]》这篇文章中,Anderson Silva 介绍了面向安全的 `Kali Linux` 发行版。这是一篇短文,但它满是关于文档和安全相关项目的有用的链接,您可以在自己的树莓派上使用它们。 + +### 《量子计算会破坏安全吗?(Will quantum computing break security?)》 + +这篇文章的余下部分是浪费吗?量子计算会让我们对安全的所知变得过时吗?好消息是:回答是否定的,但是量子计算仍然可以在更广泛的范围内对安全和计算世界产生深远的影响。在《[量子计算会破坏安全吗?(Will quantum computing break security?)][14]》一文中,Mike Bursell 剖析了它好坏两方面的影响,当然,量子计算可能会让加密的破解变得更容易,但如果坏人一开始就无法获得你的数据,那也没有关系。 + +### 《展望 2020(Looking to 2020)》 + +安全永远是重要的,(正如那篇量子计算文章所建议的) 未来几年将是该领域的一个有趣时期。在 2020 年,Opensource.com 的文章将着眼于开源安全的前沿,并帮助向不断增长的开源社区解释基础知识。如果你有一个你想要我们报导的主题,请在评论中分享它,或者更进一步 —— 如果你想写一篇文章,就写给我们吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/security-resources + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[nacyro](https://github.com/nacyro) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko "A secure lock." +[2]: https://opensource.com/article/19/10/linux-server-security +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging +[5]: https://opensource.com/article/19/4/gpg-subkeys-ssh +[6]: https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples +[7]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage +[8]: https://opensource.com/article/19/4/ssh-keys-seahorse +[9]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[10]: https://opensource.com/article/19/9/open-source-cloud-security +[11]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 +[12]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 +[13]: https://opensource.com/article/19/3/computer-security-raspberry-pi +[14]: https://opensource.com/article/19/1/will-quantum-computing-break-security +[15]: https://opensource.com/how-submit-article From 604cb2366eecb2b1a284bf16ce9cdae63fef29b7 Mon Sep 17 00:00:00 2001 From: nacyro Date: Thu, 2 Jan 2020 22:59:14 +0800 Subject: [PATCH 0060/3057] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...101 9 cheat sheets and guides to enhance your tech skills.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md index fb9d954ab5..7e9e984b63 100644 --- a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md +++ b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (nacyro) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 243e8f0246e21f8fa22a0f64b4bad49743ab5a2c Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Thu, 2 Jan 2020 23:31:04 +0800 Subject: [PATCH 0061/3057] translated --- ...1017 Intro to the Linux useradd command.md | 131 ++++++++---------- 1 file changed, 58 insertions(+), 73 deletions(-) diff --git a/translated/tech/20191017 Intro to the Linux useradd command.md b/translated/tech/20191017 Intro to the Linux useradd command.md index ab23c72db5..ffebd61d47 100644 --- a/translated/tech/20191017 Intro to the Linux useradd command.md +++ b/translated/tech/20191017 Intro to the Linux useradd command.md @@ -7,59 +7,55 @@ [#]: via: (https://opensource.com/article/19/10/linux-useradd-command) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) -Intro to the Linux useradd command +Linux useradd 命令介绍 ====== -Add users (and customize their accounts as needed) with the useradd -command. +使用 useradd 命令来添加用户(并且根据需要修改账号)。 ![people in different locations who are part of the same team][1] -Adding a user is one of the most fundamental exercises on any computer system; this article focuses on how to do it on a Linux system. +任何计算机系统中,添加用户都是最重要的事之一;本文着重介绍如何在 Linux 系统中添加用户。 -Before getting started, I want to mention three fundamentals to keep in mind. First, like with most operating systems, Linux users need an account to be able to log in. This article specifically covers local accounts, not network accounts such as LDAP. Second, accounts have both a name (called a username) and a number (called a user ID). Third, users are typically placed into a group. Groups also have a name and group ID. - -As you'd expect, Linux includes a command-line utility for adding users; it's called **useradd**. You may also find the command **adduser**. Many distributions have added this symbolic link to the **useradd** command as a matter of convenience. +正式开始之前,我先提三个概念。首先,跟大多数操作系统一样,Linux 用户也需要一个账号才能登录。本文只介绍本地账号,不涉及网络账号,如 LDAP。其次,每个账号都有一个名字(username)和一个对应的数字(用户 ID)。最后,每个用户通常都在一个组内,每个组都有一个名字和一个组 ID。 +你可能已经想到了,Linux 提供了添加用户的命令行工具,就是 `useradd` 命令。有些版本也叫 `adduser`。为了方便使用,很多发行版上这个命令是一个指向 `useradd` 命令的符号链接。 ``` $ file `which adduser` /usr/sbin/adduser: symbolic link to useradd ``` -Let's take a look at **useradd**. +来看一下 `useradd`。 -> Note: The defaults described in this article reflect those in Red Hat Enterprise Linux 8.0. You may find subtle differences in these files and certain defaults on other Linux distributions or other Unix operating systems such as FreeBSD or Solaris. +> 注意:本文描述的默认环境是 Red Hat Enterprise Linux 8.0。你可能会发现本文描述的这些文件和某些默认值与某些 Linux 发行版或其他 Unix 操作系统(FreeBSD 或 Solaris)偶尔会有差异。 -### Default behavior +### 默认处理 -The basic usage of **useradd** is quite simple: A user can be added just by providing their username. +`useradd` 的基本用法相当简单:通过一个用户名就可以添加一个用户 - -``` -`$ sudo useradd sonny` +```bash +$ sudo useradd sonny ``` -In this example, the **useradd** command creates an account called _sonny_. A group with the same name is also created, and _sonny_ is placed in it to be used as the primary group. There are other parameters, such as language and shell, that are applied according to defaults and values set in the configuration files **/etc/default/useradd** and **/etc/login.defs**. This is generally sufficient for a single, personal system or a small, one-server business environment. +在本例中,`useradd` 命令创建了一个名为 *sonny* 的账号。此命令同时创建了一个同名的组,*sonny* 被放进了这个组,这个组也是 *sonny* 账号的主组。命令执行时,根据配置文件 `/etc/default/useradd` 和 `/etc/login.defs` 中的不同设置,也会有其他的参数处理,如语言和 shell。对于一个私人系统或微小的单服务商业环境,这些参数已经足够了。 -While the two files above govern the behavior of **useradd**, user information is stored in other files found in the **/etc** directory, which I will refer to throughout this article. +上面两个文件控制 `useradd` 的处理,用户的信息保存在 `/etc` 目录下的一些其他文件中,关于这些信息的讲解会贯穿全文。 -File | Description | Fields (bold—set by useradd) ----|---|--- -passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** -shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused -group | Stores group details | **groupname**:unused:**gid**:**members** +| 文件 | 描述 | 域 (加粗的表示由 useradd 命令设置) | +| ------ | ------------------------------------ | ------------------------------------------------------------ | +| passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** | +| shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused | +| group | Stores group details | **groupname**:unused:**gid**:**members** | -### Customizable behavior +### 自定义处理 -The command line allows customization for times when an administrator needs finer control, such as to specify a user's ID number. +当管理员需要更好地控制账号时,可以使用命令行来自定义,如指定一个用户的 ID。 -#### User and group ID numbers +#### 用户和组 ID -By default, **useradd** tries to use the same number for the user ID (UID) and primary group ID (GID), but there are no guarantees. Although it's not necessary for the UID and GID to match, it's easier for administrators to manage them when they do. +`useradd` 默认主组 ID(GID)与用户 ID(UID)相同,但也不完全是。虽然 UID 与 GID 相同不是必须的,但如果相同,会更方便管理员管理。 -I have just the scenario to explain. Suppose I add another account, this time for Timmy. Comparing the two users, _sonny_ and _timmy_, shows that both users and their respective primary groups were created by using the **getent** command. +下面的场景就是一个 GID 与 UID 不同的 例子。现在我添加另一账号,名为 Timmy。通过使用 `getent` 命令来比较 *sonny* 和 *timmy* 两个账号,显示两个用户和对应的主组。 - -``` +```bash $ getent passwd sonny timmy sonny❌1001:1002:Sonny:/home/sonny:/bin/bash timmy❌1002:1003::/home/timmy:/bin/bash @@ -69,18 +65,16 @@ sonny❌1002: timmy❌1003: ``` -Unfortunately, neither users' UID nor primary GID match. This is because the default behavior is to assign the next available UID to the user and then attempt to assign the same number to the primary group. However, if that number is already used, the next available GID is assigned to the group. To explain what happened, I hypothesize that a group with GID 1001 already exists and enter a command to confirm. +不幸的是,两者的 UID 和 GID 都不相同。因为默认的处理是,创建用户时,把下一个可用的 UID 赋给用户,然后把同一个数字作为主组 ID 赋给它。然而,当要使用的 ID 已经被使用时,就再把下一个可用的 GID 赋给它。为了弄清细节,我猜想 1001 这个 GID 已经被使用了,用一个命令确认了一下。 - -``` +```bash $ getent group 1001 book❌1001:alan ``` -The group _book_ with the ID _1001_ has caused the GIDs to be off by one. This is an example where a system administrator would need to take more control of the user-creation process. To resolve this issue, I must first determine the next available user and group ID that will match. The commands **getent group** and **getent passwd** will be helpful in determining the next available number. This number can be passed with the **-u** argument. +*book* 的 ID 是 *1001*,因此新创建的用户的 GID 都有偏移量 1。这就是为什么系统管理员在用户创建过程中需要多设置一些值的一个实例。为了解决这个问题,我必须先确定下一个可用的 UID 和 GID 是否相同。确定下一个可用值时,可以使用 `getent group` 和 `getent passwd` 命令,通过 `-u` 参数传递要确认的值。 - -``` +```bash $ sudo useradd -u 1004 bobby $ getent passwd bobby; getent group bobby @@ -88,64 +82,59 @@ bobby❌1004:1004::/home/bobby:/bin/bash bobby❌1004: ``` -Another good reason to specify the ID is for users that will be accessing files on a remote system using the Network File System (NFS). NFS is easier to administer when all client and server systems have the same ID configured for a given user. I cover this in a bit more detail in my article on [using autofs to mount NFS shares][2]. +另一个需要指定 ID 的场景是,通过 NFS 访问远程系统上的文件时。对于一个给定的用户,当 NFS 所有客户端和服务系统的 ID 都一样时,管理员更容易控制。在我的文章 [使用 autofs 挂载 NFS][2] 中有详细介绍。 -### More customization +### 更多自定义 -Very often though, other account parameters need to be specified for a user. Here are brief examples of the most common customizations you may need to use. +一些其他的指定用户信息的参数也用得比较频繁。这里是一些你会经常用到的参数的概括例子。 -#### Comment +#### 注释 -The comment option is a plain-text field for providing a short description or other information using the **-c** argument. +注释选项是通过 `-c` 参数指定的一个解释文本字段,可以提供一段简短的描述或其他信息。 - -``` +```bash $ sudo useradd -c "Bailey is cool" bailey $ getent passwd bailey bailey❌1011:1011:Bailey is cool:/home/bailey:/bin/bash ``` -#### Groups +#### 组 -A user can be assigned one primary group and multiple secondary groups. The **-g** argument specifies the name or GID of the primary group. If it's not specified, **useradd** creates a primary group with the user's same name (as demonstrated above). The **-G** (uppercase) argument is used to pass a comma-separated list of groups that the user will be placed into; these are known as secondary groups. +一个用户可以被指定一个主组和多个次组。 `-g` 参数指定主组名称或 GID。如果不指定,`useradd` 会以用户名创建一个主组(前面演示过)。`-G`(大写)参数用一个逗号分隔的组列表来指定此用户所属的组,这些组就是次组。 - -``` +```bash $ sudo useradd -G tgroup,fgroup,libvirt milly $ id milly uid=1012(milly) gid=1012(milly) groups=1012(milly),981(libvirt),4000(fgroup),3000(tgroup) ``` -#### Home directory +#### 家目录 -The default behavior of **useradd** is to create the user's home directory in **/home**. However, different aspects of the home directory can be overridden with the following arguments. The **-b** sets another directory where user homes can be placed. For example, **/home2** instead of the default **/home**. +`useradd` 的默认处理是,在 `/home` 目录下创建用户的家目录。然而,下面的参数可以改写家目录的 base 目录。`-b` 设置另一个可以创建家目录的 base 目录。例如 指定 `/home2` 而不是 `/home`。 - -``` +```bash $ sudo useradd -b /home2 vicky $ getent passwd vicky vicky❌1013:1013::/home2/vicky:/bin/bash ``` -The **-d** lets you specify a home directory with a different name from the user. +`-d` 参数可以指定一个与用户名不同的家目录。 - -``` +```bash $ sudo useradd -d /home/ben jerry $ getent passwd jerry jerry❌1014:1014::/home/ben:/bin/bash ``` -#### The skeleton directory +#### skeleton 目录 -The **-k** instructs the new user's new home directory to be populated with any files in the **/etc/skel** directory. These are usually shell configuration files, but they can be anything that a system administrator would like to make available to all new users. +`-k` 参数指定创建新用户时,会复制 `/etc/skel` 目录下的所有文件到家目录中。这些文件通常是 shell 配置文件,当然也可以是系统管理员想在新建用户时使用的任何文件。 #### Shell -The **-s** argument can be used to specify the shell. The default is used if nothing else is specified. For example, in the following, shell **bash** is defined in the default configuration file, but Wally has requested **zsh**. +`-s` 参数可以指定 shell。如果不指定,则使用默认的 shell。例如,下面的例子中 ,配置文件中定义的 shell 是 `bash`,但 `Wally` 这个用户指定的是 `zsh`。 - -``` +```bash $ grep SHELL /etc/default/useradd SHELL=/bin/bash @@ -154,42 +143,38 @@ $ getent passwd wally wally❌1004:1004::/home/wally:/usr/bin/zsh ``` -#### Security +#### 安全 -Security is an essential part of user management, so there are several options available with the **useradd** command. A user account can be given an expiration date, in the form YYYY-MM-DD, using the **-e** argument. +安全是用户管理的重中之重,因此 `useradd` 命令也提供了很多关于安全的选项。可以使用 `-e` 参数,以 YYYY-MM-DD 的格式指定一个用户的过期时间。 - -``` +```bash $ sudo useradd -e 20191231 sammy $ sudo getent shadow sammy sammy:!!:18171:0:99999:7::20191231: ``` -An account can also be disabled automatically if the password expires. The **-f** argument will set the number of days after the password expires before the account is disabled. Zero is immediate. +当密码过期时,一个账号也可以自动失效。`-f` 参数指定密码过期后经过几天账号失效。如果设为 0,则立即失效。 - -``` +```bash $ sudo useradd -f 30 willy $ sudo getent shadow willy willy:!!:18171:0:99999:7:30:: ``` -### A real-world example +### 实例 -In practice, several of these arguments may be used when creating a new user account. For example, if I need to create an account for Perry, I might use the following command: +生产中,创建一个用户账号时会用到多个参数。例如,我要创建一个 Perry 账号,可能会用下面的命令: - -``` +```bash $ sudo useradd -u 1020 -c "Perry Example" \ -G tgroup -b /home2 \ -s /usr/bin/zsh \ -e 20201201 -f 5 perry ``` -Refer to the sections above to understand each option. Verify the results with: +查看前面的内容来理解每个选项。用下面的命令确认结果: - -``` +```bash $ getent passwd perry; getent group perry; getent shadow perry; id perry perry❌1020:1020:Perry Example:/home2/perry:/usr/bin/zsh perry❌1020: @@ -197,9 +182,9 @@ perry:!!:18171:0:99999:7:5:20201201: uid=1020(perry) gid=1020(perry) groups=1020(perry),3000(tgroup) ``` -### Some final advice +### 一点小建议 -The **useradd** command is a "must-know" for any Unix (not just Linux) administrator. It is important to understand all of its options since user creation is something that you want to get right the first time. This means having a well-thought-out naming convention that includes a dedicated UID/GID range reserved for your users across your enterprise, not just on a single system—particularly when you're working in a growing organization. +`useradd` 命令是所有 Unix(不仅仅是 Linux)系统管理员都必知必会的命令。由于用户创建不能出错,需要第一次就正确,所以理解它的每一个选项很重要。这意味着你需要有一套深思熟虑的命名约定,包括为整个企业环境而不仅仅是一个单系统预留一个专用的 UID/GID 范围,尤其是你为一个成长中的组织工作时。 -------------------------------------------------------------------------------- From a067016b3d77e9bfdace19660e58e95989f8bdf1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 00:45:18 +0800 Subject: [PATCH 0062/3057] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @nacyro 恭喜你完成了第一篇翻译! --- ...icles to enhance your security aptitude.md | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/translated/tech/20191230 10 articles to enhance your security aptitude.md b/translated/tech/20191230 10 articles to enhance your security aptitude.md index 3a86ffc6a0..bd488182d4 100644 --- a/translated/tech/20191230 10 articles to enhance your security aptitude.md +++ b/translated/tech/20191230 10 articles to enhance your security aptitude.md @@ -1,65 +1,66 @@ [#]: collector: "lujun9972" [#]: translator: "nacyro" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "10 articles to enhance your security aptitude" [#]: via: "https://opensource.com/article/19/12/security-resources" [#]: author: "Ben Cotton https://opensource.com/users/bcotton" -10 篇文章强化你的安全能力 +10 篇强化你的安全能力的文章 ====== -无论你是新手还是想要增加技能,Opensource.com 2019 年十大安全文章中都有适合你的内容。 -![A secure lock.][1] +> 无论你是新手还是想要增加技能,这十篇安全文章中都有适合你的内容。 -如果安全是一个过程(确实如此),那么理所当然的,不同的项目(及其贡献者)情况各有不同。有些应用程序经历了多年的安全测试,由在信息安全领域工作了几十年的人员所设计。其他的则是由开发人员在他们的第一个开源项目中开发的全新项目。毫不奇怪,Opensource.com 2019 年十大安全文章囊括了代表这一范围的经验。我们有介绍基本安全实践的文章,也有深入探讨更高级主题的文章。 +![](https://img.linux.net.cn/data/attachment/album/202001/03/004344rco51cnc153ns1zz.jpg) + +如果安全是一个过程(确实如此),那么理所当然的,不同的项目(及其贡献者)的情况各有不同。有些应用程序经历了多年的安全测试,由在信息安全领域工作了几十年的人员所设计。而另外一些则是由开发人员在他们的第一个开源项目中开发的全新项目。毫不奇怪,这十大安全文章囊括了代表这一范围的经验。我们有介绍基本安全实践的文章,也有深入探讨更高级主题的文章。 无论你是新手还是想要增加你在传奇职业生涯中获得的技能,2019 年十大安全文章中都有适合你的内容。 -### 《七步捍卫你的 Linux 服务器(7 steps to securing your Linux server)》 +### 《安全强化你的 Linux 服务器的七个步骤》 -安全如舍,地基不牢,房屋不稳。Patrick H. Mullins 的杰作《[七步捍卫你的 Linux 服务器(7 steps to securing your Linux server)][2]》让您从Linux服务器的基本安全步骤开始。即使您有很多管理服务器的经验,本文也提供了一个很好的清单以确保您掌握了基础知识。在此基础上,您可以开始添加额外的安全层。 +安全如舍,地基不牢,房屋不稳。Patrick H. Mullins 的杰作《[安全强化你的 Linux 服务器的七个步骤][2]》让你从 Linux 服务器的基本安全步骤开始。即使你有很多管理服务器的经验,本文也提供了一个很好的清单以确保你掌握了基础知识。在此基础上,你可以开始添加额外的安全层。 -### 《用防火墙使 Linux 更健壮(Make Linux stronger with firewalls)》 +### 《使用防火墙让你的 Linux 更加强大》 -七步捍卫你的 Linux 服务器中的一步即是启用防火墙。但什么**是**防火墙,它是如何工作的呢? Seth Kenlon 在《[用防火墙使 Linux 更健壮(Make Linux stronger with firewalls)][3]》一文中回答了这些问题,然后详细描述了为了更好的安全性应如何配置你的防火墙。使用 `firewalld` 与 `Network Manager`,您可以为不同的网络设置不同的防火墙配置。例如,这允许您在您的家庭网络上进行信任配置,并在您最喜欢的咖啡店的 WiFi 网络上进行更多疑的配置。 +七步捍卫你的 Linux 服务器中的一步即是启用防火墙。但什么**是**防火墙,它是如何工作的呢? Seth Kenlon 在《[使用防火墙让你的 Linux 更加强大][3]》一文中回答了这些问题,然后详细描述了为了更好的安全性应如何配置你的防火墙。使用 firewalld 与 Network Manager,你可以为不同的网络设置不同的防火墙配置。例如,这允许你在家庭网络上进行信任配置,并在你最喜欢的咖啡店的 WiFi 网络上进行更多疑的配置。 -### 《减少集中日志的安全风险(Reducing security risks with centralized logging)》 +### 《用集中日志减少安全风险》 -保护系统安全,只有开始,没有结束:安全是一个过程而不是状态。**保持**系统安全工作的一部分即是密切关注所发生的事情。集中化日志是实现这一点的一种方法,尤其是在管理多系统时。在《[减少集中日志的安全风险(Reducing security risks with centralized logging)][4]》中 Hannah Suarez 分享了要如何开始(她这篇文章基于她在 FOSDEM'19 (自由及开源软件开发者欧洲会议) 中的闪电演讲) +保护系统安全,只有开始,没有结束:安全是一个过程而不是状态。**保持**系统安全工作的一部分即是密切关注所发生的事情。集中化日志是实现这一点的一种方法,尤其是在管理多系统时。在《[减少集中日志的安全风险][4]》中 Hannah Suarez 分享了要如何开始(她这篇文章基于她在 FOSDEM'19 [自由及开源软件开发者欧洲会议] 中的闪电演讲)。 -### 《为 SSH 使用 GPG 密钥(Using GPG keys for SSH)》 +### 《在 SSH 中使用 GPG 密钥》 -大多数人都会为 `SSH` 的密钥认证使用 `SSH 密钥`。为什么不呢?毕竟就在名字里。从安全的角度来看,这些方法非常好。但若想简化某些形式的密钥分发与备份还有另一种方法,Brian Exelbierd 的三部曲系列介绍了《[如何启用使用 GPG 子钥的 SSH 访问(How to enable SSH access with a GPG subkey)][5]》、《[如何导入现有 SSH 密钥(How to import existing SSH keys)][6]》、《[如何将备份量减少到单个密钥文件(How to reduce your backup needs to a single key file)][7]》 +大多数人都会为 SSH 的密钥认证使用 SSH 密钥。为什么不呢?毕竟 SSH 就在名字里。从安全的角度来看,这些方法非常好。但若想简化某些形式的密钥分发与备份还有另一种方法,Brian Exelbierd 的三部曲系列介绍了《[如何启用使用 GPG 子钥的 SSH 访问][5]》、《[如何导入现有 SSH 密钥][6]》、《[如何将备份量减少到单个密钥文件][7]》 -### 《使用 `Seahorse` 图形化管理 SSH 密钥(Graphically manage SSH keys with Seahorse)》 +### 《使用 Seahorse 图形化管理 SSH 密钥》 -并不是所有人都喜欢用 `GPG` 作为 `SSH 密钥`,但这并不意味着您在密钥管理上会不顺。`Seahorse` 是一个在 `GNOME` 桌面中用于管理 `SSH 密钥` 及其他身份验证方法的图形化工具。Alan Formy-Duval 的《[使用 `Seahorse` 图形化管理 SSH 密钥(Graphically manage SSH keys with Seahorse)][8]》对新手用户特别有帮助。 +并不是所有人都喜欢用 GPG 作为 SSH 密钥,但这并不意味着你在密钥管理上会不顺利。Seahorse 是一个在 GNOME 桌面中用于管理 SSH 密钥及其他身份验证方法的图形化工具。Alan Formy-Duval 的《[使用 Seahorse 图形化管理 SSH 密钥》对新手用户特别有帮助。 -### 《安全扫描你的 DevOps 管线(Security scanning your DevOps pipeline)》 +### 《安全扫描你的 DevOps 流程》 -如今到处都是容器。但它们容纳着什么?了解容器满足您的安全策略是保持安全性的重要部分。幸运的是,您可以使用开源工具来帮助自动化符合性检查。Jessica Cherry (原名: Repka) 的《[安全扫描你的 DevOps 管线(Security scanning your DevOps pipeline)][9]》是一个循序渐进的教程,向您展示了如何使用 `Jenkins` 构建系统和 `Anchore` 检查服务为容器镜像和 `registries` 创建扫描管线。 +如今到处都是容器。但它们容纳着什么?了解容器满足你的安全策略是保持安全性的重要部分。幸运的是,你可以使用开源工具来帮助自动化合规检查。Jessica Cherry(原名: Repka)的《[安全扫描你的 DevOps 流程][9]》是一个循序渐进的教程,向你展示了如何使用 Jenkins 构建系统和 Anchore 检查服务为容器镜像和注册库创建扫描流程。 -### 《四个开源云安全工具(4 open source cloud security tools)》 +### 《4 种开源云安全工具》 -云服务的一大优点是你的数据可以从任何地方访问。云服务的一个缺点是你的数据可以从任何地方访问。如果您使用的是 `"-as-a-Service" (译注: IaaS, PaaS, SaaS)` 产品,那么您需要确保它们是经过安全配置的。Anderson Silva、Alison Naylor、Travis McPeak 和 Rich Monk 联合推出《[四个开源云安全工具(4 open source cloud security tools)][10]》以帮助在使用 `GitHub` 和 `AWS` 时提高安全性。如果你正在寻找被不小心提交的秘密,或尝试从一开始就阻止这些秘密被提交,这篇文章提供了工具。 +云服务的一大优点是你的数据可以从任何地方访问。云服务的一个缺点是你的数据可以从任何地方访问。如果你使用的是 “-as-a-Service”(LCTT 译注: 某某即服务,如 IaaS、PaaS、Saa)产品,那么你需要确保它们是经过安全配置的。Anderson Silva、Alison Naylor、Travis McPeak 和 Rich Monk 联合推出《[4 种开源云安全工具][10]》以帮助在使用 GitHub 和 AWS 时提高安全性。如果你正在寻找被不小心提交的机密信息,或尝试从一开始就阻止这些机密信息被提交,这篇文章提供了工具。 -### 《如何使用OpenSSL:哈希,数字签名,等等(How to use OpenSSL: hashes, digital signatures, and more)》 +### 《如何使用 OpenSSL:哈希、数字签名等》 -许多信息安全是基于数学的:特别是用于加密数据和验证用户或文件内容的加密函数。在《[开始使用 OpenSSL:密码学基础(Getting started with OpenSSL: Cryptography basics)][11]》中进行介绍后,Marty Kalin 深入讨论了《[如何使用 OpenSSL:哈希,数字签名,等等(How to use OpenSSL: hashes, digital signatures, and more)][12]》的细节,解释了如何使用 `OpenSSL` 实用程序来探索这些常用但不常被理解的概念。 +许多信息安全是基于数学的:特别是用于加密数据和验证用户或文件内容的加密函数。在《[开始使用 OpenSSL:密码学基础][11]》中进行介绍后,Marty Kalin 深入讨论了《[如何使用 OpenSSL:哈希、数字签名等][12]》的细节,解释了如何使用 OpenSSL 实用程序来探索这些常用但不常被理解的概念。 -### 《使用树莓派和 Kali Linux 学习计算机安全(Learn about computer security with the Raspberry Pi and Kali Linux)》 +### 《使用树莓派和 Kali Linux 学习计算机安全》 -廉价硬件与开源软件构成了一个很好的组合,特别是对于那些希望边做边学的人来说。在《[使用树莓派和 Kali Linux 学习计算机安全(Learn about computer security with the Raspberry Pi and Kali Linux)][13]》这篇文章中,Anderson Silva 介绍了面向安全的 `Kali Linux` 发行版。这是一篇短文,但它满是关于文档和安全相关项目的有用的链接,您可以在自己的树莓派上使用它们。 +廉价硬件与开源软件构成了一个很好的组合,特别是对于那些希望边做边学的人来说。在《[使用树莓派和 Kali Linux 学习计算机安全][13]》这篇文章中,Anderson Silva 介绍了面向安全的 Kali Linux 发行版。这是一篇短文,但它满是关于文档和安全相关项目的有用的链接,你可以在自己的树莓派上使用它们。 -### 《量子计算会破坏安全吗?(Will quantum computing break security?)》 +### 《量子计算会打破现有的安全体系吗?》 -这篇文章的余下部分是浪费吗?量子计算会让我们对安全的所知变得过时吗?好消息是:回答是否定的,但是量子计算仍然可以在更广泛的范围内对安全和计算世界产生深远的影响。在《[量子计算会破坏安全吗?(Will quantum computing break security?)][14]》一文中,Mike Bursell 剖析了它好坏两方面的影响,当然,量子计算可能会让加密的破解变得更容易,但如果坏人一开始就无法获得你的数据,那也没有关系。 +这篇文章的余下部分是浪费吗?量子计算会让我们对安全的所知变得过时吗?好消息是:回答是否定的,但是量子计算仍然可以在更广泛的范围内对安全和计算世界产生深远的影响。在《[量子计算会打破现有的安全体系吗?][14]》一文中,Mike Bursell 剖析了它好坏两方面的影响,当然,量子计算可能会让加密的破解变得更容易,但如果坏人一开始就无法获得你的数据,那也没有关系。 -### 《展望 2020(Looking to 2020)》 +### 展望 2020 -安全永远是重要的,(正如那篇量子计算文章所建议的) 未来几年将是该领域的一个有趣时期。在 2020 年,Opensource.com 的文章将着眼于开源安全的前沿,并帮助向不断增长的开源社区解释基础知识。如果你有一个你想要我们报导的主题,请在评论中分享它,或者更进一步 —— 如果你想写一篇文章,就写给我们吧。 +安全永远是重要的,(正如那篇量子计算文章所建议的)未来几年将是该领域的一个有趣时期。在 2020 年,我们的文章将着眼于开源安全的前沿,并帮助向不断增长的开源社区解释基础知识。如果你有一个你想要我们报导的主题,请在评论中分享它,或者更进一步 —— 如果你想写一篇文章,就写给我们吧。 -------------------------------------------------------------------------------- @@ -68,24 +69,24 @@ via: https://opensource.com/article/19/12/security-resources 作者:[Ben Cotton][a] 选题:[lujun9972][b] 译者:[nacyro](https://github.com/nacyro) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/bcotton [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko "A secure lock." -[2]: https://opensource.com/article/19/10/linux-server-security -[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[2]: https://linux.cn/article-11444-1.html +[3]: https://linux.cn/article-11093-1.html [4]: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging [5]: https://opensource.com/article/19/4/gpg-subkeys-ssh [6]: https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples [7]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage [8]: https://opensource.com/article/19/4/ssh-keys-seahorse [9]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline -[10]: https://opensource.com/article/19/9/open-source-cloud-security +[10]: https://linux.cn/article-11432-1.html [11]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 [12]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 [13]: https://opensource.com/article/19/3/computer-security-raspberry-pi -[14]: https://opensource.com/article/19/1/will-quantum-computing-break-security +[14]: https://linux.cn/article-10566-1.html [15]: https://opensource.com/how-submit-article From a45011051057696c1ade6b077fbd42371b1c11ab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 00:46:25 +0800 Subject: [PATCH 0063/3057] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @nacyro 本文首发地址: https://linux.cn/article-11742-1.html 你的 LCTT 专页地址: https://linux.cn/lctt/nacyro 请注册以领取 LCCN: https://lctt.linux.cn/ --- .../20191230 10 articles to enhance your security aptitude.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191230 10 articles to enhance your security aptitude.md (99%) diff --git a/translated/tech/20191230 10 articles to enhance your security aptitude.md b/published/20191230 10 articles to enhance your security aptitude.md similarity index 99% rename from translated/tech/20191230 10 articles to enhance your security aptitude.md rename to published/20191230 10 articles to enhance your security aptitude.md index bd488182d4..4f55e44590 100644 --- a/translated/tech/20191230 10 articles to enhance your security aptitude.md +++ b/published/20191230 10 articles to enhance your security aptitude.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "nacyro" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11742-1.html" [#]: subject: "10 articles to enhance your security aptitude" [#]: via: "https://opensource.com/article/19/12/security-resources" [#]: author: "Ben Cotton https://opensource.com/users/bcotton" From 791826ef8316669fd7eb28a9ced6a6307cb2483f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 3 Jan 2020 00:52:53 +0800 Subject: [PATCH 0064/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20GNOM?= =?UTF-8?q?E=20has=20a=20=E2=80=98Secret=E2=80=99=20Screen=20Recorder.=20H?= =?UTF-8?q?ere=E2=80=99s=20How=20to=20Use=20it!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md --- ...et- Screen Recorder. Here-s How to Use it.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md diff --git a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md new file mode 100644 index 0000000000..96de8997fa --- /dev/null +++ b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) +[#]: via: (https://itsfoss.com/gnome-screen-recorder/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it! +====== + +[GNOME][1] is one of the [most popular desktop environments][2] and for good reasons. It has a modern UI and it comes with a number of GNOME-specific applications that blend well with the overall desktop appearance. + +You can [tweak GNOME][3] to your liking as much as you want but I am not here to discuss that. GNOME desktop has some hidden features that you probably are not aware of. + +One of such not-so-obvious feature is a built in screen recorder. + +Yes, you read that right. If you are using GNOME desktop, you don’t necessarily need to install other [screen recorders in Linux][4]. You just need to know the correct keyboard shortcut. + +### Instantly record your screen with GNOME Screen Recorder + +To quickly access the GNOME screen recorder, you have to press this [keyboard shortcut in Ubuntu][5] or other distributions using GNOME desktop: + +``` +Ctrl + Alt + Shift + R +``` + +This will immediately start recording your desktop. You can tell that the screen recording is in progress by looking at the red dot in the system tray area of the top panel: + +![The red dot in the system tray area indicates that screen recording is in progress][6] + +#### Increase the screencast duration + +The default maximum record time is just 30 seconds. It can be increased though. + +Open a terminal and use the following command: + +``` +gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300 +``` + +In the above command, I have increased the maximum length of the recording to 300 seconds (i.e. 5 minutes). You can change it to any other value but it should be in seconds. + +If you **don’t want any limit on the maximum recording time, set it to 0** and then the recording won’t stop until you manually stop it or your disk runs out of space. + +#### Stop the screen recording + +As I mentioned, your desktop recording will stop automatically after it reaches the maximum time limit. + +To stop the recording before that, you can press the same key combination: + +``` +Ctrl + Alt + Shift + R +``` + +Your recordings are saved in [webm][7] format in the Videos folder of your Home directory. + +#### Limitations + +While it might be handy to record your desktop quickly with this handy little tool, it has its several limitations when compared to a full-fledged screen recording tool like [Simple Screen Recorder][8]. + + * There is no time delay option before the recording starts + * There is no pause and play option + * It records the entire screen. No option to record only an application window or a ceratin area or a certain monitor (if you have a multi-monitor setup). + * Videos are saved in webm format in the user’s Videos directory. You cannot change it. You’ll have to use a tool like [HandBrake to convert the videos to other format][9]. + + + +As you can see, the secret GNOME screen recorder is no where near to the features provided by the likes of [Kazam][10] or other such tools. + +But it doesn’t try to be a full-fledged screen recorder. It just provides you a quick way of recording a small screencast. That’s it. + +GNOME is a versatile modern desktop environments. You can [tweak GNOME][3] extensively. The [GNOME Extensions][11] provide another dimension to the desktop customization. + +This screen recorder is one of the hidden features of GNOME like the suspend option that you won’t easily find on your own. + +_How do you like it? Do you know some other hidden GNOME features that you would like to share with us? The comment section is all yours._ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-screen-recorder/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://gnome.org/ +[2]: https://itsfoss.com/best-linux-desktop-environments/ +[3]: https://itsfoss.com/gnome-tweak-tool/ +[4]: https://itsfoss.com/best-linux-screen-recorders/ +[5]: https://itsfoss.com/ubuntu-shortcuts/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/gnome_screen_recording.jpg?ssl=1 +[7]: https://www.webmproject.org/about/ +[8]: https://itsfoss.com/record-screen-ubuntu-simplescreenrecorder/ +[9]: https://itsfoss.com/handbrake/ +[10]: https://itsfoss.com/kazam-screen-recorder/ +[11]: https://itsfoss.com/best-gnome-extensions/ From 1b5cb52623e7d72de8e53710f9f6c8be135530e0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 3 Jan 2020 00:54:04 +0800 Subject: [PATCH 0065/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200102=20Data?= =?UTF-8?q?=20streaming=20and=20functional=20programming=20in=20Java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200102 Data streaming and functional programming in Java.md --- ...ming and functional programming in Java.md | 496 ++++++++++++++++++ 1 file changed, 496 insertions(+) create mode 100644 sources/tech/20200102 Data streaming and functional programming in Java.md diff --git a/sources/tech/20200102 Data streaming and functional programming in Java.md b/sources/tech/20200102 Data streaming and functional programming in Java.md new file mode 100644 index 0000000000..0349de9072 --- /dev/null +++ b/sources/tech/20200102 Data streaming and functional programming in Java.md @@ -0,0 +1,496 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data streaming and functional programming in Java) +[#]: via: (https://opensource.com/article/20/1/javastream) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +Data streaming and functional programming in Java +====== +Learn how to use the stream API and functional programming constructs in +Java 8. +![computer screen ][1] + +When Java SE 8 (aka core Java 8) was introduced in 2014, it introduced changes that fundamentally impact programming in it. The changes have two closely linked parts: the stream API and the functional programming constructs. This article uses code examples, from the basics through advanced features, to introduce each part and illustrate the interplay between them. + +### The basics + +The stream API is a concise and high-level way to iterate over the elements in a data sequence. The packages **java.util.stream** and **java.util.function** house the new libraries for the stream API and related functional programming constructs. Of course, a code example is worth a thousand words. + +The code segment below populates a **List** with about 2,000 random integer values: + + +``` +[Random][2] rand = new [Random][2](); +List<Integer> list = new ArrayList<Integer>();           // empty list +for (int i = 0; i < 2048; i++) list.add(rand.nextInt()); // populate it +``` + +Another **for** loop could be used to iterate over the populated list to collect the even values into another list. The stream API is a cleaner way to do the same: + + +``` +[List][3] <Integer> evens = list +   .stream()                      // streamify the list +   .filter(n -> (n & 0x1) == 0)   // filter out odd values +   .collect(Collectors.toList()); // collect even values +``` + +The example has three functions from the stream API: + + * The **stream** function can turn a **Collection** into a stream, which is a conveyor belt of values accessible one at a time. The streamification is lazy (and therefore efficient) in that the values are produced as needed rather than all at once. + + * The **filter** function determines which streamed values, if any, get through to the next stage in the processing pipeline, the **collect** stage. The **filter** function is _higher-order_ in that its argument is a function—in this example, a lambda, which is an unnamed function and at the center of Java's new functional programming constructs. + +The lambda syntax departs radically from traditional Java: + + +``` +`n -> (n & 0x1) == 0` +``` + +The arrow (a minus sign followed immediately by a greater-than sign) separates the argument list on the left from the function's body on the right. The argument **n** is not explicitly typed, although it could be; in any case, the compiler figures out that **n** is an **Integer**. If there were multiple arguments, these would be enclosed in parentheses and separated by commas. + +The body, in this example, checks whether an integer's lowest-order (rightmost) bit is a zero, which indicates an even value. A filter should return a boolean value. There is no explicit **return** in the function's body, although there could be. If the body has no explicit **return**, then the body's last expression is the returned value. In this example, written in the spirit of lambda programming, the body consists of the single, simple boolean expression **(n & 0x1) == 0**. + + * The **collect** function gathers the even values into a list whose reference is **evens**. As an example below illustrates, the **collect** function is thread-safe and, therefore, would work correctly even if the filtering operation was shared among multiple threads. + + + + +### Convenience functions and easy multi-threading + +In a production environment, a data stream might have a file or a network connection as its source. For learning the stream API, Java provides types such as **IntStream**, which can generate streams with elements of various types. Here is an **IntStream** example: + + +``` +IntStream                         // integer stream +   .range(1, 2048)                // generate a stream of ints in this range +   .parallel()                    // partition the data for multiple threads +   .filter(i -> ((i & 0x1) > 0))  // odd parity? pass through only odds +   .forEach([System][4].out::println); // print each +``` + +The **IntStream** type includes a **range** function that generates a stream of integer values within a specified range, in this case, from 1 through 2,048, with increments of 1. The **parallel** function automatically partitions the work to be done among multiple threads, each of which does the filtering and printing. (The number of threads typically matches the number of CPUs on the host system.) The argument to the **forEach** function is a _method reference_, in this case, a reference to the **println** method encapsulated in **System.out**, which is of type **PrintStream**. The syntax for method and constructor references will be discussed shortly. + +Because of the multi-threading, the integer values are printed in an arbitrary order overall but in sequence within a given thread. For example, if thread T1 prints 409 and 411, then T1 does so in the order 409–411, but some other thread might print 2,045 beforehand. The threads behind the **parallel** call execute concurrently, and the order of their output is therefore indeterminate. + +### The map/reduce pattern + +The _map/reduce_ pattern has become popular in processing large datasets. A map/reduce macro operation is built from two micro-operations. The data first are scattered (_mapped_) among various workers, and the separate results then are gathered together—perhaps as a single value, which would be the _reduction_. Reduction can take different forms, as the following examples illustrate. + +Instances of the **Number** class below represent integer values with either **EVEN** or **ODD** parity: + + +``` +public class [Number][5] { +    enum Parity { EVEN, ODD } +    private int value; +    public [Number][5](int n) { setValue(n); } +    public void setValue(int value) { this.value = value; } +    public int getValue() { return this.value; } +    public Parity getParity() { +        return ((value & 0x1) == 0) ? Parity.EVEN : Parity.ODD; +    } +    public void dump() { +        [System][4].out.format("Value: %2d (parity: %s)\n", getValue(), +                          (getParity() == Parity.ODD ? "odd" : "even")); +    } +} +``` + +The following code illustrates map/reduce with a **Number** stream, thereby showing that the stream API can handle not only primitive types such as **int** and **float** but programmer-defined class types as well. + +In the code segment below, a list of random integer values is streamified using the **parallelStream** rather than the **stream** function. The **parallelStream** variant, like the **parallel** function introduced earlier, does automatic multithreading. + + +``` +final int howMany = 200; +[Random][2] r = new [Random][2](); +[Number][5][ ] nums = new [Number][5][howMany]; +for (int i = 0; i < howMany; i++) nums[i] = new [Number][5](r.nextInt(100)); +List<Number> listOfNums = [Arrays][6].asList(nums);  // listify the array + +[Integer][7] sum4All = listOfNums +   .parallelStream()           // automatic multi-threading +   .mapToInt([Number][5]::getValue) // method reference rather than lambda +   .sum();                     // reduce streamed values to a single value +[System][4].out.println("The sum of the randomly generated values is: " + sum4All); +``` + +The higher-order **mapToInt** function could take a lambda as an argument, but in this case, it takes a method reference instead, which is **Number::getValue**. The **getValue** method expects no arguments and returns its **int** value for a given **Number** instance. The syntax is uncomplicated: the class name **Number** followed by a double colon and the method's name. Recall the earlier **System.out::println** example, which has the double colon after the **static** field **out** in the **System** class. + +The method reference **Number::getValue** could be replaced by the lambda below. The argument **n** is one of the **Number** instances in the stream: + + +``` +`mapToInt(n -> n.getValue())` +``` + +In general, lambdas and method references are interchangeable: if a higher-order function such as **mapToInt** can take one form as an argument, then this function could take the other as well. The two functional programming constructs have the same purpose—to perform some customized operation on data passed in as arguments. Choosing between the two is often a matter of convenience. For example, a lambda can be written without an encapsulating class, whereas a method cannot. My habit is to use a lambda unless the appropriate encapsulated method is already at hand. + +The **sum** function at the end of the current example does the reduction in a thread-safe manner by combining the partial sums from the **parallelStream** threads. However, the programmer is responsible for ensuring that, in the course of the multi-threading induced by the **parallelStream** call, the programmer's own function calls (in this case, to **getValue**) are thread-safe. + +The last point deserves emphasis. Lambda syntax encourages the writing of _pure functions_, which are functions whose return values depend only on the arguments, if any, passed in; a pure function has no side effects such as updating a **static** field in a class. Pure functions are thereby thread-safe, and the stream API works best if the functional arguments passed to higher-order functions, such as **filter** and **map**, are pure functions. + +For finer-grained control, there is another stream API function, named **reduce**, that could be used for summing the values in the **Number** stream: + + +``` +[Integer][7] sum4AllHarder = listOfNums +   .parallelStream()                           // multi-threading +   .map([Number][5]::getValue)                      // value per Number +   .reduce(0, (sofar, next) -> sofar + next);  // reduction to a sum +``` + +This version of the **reduce** function takes two arguments, the second of which is a function: + + * The first argument (in this case, zero) is the _identity_ value, which serves as the initial value for the reduction operation and as the default value should the stream run dry during the reduction. + * The second argument is the _accumulator_, in this case, a lambda with two arguments: the first argument (**sofar**) is the running sum, and the second argument (**next**) is the next value from the stream. The running sum and next value then are added to update the accumulator. Keep in mind that both the **map** and the **reduce** functions now execute in a multi-threaded context because of the **parallelStream** call at the start. + + + +In the examples so far, stream values are collected and then reduced, but, in general, the **Collectors** in the stream API can accumulate values without reducing them to a single value. The collection activity can produce arbitrarily rich data structures, as the next code segment illustrates. The example uses the same **listOfNums** as the preceding examples: + + +``` +Map<[Number][5].Parity, List<Number>> numMap = listOfNums +   .parallelStream() +   .collect(Collectors.groupingBy([Number][5]::getParity)); + +List<Number> evens = numMap.get([Number][5].Parity.EVEN); +List<Number> odds = numMap.get([Number][5].Parity.ODD); +``` + +The **numMap** in the first line refers to a **Map** whose key is a **Number** parity (**ODD** or **EVEN**) and whose value is a **List** of **Number** instances with values having the designated parity. Once again, the processing is multi-threaded through the **parallelStream** call, and the **collect** call then assembles (in a thread-safe manner) the partial results into the single **Map** to which **numMap** refers. The **get** method then is called twice on the **numMap**, once to get the **evens** and a second time to get the **odds**. + +The utility function **dumpList** again uses the higher-order **forEach** function from the stream API: + + +``` +private void dumpList([String][8] msg, List<Number> list) { +   [System][4].out.println("\n" + msg); +   list.stream().forEach(n -> n.dump()); // or: forEach(Number::dump) +} +``` + +Here is a slice of the program's output from a sample run: + + +``` +The sum of the randomly generated values is: 3322 +The sum again, using a different method:     3322 + +Evens: + +Value: 72 (parity: even) +Value: 54 (parity: even) +... +Value: 92 (parity: even) + +Odds: + +Value: 35 (parity: odd) +Value: 37 (parity: odd) +... +Value: 41 (parity: odd) +``` + +### Functional constructs for code simplification + +Functional constructs, such as method references and lambdas, fit nicely into the stream API. These constructs represent a major simplification of higher-order functions in Java. Even in the bad old days, Java technically supported higher-order functions through the **Method** and **Constructor** types, instances of which could be passed as arguments to other functions. These types were used—but rarely in production-grade Java precisely because of their complexity. Invoking a **Method**, for example, requires either an object reference (if the method is non-**static**) or at least a class identifier (if the method is **static**). The arguments for the invoked **Method** then are passed to it as **Object** instances, which may require explicit downcasting if polymorphism (another complexity!) is not in play. By contrast, lambdas and method references are easy to pass as arguments to other functions. + +The new functional constructs have uses beyond the stream API, however. Consider a Java GUI program with a button for the user to push, for example, to get the current time. The event handler for the button push might be written as follows: + + +``` +[JButton][9] updateCurrentTime = new [JButton][9]("Update current time"); +updateCurrentTime.addActionListener(new [ActionListener][10]() { +   @Override +   public void actionPerformed([ActionEvent][11] e) { +      currentTime.setText(new [Date][12]().toString()); +   } +}); +``` + +This short code segment is a challenge to explain. Consider the second line in which the argument to the method **addActionListener** begins as follows: + + +``` +`new ActionListener() {` +``` + +This seems wrong in that **ActionListener** is an **abstract** interface, and **abstract** types cannot be instantiated with a call to **new**. However, it turns out that something else entirely is being instantiated: an unnamed inner class that implements this interface. If the code above were encapsulated in a class named **OldJava**, then this unnamed inner class would be compiled as **OldJava$1.class**. The **actionPerformed** method is overridden in the unnamed inner class. + +Now consider this refreshing change with the new functional constructs: + + +``` +`updateCurrentTime.addActionListener(e -> currentTime.setText(new Date().toString()));` +``` + +The argument **e** in the lambda is an **ActionEvent** instance, and the lambda's body is a simple call to **setText** on the button. + +### Functional interfaces and composition + +The lambdas used so far have been written in place. For convenience, however, there can be references to lambdas just as there are to encapsulated methods. The following series of short examples illustrate this. + +Consider this interface definition: + + +``` +@FunctionalInterface // optional, usually omitted +interface BinaryIntOp { +    abstract int compute(int arg1, int arg2); // abstract could be dropped +} +``` + +The annotation **@FunctionalInterface** applies to any interface that declares a _single_ abstract method; in this case, **compute**. Several standard interfaces (e.g., the **Runnable** interface with its single declared method, **run**) fit the bill. In this example, **compute** is the declared method. The interface can be used as the target type in a reference declaration: + + +``` +BinaryIntOp div = (arg1, arg2) -> arg1 / arg2; +div.compute(12, 3); // 4 +``` + +The package **java.util.function** provides various functional interfaces. Some examples follow. + +The code segment below introduces the parameterized **Predicate** functional interface. In this example, the type **Predicate<String>** with parameter **String** can refer to either a lambda with a **String** argument or a **String** method such as **isEmpty**. In general, a _predicate_ is a function that returns a boolean value. + + +``` +Predicate<String> pred = [String][8]::isEmpty; // predicate for a String method +[String][8][ ] strings = {"one", "two", "", "three", "four"}; +[Arrays][6].asList(strings) +   .stream() +   .filter(pred)                  // filter out non-empty strings +   .forEach([System][4].out::println); // only the empty string is printed +``` + +The **isEmpty** predicate evaluates to **true** just in case a string's length is zero; hence, only the empty string makes it through to the **forEach** stage in the pipeline. + +The next code segments illustrate how simple lambdas or method references can be composed into richer ones. Consider this series of assignments to references of the **IntUnaryOperator** type, which takes an integer argument and returns an integer value: + + +``` +IntUnaryOperator doubled = n -> n * 2; +IntUnaryOperator tripled = n -> n * 3; +IntUnaryOperator squared = n -> n * n; +``` + +**IntUnaryOperator** is a **FunctionalInterface** whose single declared method is **applyAsInt**. The three references **doubled**, **tripled**, and **squared** now can be used standalone or in various compositions: + + +``` +int arg = 5; +doubled.applyAsInt(arg); // 10 +tripled.applyAsInt(arg); // 15 +squared.applyAsInt(arg); // 25 +``` + +Here are some sample compositions: + + +``` +int arg = 5; +doubled.compose(squared).applyAsInt(arg); // doubled-the-squared: 50 +tripled.compose(doubled).applyAsInt(arg); // tripled-the-doubled: 30 +doubled.andThen(squared).applyAsInt(arg); // doubled-andThen-squared: 100 +squared.andThen(tripled).applyAsInt(arg); // squared-andThen-tripled: 75 +``` + +Compositions could be done with in-place lambdas, but the references make the code cleaner. + +### Constructor references + +Constructor references are yet another of the functional programming constructs, but these references are useful in more subtle contexts than lambdas and method references. Once again, a code example seems the best way to clarify. + +Consider this [POJO][13] class: + + +``` +public class BedRocker { // resident of Bedrock +    private [String][8] name; +    public BedRocker([String][8] name) { this.name = name; } +    public [String][8] getName() { return this.name; } +    public void dump() { [System][4].out.println(getName()); } +} +``` + +The class has a single constructor, which requires a **String** argument. Given an array of names, the goal is to generate an array of **BedRocker** elements, one per name. Here is the code segment that uses functional constructs to do so: + + +``` +[String][8][ ] names = {"Fred", "Wilma", "Peebles", "Dino", "Baby Puss"}; + +Stream<BedRocker> bedrockers = [Arrays][6].asList(names).stream().map(BedRocker::new); +BedRocker[ ] arrayBR = bedrockers.toArray(BedRocker[]::new); + +[Arrays][6].asList(arrayBR).stream().forEach(BedRocker::dump); +``` + +At a high level, this code segment transforms names into **BedRocker** array elements. In detail, the code works as follows. The **Stream** interface (in the package **java.util.stream**) can be parameterized, in this case, to generate a stream of **BedRocker** items named **bedrockers**. + +The **Arrays.asList** utility again is used to streamify an array, **names**, with each stream item then passed to the **map** function whose argument now is the constructor reference **BedRocker::new**. This constructor reference acts as an object factory by generating and initializing, on each call, a **BedRocker** instance. After the second line executes, the stream named **bedrockers** consists of five **BedRocker** items. + +The example can be clarified further by focusing on the higher-order **map** function. In a typical case, a mapping transforms a value of one type (e.g., an **int**) into a different value of the _same_ type (e.g., an integer's successor): + + +``` +`map(n -> n + 1) // map n to its successor` +``` + +In the **BedRocker** example, however, the transformation is more dramatic because a value of one type (a **String** representing a name) is mapped to a value of a _different_ type, in this case, a **BedRocker** instance with the string as its name. The transformation is done through a constructor call, which is enabled by the constructor reference: + + +``` +`map(BedRocker::new) // map a String to a BedRocker` +``` + +The value passed to the constructor is one of the names in the **names** array. + +The second line of this code example also illustrates the by-now-familiar transformation of an array first into a **List** and then into a **Stream**: + + +``` +`Stream bedrockers = Arrays.asList(names).stream().map(BedRocker::new);` +``` + +The third line goes the other way—the stream **bedrockers** is transformed into an array by invoking the **toArray** method with the _array_ constructor reference **BedRocker[]::new**: + + +``` +`BedRocker[ ] arrayBR = bedrockers.toArray(BedRocker[]::new);` +``` + +This constructor reference does not create a single **BedRocker** instance, but rather an entire array of these: the constructor reference is now **BedRocker[]::new** rather than **BedRocker::new**. For confirmation, the **arrayBR** is transformed into a **List**, which again is streamified so that **forEach** can be used to print the **BedRocker** names: + + +``` +Fred +Wilma +Peebles +Dino +Baby Puss +``` + +The example's subtle transformations of data structures are done with but few lines of code, underscoring the power of various higher-order functions that can take a lambda, a method reference, or a constructor reference as an argument + +### Currying + +To _curry_ a function is to reduce (typically by one) the number of explicit arguments required for whatever work the function does. (The term honors the logician Haskell Curry.) In general, functions are easier to call and are more robust if they have fewer arguments. (Recall some nightmarish function that expects a half-dozen or so arguments!) Accordingly, currying should be seen as an effort to simplify a function call. The interface types in the **java.util.function** package are suited for currying, as the next example shows. + +References of the **IntBinaryOperator** interface type are for functions that take two integer arguments and return an integer value: + + +``` +IntBinaryOperator mult2 = (n1, n2) -> n1 * n2; +mult2.applyAsInt(10, 20); // 200 +mult2.applyAsInt(10, 30); // 300 +``` + +The reference name **mult2** underscores that two explicit arguments are required, in this example, 10 and 20. + +The previously introduced **IntUnaryOperator** is simpler than an **IntBinaryOperator** because the former requires just one argument, whereas the latter requires two arguments. Both return an integer value. The goal, therefore, is to curry the two-argument **IntBinraryOperator** named **mult2** into a one-argument **IntUnaryOperator** version **curriedMult2**. + +Consider the type **IntFunction<R>**. A function of this type takes an integer argument and returns a result of type **R**, which could be another function—indeed, an **IntBinaryOperator**. Having a lambda return another lambda is straightforward: + + +``` +`arg1 -> (arg2 -> arg1 * arg2) // parentheses could be omitted` +``` + +The full lambda starts with **arg1,** and this lambda's body—and returned value—is another lambda, which starts with **arg2**. The returned lambda takes just one argument (**arg2**) but returns the product of two numbers (**arg1** and **arg2**). The following overview, followed by the code, should clarify. + +Here is an overview of how **mult2** can be curried: + + * A lambda of type **IntFunction<IntUnaryOperator>** is written and called with an integer value such as 10. The returned **IntUnaryOperator** caches the value 10 and thereby becomes the curried version of **mult2**, in this example, **curriedMult2**. + * The **curriedMult2** function then is called with a single explicit argument (e.g., 20), which is multiplied with the cached argument (in this case, 10) to produce the product returned. + + + +Here are the details in code: + + +``` +// Create a function that takes one argument n1 and returns a one-argument +// function n2 -> n1 * n2 that returns an int (the product n1 * n2). +IntFunction<IntUnaryOperator> curriedMult2Maker = n1 -> (n2 -> n1 * n2); +``` + +Calling the **curriedMult2Maker** generates the desired **IntUnaryOperator** function: + + +``` +// Use the curriedMult2Maker to get a curried version of mult2. +// The argument 10 is n1 from the lambda above. +IntUnaryOperator curriedMult2 = curriedMult2Maker2.apply(10); +``` + +The value 10 is now cached in the **curriedMult2** function so that the explicit integer argument in a **curriedMult2** call will be multiplied by 10: + + +``` +curriedMult2.applyAsInt(20); // 200 = 10 * 20 +curriedMult2.applyAsInt(80); // 800 = 10 * 80 +``` + +The cached value can be changed at will: + + +``` +curriedMult2 = curriedMult2Maker.apply(50); // cache 50 +curriedMult2.applyAsInt(101);               // 5050 = 101 * 50 +``` + +Of course, multiple curried versions of **mult2**, each an **IntUnaryOperator**, can be created in this way. + +Currying takes advantage of a powerful feature about lambdas: a lambda is easily written to return whatever type of value is needed, including another lambda. + +### Wrapping up + +Java remains a class-based object-oriented programming language. But with the stream API and its supporting functional constructs, Java takes a decisive (and welcomed) step toward functional languages such as Lisp. The result is a Java better suited to process the massive data streams so common in modern programming. This step in the functional direction also makes it easier to write clear, concise Java in the pipeline style highlighted in previous code examples: + + +``` +dataStream +   .parallelStream() // multi-threaded for efficiency +   .filter(...)      // stage 1 +   .map(...)         // stage 2 +   .filter(...)      // stage 3 +   ... +   .collect(...);    // or, perhaps, reduce: stage N +``` + +The automatic multi-threading, illustrated with the **parallel** and **parallelStream** calls, is built upon Java's fork/join framework, which supports _task stealing_ for efficiency. Suppose that the thread pool behind a **parallelStream** call consists of eight threads and that the **dataStream** is partitioned eight ways. Some thread (e.g., T1) might work faster than another (e.g., T7), which means that some of T7's tasks ought to be moved into T1's work queue. This happens automatically at runtime. + +The programmer's chief responsibility in this easy multi-threading world is to write thread-safe functions passed as arguments to the higher-order functions that dominate in the stream API. Lambdas, in particular, encourage the writing of pure—and, therefore, thread-safe—functions. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/javastream + +作者:[Marty Kalin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mkalindepauledu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/features_solutions_command_data.png?itok=4_VQN3RK (computer screen ) +[2]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random +[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+list +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+number +[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+arrays +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+jbutton +[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionlistener +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent +[12]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+date +[13]: https://en.wikipedia.org/wiki/Plain_old_Java_object From b5334c946f9a92e9c46f0eda85f9f8ee4678fb1c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 3 Jan 2020 00:54:51 +0800 Subject: [PATCH 0066/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200102=2010?= =?UTF-8?q?=20open=20source=20software=20alternatives=20for=20the=20new=20?= =?UTF-8?q?year?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200102 10 open source software alternatives for the new year.md --- ... software alternatives for the new year.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20200102 10 open source software alternatives for the new year.md diff --git a/sources/tech/20200102 10 open source software alternatives for the new year.md b/sources/tech/20200102 10 open source software alternatives for the new year.md new file mode 100644 index 0000000000..59d7f4067e --- /dev/null +++ b/sources/tech/20200102 10 open source software alternatives for the new year.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 open source software alternatives for the new year) +[#]: via: (https://opensource.com/article/20/1/open-source-alternatives) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +10 open source software alternatives for the new year +====== +Open source software can help you become better organized, more +productive, more secure, and even healthier. +![Multi-colored and directional network computer cables][1] + +Open source isn't just for techies. On your desktop (regardless of your operating system), on your phone, and in your business, open source software can help you become better organized, more productive, more secure, and healthier. Best of all, you don't need to worry about the shackles of proprietary licenses. + +Throughout 2019, Opensource.com's team of [Correspondents][2] and community of writers have highlighted top-notch open source alternatives to proprietary software. Take a quick look at the best 10 of those articles. + +In _[Intro to Corteza, an open source alternative to Salesforce][3]_, Dennis Arh introduces us to Corteza, a powerful and flexible customer relationship management (CRM) system. Dennis outlines what Corteza has to offer, then walks us through how to install and configure the system. While Corteza might not pack all the features of the bigger closed source CRM systems, it's more than enough for the majority of users. + +Opensource.com Correspondent Chris Hermansen whips up an overview of a half-dozen instant messaging apps for mobile devices in _[Choosing an open messenger client: Alternatives to WhatsApp][4]_. While each of the six apps has its strengths, Chris recommends Signal for "its open-by-design approach, its serious and ongoing privacy and security stance, and having a Signal app on our GNOME (and Windows) desktops." + +In _[5 social media alternatives to protect your privacy][5]_, privacy advocate Dan Arel walks through several open source replacements for Twitter, Facebook, Instagram, WhatsApp, and Facebook Messenger. Dan also shares how he cut his ties with those privacy-crushing services without losing touch with the people who matter. His approach might work for you, too. + +You don't need an expensive application like Adobe Acrobat to work with PDF files on the Linux desktop, as I show in _[Two graphical tools for manipulating PDFs on the Linux desktop][6]_. These tools are simple, but they pack a lot of punch and take care of most of your PDF manipulation needs. + +In _[How to create an automated calendar with Google Apps Script with open source on top][7]_, Correspondent Dan Barker explores how to manage conference submissions by stitching together a Google Sheet with Google Calendar using a script he wrote. OK, the services Dan's script interacts with aren't open source, but you can grab that script from [Dan's GitLab repository][8] and modify it to your heart's content. + +In _[4 open source apps for plant-based diets][9]_, Correspondent Joshua Allen Holm uncovers some mobile apps that can help you plan meatless meals, shop more effectively for the ingredients for those meals, and find vegan and vegetarian restaurants nearby. As someone who's shifting to a more plant-based diet, I can see myself using a couple of these apps in the near future. And that they're available on [F-Droid][10] is a bonus. + +I dive into a very useful spreadsheet editor that's built for collaboration in _[Get going with EtherCalc, a web-based alternative to Google Sheets][11]_. If you're of a technical bent, you can run your own instance; otherwise, you can use one of several hosted editions. EtherCalc does take a bit of getting used to, but if your needs are simple, you'll find (as I did) that it's a flexible tool. + +Opensource.com's Seth Kenlon examines _[CBZ and DjVu: Open source alternatives to PDFs][12]_. This pair of digital archive formats can do everything PDF can do but are easier to manipulate. Seth also shows how to use command-line tools to create archives in the CBZ and DjVu formats and, with DjVu files, offers some advanced tips and tricks. + +I explain how a good open source application can exist quite nicely in a proprietary environment in _[Organize your information on the Mac desktop with nvALT][13]_. In this article, I discuss how to how to manage notes and more with this _very_ useful tool. What makes nvALT all the more attractive to me is that [plain text][14] is at its core, so it's a solid fit for my workflow whenever I'm working in MacOS. + +In _[Getting started with Pimcore: An open source alternative for product information management][15]_, Dietmar Rietsch introduces a tool for businesses of all sizes to manage, mold, and share data about their products. In the past, I worked for a company or two that specialized in this type of software. It's great to see an open source alternative that's as flexible, polished, and easy to use as its closed source cousins. + +These articles give you a taste of the open source alternatives to proprietary software that are out there. Are there any substitutes for proprietary software that you think we should cover in the coming months? Feel free to leave a comment or, better yet, [submit an article proposal][16]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-alternatives + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: https://opensource.com/correspondent-program +[3]: https://opensource.com/article/19/8/corteza-open-source-alternative-salesforce +[4]: https://opensource.com/article/19/3/open-messenger-client +[5]: https://opensource.com/article/19/1/open-source-social-media-alternatives +[6]: https://opensource.com/article/19/2/manipulating-pdfs-linux +[7]: https://opensource.com/article/19/1/automate-calendar +[8]: https://gitlab.com/barkerd427/conference-scripts +[9]: https://opensource.com/article/19/4/apps-plant-based-diets +[10]: https://f-droid.org/ +[11]: https://opensource.com/article/19/7/get-going-ethercalc +[12]: https://opensource.com/article/19/3/comic-book-archive-djvu +[13]: https://opensource.com/article/19/1/nvalt +[14]: https://plaintextproject.online/ +[15]: https://opensource.com/article/19/11/pimcore-alternative-product-information-management +[16]: https://opensource.com/how-submit-article From a81ef337e2355038184c6b6f016acceb4b3c5118 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 3 Jan 2020 00:55:22 +0800 Subject: [PATCH 0067/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200102=20Put?= =?UTF-8?q?=20some=20loot=20in=20your=20Python=20platformer=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200102 Put some loot in your Python platformer game.md --- ...ome loot in your Python platformer game.md | 535 ++++++++++++++++++ 1 file changed, 535 insertions(+) create mode 100644 sources/tech/20200102 Put some loot in your Python platformer game.md diff --git a/sources/tech/20200102 Put some loot in your Python platformer game.md b/sources/tech/20200102 Put some loot in your Python platformer game.md new file mode 100644 index 0000000000..678fb69516 --- /dev/null +++ b/sources/tech/20200102 Put some loot in your Python platformer game.md @@ -0,0 +1,535 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Put some loot in your Python platformer game) +[#]: via: (https://opensource.com/article/20/1/loot-python-platformer-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Put some loot in your Python platformer game +====== +Give your players some treasures to collect and boost their score in +this installment on programming video games with Python's Pygame module. +![Hearts, stars, and dollar signs][1] + +This is part 9 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: + + * [Learn how to program in Python by building a simple dice game][4] + * [Build a game framework with Python using the Pygame module][5] + * [How to add a player to your Python game][6] + * [Using Pygame to move your game character around][7] + * [What's a hero without a villain? How to add one to your Python game][8] + * [Simulate gravity in your Python game][9] + * [Add jumping to your Python platformer game][10] + * [Enable your Python game player to run forward and backward][11] + + + +If you've followed along with the previous articles in this series, then you know all the basics of programming video game mechanics. You can build upon these basics to create a fully functional video game all your own. Following a "recipe" like the code samples in this series is helpful when you're first learning, but eventually, the recipe becomes a constraint. It's time to use the principles you've learned and apply them in new ways. + +If that sounds easier said than done, this article demonstrates an example of how to leverage what you already know for new purposes. Specifically, it covers how to implement a looting system + +using what you have already learned about platforms from previous lessons. + +In most video games, you have the opportunity to "loot," or collect treasures and other items within the game world. Loot usually increases your score or your health or provides information leading to your next quest. + +Including loot in your game is similar to programming platforms. Like platforms, loot has no user controls, scrolls with the game world, and must check for collisions with the player sprite. + +### Creating the loot function + +Loot is so similar to platforms that you don't even need a Loot class. You can just reuse the **Platform** class and call the results loot. + +Since loot type and placement probably differ from level to level, create a new function called **loot** in your **Level** class, if you don't already have one. Since loot items are not platforms, you must also create a new **loot_list** group and then add loot objects to it. As with platforms, ground, and enemies, this group is used when checking for collisions: + + +``` +    def loot(lvl,lloc): +        if lvl == 1: +            loot_list = pygame.sprite.Group() +            loot = Platform(300,ty*7,tx,ty, 'loot_1.png') +            loot_list.add(loot) + +        if lvl == 2: +            print(lvl) + +        return loot_list +``` + +You can add as many loot objects as you like; just remember to add each one to your loot list. The arguments for the **Platform** class are the X position, the Y position, the width and height of the loot sprite (it's usually easiest to keep your loot sprite the same size as all other tiles), and the image you want to use as loot. Placement of loot can be just as complex as mapping platforms, so use the level design document you created when creating the level. + +Call your new loot function in the **Setup** section of your script. In the following code, the first three lines are for context, so just add the fourth: + + +``` +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) +loot_list = Level.loot(1,tx,ty) +``` + +As you know by now, the loot won't get drawn to the screen unless you include it in your main loop. Add the final line from the following code sample to your loop: + + +``` +    enemy_list.draw(world) +    ground_list.draw(world) +    plat_list.draw(world) +    loot_list.draw(world) +``` + +Launch your game to see what happens. + +![Loot in Python platformer][12] + +Your loot objects are spawned, but they don't do anything when your player runs into them, nor do they scroll when your player runs past them. Fix these issues next. + +### Scrolling loot + +Like platforms, loot has to scroll when the player moves through the game world. The logic is identical to platform scrolling. To scroll the loot forward, add the last two lines: + + +``` +        for e in enemy_list: +            e.rect.x -= scroll +        for l in loot_list: +            l.rect.x -= scroll +``` + +To scroll it backward, add the last two lines: + + +``` +        for e in enemy_list: +            e.rect.x += scroll +        for l in loot_list: +            l.rect.x += scroll +``` + +Launch your game again to see that your loot objects now act like they're _in_ the game world instead of just painted on top of it. + +### Detecting collisions + +As with platforms and enemies, you can check for collisions between loot and your player. The logic is the same as other collisions, except that a hit doesn't (necessarily) affect gravity or health. Instead, a hit causes the loot to disappear and increment the player's score. + +When your player touches a loot object, you can remove that object from the **loot_list**. This means that when your main loop redraws all loot items in **loot_list**, it won't redraw that particular object, so it will look like the player has grabbed the loot. + +Add the following code above the platform collision detection in the **update** function of your **Player** class (the last line is just for context): + + +``` +                loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) +                for loot in loot_hit_list: +                        loot_list.remove(loot) +                        self.score += 1 +                print(self.score) +  +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +``` + +Not only do you remove the loot object from its group when a collision happens, but you also award your player a bump in score. You haven't created a score variable yet, so add that to your player's properties, created in the **__init__** function of the **Player** class. In the following code, the first two lines are for context, so just add the score variable: + + +``` +        self.frame = 0 +        self.health = 10 +        self.score = 0 +``` + +When calling the **update** function in your main loop, include the **loot_list**: + + +``` +        player.gravity() +        player.update() +``` + +As you can see, you've got all the basics. All you have to do now is use what you know in new ways. + +There are a few more tips in the next article, but in the meantime, use what you've learned to make a few simple, single-level games. Limiting the scope of what you are trying to create is important so that you don't overwhelm yourself. It also makes it easier to end up with a finished product that looks and feels finished. + +Here's all the code you've written for this Python platformer so far: + + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform +# add gravity +# add jumping +# add scrolling + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os + +''' +Objects +''' + +class Platform(pygame.sprite.Sprite): +    # x location, y location, img width, img height, img file     +    def __init__(self,xloc,yloc,imgw,imgh,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)).convert() +        self.image.convert_alpha() +        self.rect = self.image.get_rect() +        self.rect.y = yloc +        self.rect.x = xloc + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 +        self.movey = 0 +        self.frame = 0 +        self.health = 10 +        self.collide_delta = 0 +        self.jump_delta = 6 +        self.score = 1 +        self.images = [] +        for i in range(1,9): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha() +            img.set_colorkey(ALPHA) +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() + +    def jump(self,platform_list): +        self.jump_delta = 0 + +    def gravity(self): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty +        +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +        +    def update(self): +        ''' +        Update sprite position +        ''' +        +        self.rect.x = self.rect.x + self.movex +        self.rect.y = self.rect.y + self.movey + +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        for enemy in enemy_hit_list: +            self.health -= 1 +            #print(self.health) + +        loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) +        for loot in loot_hit_list: +            loot_list.remove(loot) +            self.score += 1 +            print(self.score) + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.collide_delta = 0 # stop jumping +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty +            +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.movey = 0 +            self.rect.y = worldy-ty-ty +            self.collide_delta = 0 # stop jumping +            if self.rect.y > g.rect.y: +                self.health -=1 +                print(self.health) +                +        if self.collide_delta < 6 and self.jump_delta < 6: +            self.jump_delta = 6*2 +            self.movey -= 33  # how high to jump +            self.collide_delta += 6 +            self.jump_delta    += 6 +            +class Enemy(pygame.sprite.Sprite): +    ''' +    Spawn an enemy +    ''' +    def __init__(self,x,y,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)) +        self.movey = 0 +        #self.image.convert_alpha() +        #self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.counter = 0 + +                +    def move(self): +        ''' +        enemy movement +        ''' +        distance = 80 +        speed = 8 + +        self.movey += 3.2 +        +        if self.counter >= 0 and self.counter <= distance: +            self.rect.x += speed +        elif self.counter >= distance and self.counter <= distance*2: +            self.rect.x -= speed +        else: +            self.counter = 0 +        +        self.counter += 1 + +        if not self.rect.y >= worldy-ty-ty: +            self.rect.y += self.movey + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.rect.y = worldy-ty-ty + +        +class Level(): +    def bad(lvl,eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list.add(enemy)              # add enemy to group +            +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return enemy_list + +    def loot(lvl,tx,ty): +        if lvl == 1: +            loot_list = pygame.sprite.Group() +            loot = Platform(200,ty*7,tx,ty, 'loot_1.png') +            loot_list.add(loot) + +        if lvl == 2: +            print(lvl) + +        return loot_list + +    def ground(lvl,gloc,tx,ty): +        ground_list = pygame.sprite.Group() +        i=0 +        if lvl == 1: +            while i < len(gloc): +                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') +                ground_list.add(ground) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return ground_list + +    def platform(lvl,tx,ty): +        plat_list = pygame.sprite.Group() +        ploc = [] +        i=0 +        if lvl == 1: +            ploc.append((20,worldy-ty-128,3)) +            ploc.append((300,worldy-ty-256,3)) +            ploc.append((500,worldy-ty-128,4)) + +            while i < len(ploc): +                j=0 +                while j <= ploc[i][2]: +                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') +                    plat_list.add(plat) +                    j=j+1 +                print('run' + str(i) + str(ploc[i])) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return plat_list + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4  # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +ALPHA = (0,255,0) + +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +forwardx = 600 +backwardx = 230 + +eloc = [] +eloc = [200,20] +gloc = [] +#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] +tx = 64 #tile size +ty = 64 #tile size + +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) +loot_list = Level.loot(1,tx,ty) + +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print("LEFT") +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print("RIGHT") +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                player.jump(plat_list) + +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +        for l in loot_list: +            l.rect.x -= scroll +                +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll +        for l in loot_list: +            l.rect.x += scroll + +    world.blit(backdrop, backdropbox)     +    player.gravity() # check gravity +    player.update() +    player_list.draw(world) #refresh player position +    enemy_list.draw(world)  # refresh enemies +    ground_list.draw(world)  # refresh enemies +    plat_list.draw(world)   # refresh platforms +    loot_list.draw(world)   # refresh loot + +    for e in enemy_list: +        e.move() +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/loot-python-platformer-game + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_lovemoneyglory2.png?itok=AvneLxFp (Hearts, stars, and dollar signs) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://opensource.com/article/17/10/python-101 +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: https://opensource.com/article/17/12/game-python-add-a-player +[7]: https://opensource.com/article/17/12/game-python-moving-player +[8]: https://opensource.com/article/18/5/pygame-enemy +[9]: https://opensource.com/article/19/11/simulate-gravity-python +[10]: https://opensource.com/article/19/12/jumping-python-platformer-game +[11]: https://opensource.com/article/19/12/python-platformer-game-run +[12]: https://opensource.com/sites/default/files/uploads/pygame-loot.jpg (Loot in Python platformer) From 710ae3242d3bc3c45b19f90796510493bac3029c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 08:38:04 +0800 Subject: [PATCH 0068/3057] PRF @wxy --- ... Pop-_OS vs Ubuntu- Which One is Better.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md index 3693d00e22..292ce90348 100644 --- a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md +++ b/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?) @@ -12,7 +12,7 @@ Pop!_OS 与 Ubuntu:哪个更棒? 好吧,你可能会发现从[最佳 Linux 发行版][1]列表中选择一个发行版很容易,但是,将两个类似的 Linux 发行版进行比较通常会令人困惑,就像 Pop!_OS 与 Ubuntu 一样。 -有趣的是,Pop!\_OS 基于 [Ubuntu][2]。那么,Pop!\_OS 和 Ubuntu 之间有什么区别呢?为什么要从中选择一个呢? +有趣的是,Pop!\_OS 是基于 [Ubuntu][2] 的。那么,Pop!\_OS 和 Ubuntu 之间有什么区别呢?为什么要从中选择一个呢? 在本文中,我将比较 Pop!_OS 和 Ubuntu(两者都是我的最爱)。 @@ -24,7 +24,7 @@ Pop!_OS 与 Ubuntu:哪个更棒? 发现相似之处可帮助你区分其他差异之处。因此,让我们从一些明显的相似之处开始。 -就像我提到的,Pop!\_OS 是基于 Ubuntu 之上的 Linux 发行版。因此,当你使用 Pop!_OS 时,你将获得使用 Ubuntu 的所有好处(从技术上说,其核心是一样的)。 +就像我提到的,Pop!\_OS 是基于 Ubuntu 之上的 Linux 发行版。因此,当你使用 Pop!\_OS 时,你将获得使用 Ubuntu 的所有好处(从技术上说,其核心是一样的)。 它们都默认带有 [GNOME 桌面环境][4],因此它们具有相似的用户界面(UI)。 @@ -42,7 +42,7 @@ Pop!_OS 与 Ubuntu:哪个更棒? 除了外观之外,[Ubuntu 还通过添加程序坞和其他一些小花巧来定制了 GNOME 的体验][6]。如果你喜欢定制的 GNOME 体验,可能会发现它更好。 -但是,如果你更喜欢纯粹的 GNOME 体验,默认情况下 Pop!_OS 会为你提供。 +但是,如果你更喜欢纯粹的 GNOME 体验,Pop!_OS 默认情况下为你提供的就是这样。 在你亲自尝试之前,我无法说服你。但是,Pop!_OS 中的总体配色方案、图标和主题可以说是令人愉悦的高级用户体验。 @@ -60,7 +60,7 @@ Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数 我为什么要说这个呢? -因为 Pop!_OS 具有其[自己的官方 PPA][8],并在默认情况下已启用。你会在此处找到一些有用的应用程序,例如 Android Studio、TensorFlow。无需下载 Android Studio 的 1GB 大的 Snap 程序包。只需使用 [apt-get install][9]就可以了。 +因为 Pop!_OS 具有其[自己的官方 PPA][8],并已默认启用。你会在此处找到一些有用的应用程序,例如 Android Studio、TensorFlow。无需下载 Android Studio 的 1GB 大的 Snap 程序包。只需使用 [apt-get install][9]就可以了。 #### 预装应用 @@ -76,13 +76,13 @@ Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数 ![][11] -对于熟悉 Snap 程序包的用户来说,Ubuntu 的软件中心是比 Pop!_OS 商店更好的解决方案,因为你可以在软件中心中列出快照程序包。 +对于熟悉 Snap 程序包的用户来说,Ubuntu 的软件中心是比 Pop!_OS 商店更好的解决方案,因为你可以在软件中心中列出 Snap 程序包。 -你无法在软件中心中过滤快照包,但是当你在软件中心中发现一个 Snap 包(查看应用程序来源的详细信息为“ Snap store ”/“Snapcraft”)时安装它就更容易了。 +你无法在软件中心中过滤 Snap 软件包,但是当你在软件中心中发现一个 Snap 软件包(查看应用程序来源的详细信息为 “Snap store”/“Snapcraft”)时安装它就更容易了。 -如果你感到困惑,Pop!\_OS 也确实支持快照包。但是,你不会在 Pop!_OS 商店中找到它们,这是唯一的区别。 +可能你会感到困惑,Pop!\_OS 也确实支持 Snap 软件包。但是,你不会在 Pop!\_OS 商店中找到它们,这是唯一的区别。 -如果不确定什么是 Snap 软件包及其功能,可以查看我们的文章[在 Linux 上安装 Snap 应用][12]。 +如果不确定什么是 Snap 软件包及其功能,可以查看我们的文章《[在 Linux 上安装 Snap 应用][12]》。 #### 单独的 NVIDIA/AMD ISO 文件 @@ -96,9 +96,9 @@ Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数 #### 可靠性与问题 -毫无疑问,这两个[发行版都适合初学者][14],并且相当可靠。如果你想要更好的可靠性和更少的问题,则可能希望一直用长期支持(LTS)版本。 +毫无疑问,这两个[发行版都适合初学者][14],并且相当可靠。如果你想要更好的可靠性和更少的问题,则可能希望一直使用长期支持(LTS)版本。 -当出现新版本的 Ubuntu 时,Pop!_OS 将在其上开发,并有可能解决用户在 Ubuntu 原始发行版上遇到的问题,然后再进行新的升级。这给他们带来了一点优势,但这没什么实质性的不同,因为这些修复最终都可以运用于 Ubuntu。 +当出现新版本的 Ubuntu 时,Pop!_OS 将在其上开发,并有可能解决用户在 Ubuntu 原始发行版上遇到的问题,然后再进行新的升级。这给它们带来了一点优势,但这没什么实质性的不同,因为这些修复最终都可以运用于 Ubuntu。 #### 性能 @@ -110,7 +110,7 @@ Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数 当然,你可以手动进行一些优化调整以满足要求——无论它们中的哪个不满足你的硬件配置。 -但是,如果你想使用 System76 笔记本电脑,那么 Pop!\_OS 将可以证明自己是 [Linux 领域的苹果][15],因为 Pop!_OS 是针对其硬件量身定制的,与 Ubuntu 有所不同。 +但是,如果你想使用 System76 笔记本电脑,那么 Pop!\_OS 将可以证明自己是 [Linux 领域的苹果][15],因为 Pop!\_OS 是针对其硬件量身定制的,与 Ubuntu 有所不同。 #### 硬件兼容性 @@ -131,7 +131,7 @@ via: https://itsfoss.com/pop-os-vs-ubuntu/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 20ec23ed537d76f5fa3f0ca936b662d398c1a21e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 08:53:40 +0800 Subject: [PATCH 0069/3057] PUB @wxy https://linux.cn/article-11744-1.html --- .../20191221 Pop-_OS vs Ubuntu- Which One is Better.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191221 Pop-_OS vs Ubuntu- Which One is Better.md (99%) diff --git a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/published/20191221 Pop-_OS vs Ubuntu- Which One is Better.md similarity index 99% rename from translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md rename to published/20191221 Pop-_OS vs Ubuntu- Which One is Better.md index 292ce90348..dd86eb3196 100644 --- a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md +++ b/published/20191221 Pop-_OS vs Ubuntu- Which One is Better.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11744-1.html) [#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?) [#]: via: (https://itsfoss.com/pop-os-vs-ubuntu/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From bcba764d318f9d0cce44b30c8c449028246540d0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 3 Jan 2020 08:59:00 +0800 Subject: [PATCH 0070/3057] translated --- ...nable to Open the MRL- Error -Quick Tip.md | 102 ------------------ ...nable to Open the MRL- Error -Quick Tip.md | 101 +++++++++++++++++ 2 files changed, 101 insertions(+), 102 deletions(-) delete mode 100644 sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md create mode 100644 translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md diff --git a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md deleted file mode 100644 index b8314533cf..0000000000 --- a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) -[#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Fixing “VLC is Unable to Open the MRL” Error [Quick Tip] -====== - -One of the [VLC tips][1] is to play YouTube and other online videos with [VLC][2]. This could help you [watch online videos with subtitles][3]. - -But things may not always be simple because at times you’ll encounter this error when trying to open YouTube video with VLC: - -**Your input can’t be opened: -VLC is unable to open the MRL ‘. Check the log for details.** - -![VLC error while playing YouTube videos][4] - -The thing here is that Google doesn’t want you to use any third party application for watching YouTube because then they cannot collect data properly. - -So, they keep changing stuff from their side to make it harder for third party devs to work with YouTube. - -Take [youtube-dl][5] for example. You’ll notice that you cannot [download YouTube videos][6] with it all of a sudden and the simplest solution is to have the latest version of youtube-dl installed. - -Same goes for VLC. If you [install the latest VLC in Ubuntu][7] or whichever operating system you are using, you probably won’t see this error. - -### Fixing “VLC is unable to open the MRL” error - -Let me show you the steps to fix this problem for YouTube at least. - -Go to this page and use Ctrl+S to save the file from the official GitHub repository of VLC media player: - -[Download youtube.lua file][8] - -Now, what you need to do is to replace the youtube.luac (mind the ‘c’ in luac) in lib/vlc/lua/playlist directory with this downloaded file. - -#### Steps for Linux - -If you are using Linux, open the terminal and use the [locate command][9] to find the exact location of youtube.luac file: - -``` -locate youtube.luac -``` - -When you get the path of the file, you just replace that file with your downloaded file. I trust you to handle this simple task. - -For me, it showed the path of the file here: - -``` -[email protected]:~$ locate youtube.lua -/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac -``` - -So all I did was to move the downloaded file to this location and replace the content of the file: - -``` -sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac -``` - -You should be able to play the YouTube videos in VLC now. - -#### Steps for Windows - -If you are using Windows, you should follow these steps: - - * Rename the downloaded youtube.lua file to youtube.luac - * Now copy this file and paste it to C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\ - - - -That’s it. - -If you have trouble with Dailymotion or other video streaming websites, you can download their respective lua files from the VLC repository [here][10] and replace the existing one in your VLC install. - -I hope this quick tip fixed the problem with VLC unable to play YouTube videos for you. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/simple-vlc-tips/ -[2]: https://www.videolan.org/index.html -[3]: https://itsfoss.com/penguin-subtitle-player/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc_error_input_cant_be_played.png?ssl=1 -[5]: https://itsfoss.com/download-youtube-linux/ -[6]: https://itsfoss.com/download-youtube-videos-ubuntu/ -[7]: https://itsfoss.com/install-latest-vlc/ -[8]: https://raw.githubusercontent.com/videolan/vlc/master/share/lua/playlist/youtube.lua -[9]: https://linuxhandbook.com/locate-command/ -[10]: https://github.com/videolan/vlc/tree/master/share/lua/playlist diff --git a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md new file mode 100644 index 0000000000..004f300c56 --- /dev/null +++ b/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) +[#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +修复 “VLC is Unable to Open the MRL” 错误 +====== + +一个使用 [VLC 的技巧][1]是使用 [VLC] [2] 播放 YouTube 和其他在线视频。这可以帮助你[观看带有字幕的在线视频][3]。 + +但是事情并不总是这么简单,因为有时使用 VLC 打开 YouTube 视频时会遇到此错误: + +**Your input can’t be opened: VLC is unable to open the MRL ‘. Check the log for details.** + +![VLC error while playing YouTube videos][4] + +这是因为 Google 不想让你使用任何第三方应用观看 YouTube,因为这样他们就无法正常收集数据。 + +因此,他们不断修改服务端,以使第三发开发更难与 Youtube 集成。 + +以 [youtube-dl][5] 为例。你会发现自己无法突然[下载 YouTube 视频] [6],最简单的方案是安装最新版本的 youtube-dl。 + +对于 VLC 也是如此。如果你[在 Ubuntu 或任何你用的系统中安装了最新的 VLC][7],那么可能不会看到此错误。 + +### 修复 ”VLC is unable to open the MRL“ 错误 + +让我向你展示对于 YouTube 的修复步骤。 + +进入 VLC 媒体播放器的官方 Github 仓库页面,并使用 Ctrl+S 保存文件: + +[Download youtube.lua file][8] + +现在,你需要做的是用此下载文件替换 lib/vlc/lua/playlist 目录中的 youtube.luac(注意 luac 中的 “c”)。 + +#### Linux 中的步骤 + +如果你使用的是 Linux,请打开终端并使用 [locate 命令][9]查找 youtube.luac 文件的确切位置: + +``` +locate youtube.luac +``` + +当你得到文件的路径时,只需将该文件替换为下载的文件即可。我相信你可以完成这项简单的任务。 + +对我而言,以下是文件路径: + +``` +[email protected]:~$ locate youtube.lua +/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac +``` + +因此,我要做的就是将下载的文件移到该位置并替换它的内容: + +``` +sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac +``` + +你现在应该可以在 VLC 中播放 YouTube 视频了。 + +#### Windows 中的步骤 + +如果你使用的是 Windows,那么应遵循以下步骤: + + * 将下载的 youtube.lua 文件重命名为 youtube.luac + * 复制此文件并将其粘贴到 C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\ + + + +就是这些了。 + +如果你在 Dailymotion 或其他视频流网站上遇到问题,那么可以从 VLC 仓库的[此处][10]下载它们各自的 lua 文件,并替换 VLC 安装中的现有 lua 文件。 + +我希望这个快速提示可以解决 VLC 无法为你播放 YouTube 视频的问题。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/simple-vlc-tips/ +[2]: https://www.videolan.org/index.html +[3]: https://itsfoss.com/penguin-subtitle-player/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc_error_input_cant_be_played.png?ssl=1 +[5]: https://itsfoss.com/download-youtube-linux/ +[6]: https://itsfoss.com/download-youtube-videos-ubuntu/ +[7]: https://itsfoss.com/install-latest-vlc/ +[8]: https://raw.githubusercontent.com/videolan/vlc/master/share/lua/playlist/youtube.lua +[9]: https://linuxhandbook.com/locate-command/ +[10]: https://github.com/videolan/vlc/tree/master/share/lua/playlist From 00d722679c20875a9ce34b4ab40ee0e24331468d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 3 Jan 2020 09:05:16 +0800 Subject: [PATCH 0071/3057] translating --- ...NOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md index 96de8997fa..f761c28dd1 100644 --- a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md +++ b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 44468cd7fbf184224c9354c16e1c588596230d9a Mon Sep 17 00:00:00 2001 From: BrunoJu Date: Fri, 3 Jan 2020 10:56:16 +0800 Subject: [PATCH 0072/3057] Update 20191231 10 Ansible resources to accelerate your automation skills.md --- ...10 Ansible resources to accelerate your automation skills.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md index a522f0c869..5a1dc5dccf 100644 --- a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md +++ b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (BrunoJu) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5e91314ff78ea596911f56572f0dba9a49f55790 Mon Sep 17 00:00:00 2001 From: nacyro Date: Fri, 3 Jan 2020 15:59:02 +0800 Subject: [PATCH 0073/3057] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... and guides to enhance your tech skills.md | 89 ------------------- ... and guides to enhance your tech skills.md | 88 ++++++++++++++++++ 2 files changed, 88 insertions(+), 89 deletions(-) delete mode 100644 sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md create mode 100644 translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md diff --git a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md deleted file mode 100644 index 7e9e984b63..0000000000 --- a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (nacyro) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 cheat sheets and guides to enhance your tech skills) -[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) -[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) - -9 cheat sheets and guides to enhance your tech skills -====== -Kick off the new year with our latest programming cheat sheets and -guides for people of all skill levels. Take our poll to let us know what -you'd like to see next! -![a checklist for a team][1] - -Cheat sheets are perfect for the new coder just starting out on the command line. However, even the most experienced programmers need to lean on references every once in a while. If that pesky keyboard shortcut is just at the tip of your finger, a cheat sheet is perfect to have nearby. Here’s a roundup of our downloadable guides that will set you up for success in 2020. - -### Cheat sheets - -#### [Markdown][2] - -Markdown is not just for coders. Anyone can use it to help bring syntax and structure to a plain text document. This cheat sheet provides Markdown foundations using the CommonMark specification. It also includes syntax for GitHub and GitLab.  - -#### [Linux permissions and users][3] - -Keep commands for managing users close at hand with this Linux cheat sheet. Quickly learn how to add users, delete users, show history, and set permissions. - -#### [Bash][4] - -Once you know Bash, the possibilities at the command line are endless. Our Bash cheat sheet helps you become more efficient with keyboard shortcuts. Before you know it, you'll be running scripts in your sleep (literally).   - -#### [Linux common commands][5] - -It's no wonder that our cheat sheet for common Linux commands is so popular. This cheat sheet is packed with the essentials to get started with installing software and navigating file systems. Print this one out for yourself and your colleagues. - -#### [Microservices][6] - -It seems like everyone is talking about microservices and for good reason. Microservices make applications modular so that they are easier to build and maintain. It's no longer just a buzzword with this cheat sheet. Get to know important terms and learn more about the fundamentals of microservices in [A guide to open source for microservices][7]. - -#### [Java][8] - -This cheat sheet is ideal for beginner and intermediate Java programmers. It includes important context along with code for handling imports, variables, classes, and more. - -#### [pip][9] - -Programmers love using pip commands to help install, manage, and use Python software packages. However, pip can do much more than that. This cheat sheet will teach you how to build wheels and record packages. - -### Guides - -#### [7 essential PyPI libraries][10] - -This collection of Python tutorials will help you learn how to write extensions faster, format your code, automate tests, ensure code consistency, and more using PyPI libraries.  - -#### [Getting started with Kubernetes][11] - -In this approachable guide, author [Scott McCarty][12] uses an unexpected analogy to explain the value of Kubernetes and the steps to get started.  - -* * * - -We'd like to hear from you: Do you have an idea for a new cheat sheet or guide? Take our poll and choose from one of the options, or let us know in the comments. Check out all of our downloads [here][13]. Get alerts about new cheat sheets by [signing up][14] for our email newsletter. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/cheat-sheets-guides - -作者:[Lauren Pritchett][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/lauren-pritchett -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) -[2]: https://opensource.com/downloads/cheat-sheet-markdown -[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet -[4]: https://opensource.com/downloads/bash-cheat-sheet -[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet -[6]: https://opensource.com/downloads/microservices-cheat-sheet -[7]: https://opensource.com/article/19/11/microservices-cheat-sheet -[8]: https://opensource.com/downloads/java-cheat-sheet -[9]: https://opensource.com/downloads/pip-cheat-sheet -[10]: https://opensource.com/downloads/7-essential-pypi-libraries -[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook -[12]: https://opensource.com/users/fatherlinux -[13]: https://opensource.com/downloads/cheat-sheets -[14]: https://opensource.com/email-newsletter diff --git a/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md new file mode 100644 index 0000000000..15c10736ed --- /dev/null +++ b/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (nacyro) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (9 cheat sheets and guides to enhance your tech skills) +[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +九个提升你技术技能的备忘单和指南 +====== +用我们最新的编程备忘单和指南来为新年开局,它适合所有技能水平的人。来参加我们的投票,让我们知道你接下来想看什么! + +![a checklist for a team][1] + +对刚接触命令行的新程序员来说备忘单是完美的。然而,即便是最有经验的程序员也需要时不时地依靠参考资料。假如你刚好敲不出那个讨厌的快捷键,那么手边有个备忘单就很赞了。这是一份我们可供下载指南的综述,它将助你在 2020 年取得成功。 + +### 备忘单 + +#### [Markdown][2] + +Markdown 不仅针对程序员,任何人都可以借助它为纯文本文档增添语法和结构。此备忘单提供了使用 CommonMark 规范的 Markdown 要点。它还包括 GitHub 和 GitLab 的语法。 + +#### [Linux 权限和用户][3] + +用这个 Linux 备忘单把用户管理命令放在手边。快速学习如何增删用户、查看历史以及设置权限。 + +#### [Bash][4] + +一旦您了解了 Bash,在命令行中就蕴含了无限可能。我们的 Bash 备忘单可以帮助您更有效地使用键盘快捷键。不知不觉间,您就能易如反掌地运行脚本。 + +#### [Linux 常用命令][5] + +毫不奇怪,我们的 Linux 常用命令备忘单是如此受欢迎。这个备忘单包含了开始安装软件和导览文件系统的要点。为自己和你的同事打印出来吧。 + +#### [微服务][6] + +似乎每个人都在谈论微服务,而且理由很充分。微服务使应用程序模块化,因此更容易构建和维护。它不再只是这个备忘单上的流行语。在 [微服务开源指南][7] 中了解重要的术语并学习更多关于微服务的基础知识。 + +#### [Java][8] + +此备忘单非常适合初级和中级 Java 程序员。它包括重要的上下文以及处理导入、变量、类等的代码。 + +#### [pip][9] + +程序员爱用 pip 命令来帮助安装、管理和使用 Python 软件包。然而,pip 可以做的远不止这些。这个备忘单将教你如何构建 wheels 和 record 包。 + +### 指南 + +#### [七个不可或缺的 PyPI 库][10] + +这组 Python 教程将帮助您学习如何更快地编写扩展、格式化代码、自动化测试、确保代码一致性,以及更多使用 PyPI 库的方法。 + +#### [开始学习 Kubernetes][11] + +在这份平易近人的指南中,作者 [Scott McCarty][12] 用了一个出人意料的类比来解释 Kubernetes 的价值和上手步骤。 + +* * * + +我们想听听你的意见:你对新的备忘单或指南有什么高见?参加我们的投票,从选项中选择一个,或者在评论中告诉我们。点击 [这里][13] 查看我们所有的下载。通过 [注册][14] 我们的电子邮件通讯获得关于新备忘单的提醒。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cheat-sheets-guides + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[nacyro](https://github.com/nacyro) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://opensource.com/downloads/cheat-sheet-markdown +[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet +[4]: https://opensource.com/downloads/bash-cheat-sheet +[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[6]: https://opensource.com/downloads/microservices-cheat-sheet +[7]: https://opensource.com/article/19/11/microservices-cheat-sheet +[8]: https://opensource.com/downloads/java-cheat-sheet +[9]: https://opensource.com/downloads/pip-cheat-sheet +[10]: https://opensource.com/downloads/7-essential-pypi-libraries +[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook +[12]: https://opensource.com/users/fatherlinux +[13]: https://opensource.com/downloads/cheat-sheets +[14]: https://opensource.com/email-newsletter From 8eeac9210007c607f9b6f694d7195421fd93d1b1 Mon Sep 17 00:00:00 2001 From: nacyro Date: Fri, 3 Jan 2020 16:50:55 +0800 Subject: [PATCH 0074/3057] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20191031 Advance your awk skills with two easy tutorials.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md index f84e4ebe3a..76f7a54e5f 100644 --- a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md +++ b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (nacyro) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ecf018d5142d2ccf3daf2dee7d58360c6059fef6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 17:44:07 +0800 Subject: [PATCH 0075/3057] PRF @geekpi --- ...h the Linux Equinox Desktop Environment.md | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md index cfa8489c40..84c9ed2b1e 100644 --- a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md +++ b/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Chill out with the Linux Equinox Desktop Environment) @@ -9,20 +9,20 @@ 轻松使用 Linux Equinox 桌面环境 ====== -本文是 24 天 Linux 桌面特别系列的一部分。EDE 不是最迷人、最小或效率最高的桌面。但它的柔和、静音让人平静,它让人感到熟悉舒缓,它的图标主题有趣。 -![Linux penguin at the north pole beside an igloo][1] -我还没有认真用过 Fast Light Toolkit([FLTK] [2]),但我是 C++ GUI 工具箱的粉丝,它非常易于学习,并且即使跨更新时也很可靠。当我发现有一个用 FLTK 构建的桌面环境时,我很想尝试一下,并且我很快为我的决定感到高兴。[Equinox 桌面环境(EDE)][3] 是用 C++ 和 FLTK 为 Unix 桌面编写的快速、简单的桌面。它使用通用的桌面约定,因此外观和感觉都非常熟悉,并且在使用几天后,我发现它的简单性提供了我所喜欢的最低限度的优雅。 +> 本文是 24 天 Linux 桌面特别系列的一部分。EDE 不是最迷人、最小或效率最高的桌面。但它的柔和、安宁让人平静,它让人感到熟悉舒缓,它的图标主题也很有趣。 + +我还没有认真用过 Fast Light Toolkit([FLTK] [2]),但我是 C++ GUI 工具箱的粉丝,它非常易于学习,并且即使进行更新也很可靠。当我发现有一个用 FLTK 构建的桌面环境时,我很想尝试一下,并且我很快为我的决定感到高兴。[Equinox 桌面环境(EDE)][3] 是用 C++ 和 FLTK 为 Unix 桌面编写的快速、简单的桌面环境。它使用通用的桌面约定,因此外观和感觉都非常熟悉,并且在使用几天后,我发现它的简单性提供了我所喜欢的最低限度的优雅。 ![EDE desktop][4] ### 安装 EDE -你可能会发现 EDE 包含在发行版的软件仓库中,但你也可以在它的 [SourceForge 仓库][5]中找到它。如果你已经在运行其他桌面,你可以安全地在同一系统上安装 EDE,因为它仅带来了一些额外的应用,这些应用程序特定于 EDE,因此它们不会妨碍你的其他桌面。 +你可能会发现 EDE 包含在发行版的软件仓库中,但你也可以在它的 [SourceForge 仓库][5]中找到它。如果你已经在运行其他桌面环境,你可以安全地在同一系统上安装 EDE,因为它仅带来了一些额外的应用,这些应用程序特定于 EDE,因此它们不会妨碍你的其他桌面。 -EDE 只是桌面,它使用 [Pekwm][6] 窗口管理器来处理布局。 +EDE 只是桌面环境,它使用 [Pekwm][6] 窗口管理器来处理布局。 -安装 EDE 之后,注销当前的桌面会话,以便你可以登录到新的会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 +安装 EDE 之后,注销当前的桌面会话,以便你可以登录到新的会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面环境,因此你必须在登录之前覆盖该桌面环境。 在 GDM 中: @@ -48,14 +48,12 @@ EDE 的布局恰恰是大多数人在桌面上所期望的布局:左侧的应 EDE 有一个小的配置应用,可用于设置一些简单的选项: - * 背景和图标设置 -  * 屏幕保护程序设置 -  * 时间和时钟 -  * 系统铃声 -  * 键盘 -  * 偏好应用 - - +* 背景和图标设置 +* 屏幕保护程序设置 +* 时间和时钟 +* 系统铃声 +* 键盘 +* 偏好应用 ![EDE Configuration Place][10] @@ -63,7 +61,7 @@ EDE 的功能不多。没有文件管理器、文本编辑器、绘画程序或 ### EDE 总结 -我发现 EDE 至少作为一种”假日“桌面而言,它的简单性令人舒适。它值得一看。它不是最迷人的桌面,也不是最小的、也不是最高效的。但它的柔和、静音让人平静,它让人感到熟悉舒缓,并且它的图标主题充满乐趣和生气。EDE 是一个以其缓慢而稳定的步调而自豪的桌面。 +我发现 EDE 至少作为一种“假日”桌面而言,它的简单性令人舒适。它值得一看。它不是最迷人的桌面,也不是最精简的、也不是最高效的。但它的柔和、安宁让人平静,它让人感到熟悉舒缓,并且它的图标主题充满乐趣和生气。EDE 是一个以其缓慢而稳定的步调而自豪的桌面。 如果你想放松心情使用一个干净和令人愉悦的界面,请试试 EDE。 @@ -74,7 +72,7 @@ via: https://opensource.com/article/19/12/ede-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ebdcc4000c43d02a6b15df7922461277b0433027 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 17:44:37 +0800 Subject: [PATCH 0076/3057] PUB @geekpi https://linux.cn/article-11745-1.html --- ...24 Chill out with the Linux Equinox Desktop Environment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191224 Chill out with the Linux Equinox Desktop Environment.md (98%) diff --git a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/published/20191224 Chill out with the Linux Equinox Desktop Environment.md similarity index 98% rename from translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md rename to published/20191224 Chill out with the Linux Equinox Desktop Environment.md index 84c9ed2b1e..c6a96672d7 100644 --- a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md +++ b/published/20191224 Chill out with the Linux Equinox Desktop Environment.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11745-1.html) [#]: subject: (Chill out with the Linux Equinox Desktop Environment) [#]: via: (https://opensource.com/article/19/12/ede-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 965419e2bece4108bb02ca647ec930b4da6bc229 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Fri, 3 Jan 2020 22:08:52 +0800 Subject: [PATCH 0077/3057] translating by lxbwolf --- sources/tech/20200101 5 predictions for Kubernetes in 2020.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md index 2032983b78..99723632b8 100644 --- a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md +++ b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 09736cf9fdd2ade647f8c89c1399dfa439912f4c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 23:30:13 +0800 Subject: [PATCH 0078/3057] PUB --- .../20191227 10 resources to boost your Git skills.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20191227 10 resources to boost your Git skills.md (100%) diff --git a/translated/tech/20191227 10 resources to boost your Git skills.md b/published/20191227 10 resources to boost your Git skills.md similarity index 100% rename from translated/tech/20191227 10 resources to boost your Git skills.md rename to published/20191227 10 resources to boost your Git skills.md From d99886fd6152b9885d359aaa2322db2e15faf2f8 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Fri, 3 Jan 2020 23:31:14 +0800 Subject: [PATCH 0079/3057] Translating by MjSeven --- .../tech/20191129 How to write a Python web API with Django.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191129 How to write a Python web API with Django.md b/sources/tech/20191129 How to write a Python web API with Django.md index ed16fc40f8..38acb243cd 100644 --- a/sources/tech/20191129 How to write a Python web API with Django.md +++ b/sources/tech/20191129 How to write a Python web API with Django.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 461886a295a1e4ba1f9d14777053ca22e48d0a0e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:55:34 +0800 Subject: [PATCH 0080/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20Trac?= =?UTF-8?q?king=20Translations=20with=20Transtats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 Tracking Translations with Transtats.md --- ...03 Tracking Translations with Transtats.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20200103 Tracking Translations with Transtats.md diff --git a/sources/tech/20200103 Tracking Translations with Transtats.md b/sources/tech/20200103 Tracking Translations with Transtats.md new file mode 100644 index 0000000000..b11a56be66 --- /dev/null +++ b/sources/tech/20200103 Tracking Translations with Transtats.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tracking Translations with Transtats) +[#]: via: (https://fedoramagazine.org/tracking-translations-with-transtats/) +[#]: author: (Sundeep Anand https://fedoramagazine.org/author/suanand/) + +Tracking Translations with Transtats +====== + +![][1] + +Translation is an important step in software localization which helps make software more popular globally, and impacts international user experience. In recent years, localization processes have been evolving worldwide to become more continuous, faster, efficient with automation. In Fedora, the development of the [Zanata][2] platform and its plugins, then [Transtats][3], and now the migration to the [Weblate][4] platform are part of this common ongoing goal. The localization of a desktop OS like Fedora is highly complex because it depends on many factors of the individual upstream projects which are packaged in Fedora. For example, different translation timelines, resources, and tooling. + +### What is Transtats? + +Transtats is a web application which tries to tie up upstream repositories, translation platforms, build system, and product release schedule together to solve problems of mismatch, out-of-sync conditions and to assist the timely packaging of quality translations. Actually, it collects translation data, analyzes them, and creates meaningful representations. + +Fedora Transtats is hosted at + +![][5] + +### How to see the translation status of my package? + +Just select **Packages** tab from left hand side navigation bar. This takes us to the packages list view. Then, search for the package and click on its name. + +![][6] + +For example _anaconda_. On package details page, locate following: + +![][7] + +Here, we have translation statistics from translation platform: [Zanata][8] and [Koji][9] build system. Syncs with the platform and build system are scheduled, which update differences periodically. Languages in red color indicate that there are translated strings remaining in the Translation Platform to be pulled and packaged, whereas, blue denote translated messages could not make 100% in the built package. + +### String breakage (or changes?) + +In translation of software packages, one of the challenges is to prevent string breakage. Package maintainers should strive to abide by the scheduled Fedora release String Freeze. However, in some circumstances it could be necessary to break the string freeze and to inform the translation team on the mailing list. As well as, to update latest translation template (POT) file in the translation platform. Just in case these actions seem missing – translators may get new strings to translate very late or the application may have some strings untranslated. In the worst case, an outdated translation string mismatch may result in a crash. Sync and automation pipelines are there to prevent this, nevertheless it depends on the push or pull methods followed by package developers or maintainers. + +To deal with the same context, we can use a job template in Transtats to detect this string change – particularly useful after string freeze in Fedora release schedule. This would be really helpful for the folks who look for packaging translations without string breakage, keeping translation template (POT) file in sync with translation platform, and testing localized form of the application for translation completeness to back trace. + +### How to detect string changes? + +One of the options in **Jobs** tab is ‘YML based Jobs’. Where we can see available job templates. + +![][10] + +The jobs framework executes all the tasks mentioned in the YAML, create appropriate logs and store results. Track String Change job basically: + + 1. Clones the source repository of respective package. + 2. Tries to generate translation template (POT) file. + 3. Downloads POT file from respective translation platform. + 4. And, finds differences between both the POT files. + + + +_Actually, Transtats maintains mapping of upstream repository, Translation Platform project and respective build tag for every package._ + +![][11] + +Let’s take a closer look into this YAML. We can provide value for %PACKAGE_NAME% and %RELEASE_SLUG% in the next step – **Set Values**! For example: _anaconda_ and _fedora-32_. Furthermore, a couple of things seek attention are: + + * In case the upstream software repository maintains separate git branch for fedora release, please edit ‘branch: master’ to ‘branch: <fedora-release-branch>’ + * In ‘generate’ block, mention the command to generate POT file. Default one should work for ‘intltool-update’ only, however, many packages do have their own. + * A few packages may have gettext domain name different than that of package name. If this is the case, mention the gettext domain too. + + + +As soon as the job is triggered, logs should be populated. If this is not a _scratch_ run, a unique URL shall also be created at the end. + +![][12] + +Left hand side is the input YAML and right hand side is respective log for each task. Here we can find the differences and figure out string mismatch. + +![][13] + +In [Transtats][14], we can create solutions to different problems in the form of job templates. And, scheduling of these jobs could be a step towards automation. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/tracking-translations-with-transtats/ + +作者:[Sundeep Anand][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/suanand/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/12/transtats-816x345.png +[2]: http://zanata.org/ +[3]: http://transtats.org/ +[4]: https://weblate.org/en/ +[5]: https://fedoramagazine.org/wp-content/uploads/2019/12/transtats-landing-1-1024x450.png +[6]: https://fedoramagazine.org/wp-content/uploads/2019/12/anaconda-pkg.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/12/anaconda-details.png +[8]: https://fedora.zanata.org/project/view/anaconda +[9]: https://koji.fedoraproject.org/koji +[10]: https://fedoramagazine.org/wp-content/uploads/2019/12/job-templates-1024x361.png +[11]: https://fedoramagazine.org/wp-content/uploads/2019/12/strchgjob.png +[12]: https://fedoramagazine.org/wp-content/uploads/2019/12/string-change-job-log-1024x478.png +[13]: https://fedoramagazine.org/wp-content/uploads/2019/12/string-change-1024x614.png +[14]: https://github.com/transtats/transtats From 647cd510fe8700b5219e8bfb6e3382026cf6f6b8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:57:40 +0800 Subject: [PATCH 0081/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200104=20Shoc?= =?UTF-8?q?king!=20EA=20is=20Permanently=20Banning=20Linux=20Gamers=20on?= =?UTF-8?q?=20Battlefield=20V?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md --- ...y Banning Linux Gamers on Battlefield V.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md diff --git a/sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md b/sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md new file mode 100644 index 0000000000..b0d8bb3874 --- /dev/null +++ b/sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Shocking! EA is Permanently Banning Linux Gamers on Battlefield V) +[#]: via: (https://itsfoss.com/ea-banning-linux-gamers/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Shocking! EA is Permanently Banning Linux Gamers on Battlefield V +====== + +Only when I thought that [EA][1] as a game company might be getting better after [its decision to make its games available on Steam][2] – but it looks like that isn’t the case. + +In a [Reddit thread][3], a lot of Linux players seem to complain about getting banned by FairFight (which is the server-side anti-cheat engine used for BF V) just because they chose to play Battlefield V (BF V) on [Linux using Wine][4]. + +![][5] + +### Is this a widespread issue? + +Unfortunately, it seems to be the case with a number of Linux players using Wine to play Battlefield V on Linux. + +You can also find users on [Lutris Gaming forums][6] and [Battlefield forums][7] talking about it. + +Of course, the userbase on Linux playing Battlefield V isn’t huge – but it still matters, right? + +### What’s exactly the issue here? + +It looks like EA’s anti-cheat tech considers [DXVK][8] (Vulkan-based implementation of DirectX which tries to solve compatibility issues) as cheating. + +So, basically, the compatibility layer that is being utilized to make it possible to run Battlefield V is being detected as a modified file through which you’re “**potentially**” cheating. + +![Battlefield V on Lutris][9] + +Even though this could be an innocent problem for the anti-cheat engine but EA does not seem to acknowledge that at all. + +Here’s what they respond with when one of the players wrote an email to EA in order to lift the ban: + +> After thoroughly investigating your account and concern, we found that your account was actioned correctly and will not remove this sanction from your account. + +Also, with all this going on, [Lutris Gaming][10] seems to be quite furious on EA’s behavior with the permanent bans: + +> It has come to our attention that several Battlefield 5 players have recently been banned for playing on Linux, and that EA has chosen not to revert these wrongful punishments. Due to this, we advise to refrain from playing any multiplayer games published by [@EA][11] in the future. +> +> — Lutris Gaming (@LutrisGaming) [January 2, 2020][12] + +### Not just Battlefield V, it’s the same with Destiny 2 + +As pointed by a Redditor in the same thread, Bungie also happens to consider Wine as an emulator (which is against their policy) and has banned players on Linux a while back. + +### EA needs to address the issue + +_We have reached out to EA for a comment on the issue_. _And, we’re still waiting for a response._ + +I shall update the article if we have an official response from EA. However, considering Blizzard as an example, they should actually work on fixing the issue and [reverse the bans on players using Linux][13]. + +I know that BF V does not offer native Linux support – but supporting the compatibility layer and not considering it as cheating would allow Linux users to experience the game which they rightfully own (or considering to purchase). + +What are your thoughts on this? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ea-banning-linux-gamers/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.ea.com/ +[2]: https://thenextweb.com/gaming/2019/10/29/ea-games-are-coming-back-to-steam-but-you-still-need-origin/ +[3]: https://www.reddit.com/r/linux/comments/ej3q2p/ea_is_permanently_banning_linux_players_on/ +[4]: https://itsfoss.com/install-latest-wine/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/reddit-thread-ea.jpg?ssl=1 +[6]: https://forums.lutris.net/t/ea-banning-dxvk-on-battlefield-v/7810 +[7]: https://forums.battlefield.com/en-us/discussion/197938/ea-banning-dxvk-on-battlefield-v-play-linux +[8]: https://github.com/doitsujin/dxvk +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/battlefield-v-lutris-gaming.png?ssl=1 +[10]: https://lutris.net/ +[11]: https://twitter.com/EA?ref_src=twsrc%5Etfw +[12]: https://twitter.com/LutrisGaming/status/1212827248430059520?ref_src=twsrc%5Etfw +[13]: https://www.altchar.com/game-news/blizzard-unbans-overwatch-players-who-used-linux-os-agF9y0G2gWjn From fd094955beb7b002093e38de46058c3b6730236e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:58:13 +0800 Subject: [PATCH 0082/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20What?= =?UTF-8?q?=20you=20need=20to=20know=20about=20Rust=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 What you need to know about Rust in 2020.md --- ...hat you need to know about Rust in 2020.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20200103 What you need to know about Rust in 2020.md diff --git a/sources/tech/20200103 What you need to know about Rust in 2020.md b/sources/tech/20200103 What you need to know about Rust in 2020.md new file mode 100644 index 0000000000..ddb91f42ea --- /dev/null +++ b/sources/tech/20200103 What you need to know about Rust in 2020.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What you need to know about Rust in 2020) +[#]: via: (https://opensource.com/article/20/1/rust-resources) +[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) + +What you need to know about Rust in 2020 +====== +While many programmers have long used Rust for hobby projects, in 2019, +the language attracted support from major technology companies, as the +top Rust articles on Opensource.com explain. +![Person using a laptop][1] + +[Rust][2] has drawn plenty of attention from programmers on sites like Hacker News for a while. While many have long [loved using the language][3] for hobby projects, it didn't start catching on in industry until 2019, when this really started to change. + +Over the last year, many large companies, including [Microsoft][4], [Facebook][5], and [Intel][6], came out in support of Rust, and many [smaller ones][7] took notice. As the first emcee at [RustFest][8], the largest Rust conference in Europe, in 2016, I didn't meet a single person professionally using Rust who didn't work at Mozilla. Three years later, it seemed like every other person I talked to at RustFest 2019 was using Rust in their day job for another company, whether as a game developer, a backend engineer at a bank, a creator of developer tools, or something else. + +In 2019, Opensource.com also played a role by reporting on the growing interest in Rust. In case you missed them, here are the top articles about Rust on Opensource.com over the last year. + +### Building the virtualization stack of the future with rust-vmm + +Amazon's [Firecracker][9] is the virtualization technology that powers AWS Lambda and Fargate, and it is written completely in Rust. One of the technology's authors, Andreea Florescu, offers insight into Firecracker and its related technologies in [_**Building the virtualization stack of the future with rust-vmm**_][10]. + +Firecracker started life as a fork of Google's [CrosVM][11] but quickly diverged due to the differing needs of the two projects. Despite this, there are many common pieces that are best shared across the project and in any other virtual machine manager (VMM) written in Rust. With that in mind, the [rust-vmm][12] project started as a way for Amazon and Google, as well as Intel and Red Hat, to share common Rust "crates" (i.e., packages) with each other and the rest of the open source community. These include interfaces to KVM (Linux virtualization APIs), Virtio device support, and a kernel loader. + +It's truly amazing to see some of the titans of the software industry working together around a common technology stack written in Rust. Given this and other partnerships around [technology stacks written in Rust][13], I wouldn't be surprised to see more of this in 2020. + +### Why to choose Rust as your next programming language + +Adopting a new language, especially at a large company with a long-established technology stack, is no easy task. I had the pleasure of writing [_**Why to choose Rust as your next programming language**_][14] about how Microsoft is looking into adopting Rust when so many other interesting programming languages have not been considered. + +Choosing a programming language involves many different criteria—from technical to organizational to even emotional. Some of these criteria are easier to measure than others. For instance, it's easier to understand the costs of technical changes, like adapting build systems and building new tooling, than it is to understand organizational or emotional issues like how productive or happy developers will be using this new language. What's more, the easy-to-measure criteria are often cost-related, while the hard-to-measure criteria are often benefits-oriented. This often leads to costs getting more weight in the decision-making process, even though it's not necessarily true that the costs outweigh the benefits—it's just that they're easier to measure. This makes it unlikely for a company to adopt a new language. + +However, one of Rust's largest benefits is how easy it is to measure its ability to write secure yet performant systems software. Given that 70% of severe vulnerabilities at Microsoft are due to memory-safety issues that Rust is designed to prevent, and that these issues cost the company billions of dollars per year, it's easy to measure and understand the benefits of adopting the language. + +Whether full-scale adoption of Rust at Microsoft will happen remains to be seen, but Rust's future is bright if only for the fact that is has a clear and measurable benefit over existing technologies. + +### Rust in 2020 + +Rust is really starting to gain traction in industry. Although it still has a long way to go to reach the popularity of languages like C++. I expect more companies to start adopting Rust in 2020. The Rust community must now set its sights on welcoming people and companies into the community while ensuring that the things that have driven the language to this point remain in place. + +Rust is more than just a compiler and a set of libraries. It's a group of people who care about making systems programming easy, safe, and fun. The coming year will be critical in Rust's journey from a hobbyist language to one of the main languages used in the software industry. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/rust-resources + +作者:[Ryan Levick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ryanlevick +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: http://rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://youtu.be/o01QmYVluSw +[5]: https://youtu.be/kylqq8pEgRs +[6]: https://youtu.be/l9hM0h6IQDo +[7]: https://oxide.computer/blog/introducing-the-oxide-computer-company/ +[8]: https://rustfest.eu +[9]: https://firecracker-microvm.github.io/ +[10]: https://opensource.com/article/19/3/rust-virtual-machine +[11]: https://chromium.googlesource.com/chromiumos/platform/crosvm/ +[12]: https://github.com/rust-vmm +[13]: https://bytecodealliance.org/ +[14]: https://opensource.com/article/19/10/choose-rust-programming-language From 92e78b5fd087fa09872902c82ca0c0e62dd6defa Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:58:39 +0800 Subject: [PATCH 0083/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20My?= =?UTF-8?q?=20Raspberry=20Pi=20retrospective:=206=20projects=20and=20more?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md --- ...y Pi retrospective- 6 projects and more.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md diff --git a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md new file mode 100644 index 0000000000..b68e15a924 --- /dev/null +++ b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Raspberry Pi retrospective: 6 projects and more) +[#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +My Raspberry Pi retrospective: 6 projects and more +====== +See what I've done with the fun, educational, and useful Raspberry Pi. +![Raspberry Pi 4 board, posterized filter][1] + +Historically and theoretically speaking, a decade, a century, or a millennium starts when the clock turns midnight on January 1 of the year one of its decimal order. For example, the 20th century started on January 1, 1901, not on January 1, 1900. The reason for this is simple: there is no year 0 in our modern calendar, so these periods of time start on year 1 (using the Gregorian calendar). But that's not how we refer to time periods colloquially and culturally; for example, when we mention '80s music or movies, we're talking about the period from 1980 to 1989. + +The recently passed 2010s, I could argue, was the decade of the cloud, social media, mobile technology, and the Internet of Things (IoT), which includes the [Raspberry Pi][2]. Recently, _Time_ magazine called the Raspberry Pi one of the [10 best gadgets of the past decade][3]. And I very much agree. + +The original Raspberry Pi launched in 2012, and it took me a couple of years to jump on the bandwagon and ride on the Pi-train. But since then, I have built many fun educational projects at home and even documented a few of them for Opensource.com. + +### The Christmas light trilogy + +I wrote three articles over three years that explored controlling Christmas lights with the Raspberry Pi and the open source project LightShowPi. The first article, [_Create your own musical light show with Raspberry Pi_][4], was a mix between a very basic introduction to electronics development and building a Christmas light show. The second article, [_SSH into your Christmas tree with Raspberry Pi_][5], went a little deeper into controlling the lights with things such as remote management and electronic buttons. The last chapter of the trilogy, [_Set the holiday mood with your Raspberry Pi_][6], reviewed changes introduced in the LightShowPi project in the prior year. + +### DIY projects + +Over the years, I've turned my Raspberry Pi into several useful devices. One time, I turned the Pi into a [music-playing device with the Pi MusicBox][7], which allows you to plug your favorite music streaming services into a common web interface and play your favorite tunes around the house. + +Making the Raspberry Pi into a [mobile video recording device][8] was another DIY project I put together. It required a few extra pieces of hardware, like a touchscreen, a Pi Camera, and a battery pack, but it worked. One of the biggest drawbacks of this setup was the small amount of memory available on the Pi at the time. I think the capabilities of this little portable camera could be a lot better if I re-did it on a Raspberry Pi 4 with 4GB of RAM. This may be a project to revisit in 2020. + +Another small project I built, a [digital clock for my living room][9], used the small Adafruit PiTFT screen. As simple as this project was, it probably was the one that I used the longest. That clock stood by my TV set for over a year, running 24 hours a day… until the day the screen burned out. + +### The Pi Day series + +Last but not least, in 2019, I contributed [14 articles in 14 days][10] leading up to Pi Day (March 14). This was by far the most challenging writing project I've ever done, but it allowed me to cover many different topics and hopefully expose readers to even more ideas about the versatility of the Raspberry Pi. + +### To infinity and beyond + +I don't know anyone in the Raspberry Pi Foundation, so I don't have any special access to its roadmaps and future plans. I could (but I won't) speculate on what the future holds for the brand and its devices that have allowed so many people of different social statuses around the world to expand their knowledge about computer science, electronics, and open source development. All I hope is for the foundation's management to stay true to its vision and mission and continue making affordable technology for people everywhere. + +The 2010s are over, and what a sweet decade it was. To me, it smelled like pie, raspberry pie. + +Having recently co-authored a book about building things with the Raspberry Pi ( Raspberry Pi Hacks... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/raspberry-pi-best + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi4_board_hardware.jpg?itok=KnFU7NvR (Raspberry Pi 4 board, posterized filter) +[2]: https://www.raspberrypi.org/ +[3]: https://time.com/5745302/best-gadgets-of-the-2010s-decade/?utm_source=reddit.com +[4]: https://opensource.com/life/15/2/music-light-show-with-raspberry-pi +[5]: https://opensource.com/life/15/12/ssh-your-christmas-tree-raspberry-pi +[6]: https://opensource.com/article/18/12/lightshowpi-raspberry-pi +[7]: https://opensource.com/life/15/3/pi-musicbox-guide +[8]: https://opensource.com/life/15/9/turning-raspberry-pi-portable-streaming-camera +[9]: https://opensource.com/article/17/7/raspberry-pi-clock +[10]: https://opensource.com/article/19/3/happy-pi-day From 1a8473c1a5c9b7fb65bf661589f5845ca0d8bce6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:59:05 +0800 Subject: [PATCH 0084/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20Intr?= =?UTF-8?q?oducing=20the=20guide=20to=20inter-process=20communication=20in?= =?UTF-8?q?=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md --- ...to inter-process communication in Linux.md | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md diff --git a/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md b/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md new file mode 100644 index 0000000000..c0b7eee940 --- /dev/null +++ b/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introducing the guide to inter-process communication in Linux) +[#]: via: (https://opensource.com/article/20/1/inter-process-communication-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Introducing the guide to inter-process communication in Linux +====== +This free eBook gives seasoned and occasional coders insight into the +core concepts and mechanisms of inter-process communication (IPC) in +Linux. +![Inter-process Communication in Linux][1] + +Getting one software process to talk to another software process is a delicate balancing act. It can be a vital function for an application, though, so it's a problem any programmer embarking on a complex project has to solve. Whether your application needs to kick off a job being handled by someone else's software; to monitor an action being performed by a peripheral or over a network; or to detect a signal from some other source, when your software relies on something outside of its own code to know what to do next or when to do it, you need to think about inter-process communication (IPC). + +The Unix operating system accounted for this long ago, possibly because of an early expectation that software would originate from diverse sources. In the same tradition, Linux provides many of the same interfaces for IPC and some new ones. The Linux kernel features several IPC methods, and the [util-linux package][2] contains the **ipcmk**, **ipcrm**, **ipcs**, and **lsipc** commands for monitoring and managing IPC messages. + +### Show IPC information + +Before experimenting with IPC, you should know what IPC facilities are already on your system. The **lsipc** command provides that information. + + +``` +RESOURCE DESCRIPTION               LIMIT  USED  USE% +MSGMNI   Number of message queues  32000     0 0.00% +MSGMAX   Max size of message (byt.. 8192     -     - +MSGMNB   Default max size of queue 16384     -     - +SHMMNI   Shared memory segments     4096    79 1.93% +SHMALL   Shared memory pages       184[...] 25452 0.00% +SHMMAX   Max size of shared memory 18446744073692774399 +SHMMIN   Min size of shared memory     1     -     - +SEMMNI   Number of semaphore ident 32000     0 0.00% +SEMMNS   Total number of semaphore 1024000.. 0 0.00% +SEMMSL   Max semaphores per semap  32000     -     - +SEMOPM   Max number of operations p  500     -     - +SEMVMX   Semaphore max value       32767     -     - +``` + +You may notice that this sample listing includes three different types of IPC mechanisms, each available in the Linux kernel: messages (MSG), shared memory (SHM), and semaphores (SEM). You can view current activity in each of those subsystems with the **ipcs** command: + + +``` +$ ipcs + +\------ Message Queues Creators/Owners --- +msqid     perms     cuid      cgid  [...] + +\------ Shared Memory Segment Creators/Owners +shmid     perms    cuid    cgid  [...] +557056    700      seth    users [...] +3571713   700      seth    users [...] +2654210   600      seth    users [...] +2457603   700      seth    users [...] + +\------ Semaphore Arrays Creators/Owners --- +semid     perms     cuid      cgid  [...] +``` + +This shows that there currently are no messages or semaphore arrays, but a number of shared memory segments are in use. + +There's a simple example you can perform on your system so you can see one of these systems at work. It involves some C code, so you must have build tools on your system. The names of the packages you must install to be able to build from source code vary depending on your distro, so refer to your documentation for specifics. For example, on Debian-based distributions, you can learn about build requirements on the [BuildingTutorial][3] section of the wiki, and on Fedora-based distributions, refer to the [Installing software from source][4] section of the docs. + +### Create a message queue + +Your system has a default message queue already, but you can create your own using the **ipcmk** command: + + +``` +$ ipcmk --queue +Message queue id: 32764 +``` + +Write a simple IPC message sender, hard-coding in the queue ID for simplicity: + + +``` +#include <sys/ipc.h> +#include <sys/msg.h> +#include <stdio.h> +#include <string.h> + +struct msgbuffer { +  char text[24]; +} message; + +int main() { +    int msqid = 32764; +    strcpy(message.text,"opensource.com"); +    msgsnd(msqid, &message, sizeof(message), 0); +    printf("Message: %s\n",message.text); +    printf("Queue: %d\n",msqid); +    return 0; +        } +``` + +Compile the application and run it: + + +``` +$ gcc msgsend.c -o msg.bin +$ ./msg.bin +Message: opensource.com +Queue: 32769 +``` + +You just sent a message to your message queue. You can verify that with the **ipcs** command, using the **\--queue** option to limit output to the message queue: + + +``` +$ ipcs -q + +\------ Message Queues -------- +key        msqid   owner  perms  used-bytes  messages +0x7b341ab9 0       seth   666    0          0 +0x72bd8410 32764   seth   644    24         1 +``` + +You can also retrieve those messages with: + + +``` +#include <sys/ipc.h> +#include <sys/msg.h> +#include <stdio.h> + +struct msgbuffer { +    char text[24]; +} message; + +int main() { +    int msqid = 32764; +    msgrcv(msqid, &message, sizeof(message),0,0); +    printf("\nQueue: %d\n",msqid); +    printf("Got this message: %s\n", message.text); +    msgctl(msqid,IPC_RMID,NULL); +    return 0; +``` + +Compile and run with: + + +``` +$ gcc get.c -o get.bin +$ ./get.bin + +Queue: 32764 +Got this message: opensource.com +``` + +### Download [the eBook][5] + +This is just one example of the lessons available in Marty Kalin's [A guide to inter-process communication in Linux][5], the latest free (and Creative Commons) downloadable eBook from Opensource.com. In just a few short lessons, you will learn about POSIX methods of IPC from message queues, shared memory and semaphores, sockets, signals, and much more. Sit down with Marty's book, and you'll emerge a better-informed programmer. But it isn't just for seasoned coders—if all you ever write are shell scripts, there's plenty of practical knowledge about pipes (named and unnamed) and shared files, as well as important concepts you need to know when you use a shared file or an external message queue. + +If you're interested in making great software that's written to be dynamic and system-aware, you need to know about IPC. Let [this book][5] be your guide. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/inter-process-communication-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_inter-process_communication_linux_520x292.png?itok=hPoen7oI (Inter-process Communication in Linux) +[2]: https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/ +[3]: https://wiki.debian.org/BuildingTutorial +[4]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html +[5]: https://opensource.com/downloads/guide-inter-process-communication-linux From 24abcbc7833e4a91ce122e8f552d5dd7d19314ec Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:59:46 +0800 Subject: [PATCH 0085/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20Add?= =?UTF-8?q?=20scorekeeping=20to=20your=20Python=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 Add scorekeeping to your Python game.md --- ...03 Add scorekeeping to your Python game.md | 640 ++++++++++++++++++ 1 file changed, 640 insertions(+) create mode 100644 sources/tech/20200103 Add scorekeeping to your Python game.md diff --git a/sources/tech/20200103 Add scorekeeping to your Python game.md b/sources/tech/20200103 Add scorekeeping to your Python game.md new file mode 100644 index 0000000000..d2055cc067 --- /dev/null +++ b/sources/tech/20200103 Add scorekeeping to your Python game.md @@ -0,0 +1,640 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Add scorekeeping to your Python game) +[#]: via: (https://opensource.com/article/20/1/add-scorekeeping-your-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Add scorekeeping to your Python game +====== +In the tenth article in this series on programming with Python's Pygame +module, display your game player's score when they collect loot or take +damage. +![connecting yellow dots in a maze][1] + +This is part 10 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: + + * [Learn how to program in Python by building a simple dice game][4] + * [Build a game framework with Python using the Pygame module][5] + * [How to add a player to your Python game][6] + * [Using Pygame to move your game character around][7] + * [What's a hero without a villain? How to add one to your Python game][8] + * [Simulate gravity in your Python game][9] + * [Add jumping to your Python platformer game][10] + * [Enable your Python game player to run forward and backward][11] + * [Using Python to set up loot in Pygame][12] + + + +If you've followed along with this series, you've learned all the essential syntax and patterns you need to create a video game with Python. However, it still lacks one vital component. This component isn't important just for programming games in Python; it's something you must master no matter what branch of computing you explore: Learning new tricks as a programmer by reading a language's or library's documentation. + +Luckily, the fact that you're reading this article is a sign that you're comfortable with documentation. For the practical purpose of making your platform game more polished, in this article, you will add a score and health display to your game screen. But the not-so-secret agenda of this lesson is to teach you how to find out what a library offers and how you can use new features. + +### Displaying the score in Pygame + +Now that you have loot that your player can collect, there's every reason to keep score so that your player sees just how much loot they've collected. You can also track the player's health so that when they hit one of the enemies, it has a consequence. + +You already have variables that track score and health, but it all happens in the background. This article teaches you to display these statistics in a font of your choice on the game screen during gameplay. + +### Read the docs + +Most Python modules have documentation, and even those that do not can be minimally documented by Python's Help function. [Pygame's main page][13] links to its documentation. However, Pygame is a big module with a lot of documentation, and its docs aren't exactly written in the same approachable (and friendly and elucidating and helpful) narrative style as articles on Opensource.com. They're technical documents, and they list each class and function available in the module, what kind of inputs each expects, and so on. If you're not comfortable referring to descriptions of code components, this can be overwhelming. + +The first thing to do, before bothering with a library's documentation, is to think about what you are trying to achieve. In this case, you want to display the player's score and health on the screen. + +Once you've determined your desired outcome, think about what components are required for it. You can think of this in terms of variables and functions or, if that doesn't come naturally to you yet, you can think generically. You probably recognize that displaying a score requires some text, which you want Pygame to draw on the screen. If you think it through, you might realize that it's not very different from rendering a player or loot or a platform on screen. + +Technically, you _could_ use graphics of numbers and have Pygame display those. It's not the easiest way to achieve your goal, but if it's the only way you know, then it's a valid way. However, if you refer to Pygame's docs, you see that one of the modules listed is **font**, which is Pygame's method for making printing text on the screen as easy as typing. + +### Deciphering technical documentation + +The **font** documentation page starts with **pygame.font.init()**, which it lists as the function that is used to initialize the font module. It's called automatically by **pygame.init()**, which you already call in your code. Once again, you've reached a point that that's technically _good enough_. While you don't know _how_ yet, you know that you _can_ use the **pygame.font** functions to print text on the screen. + +If you read further, however, you find that there's yet an even better way to print fonts. The **pygame.freetype** module is described in the docs this way: + +> The pygame.freetype module is a replacement for pygame.fontpygame module for loading and rendering fonts. It has all of the functionality of the original, plus many new features. + +Further down the **pygame.freetype** documentation page, there's some sample code: + + +``` +import pygame +import pygame.freetype +``` + +Your code already imports Pygame, but modify your **import** statements to include the Freetype module: + + +``` +import pygame +import sys +import os +import pygame.freetype +``` + +### Using a font in Pygame + +From the description of the font modules, it's clear that Pygame uses a font, whether it's one you provide or a default font built into Pygame, to render text on the screen. Scroll through the **pygame.freetype** documentation to find the **pygame.freetype.Font** function: + + +``` +pygame.freetype.Font +Create a new Font instance from a supported font file. + +Font(file, size=0, font_index=0, resolution=0, ucs4=False) -> Font + +pygame.freetype.Font.name +  Proper font name. + +pygame.freetype.Font.path +  Font file path + +pygame.freetype.Font.size +  The default point size used in rendering +``` + +This describes how to construct a font "object" in Pygame. It may not feel natural to you to think of a simple object onscreen as the combination of several code attributes, but it's very similar to how you built your hero and enemy sprites. Instead of an image file, you need a font file. Once you have a font file, you can create a font object in your code with the **pygame.freetype.Font** function and then use that object to render text on the screen. + +Because not everyone in the world has the exact same fonts on their computers, it's important to bundle your chosen font with your game. To bundle a font, first create a new directory in your game folder, right along with the directory you created for your images. Call it **fonts**. + +Even though several fonts come with your computer, it's not legal to give those fonts away. It seems strange, but that's how the law works. If you want to ship a font with your game, you must find an open source or Creative Commons font that permits you to give the font away along with your game. + +Sites that specialize in free and legal fonts include: + + * [Font Library][14] + * [Font Squirrel][15] + * [League of Moveable Type][16] + + + +When you find a font that you like, download it. Extract the ZIP or [TAR][17] file and move the **.ttf** or **.otf** file into the **fonts** folder in your game project directory. + +You aren't installing the font on your computer. You're just placing it in your game's **fonts** folder so that Pygame can use it. You _can_ install the font on your computer if you want, but it's not necessary. The important thing is to have it in your game directory, so Pygame can "trace" it onto the screen. + +If the font file has a complicated name with spaces or special characters, just rename it. The filename is completely arbitrary, and the simpler it is, the easier it is for you to type into your code. + +Now tell Pygame about your font. From the documentation, you know that you'll get a font object in return when you provide at least the path to a font file to **pygame.freetype.Font** (the docs state explicitly that all remaining attributes are optional): + + +``` +`Font(file, size=0, font_index=0, resolution=0, ucs4=False) -> Font` +``` + +Create a new variable called **myfont** to serve as your font in the game, and place the results of the **Font** function into that variable. This example uses the **amazdoom.ttf** font, but you can use whatever font you want. Place this code in your Setup section: + + +``` +font_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"fonts","amazdoom.ttf") +font_size = tx +myfont = pygame.freetype.Font(font_path, font_size) +``` + +### Displaying text in Pygame + +Now that you've created a font object, you need a function to draw the text you want onto the screen. This is the same principle you used to draw the background and platforms in your game. + +First, create a function, and use the **myfont** object to create some text, setting the color to some RGB value. This must be a global function; it does not belong to any specific class: + + +``` +def stats(score,health): +    myfont.render_to(world, (4, 4), "Score:"+str(score), WHITE, None, size=64) +    myfont.render_to(world, (4, 72), "Health:"+str(health), WHITE, None, size=64) +``` + +Of course, you know by now that nothing happens in your game if it's not in the Main loop, so add a call to your **stats** function near the bottom of the file: + + +``` +    for e in enemy_list: +        e.move() +    stats(player.score,player.health) # draw text +    pygame.display.flip() +``` + +Try your game. + +When the player collects loot, the score goes up. When the player gets hit by an enemy, health goes down. Success! + +![Keeping score in Pygame][18] + +There is one problem, though. When a player gets hit by an enemy, health goes _way_ down, and that's not fair. You have just discovered a non-fatal bug. Non-fatal bugs are those little problems in applications that don't keep the application from starting up or even from working (mostly), but they either don't make sense, or they annoy the user. Here's how to fix this one. + +### Fixing the health counter + +The problem with the current health point system is that health is subtracted for every tick of the Pygame clock that the enemy is touching the player. That means that a slow-moving enemy can take a player down to –200 health in just one encounter, and that's not fair. You could, of course, just give your player a starting health score of 10,000 and not worry about it; that would work, and possibly no one would mind. But there is a better way. + +Currently, your code detects when a player and an enemy collide. The fix for the health-point problem is to detect _two_ separate events: when the player and enemy collide and, once they have collided, when they _stop_ colliding. + +First, in your Player class, create a variable to represent when a player and enemy have collided: + + +``` +        self.frame = 0 +        self.health = 10 +        self.damage = 0 +``` + +In the update function of your Player class, _remove_ this block of code: + + +``` +        for enemy in enemy_hit_list: +            self.health -= 1 +            #print(self.health) +``` + +And in its place, check for collision as long as the player is not currently being hit: + + +``` +        if self.damage == 0: +            for enemy in enemy_hit_list: +                if not self.rect.contains(enemy): +                    self.damage = self.rect.colliderect(enemy) +``` + +You might see similarities between the block you deleted and the one you just added. They're both doing the same job, but the new code is more complex. Most importantly, the new code runs only if the player is not _currently_ being hit. That means that this code runs once when a player and enemy collide and not constantly for as long as the collision happens, the way it used to. + +The new code uses two new Pygame functions. The **self.rect.contains** function checks to see if an enemy is currently within the player's bounding box, and **self.rect.colliderect** sets your new **self.damage** variable to one when it is true, no matter how many times it is true. + +Now even three seconds of getting hit by an enemy still looks like one hit to Pygame. + +I discovered these functions by reading through Pygame's documentation. You don't have to read all the docs at once, and you don't have to read every word of each function. However, it's important to spend time with the documentation of a new library or module that you're using; otherwise, you run a high risk of reinventing the wheel. Don't spend an afternoon trying to hack together a solution to something that's already been solved by the framework you're using. Read the docs, find the functions, and benefit from the work of others! + +Finally, add another block of code to detect when the player and the enemy are no longer touching. Then and only then, subtract one point of health from the player. + + +``` +        if self.damage == 1: +            idx = self.rect.collidelist(enemy_hit_list) +            if idx == -1: +                self.damage = 0   # set damage back to 0 +                self.health -= 1  # subtract 1 hp +``` + +Notice that this new code gets triggered _only_ if the player has been hit. That means this code doesn't run while your player is running around your game world exploring or collecting loot. It only runs when the **self.damage** variable gets activated. + +When the code runs, it uses **self.rect.collidelist** to see whether or not the player is _still_ touching an enemy in your enemy list (**collidelist** returns negative one when it detects no collision). Once it is not touching an enemy, it's time to pay the **self.damage** debt: deactivate the **self.damage** variable by setting it back to zero and subtract one point of health. + +Try your game now. + +### Score reaction + +Now that you have a way for your player to know their score and health, you can make certain events occur when your player reaches certain milestones. For instance, maybe there's a special loot item that restores some health points. And maybe a player who reaches zero health points has to start back at the beginning of a level. + +You can check for these events in your code and manipulate your game world accordingly. You already know how, so go skim the documentation for new tricks and try them out on your own. + +Here's all the code so far: + + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform +# add gravity +# add jumping +# add scrolling +# add loot +# add score + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os +import pygame.freetype + +''' +Objects +''' +        +class Platform(pygame.sprite.Sprite): +    # x location, y location, img width, img height, img file     +    def __init__(self,xloc,yloc,imgw,imgh,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)).convert() +        self.image.convert_alpha() +        self.rect = self.image.get_rect() +        self.rect.y = yloc +        self.rect.x = xloc + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 +        self.movey = 0 +        self.frame = 0 +        self.health = 10 +        self.damage = 0 +        self.collide_delta = 0 +        self.jump_delta = 6 +        self.score = 1 +        self.images = [] +        for i in range(1,9): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha() +            img.set_colorkey(ALPHA) +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() + +    def jump(self,platform_list): +        self.jump_delta = 0 + +    def gravity(self): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty +        +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +        +    def update(self): +        ''' +        Update sprite position +        ''' +        +        self.rect.x = self.rect.x + self.movex +        self.rect.y = self.rect.y + self.movey + +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        if self.damage == 0: +            for enemy in enemy_hit_list: +                if not self.rect.contains(enemy): +                    self.damage = self.rect.colliderect(enemy) + +        if self.damage == 1: +            idx = self.rect.collidelist(enemy_hit_list) +            if idx == -1: +                self.damage = 0   # set damage back to 0 +                self.health -= 1  # subtract 1 hp + +        loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) +        for loot in loot_hit_list: +            loot_list.remove(loot) +            self.score += 1 +            print(self.score) + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.collide_delta = 0 # stop jumping +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty +            +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.movey = 0 +            self.rect.y = worldy-ty-ty +            self.collide_delta = 0 # stop jumping +            if self.rect.y > g.rect.y: +                self.health -=1 +                print(self.health) +                +        if self.collide_delta < 6 and self.jump_delta < 6: +            self.jump_delta = 6*2 +            self.movey -= 33  # how high to jump +            self.collide_delta += 6 +            self.jump_delta    += 6 +            +class Enemy(pygame.sprite.Sprite): +    ''' +    Spawn an enemy +    ''' +    def __init__(self,x,y,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)) +        self.movey = 0 +        #self.image.convert_alpha() +        #self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.counter = 0 + +                +    def move(self): +        ''' +        enemy movement +        ''' +        distance = 80 +        speed = 8 + +        self.movey += 3.2 +        +        if self.counter >= 0 and self.counter <= distance: +            self.rect.x += speed +        elif self.counter >= distance and self.counter <= distance*2: +            self.rect.x -= speed +        else: +            self.counter = 0 +        +        self.counter += 1 + +        if not self.rect.y >= worldy-ty-ty: +            self.rect.y += self.movey + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.rect.y = worldy-ty-ty + +        +class Level(): +    def bad(lvl,eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list.add(enemy)              # add enemy to group +            +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return enemy_list + +    def loot(lvl,tx,ty): +        if lvl == 1: +            loot_list = pygame.sprite.Group() +            loot = Platform(200,ty*7,tx,ty, 'loot_1.png') +            loot_list.add(loot) + +        if lvl == 2: +            print(lvl) + +        return loot_list + +    def ground(lvl,gloc,tx,ty): +        ground_list = pygame.sprite.Group() +        i=0 +        if lvl == 1: +            while i < len(gloc): +                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') +                ground_list.add(ground) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return ground_list + +    def platform(lvl,tx,ty): +        plat_list = pygame.sprite.Group() +        ploc = [] +        i=0 +        if lvl == 1: +            ploc.append((20,worldy-ty-128,3)) +            ploc.append((300,worldy-ty-256,3)) +            ploc.append((500,worldy-ty-128,4)) + +            while i < len(ploc): +                j=0 +                while j <= ploc[i][2]: +                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') +                    plat_list.add(plat) +                    j=j+1 +                print('run' + str(i) + str(ploc[i])) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return plat_list + +def stats(score,health): +    myfont.render_to(world, (4, 4), "Score:"+str(score), SNOWGRAY, None, size=64) +    myfont.render_to(world, (4, 72), "Health:"+str(health), SNOWGRAY, None, size=64) + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4  # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +SNOWGRAY = (137,164,166) +ALPHA = (0,255,0) +    +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +forwardx = 600 +backwardx = 230 + +eloc = [] +eloc = [200,20] +gloc = [] +tx = 64 #tile size +ty = 64 #tile size + +font_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"fonts","amazdoom.ttf") +font_size = tx +myfont = pygame.freetype.Font(font_path, font_size) +    +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) +loot_list = Level.loot(1,tx,ty) + +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print("LEFT") +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print("RIGHT") +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                player.jump(plat_list) + +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +        for l in loot_list: + +            l.rect.x -= scroll +                +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll +        for l in loot_list: +            l.rect.x += scroll + +    world.blit(backdrop, backdropbox) +    player.gravity() # check gravity +    player.update() +    player_list.draw(world) #refresh player position +    enemy_list.draw(world)  # refresh enemies +    ground_list.draw(world)  # refresh enemies +    plat_list.draw(world)   # refresh platforms +    loot_list.draw(world)   # refresh loot +    for e in enemy_list: +        e.move() +    stats(player.score,player.health) # draw text +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/add-scorekeeping-your-python-game + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_maze.png?itok=mZ5LP4-X (connecting yellow dots in a maze) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://opensource.com/article/17/10/python-101 +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: https://opensource.com/article/17/12/game-python-add-a-player +[7]: https://opensource.com/article/17/12/game-python-moving-player +[8]: https://opensource.com/article/18/5/pygame-enemy +[9]: https://opensource.com/article/19/11/simulate-gravity-python +[10]: https://opensource.com/article/19/12/jumping-python-platformer-game +[11]: https://opensource.com/article/19/12/python-platformer-game-run +[12]: https://opensource.com/article/19/12/loot-python-platformer-game +[13]: http://pygame.org/news +[14]: https://fontlibrary.org/ +[15]: https://www.fontsquirrel.com/ +[16]: https://www.theleagueofmoveabletype.com/ +[17]: https://opensource.com/article/17/7/how-unzip-targz-file +[18]: https://opensource.com/sites/default/files/uploads/pygame-score.jpg (Keeping score in Pygame) From b3182a7127a88ff8399d719ea871aa3a8eec5c7c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 4 Jan 2020 06:40:45 +0800 Subject: [PATCH 0086/3057] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @chen-ni 翻译的很棒! --- ...ow to make an old computer useful again.md | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/translated/tech/20190724 How to make an old computer useful again.md b/translated/tech/20190724 How to make an old computer useful again.md index 1df6d5fabd..60497a12b2 100644 --- a/translated/tech/20190724 How to make an old computer useful again.md +++ b/translated/tech/20190724 How to make an old computer useful again.md @@ -1,18 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to make an old computer useful again) [#]: via: (https://opensource.com/article/19/7/how-make-old-computer-useful-again) -[#]: author: (Howard Fosdick https://opensource.com/users/howtechhttps://opensource.com/users/don-watkinshttps://opensource.com/users/suehlehttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/dragonbitehttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/seth) +[#]: author: (Howard Fosdick https://opensource.com/users/howtech) 如何把你的老爷机重新利用起来 ====== -按照下面各个步骤,让你的老爷机焕然一新 -![Person typing on a 1980's computer][1] -你的地下室里有一台用来落灰的旧电脑?为什么不把它利用起来呢?如果你常用的电脑坏了,又想用一个比手机更大的屏幕上网,这时候一台备用电脑可能就派上用场了。或者,它也可以充当一台全家人共用的廉价辅助电脑,甚至还可以改造为一台复古游戏机。 +> 按照下面各个步骤,让你的老爷机焕然一新。 + +![](https://img.linux.net.cn/data/attachment/album/202001/04/064017ztl28cn6jjhnjnaj.jpg) + +你的地下室里是不是有一台用来落灰的旧电脑?为什么不把它利用起来呢?如果你常用的电脑坏了,又想用一个比手机更大的屏幕上网,这时候一台备用电脑可能就派上用场了。或者,它也可以充当一台全家人共用的廉价备用电脑,甚至还可以改造为一台复古游戏机。 哪怕是一台有十余年历史的老爷机,只要选对了软件,也可以胜任很多新电脑能够完成的任务。其中的关键在于,要使用开源软件。 @@ -22,7 +24,7 @@ 第一步是检查硬件是否运转正常。如果在这个环节忽略了一个问题,后面可能会让你非常头疼。 -灰尘是电子器件的天敌,所以第一件事应该是打开机箱,清除灰尘。[压缩空气设备][2]这时候可能会派上用场。请注意,进行任何接触电脑的操作时,都应该确保你是[触地][3]的。此外,_避免_ 清洁布与任何物体发生摩擦。即使是一次小到你无法察觉的静电放电,也可能会导致电路损毁。 +灰尘是电子器件的天敌,所以第一件事应该是打开机箱,清除灰尘。[压缩空气设备][2]这时候可能会派上用场。请注意,进行任何接触电脑的操作时,都应该确保[接地][3]。此外,**不要**用清洁布擦拭任何东西。即使是一次小到你无法察觉的静电放电,也可能会导致电路损毁。 清洁工作完成之后,关闭机箱,检查是否所有硬件都可以正常工作。需要测试的项目包括: @@ -31,23 +33,23 @@ * 主板 * 外围设备(DVD 驱动器、USB 接口、声卡,等等) -首先,将计算机启动面板([UEFI][4] 或者是 [BIOS][5]面板)上的诊断测试依次运行一遍。如果不知道按哪个程序功能按键进入你电脑的启动面板,可以参考 [这份列表][6]。 +首先,将计算机启动界面([UEFI][4] 或者是 [BIOS][5] 界面)上的诊断测试依次运行一遍。如果不知道按哪个功能键进入你电脑的启动界面,可以参考 [这份列表][6]。 -此外,也可以使用诸如 [Hirens BootCD][7] 和 [Ultimate Boot CD][8] 之类的免费资源工具包,进行启动面板覆盖不到的测试。这些资源工具包涵盖了数百个测试程序,并且都是免费的,尽管不都开源。运行这些工具包无需安装任何软件,因为它们都是从 U 盘或者 DVD 驱动器启动的。 +此外,也可以使用诸如 [Hirens BootCD][7] 和 [Ultimate Boot CD][8] 之类的免费资源工具包,进行启动界面覆盖不到的测试。这些资源工具包涵盖了数百个测试程序,并且都是免费的,尽管不都开源。运行这些工具包无需安装任何软件,因为它们都是从 U 盘或者 DVD 驱动器启动的。 测试一定要彻底!对于内存和硬盘来说,基础测试还不够,应该运行深度测试,哪怕是运行一整夜也无妨。只有这样,才能够查出那些不易发现的瞬时故障。 -如果发现了问题,可以参考我的[硬件故障排除快速指南][9],帮你解决最常见的硬件问题。 +如果发现了问题,可以参考我的[硬件故障排除快速指南][9],可以帮你解决最常见的硬件问题。 ### 选择软件 电脑翻新的关键在于,根据手头的硬件资源,恰如其分地安装软件。最核心的三种硬件资源分别是: -1. 处理器(核数、速度) +1. 处理器(内核数、速度) 2. 内存 3. 显存 -可以在启动时的 UEFI/BIOS 面板上,弄清楚你电脑的硬件资源。记得抄下数据,以免遗忘。接下来,可以在 [CPU Benchmark][10] 网站上查看你的处理器,该网站除了提供 CPU 的背景资料,还提供一个 CPU 的性能分数。 +可以在启动时的 UEFI/BIOS 界面上,弄清楚你电脑的硬件资源。记得抄下数据,以免遗忘。接下来,可以在 [CPU Benchmark][10] 网站上查看你的处理器,该网站除了提供 CPU 的背景资料,还提供一个 CPU 的性能分数。 了解了硬件性能之后,就可以选择能够在硬件上高效运行的软件了。软件的选择涉及四个重要的层面: @@ -56,19 +58,19 @@ 3. 浏览器 4. 应用 -一个优秀的 Linux 发行版可以满足全部四个层面。不要试图使用已经停止维护的 Windows 版本,例如 Windows 8、Vista 或者 XP,哪怕已经安装在电脑上了。恶意软件的 [风险][11] 你是承受不起的。明智的做法是,使用一个更抗病毒的最新版本操作系统。 +一个优秀的 Linux 发行版可以满足上述全部四个层面。不要试图使用已经停止维护的 Windows 版本,例如 Windows 8、Vista 或者 XP,哪怕已经安装在电脑上了。恶意软件的[风险][11]你是承受不起的。明智的做法是,使用一个更抗病毒的最新版本操作系统。 -那 Windows 7 呢?[维护宽限期][12] 至 2020 年 1 月 14 日结束,也就是说,在此日期之前你还可以获得安全补丁,之后就想都别想了。现在正是迁出 Windows 7 的绝佳时机。 +那 Windows 7 呢?[维护宽限期][12]至 2020 年 1 月 14 日结束,也就是说,在此日期之前你还可以获得安全补丁,之后就想都别想了。现在正是迁出 Windows 7 的绝佳时机。 Linux 的巨大优势在于,有许多专门为过时硬件设计的[发行版][13]。此外,[桌面环境][14]和操作系统在 Linux 的设计中是分开的,你可以自行选择搭配。这一点非常重要,因为桌面环境对低端系统的性能有很大影响。(对于 Windows 和 MacOS 来说,你选择的操作系统版本决定了桌面环境,没得可选。) -Linux 的另一个好处是,拥有数以千计免费且开源的应用,不需要担心激活或者许可的问题。此外,Linux 是可移植的,可以在不同的分区、硬盘、设备或计算机之间,对操作系统和应用进行复制、移动或克隆。(Windows 则不然,使用注册表将系统捆绑在了所安装的计算机上。) +Linux 的另一个好处是,拥有数以千计自由且开源的应用,不需要担心激活或者许可的问题。此外,Linux 是可移植的,可以在不同的分区、硬盘、设备或计算机之间,对操作系统和应用进行复制、移动或克隆。(Windows 则不然,使用注册表将系统捆绑在了所安装的计算机上。) ### 翻新后的电脑能够做什么? 这里讨论的是大约在 2006 年到 2013 年之间生产的双核计算机,尤其是装载了 [Intel 酷睿 2][15] CPU 或 [AMD 速龙 64 X2][16] 系列处理器的计算机。它们的 [CPU 分数][10] 大多在 1000 到 4000 分之间。这种电脑卖不了几个钱,但用在运行轻量级 Linux 软件上,性能还是足够的。 -有一点需要注意:你的电脑应该至少拥有 2 GB 内存,如果不够就进行升级。就我翻新过的电脑来说,使用者用到的内存(不包括数据缓存)一般在 0.5 到 2 GB 之间,很少超过 2 GB。如果将内存升级到 2GB,系统就不至于进行 _swap_,即将硬盘当做内存使用。如果想要获得良好性能,这一点十分关键。 +有一点需要注意:你的电脑应该至少拥有 2 GB 内存,如果不够就进行升级。就我翻新过的电脑来说,使用者用到的内存(不包括数据缓存)一般在 0.5 到 2 GB 之间,很少超过 2 GB。如果将内存升级到 2GB,系统就不至于进行**内存交换**,即将硬盘当做内存使用。如果想要获得良好性能,这一点十分关键。 以我自己为例,我用来写作这篇文章的是一台有十年机龄的翻新电脑。取下 1 GB 内存条之后,它只剩下了 1 GB 内存,然后就慢得像一只乌龟。用它浏览网页,或者是做类似的事情,都让人感到灰心,甚至痛苦。一旦把内存条重新装回去,有了 2 GB 内存,它就立马回到了可以使用的状态。 @@ -76,19 +78,19 @@ Linux 的另一个好处是,拥有数以千计免费且开源的应用,不 ### 翻新电脑的局限 -那么,这些老爷机又有什么局限呢?由于它们的并发比不上最先进的计算机,所以应该使用轻量级浏览器,同时拦截广告(广告正是让网页加载变慢的罪魁祸首)。如果可以使用虚拟专用网络(VPN)拦截广告,为处理器免除广告加载的负荷,那就再好不过。此外,还需要禁用视频自动播放、Flash 以及网页动效;将浏览器上的标签页控制在少数几个,不要同时打开 20 个;以及下载可以开启/禁用 JavaScript 的浏览器扩展。 +那么,这些老爷机又有什么局限呢?由于它们的并发性能比不上最先进的计算机,所以应该使用轻量级浏览器,同时拦截广告(广告正是让网页加载变慢的罪魁祸首)。如果可以使用虚拟专用网络(VPN)拦截广告,为处理器免除加载广告的负荷,那就再好不过。此外,还需要禁用视频自动播放、Flash 以及网页动画效果;将浏览器上的标签页控制在少数几个,不要同时打开 20 个;以及下载可以开启/禁用 JavaScript 的浏览器扩展。 让处理器专注于你目前正在做的事情吧,不要同时打开一堆应用,也不要在后台运行很多程序。图像编辑和视频编辑的高级工具可能会很慢;至于运行虚拟机,还是别想了吧。 -那游戏呢?开源软件仓库提供了数以千计的游戏。这就是我为什么将显存列为三种核心硬件资源之一。如果你的电脑没有显卡,那很可能只有 32 或者 64 MB 的显存。可以增加一张显卡,将显存提升到 256 或者 512 MB,这样一来,处理器密集型的游戏就会顺畅很多了。如果不确定你的电脑有多少显存,可以参考[这里][17]。请注意,需要确保显卡与电脑的[显卡插槽][18](AGP、PCI-Express 或者 PCI)相匹配,同时使用正确的[连接线][19](VGA、DVI 或者 HDMI)。 +那游戏呢?开源软件仓库提供了数以千计的游戏。这就是我为什么将显存列为三种核心硬件资源之一。如果你的电脑没有独立显卡,那很可能只有 32 或者 64 MB 的显存。可以增加一张显卡,将显存提升到 256 或者 512 MB,这样一来,处理器密集型的游戏就会顺畅很多了。如果不确定你的电脑有多少显存,可以参考[这里][17]。请注意,需要确保显卡与电脑的[显卡插槽][18](AGP、PCI-Express 或者 PCI)相匹配,同时使用正确的[连接线][19](VGA、DVI 或者 HDMI)。 #### 与 Windows 系统的兼容性如何? -许多人关心 Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 的替代版本][20]。 +许多人关心 Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 版本的替代品][20]。 退一步说,即使你真的必须要运行某个特定的 Windows 程序,通常也可以借助 [Wine][21] 在 Linux 上运行。可以在 [Wine 数据库][22] 里查找一下你的应用,看看是否可以在 Wine 上运行,顺便学一些特殊安装技巧。[Winetricks][23] 和 [PlayOnLinux][24] 这两个辅助工具可以帮助你进行安装和配置。 -Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP、ME/98/95 和 3.1。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。借助 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 +Wine 的另一个优势是可以运行旧版本 Windows(例如 Vista、XP、ME/98/95 和 3.1)上的程序。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。借助 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 对了,与 Microsoft Office 的兼容性又如何呢?我使用的是 LibreOffice,经常编辑并交换 Word 和 Excel 文件,完全没有问题。不过,你应该避免使用隐晦或者过于专业的功能。 @@ -96,7 +98,7 @@ Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP 假设选择了 Linux 作为操作系统,那么你还需要选择桌面环境、浏览器和各种应用。最简单的方法是,安装一个包含了你所需要的一切的发行版。 -通过从 [live USB][28] U 盘或者 DVD 启动,你无需安装任何程序,就可以尝试不同的发行版。关于在 Linux 或 Windows 上创建可启动的 Linux 的方法,可以参考 [这里][29]。 +通过从 [live USB][28] U 盘或者 DVD 启动,你无需安装任何程序,就可以尝试不同的发行版。关于在 Linux 或 Windows 上创建可启动的 Linux 的方法,可以参考[这里][29]。 我进行电脑翻新的目的是做慈善,所以无法指望电脑使用者具备任何相应知识。我需要的发行版应该具有以下特性: @@ -110,11 +112,11 @@ Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP * 更重视可靠性,而不是尖端功能 * 可以通过图形化用户界面进行设置,而不是只能通过文本文件进行设置 -许多发行版都能够满足上面的要求。我曾经尝试成功的有 [Mint/Xfce][30]、[Xubuntu,][31] 和 [Lubuntu][32]。前两个发行版使用 Xfce 桌面环境,第三个使用 LXQt。相比 GNOME、Unity、KDE、MATE 和 Cinnamon 这些桌面环境,运行上面这两种桌面环境只需要[更少][33]的处理器和内存资源。 +许多发行版都能够满足上面的要求。我曾经尝试成功的有 [Mint/Xfce][30]、[Xubuntu][31] 和 [Lubuntu][32]。前两个发行版使用 Xfce 桌面环境,第三个使用 LXQt。相比 GNOME、Unity、KDE、MATE 和 Cinnamon 这些桌面环境,运行上面这两种桌面环境只需要[更少][33]的处理器和内存资源。 Xfce 和 LXQt 用起来非常简单,我的客户们之前从未见过 Linux,但是都可以自如使用这些简单的、菜单驱动的用户界面。 -对于旧电脑来说,运行最快速、最高效的浏览器是一件非常重要的事情。[很多人觉得][34] Chromium 是最好的浏览器;此外,我还安装了 Firefox Quantum,因为大家比较熟悉它,并且[它的性能][35]可以和 [Chromium 的性能][36]媲美。我还加上了 Opera,因为它速度快,而且有一些独特功能,比如内置的广告拦截,以及免费的 [虚拟专用网络][37]。Opera 是免费的,但并非开源。 +对于旧电脑来说,运行最快速、最高效的浏览器是一件非常重要的事情。[很多人觉得][34] Chromium 是最好的浏览器;此外,我还安装了 Firefox Quantum,因为大家比较熟悉它,并且[它的性能][35]可以和 [Chromium 的性能][36]媲美。我还加上了 Opera,因为它速度快,而且有一些独特功能,比如内置的广告拦截,以及免费的[虚拟专用网络][37]。Opera 是免费的,但并非开源。 无论你使用什么浏览器,一定要拦截广告和追踪器,尽量降低浏览器的负荷。此外,除非得到你的明确批准,否则视频和 Flash 都不应该被允许运行。 @@ -122,7 +124,7 @@ Xfce 和 LXQt 用起来非常简单,我的客户们之前从未见过 Linux, ### 行动起来吧 -你是否会对翻新后的电脑感到满意呢?就我来说,我所使用的两台电脑的机龄都已经超过十年了,其中一个装载的是 Intel 双核处理器([eMachines T5274a][38]),另一个装载的是 AMD 速龙 64 x2 处理器([HP dc5750][39]),两台电脑都有 2 GB 内存。它们和我的另一台具备四核 i5 处理器和 16 GB 内存 的电脑一样,完全能够胜任我的办公工作。如果说有什么功能是这两台电脑缺失的,那就是运行虚拟机了。 +你是否会对翻新后的电脑感到满意呢?就我来说,我所使用的两台电脑的机龄都已经超过十年了,其中一个装载的是 Intel 双核处理器([eMachines T5274a][38]),另一个装载的是 AMD 速龙 64 x2 处理器([HP dc5750][39]),两台电脑都有 2 GB 内存。它们和我的另一台具备四核 i5 处理器和 16 GB 内存的电脑一样,完全能够胜任我的办公工作。如果说有什么功能是这两台电脑缺失的,那就是运行虚拟机了。 我们生活在一个非常神奇的年代。只需要付出一点努力,就可以将一台机龄在 5 到 12 年之间的旧电脑,翻新为一台具备实用价值的机器。还有什么比这更有趣吗? @@ -133,11 +135,11 @@ via: https://opensource.com/article/19/7/how-make-old-computer-useful-again 作者:[Howard Fosdick][a] 选题:[lujun9972][b] 译者:[chen-ni](https://github.com/chen-ni) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]: https://opensource.com/users/howtechhttps://opensource.com/users/don-watkinshttps://opensource.com/users/suehlehttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/dragonbitehttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/seth +[a]: https://opensource.com/users/howtech [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) [2]: https://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=compressed+air+for+computers&rh=i%3Aaps%2Ck%3Acompressed+air+for+computers From 5d8cd4cc24adb26cc85a9d42d60913d2e70529ae Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 4 Jan 2020 06:41:56 +0800 Subject: [PATCH 0087/3057] PUB @chen-ni https://linux.cn/article-11746-1.html --- .../20190724 How to make an old computer useful again.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190724 How to make an old computer useful again.md (99%) diff --git a/translated/tech/20190724 How to make an old computer useful again.md b/published/20190724 How to make an old computer useful again.md similarity index 99% rename from translated/tech/20190724 How to make an old computer useful again.md rename to published/20190724 How to make an old computer useful again.md index 60497a12b2..726436a18a 100644 --- a/translated/tech/20190724 How to make an old computer useful again.md +++ b/published/20190724 How to make an old computer useful again.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11746-1.html) [#]: subject: (How to make an old computer useful again) [#]: via: (https://opensource.com/article/19/7/how-make-old-computer-useful-again) [#]: author: (Howard Fosdick https://opensource.com/users/howtech) From 3b9e205119021823c081167b846c92e8c91f12fd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 4 Jan 2020 07:24:32 +0800 Subject: [PATCH 0088/3057] Rename sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md to sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md --- ...ng- EA is Permanently Banning Linux Gamers on Battlefield V.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md (100%) diff --git a/sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md b/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md similarity index 100% rename from sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md rename to sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md From a631c447635fe5f90954201d1cd1761d26ed0b81 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 4 Jan 2020 07:26:42 +0800 Subject: [PATCH 0089/3057] Rename sources/tech/20200103 What you need to know about Rust in 2020.md to sources/talk/20200103 What you need to know about Rust in 2020.md --- .../20200103 What you need to know about Rust in 2020.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200103 What you need to know about Rust in 2020.md (100%) diff --git a/sources/tech/20200103 What you need to know about Rust in 2020.md b/sources/talk/20200103 What you need to know about Rust in 2020.md similarity index 100% rename from sources/tech/20200103 What you need to know about Rust in 2020.md rename to sources/talk/20200103 What you need to know about Rust in 2020.md From eac7d5f5049f0ff08489f2bb365972e881a2e02f Mon Sep 17 00:00:00 2001 From: BrunoJu Date: Sat, 4 Jan 2020 09:24:29 +0800 Subject: [PATCH 0090/3057] Update article Update article: 10 Ansible resources to accelerate your automation skills --- ...es to accelerate your automation skills.md | 70 ------------------- ...es to accelerate your automation skills.md | 65 +++++++++++++++++ 2 files changed, 65 insertions(+), 70 deletions(-) delete mode 100644 sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md create mode 100644 translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md diff --git a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md deleted file mode 100644 index 5a1dc5dccf..0000000000 --- a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (BrunoJu) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 Ansible resources to accelerate your automation skills) -[#]: via: (https://opensource.com/article/19/12/ansible-resources) -[#]: author: (James Farrell https://opensource.com/users/jamesf) - -10 Ansible resources to accelerate your automation skills -====== -Gear up and get crackin' with awesome Ansible automation skills this -year. -![Gears above purple clouds][1] - -This year saw a wide range of really helpful Ansible articles. Whether you are just starting out with Ansible or a seasoned pro, there is something for everyone here to learn from. - -A good number of these articles are worthy of your bookmarking and perhaps a cron (or maybe a Tower/AWX job) reminder to reread them periodically. - -If you are new to Ansible, start with the following articles: - - * [_A quickstart guide to Ansible_][2] has some good starter information as well as deeper dives into more advanced topics - * [_10 Ansible modules you need to know_][3] and [_5 ops tasks to do with Ansible_][4] review some of the more fundamental functions that every Ansible admin should be familiar with - * [_How to use Ansible to document procedures_][5] also presents a survey of additional topics you might find it interesting to follow up on - - - -The remainder of these articles cover more advanced topics like Windows management, testing, hardware, cloud, and containers—and even a case study in managing the demands of tech-curious children. - -I hope you enjoyed this Ansible year as much as I did. Never stop learning! - - 1. _[How Ansible brought peace to my home][6]_ is a whimsical case study in applying Ansible skills to quickly provision new (or rather old) laptops for my children. - 2. _[Ansible for the Windows admin][7]_ by Taz Brown and Abner Malivert: Did you know Ansible can manage Windows nodes as well? This piece reviews basic Ansible server and Windows client setups with an example on how to deploy an IIS server. - 3. _[10 Ansible modules you need to know][3]_ by Shashank Hegde is a great place to start for some of the most common and basic Ansible modules all admins should know. Running commands, installing packages, and handling files are the basis for many useful automation plays. - 4. _[How to use Ansible to document procedures][5]_ by Marco Bravo: Ansible’s YAML files make for easy reading, so much so that they can be used to document the manual steps needed to accomplish a task. This makes your work easier to debug and extend later on. Also contained in this article are pointers on related topics like testing and analysis. - 5. _[Using Testinfra with Ansible to verify server state][8]_ by Clement Verna: Testing is an integral part of any CI/CD DevOps pipeline, so why not test Ansible’s results as well? This primer on Testinfra can be used to help check the configuration results you need. - 6. _[Hardware bootstrapping with Ansible][9]_ by Mark Phillips: Not all the world is containers and virtual machines. Many of us sysadmins still have significant hardware deployments to manage. With a little PXE dust and DHCP magic (among other tidbits), you can create a convenient framework using Ansible to get real hardware up and running easily. - 7. _[What you need to know about Ansible modules][10]_ by Jairo da Silva Junior: Modules bring real power to Ansible. Many modules are already available, but when there is none, you may need to roll your own. Read this article to look a bit deeper into how modules are made. - 8. _[5 ops tasks to do with Ansible][4]_ by Mark Phillips: This is another more basic review of Ansible use to manage common system operations tasks. The draw here is the list of examples given in Tower (or AWX) instead of the old familiar command line. - 9. _[A quickstart guide to Ansible][2]_ by Chris Short is a great PDF download that you should keep on hand and reread from time to time. It begins with a great primer to get started in Ansible. It also covers other areas of interest including Molecule testing, sysadmin tasks, and Kubernetes object management, to name a few. - 10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ by Mark Phillips: This is a monthly round-up article full of interesting links to follow. Topics span Ansible basics, managing Netapp E-Series storage, debugging, patching, and more. Videos are included here as well as some pointers to Ansible meetup groups. Check it out! - - - -Let us know if you had a favorite Ansible article this year and why in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/ansible-resources - -作者:[James Farrell][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jamesf -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) -[2]: https://opensource.com/article/19/2/quickstart-guide-ansible -[3]: https://opensource.com/article/19/9/must-know-ansible-modules -[4]: https://opensource.com/article/19/8/ops-tasks-ansible -[5]: https://opensource.com/article/19/4/ansible-procedures -[6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops -[7]: https://opensource.com/article/19/2/ansible-windows-admin -[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state -[9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible -[10]: https://opensource.com/article/19/3/developing-ansible-modules -[11]: https://opensource.com/article/19/7/ansible-news-edition-one diff --git a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md new file mode 100644 index 0000000000..f50180a6d7 --- /dev/null +++ b/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (BrunoJu) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Ansible resources to accelerate your automation skills) +[#]: via: (https://opensource.com/article/19/12/ansible-resources) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +提升自动化技巧的10大Ansible资源 +====== +今年,准备好,用出色的Ansible自动化技能装备自己的技能包吧。 + +![Gears above purple clouds][1] + +今年我关注了大量关于Ansible的文章,以下这些内容都值得每个人学习,无论是否是Ansible的新手。 + +这些文章值得大家标记为书签,或者设置个计划任务(亦或者是设置一个Tower/AWX job),用来提醒自己常读常新。 +如果你是Ansible的新手,那么就从这些文章开始着手吧: + * [_A quickstart guide to Ansible_][2] 拥有一些对新手非常有用的信息,同时还有一些更高级的话题。 + * [_10 Ansible modules you need to know_][3] 和 [_5 ops tasks to do with Ansible_][4] 这篇文章有每一位Ansible的管理者都应该熟悉并认真研习的一些最基础的Ansible功能 + * [_How to use Ansible to document procedures_][5] 这篇文章是对一些额外话题的纵览,我猜你一定会感到很有趣。 + + +剩余的这些文章包含了更多高级的话题,比如Windows管理,测试、硬件、云和容器,甚至包括了一个案例研究,如何管理那些对技术有兴趣的孩子的需求。 + +我希望你能像我一样好好享受Ansible带来的乐趣。不要停止学习哦! + 1. _[How Ansible brought peace to my home][6]_ 这个异想天开的案例,你能看到如何利用Ansible为孩子们快速部署一个新的笔记本(或者重装旧笔记本) + 2. _[Ansible for the Windows admin][7]_ 你知道Ansible也可以管理Windows的节点吗?这篇文章以部署一个IIS为案例,阐述了基础的Ansible服务器和Windows客户端的安装。 + 3. _[10 Ansible modules you need to know][3]_ 这是个学习你最应该知道的那些最常见最基础Ansible模块的好文章。执行命令、安装系统包和操作文件是许多有用的自动化工作的基础。 + 4. _[How to use Ansible to document procedures][5]_  Ansible的YAML文件易于阅读,因此它们可以被用于记录完成任务所需的手动步骤。这一特性可以帮助你调试与扩展,这令工作变得异常轻松。同时,这篇文章还包含关于测试和分析等Ansible相关主题的指导。 + 5. _[Using Testinfra with Ansible to verify server state][8]_ 测试环节是任何一个 CI/CD 开发型运维场景不可或缺的一部分。所以为什么不把测试Ansible的运行结果也纳入其中呢?这个有关于Ansible测试架构的入门级文章可以被用来帮助你配置。 + 6. _[Hardware bootstrapping with Ansible][9]_ 这个世界并不是完全已经被容器和虚拟机所占据。许多系统管理员仍然需要管理众多硬件资源。通过Ansible与PXE、DHCP以及其他一些技术的结合,你可以创建一个简单的管理框架,对硬件实施控制。 + 7. _[What you need to know about Ansible modules][10]_ 模块给Ansible带来了巨大的潜力,许多模块我们已经可以拿来利用。但如果没有你所需的模块,那你可以尝试给自己造一个。看看这篇文章吧,它能让你了解如何从零开始打造自己所需的模块。 + 8. _[5 ops tasks to do with Ansible][4]_ 这是另一个有关于如何使用Ansible来管理常见的系统操作任务的文章。这里描述了一系列可以取代命令行操作的Tower(AWX)的案例。 + 9. _[A quickstart guide to Ansible][2]_ 这篇文章是个可以下载的PDF文档。它可以作为一本随时拿来翻阅的手册。这篇文章的开头有助于初学者入门。同时,还包括了一些其他的研究领域,比如模块测试、系统管理任务和针对K8S对象的管理。 + 10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ 这是一篇每月进行总结更新的文章,充满了有趣的链接。话题包括了Ansible的基础内容、管理Netapp的E系列存储产品、调试、打补丁包和其他一些相关内容。文章中还包括了一些视频以及指导性文章的链接。击这里查看详情! + + +如果你也有一些你喜爱的Ansible文章,那请留言告诉我们吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ansible-resources + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/BrunoJu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) +[2]: https://opensource.com/article/19/2/quickstart-guide-ansible +[3]: https://opensource.com/article/19/9/must-know-ansible-modules +[4]: https://opensource.com/article/19/8/ops-tasks-ansible +[5]: https://opensource.com/article/19/4/ansible-procedures +[6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops +[7]: https://opensource.com/article/19/2/ansible-windows-admin +[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state +[9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible +[10]: https://opensource.com/article/19/3/developing-ansible-modules +[11]: https://opensource.com/article/19/7/ansible-news-edition-one From 0e26c268164396e4dbbc564da69aa03285207db4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 4 Jan 2020 21:20:02 +0800 Subject: [PATCH 0091/3057] APL --- sources/tech/20190405 File sharing with Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190405 File sharing with Git.md b/sources/tech/20190405 File sharing with Git.md index 13f95b8287..7f135cc3ca 100644 --- a/sources/tech/20190405 File sharing with Git.md +++ b/sources/tech/20190405 File sharing with Git.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6cab90062f2eb3d2f5d8d4f48325a71ea5cd6961 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 4 Jan 2020 23:03:01 +0800 Subject: [PATCH 0092/3057] TSL --- .../tech/20190405 File sharing with Git.md | 234 ------------------ .../tech/20190405 File sharing with Git.md | 231 +++++++++++++++++ 2 files changed, 231 insertions(+), 234 deletions(-) delete mode 100644 sources/tech/20190405 File sharing with Git.md create mode 100644 translated/tech/20190405 File sharing with Git.md diff --git a/sources/tech/20190405 File sharing with Git.md b/sources/tech/20190405 File sharing with Git.md deleted file mode 100644 index 7f135cc3ca..0000000000 --- a/sources/tech/20190405 File sharing with Git.md +++ /dev/null @@ -1,234 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (File sharing with Git) -[#]: via: (https://opensource.com/article/19/4/file-sharing-git) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -File sharing with Git -====== -SparkleShare is an open source, Git-based, Dropbox-style file sharing -application. Learn more in our series about little-known uses of Git. -![][1] - -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at SparkleShare, which uses Git as the backbone for file sharing. - -### Git for file sharing - -One of the nice things about Git is that it's inherently distributed. It's built to share. Even if you're sharing a repository just with other computers on your own network, Git brings transparency to the act of getting files from a shared location. - -As interfaces go, Git is pretty simple. It varies from user to user, but the common incantation when sitting down to get some work done is just **git pull** or maybe the slightly more complex **git pull && git checkout -b my-branch**. Still, for some people, the idea of _entering a command_ into their computer at all is confusing or bothersome. Computers are meant to make life easy, and computers are good at repetitious tasks, and so there are easier ways to share files with Git. - -### SparkleShare - -The [SparkleShare][3] project is a cross-platform, open source, Dropbox-style file sharing application based on Git. It automates all Git commands, triggering the add, commit, push, and pull processes with the simple act of dragging-and-dropping a file into a specially designated SparkleShare directory. Because it is based on Git, you get fast, diff-based pushes and pulls, and you inherit all the benefits of Git version control and backend infrastructure (like Git hooks). It can be entirely self-hosted, or you can use it with Git hosting services like [GitLab][4], GitHub, Bitbucket, and others. Furthermore, because it's basically just a frontend to Git, you can access your SparkleShare files on devices that may not have a SparkleShare client but do have Git clients. - -Just as you get all the benefits of Git, you also get all the usual Git restrictions: It's impractical to use SparkleShare to store hundreds of photos and music and videos because Git is designed and optimized for text. Git certainly has the capability to store large files of binary data but it is designed to track history, so once a file is added to it, it's nearly impossible to completely remove it. This somewhat limits the usefulness of SparkleShare for some people, but it makes it ideal for many workflows, including [calendaring][5]. - -#### Installing SparkleShare - -SparkleShare is cross-platform, with installers for Windows and Mac available from its [website][6]. For Linux, there's a [Flatpak][7] in your software installer, or you can run these commands in a terminal: - - -``` -$ sudo flatpak remote-add flathub -$ sudo flatpak install flathub org.sparkleshare.SparkleShare -``` - -### Creating a Git repository - -SparkleShare isn't software-as-a-service (SaaS). You run SparkleShare on your computer to communicate with a Git repository—SparkleShare doesn't store your data. If you don't have a Git repository to sync a folder with yet, you must create one before launching SparkleShare. You have three options: hosted Git, self-hosted Git, or self-hosted SparkleShare. - -#### Git hosting - -SparkleShare can use any Git repository you can access for storage, so if you have or create an account with GitLab or any other hosting service, it can become the backend for your SparkleShare. For example, the open source [Notabug.org][8] service is a Git hosting service like GitHub and GitLab, but unique enough to prove SparkleShare's flexibility. Creating a new repository differs from host to host depending on the user interface, but all of the major ones follow the same general model. - -First, locate the button in your hosting service to create a new project or repository and click on it to begin. Then step through the repository creation process, providing a name for your repository, privacy level (repositories often default to being public), and whether or not to initialize the repository with a README file. Whether you need a README or not, enable an initial README file. Starting a repository with a file isn't strictly necessary, but it forces the Git host to instantiate a **master** branch in the repository, which helps ensure that frontend applications like SparkleShare have a branch to commit and push to. It's also useful for you to see a file, even if it's an almost empty README file, to confirm that you have connected. - -![Creating a Git repository][9] - -Once you've created a repository, obtain the URL it uses for SSH clones. You can get this URL the same way anyone gets any URL for a Git project: navigate to the page of the repository and look for the **Clone** button or field. - -![Cloning a URL on GitHub][10] - -Cloning a GitHub URL. - -![Cloning a URL on GitLab][11] - -Cloning a GitLab URL. - -This is the address SparkleShare uses to reach your data, so make note of it. Your Git repository is now configured. - -#### Self-hosted Git - -You can use SparkleShare to access a Git repository on any computer you have access to. No special setup is required, aside from a bare Git repository. However, if you want to give access to your Git repository to anyone else, then you should run a Git manager like [Gitolite][12] or SparkleShare's own Dazzle server to help you manage SSH keys and accounts. At the very least, create a user specific to Git so that users with access to your Git repository don't also automatically gain access to the rest of your server. - -Log into your server as the Git user (or yourself, if you're very good at managing user and group permissions) and create a repository: - - -``` -$ mkdir ~/sparkly.git -$ cd ~/sparkly.git -$ git init --bare . -``` - -Your Git repository is now configured. - -#### Dazzle - -SparkleShare's developers provide a Git management system called [Dazzle][13] to help you self-host Git repositories. - -On your server, download the Dazzle application to some location in your path: - - -``` -$ curl \ -\--output ~/bin/dazzle -$ chmod +x ~/bin/dazzle -``` - -Dazzle sets up a user specific to Git and SparkleShare and also implements access rights based on keys generated by the SparkleShare application. For now, just set up a project: - - -``` -`$ dazzle create sparkly` -``` - -Your server is now configured as a SparkleShare host. - -### Configuring SparkleShare - -When you launch SparkleShare for the first time, you are prompted to configure what server you want SparkleShare to use for storage. This process may feel like a first-run setup wizard, but it's actually the usual process for setting up a new shared location within SparkleShare. Unlike many shared drive applications, with SparkleShare you can have several locations configured at once. The first shared location you configure isn't any more significant than any shared location you may set up later, and you're not signing up with SparkleShare or any other service. You're just pointing SparkleShare at a Git repository so that it knows what to keep your first SparkleShare folder in sync with. - -On the first screen, identify yourself by whatever means you want on record in the Git commits that SparkleShare makes on your behalf. You can use anything, even fake information that resolves to nothing. It's purely for the commit messages, which you may never even see if you have no interest in reviewing the Git backend processes. - -The next screen prompts you to choose your hosting type. If you are using GitLab, GitHub, Planio, or Bitbucket, then select the appropriate one. For anything else, select **Own server**. - -![Choosing a Sparkleshare host][14] - -At the bottom of this screen, you must enter the SSH clone URL. If you're self-hosting, the address is something like **** and the remote path is the absolute path to the Git repository you created for this purpose. - -Based on my self-hosted examples above, the address to my imaginary server is **** (the **:22122** indicates a nonstandard SSH port) and the remote path is **/home/git/sparkly.git**. - -If I use my Notabug.org account instead, the address from the example above is **[git@notabug.org][15]** and the path is **seth/sparkly.git**. - -SparkleShare will fail the first time it attempts to connect to the host because you have not yet copied the SparkleShare client ID (an SSH key specific to the SparkleShare application) to the Git host. This is expected, so don't cancel the process. Leave the SparkleShare setup window open and obtain the client ID from the SparkleShare icon in your system tray. Then copy the client ID to your clipboard so you can add it to your Git host. - -![Getting the client ID from Sparkleshare][16] - -#### Adding your client ID to a hosted Git account - -Minor UI differences aside, adding an SSH key (which is all the client ID is) is basically the same process on any hosting service. In your Git host's web dashboard, navigate to your user settings and find the **SSH Keys** category. Click the **Add New Key** button (or similar) and paste the contents of your SparkleShare client ID. - -![Adding an SSH key][17] - -Save the key. If you want someone else, such as collaborators or family members, to be able to access this same repository, they must provide you with their SparkleShare client ID so you can add it to your account. - -#### Adding your client ID to a self-hosted Git account - -A SparkleShare client ID is just an SSH key, so copy and paste it into your Git user's **~/.ssh/authorized_keys** file. - -#### Adding your client ID with Dazzle - -If you are using Dazzle to manage your SparkleShare projects, add a client ID with this command: - - -``` -`$ dazzle link` -``` - -When Dazzle prompts you for the ID, paste in the client ID found in the SparkleShare menu. - -### Using SparkleShare - -Once you've added your client ID to your Git host, click the **Retry** button in the SparkleShare window to finish setup. When it's finished cloning your repository, you can close the SparkleShare setup window, and you'll find a new **SparkleShare** folder in your home directory. If you set up a Git repository with a hosting service and chose to include a README or license file, you can see them in your SparkleShare directory. - -![Sparkleshare file manager][18] - -Otherwise, there are some hidden directories, which you can see by revealing hidden directories in your file manager. - -![Showing hidden files in GNOME][19] - -You use SparkleShare the same way you use any directory on your computer: you put files into it. Anytime a file or directory is placed into a SparkleShare folder, it's copied in the background to your Git repository. - -#### Excluding certain files - -Since Git is designed to remember _everything_ , you may want to exclude specific file types from ever being recorded. There are a few reasons to manage excluded files. By defining files that are off limits for SparkleShare, you can avoid accidental copying of large files. You can also design a scheme for yourself that enables you to store files that logically belong together (MIDI files with their **.flac** exports, for instance) in one directory, but manually back up the large files yourself while letting SparkleShare back up the text-based files. - -If you can't see hidden files in your system's file manager, then reveal them. Navigate to your SparkleShare folder, then to the directory representing your repository, locate a file called **.gitignore** , and open it in a text editor. You can enter file extensions or file names, one per line, into **.gitignore** , and any file matching what you list will be (as the file name suggests) ignored. - - -``` -Thumbs.db -$RECYCLE.BIN/ -.DS_Store -._* -.fseventsd -.Spotlight-V100 -.Trashes -.directory -.Trash-* -*.wav -*.ogg -*.flac -*.mp3 -*.m4a -*.opus -*.jpg -*.png -*.mp4 -*.mov -*.mkv -*.avi -*.pdf -*.djvu -*.epub -*.od{s,t} -*.cbz -``` - -You know the types of files you encounter most often, so concentrate on the ones most likely to sneak their way into your SparkleShare directory. If you want to exercise a little overkill, you can find good collections of **.gitignore** files on Notabug.org and also on the internet at large. - -With those entries in your **.gitignore** file, you can place large files that you don't want sent to your Git host in your SparkleShare directory, and SparkleShare will ignore them entirely. Of course, that means it's up to you to make sure they get onto a backup or distributed to your SparkleShare collaborators through some other means. - -### Automation - -[Automation][20] is part of the silent agreement we have with computers: they do the repetitious, boring stuff that we humans either aren't very good at doing or aren't very good at remembering. SparkleShare is a nice, simple way to automate the routine distribution of data. It isn't right for every Git repository, by any means. It doesn't have an interface for advanced Git functions; it doesn't have a pause button or a manual override. And that's OK because its scope is intentionally limited. SparkleShare does what SparkleShare sets out to do, it does it well, and it's one Git repository you won't have to think about. - -If you have a use for that kind of steady, invisible automation, give SparkleShare a try. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/file-sharing-git - -作者:[Seth Kenlon (Red Hat, Community Moderator)][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO -[2]: https://git-scm.com/ -[3]: http://www.sparkleshare.org/ -[4]: http://gitlab.com -[5]: https://opensource.com/article/19/4/calendar-git -[6]: http://sparkleshare.org -[7]: /business/16/8/flatpak -[8]: http://notabug.org -[9]: https://opensource.com/sites/default/files/uploads/git-new-repo.jpg (Creating a Git repository) -[10]: https://opensource.com/sites/default/files/uploads/github-clone-url.jpg (Cloning a URL on GitHub) -[11]: https://opensource.com/sites/default/files/uploads/gitlab-clone-url.jpg (Cloning a URL on GitLab) -[12]: http://gitolite.org -[13]: https://github.com/hbons/Dazzle -[14]: https://opensource.com/sites/default/files/uploads/sparkleshare-host.jpg (Choosing a Sparkleshare host) -[15]: mailto:git@notabug.org -[16]: https://opensource.com/sites/default/files/uploads/sparkleshare-clientid.jpg (Getting the client ID from Sparkleshare) -[17]: https://opensource.com/sites/default/files/uploads/git-ssh-key.jpg (Adding an SSH key) -[18]: https://opensource.com/sites/default/files/uploads/sparkleshare-file-manager.jpg (Sparkleshare file manager) -[19]: https://opensource.com/sites/default/files/uploads/gnome-show-hidden-files.jpg (Showing hidden files in GNOME) -[20]: /downloads/ansible-quickstart diff --git a/translated/tech/20190405 File sharing with Git.md b/translated/tech/20190405 File sharing with Git.md new file mode 100644 index 0000000000..a1ad1bc228 --- /dev/null +++ b/translated/tech/20190405 File sharing with Git.md @@ -0,0 +1,231 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (File sharing with Git) +[#]: via: (https://opensource.com/article/19/4/file-sharing-git) +[#]: author: (Seth Kenlon) + +用 Git 共享文件 +====== + +> SparkleShare 是一个开源的基于 Git、Dropbox 风格的文件共享应用程序。在我们的系列文章中了解有关 Git 鲜为人知的用法。 + +![][1] + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +今天,我们将看看 SparkleShare,它使用 Git 作为文件共享的基础。 + +### 用于文件共享的 Git + +Git 的优点之一是它具有固有的分发能力。它可用来建立共享。即使你只是与自己网络上的其他计算机共享资源库,Git 也会为从共享位置获取文件的行为带来透明性。 + +随着其界面的发展,Git 变得非常简单。虽然因用户而异,他们坐下来完成一些工作时的共同点仅仅是 `git pull` 或稍微复杂一点的 `git pull && git checkout -b my-branch`。但是,对于某些人来说,将*命令输入*到他们的计算机中的做法完全是令人困惑或烦恼的。计算机旨在使生活变得轻松,计算机擅长重复性工作,因此有更简便的方法可以与 Git 共享文件。 + +### SparkleShare + +[SparkleShare][3] 项目是一个基于 Git 的跨平台的开源的 Dropbox 式的文件共享应用程序。它通过将文件拖放到专门指定的 SparkleShare 目录中的简单操作,自动执行所有 Git 命令,触发添加、提交、推送和拉取过程。因为它基于 Git,所以你可以获得基于差异(diff)的快速推送和拉取,并且继承了 Git 版本控制和后端基础设施(如 Git 挂钩)的所有优点。它可以完全自托管,也可以将其与 [GitLab][4]、GitHub、Bitbucket 等 Git 托管服务一起使用。此外,由于它基本上只是一个 Git 的前端,因此你可以在可能没有 SparkleShare 客户端但有 Git 客户端的设备上访问 SparkleShare 中的文件。 + +正如你获得 Git 的所有好处一样,你也会受到所有常见的 Git 限制:使用 SparkleShare 存储数百张照片、音乐和视频是不切实际的,因为 Git 是为文本而设计和优化的。Git 当然可以存储二进制文件的大文件,但是因为它可以跟踪历史记录,因此一旦将文件添加到其中,几乎就不可能完全删除它。这在某种程度上限制了 SparkleShare 对某些人的实用性,但使其非常适合许多工作流程,包括 [日程安排][5]。 + +#### 安装 SparkleShare + +SparkleShare 是跨平台的,可从[网站][6]获得适用于 Windows 和 Mac 的安装程序。对于 Linux,有一个 [Flatpak][7] 安装包,或者你可以在终端中运行以下命令: + +``` +$ sudo flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo +$ sudo flatpak install flathub org.sparkleshare.SparkleShare +``` + +### 创建一个 Git 存储库 + +SparkleShare 并不是软件即服务(SaaS)。你在计算机上运行 SparkleShare 以与 Git 存储库进行通信,而 SparkleShare 并不存储你的数据。如果你还没有与文件夹同步的 Git 存储库,则必须在启动 SparkleShare 之前创建一个文件夹。你有三个选择:托管的 Git、自托管 Git 或自托管 SparkleShare。 + +#### 托管的 Git + +SparkleShare 可以使用你可以访问的任何 Git 存储库进行存储,因此,如果你拥有(或可在其中创建的)GitLab 或任何其他托管服务的帐户,则它可以成为 SparkleShare 的后端。例如,开源 [Notabug.org][8] 服务是一个类似于 GitHub 和 GitLab 的 Git 托管服务,但其独特性足以证明 SparkleShare 的灵活性。根据用户界面的不同,不同的托管服务创建新存储库的方法也有所不同,但是所有主要存储库都遵循相同的通用模型。 + +首先,在托管服务中找到创建一个新项目或存储库的按钮,单击它以开始。然后逐步完成存储库的创建过程,为存储库提供名称、隐私级别(存储库通常默认为公共),以及是否使用 `README` 文件初始化存储库。无论你是否需要个 `README` 文件,请初始化建立一个。使用一个文件创立存储库不是绝对必要的,但是它会强制 Git 主机实例化存储库中的 `master` 分支,这有助于确保前端应用程序(例如 SparkleShare)具有要提交并推送的分支。即使文件几乎是空的 `README` 文件,也可以用来查看该文件以确认你已连接成功。 + +![Creating a Git repository][9] + +创建存储库后,获取其用于 SSH 克隆的 URL。你可以像获取任何人从 Git 项目获得其 URL 一样获得此 URL:导航至存储库页面并查找 “Clone” 按钮或字段。 + +![Cloning a URL on GitHub][10] + +*GitHub 的克隆 URL。* + +![Cloning a URL on GitLab][11] + +*GitLab 的克隆 URL。* + +这是 SparkleShare 用于获取数据的地址,因此请记下它。你的 Git 存储库现已配置好。 + + +#### 自托管的 Git + +你可以使用 SparkleShare 访问你有权访问的任何计算机上的 Git 存储库。除了一个 Git 裸存储库外,无需任何特殊设置。但是,如果你想将对 Git 存储库的访问权授予其他任何人,则应运行 [Gitolite][12] 之类的 Git 管理器或 SparkleShare 自己的 Dazzle 服务器来帮助你管理 SSH 密钥和帐户。至少,创建一个特定于 Git 的用户,以便有权访问你的 Git 存储库的用户不会自动获得对服务器其余部分的访问权限。 + +以 Git 用户身份登录服务器(如果你非常擅长管理用户和组权限,则可以以自己的用户登录)并创建存储库: + +``` +$ mkdir ~/sparkly.git +$ cd ~/sparkly.git +$ git init --bare . +``` + +你的 Git 存储库现已配置好。 + +#### Dazzle + +SparkleShare 的开发人员提供了一个名为 [Dazzle][13] 的 Git 管理系统,以帮助你自托管 Git 存储库。 + +在你的服务器上,将 Dazzle 应用程序下载到你的路径中的某个位置: + +``` +$ curl https://raw.githubusercontent.com/hbons/Dazzle/master/dazzle.sh --output ~/bin/dazzle +$ chmod +x ~/bin/dazzle +``` + +Dazzle 设置了一个特定于 Git 和 SparkleShare 的用户,并且还基于 SparkleShare 应用程序生成的密钥实现了访问权限。现在,只需设置一个项目: + +``` +$ dazzle create sparkly +``` + +你的服务器现在已经配置好,可以用作 SparkleShare 托管了。 + +### 配置 SparkleShare + +首次启动 SparkleShare 时,系统会提示你配置要让 SparkleShare 用于存储的服务器。这个过程可能看起来像一个首次运行的安装向导,但实际上是在 SparkleShare 中设置新共享位置的通常过程。与许多共享驱动器应用程序不同,使用 SparkleShare 可以一次配置多个位置。你配置的第一个共享位置并不比你以后可以设置的任何共享位置重要,并且你也没有注册 SparkleShare 或任何其他服务。你只是将 SparkleShare 指向 Git 存储库,以便它知道如何使第一个 SparkleShare 文件夹保持同步。 + +在第一个屏幕上,给出一个身份,SparkleShare 将在代表你进行的 Git 提交记录中使用这些信息。你可以使用任何内容,甚至可以不代表任何意义的伪造信息。它仅用于提交消息,如果你对审查 Git 后端进程没有兴趣,你可能甚至看不到它们。 + +下一个屏幕提示你选择主机类型。如果你使用的是 GitLab、GitHub、Planio 或 Bitbucket,则可以选择一个适当的。否则,请选择“自己的服务器”。 + +![Choosing a Sparkleshare host][14] + +在此屏幕底部,您必须输入 SSH 的克隆 URL。如果你是自托管的 Git,则地址类似于 ``,而远程路径是为此目的而创建的 Git 存储库的绝对路径。 + +根据上面的自托管示例,我虚构的服务器的地址为 `ssh://git@example.com:22122`(`:22122` 表示非标准的 SSH 端口),远程路径为 `/home/git/sparkly.git`。 + +如果我改用 Notabug.org 帐户,则上例中的地址为 `ssh://git@notabug.org`,路径为 `seth/sparkly.git`。 + +SparkleShare 首次尝试连接到主机时将失败,因为你尚未将 SparkleShare 客户端 ID(特定于 SparkleShare 应用程序的 SSH 密钥)复制到 Git 主机。这是预料之中的,所以不要取消该过程。将 SparkleShare 设置窗口保持打开状态,并从系统任务栏中的 SparkleShare 图标处获取客户端 ID。然后将客户端 ID 复制到剪贴板,以便可以将其添加到 Git 主机。 + +![Getting the client ID from Sparkleshare][16] + +#### 将你的客户端 ID 添加到托管的 Git 帐户 + +除了较小的 UI 差异外,在任何托管服务上添加 SSH 密钥(所有客户端 ID 都是这样)的过程基本上是相同的。在你的 Git 主机的 Web 仪表板中,导航到你的用户设置,然后找到 “SSH 密钥”类别。单击“添加新密钥”按钮(或类似按钮),然后粘贴你的 SparkleShare 客户端 ID 的内容。 + +![Adding an SSH key][17] + +保存密钥。如果你希望其他人(例如协作者或家庭成员)能够访问同一存储库,则他们必须向你提供其 SparkleShare 客户端 ID,以便你可以将其添加到帐户中。 + +#### 将你的客户端 ID 添加到自托管的 Git 帐户 + +SparkleShare 客户端 ID 只是一个 SSH 密钥,因此将其复制并粘贴到 Git 用户的 `~/.ssh/authorized_keys`文件中。 + +#### 使用 Dazzle 添加你的客户 ID + +如果你使用 Dazzle 管理 SparkleShare 项目,请使用以下命令添加客户端 ID: + +``` +$ dazzle link +``` + +当 Dazzle 提示你输入该 ID 时,请粘贴在 SparkleShare 菜单中找到的客户端 ID。 + +### 使用 SparkleShare + +将客户端 ID 添加到 Git 主机后,在 SparkleShare 窗口中单击“重试”按钮以完成设置。克隆存储库完成后,你可以关闭 SparkleShare 设置窗口,并在你的家目录中找到一个新的 `SparkleShare` 文件夹。如果你设置了带有托管服务的 Git 存储库,并选择包括 `README` 文件或许可证文件,则可以在 SparkleShare 目录中看到它们。 + +![Sparkleshare file manager][18] + +此外,有一些隐藏目录,你可以通过在文件管理器中显示隐藏目录来查看。 + +![Showing hidden files in GNOME][19] + +使用 SparkleShare 的方式与使用计算机上任何目录的方式相同:将文件放入其中。每当将文件或目录放入 SparkleShare 文件夹时,它都会在后台复制到你的 Git 存储库。 + +#### 排除某些文件 + +由于 Git 从设计上就是要记住*一切*,因此你可能希望从记录中排除特定的文件类型。排除一些文件是有原因的。通过定义摆脱 SparkleShare 限制的文件,可以避免意外复制大文件。你还可以为自己设计一种方案,使你可以将存储在一个目录中的逻辑上属于同一文件(例如,MIDI 文件及其 .flac 导出文件),但是可以自己手动备份大文件,而同时让 SparkleShare 备份基于文本的文件。 + +如果在系统的文件管理器中看不到隐藏的文件,请显示它们。导航到你的 SparkleShare 文件夹,然后到代表你的存储库的目录,找到一个名为 `.gitignore` 的文件,然后在文本编辑器中将其打开。你可以在 `.gitignore` 中输入文件扩展名或文件名(每行一个),任何与你列出的文件匹配的文件都会被忽略(如文件名所示)。 + +``` +Thumbs.db +$RECYCLE.BIN/ +.DS_Store +._* +.fseventsd +.Spotlight-V100 +.Trashes +.directory +.Trash-* +*.wav +*.ogg +*.flac +*.mp3 +*.m4a +*.opus +*.jpg +*.png +*.mp4 +*.mov +*.mkv +*.avi +*.pdf +*.djvu +*.epub +*.od{s,t} +*.cbz +``` + +你知道最经常遇到哪些文件类型,因此请集中精力处理最有可能潜入你的 SparkleShare 目录的文件。如果您想稍微矫枉过正一些,可以在 Notabug.org 以及整个网上找到 `.gitignore` 文件的好集合。 + +通过将这些条目保存在 `.gitignore` 文件中,你可以将不需要发送到 Git 主机的大文件放在 SparkleShare 目录中,SparkleShare 将完全忽略它们。当然,这意味着您需要确保它们可以备份或通过其他方式分发给你的 SparkleShare 合作者。 + +### 自动化 + +[自动化][20] 是我们与计算机达成的默契之一:计算机执行重复的、无聊的工作,而我们人类要么不擅长做这些,要么不擅长记忆这些。SparkleShare 是一种很好的、简单的自动执行例行数据分发的方法。无论如何,这并不适合每个 Git 存储库。它没有用于高级 Git 功能的接口,它没有暂停按钮或手动管理的操作。没关系,因为它的范围是有意限制的。SparkleShare 可以完成 SparkleShare 计划要做的事情,它做得很好,而且它是你无需关心的一个 Git 存储库。 + +如果你想使用这种稳定的、看不见的自动化,请尝试一下 SparkleShare。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/file-sharing-git + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO +[2]: https://git-scm.com/ +[3]: http://www.sparkleshare.org/ +[4]: http://gitlab.com +[5]: https://opensource.com/article/19/4/calendar-git +[6]: http://sparkleshare.org +[7]: /business/16/8/flatpak +[8]: http://notabug.org +[9]: https://opensource.com/sites/default/files/uploads/git-new-repo.jpg (Creating a Git repository) +[10]: https://opensource.com/sites/default/files/uploads/github-clone-url.jpg (Cloning a URL on GitHub) +[11]: https://opensource.com/sites/default/files/uploads/gitlab-clone-url.jpg (Cloning a URL on GitLab) +[12]: http://gitolite.org +[13]: https://github.com/hbons/Dazzle +[14]: https://opensource.com/sites/default/files/uploads/sparkleshare-host.jpg (Choosing a Sparkleshare host) +[15]: mailto:git@notabug.org +[16]: https://opensource.com/sites/default/files/uploads/sparkleshare-clientid.jpg (Getting the client ID from Sparkleshare) +[17]: https://opensource.com/sites/default/files/uploads/git-ssh-key.jpg (Adding an SSH key) +[18]: https://opensource.com/sites/default/files/uploads/sparkleshare-file-manager.jpg (Sparkleshare file manager) +[19]: https://opensource.com/sites/default/files/uploads/gnome-show-hidden-files.jpg (Showing hidden files in GNOME) +[20]: /downloads/ansible-quickstart From 40b7e0a32be7ea0cee4b184d3080d6ebae11f25d Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sun, 5 Jan 2020 00:37:29 +0800 Subject: [PATCH 0093/3057] translated 20200101 5 predictions for Kubernetes in 2020.md --- ...01 5 predictions for Kubernetes in 2020.md | 73 ------------------- ...01 5 predictions for Kubernetes in 2020.md | 67 +++++++++++++++++ 2 files changed, 67 insertions(+), 73 deletions(-) delete mode 100644 sources/tech/20200101 5 predictions for Kubernetes in 2020.md create mode 100644 translated/tech/20200101 5 predictions for Kubernetes in 2020.md diff --git a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md deleted file mode 100644 index 99723632b8..0000000000 --- a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 predictions for Kubernetes in 2020) -[#]: via: (https://opensource.com/article/20/1/kubernetes-2020) -[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) - -5 predictions for Kubernetes in 2020 -====== -Plus, a look back at the most popular Kubernetes articles on the site in -2019. -![Person drinking a hat drink at the computer][1] - -How do you track a wildly popular project like Kubernetes? How do you figure out where it’s going? If you are contributing to the project or participating in Special Interest Groups (SIGs), you might gain insight by osmosis, but for those of you with day jobs that don’t include contributing to Kubernetes, you might like a little help reading the tea leaves. With a fast-moving project like Kubernetes, the end of the year is an excellent time to take a look at the past year to gain insight into the next one. - -This year, Kubernetes made a lot of progress. Aside from inspecting code, documentation, and meeting notes, another good source is blog entries. To gain some insights, I took a look at the top ten Kubernetes articles on Opensource.com. These articles give us insight into what topics people are interested in reading, but just as importantly, what articles people are interested in writing. Let’s dig in! - -(Get the full list of top 10 Kubernetes articles from 2019 at the end.) - -First, I would point out that five of these articles tackle the expansion of workloads and where they can run. This expansion of workloads includes data science, PostgreSQL, InfluxDB, and Grafana (as a workload, not just to monitor the cluster itself) and Edge. Historically, Kubernetes and containers in general have mostly run on top of virtual machines, especially when run on infrastructure provided by cloud providers. With this interest in Kubernetes at the edge, it’s another sign that end users are genuinely interested in Kubernetes on bare metal (see also [Kubernetes on metal with OpenShift][2]). - -Next, there seems to be a lot of hunger for operational knowledge and best practices with Kubernetes. From [Kubernetes Operators][3], to [Kubernetes Controllers][4], from [Secrets][5] to [ConfigMaps][6], developers and operators alike are looking for best practices and ways to simplify workload deployment and management. Often we get caught up in the actual configuration example, or how people do it, and don’t take a step back to realize that all of these fall into the bucket of how to operationalize the deployment of applications (not how to install or run Kubernetes itself). - -Finally, people seem to be really interested in getting started. In fact, there is so much information on how to build Kubernetes that it intimidates people and gets them down the wrong path. A couple of the top articles focus on why you should learn to run applications on Kubernetes instead of concentrating on installing it. Like best practices, people often don’t take a step back to analyze where they should invest their time when getting started. I have always advocated for, where possible, spending limited time and money on using technology instead of building it. - -### 5 predictions for Kubernetes in 2020 - -So, looking back at those themes from 2019, what does this tell us about where 2020 is going? Well, combining insight from these articles with my own broad purview, I want to share my thoughts for 2020 and beyond: - - 1. Expansion of workloads. I would keep my eye on high-performance computing, AI/ML, and stateful workloads using Operators. - - 2. More concrete best practices, especially around mature standards like PCI, HIPAA, NIST, etc. - - 3. Increased security around rootless and higher security [runtimes classes][7] (like [gVisor][8], [Kata Containers][9], etc.) - - 4. Better standardization on Kubernetes manifests as the core artifact for deployment in development and sharing applications between developers. Things like [podman generate kube][10], [podman play kube][11], and all in one Kubernetes environments like [CodeReady Containers (CRC)][12] - - 5. An ever-wider ecosystem of network, storage and specialized hardware (GPUs, etc.) vendors creating best of breed solutions for Kubernetes (in free software, we believe that open ecosystems are better than vertically integrated solutions) - - - - -I'm looking forward to another great year in Kubernetes! - -**Top 10 Kubernetes articles for 2019** - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/kubernetes-2020 - -作者:[Scott McCarty][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/fatherlinux -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) -[2]: https://blog.openshift.com/kubernetes-on-metal-with-openshift/ -[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ -[4]: https://kubernetes.io/docs/concepts/architecture/controller/ -[5]: https://kubernetes.io/docs/concepts/configuration/secret/ -[6]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/ -[7]: https://kubernetes.io/docs/concepts/containers/runtime-class/ -[8]: https://gvisor.dev/ -[9]: https://katacontainers.io/ -[10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ -[11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities -[12]: https://developers.redhat.com/products/codeready-containers/overview diff --git a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md new file mode 100644 index 0000000000..32868982f8 --- /dev/null +++ b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: "lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 predictions for Kubernetes in 2020) +[#]: via: (https://opensource.com/article/20/1/kubernetes-2020) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +2020 年对 Kubernetes 的 5 项预测 +====== +请先回顾下 2019 年网站上最受欢迎的 Kubernetes 的文章。 +![Person drinking a hat drink at the computer][1] + +你怎么追踪一个广受欢迎的项目(如 Kubernetes)的发展轨迹?你怎么能了解它发展到什么程度了?如果你在为这个项目作贡献或加入了 SIG(Special Interest Group),可能你会在潜移默化中了解到它的发展轨迹,但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。 + +今年,Kubernetes 取得了很大的进展。除了去查看源码、文档、会议笔记,你也可以去浏览博客。为了深入了解,我在 Opensource.com 上看了 Kubernetes 的 top 10 文章。通过这些文章,我们能了解开发者们更喜欢读和写哪些话题的文章。我们开始吧! + +(2019 年末获取 Kubernetes 文章的 top 10。) + +首先,我要指明这些文章中有 5 篇是关于 Kubernetes 工作负载的扩展以及它们可以运行在什么场景。这些工作负载涵盖数据科学、PostgreSQL、InfluxDB、Grafana(不仅仅监控集群本身)和 Edge。从历史角度看,Kubernetes 和容器都是在虚拟机上运行的,尤其是运行在由云提供的基础设施上时。抛开对于 Kubernetes 的兴趣因素,这也表明了终端用户们极度希望在裸机上安装 Kubernetes(参照[OpenShift 环境安装 Kubernetes][2])。 + +其次,也有很多开发者希望了解操作相关的知识以及 Kubernetes 的最佳实践。从 [Kubernetes 操作][3] 到 [Kubernetes 控制器][4],从 [Secrets][5] 到 [ConfigMaps][6],开发者和运维人员都希望能找到简化部署和管理工作的最佳实践。我们经常纠结在怎么去修改配置文件或别人会怎么配置,而不去回头想想这些配置是怎么让应用部署运转的(不是怎么安装,也不是怎么运行 Kubernetes)。 + +最后,人们似乎对入门教程真的感兴趣。事实上,构建 Kubernetes 所需了解的信息太多了,以至于让人们望而却步,也使他们走了错误的路。流行度高的文章中有几篇讲述了为什么你需要了解用 Kubernetes 运行应用程序,而不仅仅是安装它。就是最佳实践类的文章一样,人们也通常不会回头分析在入门时他们应该在什么地方花费时间。我一直秉持的理念是,把有限的时间和金钱投入到如何使用某项技术上,而不是如何构建它。 + +### 2020 年对 Kubernetes 的 5 项预测 + +回顾下 2019 年的相关主题,这些主题告诉我们 2020 年将如何发展?结合这些文章中的观点,加上我自己的看法,我来分享下我对于 2020 年以及未来发展趋势的想法: + + 1. 工作负载扩展。我会关注高性能计算,AI/ML 以及使用 Operator 的有状态工作负载。 + + 2. 更多的生产中的最佳实践,尤其是跟一些成熟的标准相关的,像 PCI,HIPAA,NIST 等等. + + 3. rootless 相关的更好的安全性和 [runtimes classes][7](如 [gVisor][8],[Kata Containers][9] 等等)更高的安全性。 + + 4. 在部署和开发者们共享应用时,把 Kubernetes 清单的更好的规范标准作为部署的核心要素。如 [podman generate kube][10], [podman play kube][11], 还有多合一 Kubernetes 环境,如 [CodeReady Containers (CRC)][12] + + 5. 一个前所未有的网络、存储和专业硬件(如 GPU 等等)供应商的生态系统,为 Kubernetes 提供 BoB(译注:best of breed,单项最佳品牌)解决方案(在免费软件中,我们相信开放的生态系统好过垂直整合的解决方案)。 + +期待 Kubernetes 在新的一年里再创辉煌! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/kubernetes-2020 + +作者:[Scott McCarty][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://blog.openshift.com/kubernetes-on-metal-with-openshift/ +[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ +[4]: https://kubernetes.io/docs/concepts/architecture/controller/ +[5]: https://kubernetes.io/docs/concepts/configuration/secret/ +[6]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/ +[7]: https://kubernetes.io/docs/concepts/containers/runtime-class/ +[8]: https://gvisor.dev/ +[9]: https://katacontainers.io/ +[10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ +[11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities +[12]: https://developers.redhat.com/products/codeready-containers/overview From 2651b99b8bbe0469d249ea617acd7f06125babcf Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sun, 5 Jan 2020 00:46:37 +0800 Subject: [PATCH 0094/3057] modify md --- .../tech/20200101 5 predictions for Kubernetes in 2020.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md index 32868982f8..f760fcfe4a 100644 --- a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md +++ b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: "lxbwolf) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2277c19e205a701b72b7620276efb9c6750e83f0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 5 Jan 2020 00:59:21 +0800 Subject: [PATCH 0095/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200104=20DevO?= =?UTF-8?q?ps=20is=20a=20solution=20to=20burnout=20worth=20investing=20in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200104 DevOps is a solution to burnout worth investing in.md --- ... solution to burnout worth investing in.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/tech/20200104 DevOps is a solution to burnout worth investing in.md diff --git a/sources/tech/20200104 DevOps is a solution to burnout worth investing in.md b/sources/tech/20200104 DevOps is a solution to burnout worth investing in.md new file mode 100644 index 0000000000..59d27c605e --- /dev/null +++ b/sources/tech/20200104 DevOps is a solution to burnout worth investing in.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevOps is a solution to burnout worth investing in) +[#]: via: (https://opensource.com/article/20/1/devops-burnout-solution) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +DevOps is a solution to burnout worth investing in +====== +Instead of treating burnout once it kicks in, we need to do more to +prevent it in the first place. Here is a reminder of the cause and a +look at solutions. +![A person choosing between several different incentives][1] + +Not a day goes by that I don't see a tweet or hear somebody talking about burnout. Burnout is becoming a pervasive part of our lives, especially in tech and open source communities. In [_What you need to know about burnout in open source communities_,][2] I defined burnout and explored its causes, symptoms, and potential treatments. But a better question is about prevention: How do we change the underlying processes, cultures, and tools to prevent burnout from occurring in the first place? + +### Burnout's catalyst is unplanned work + +Let's start by reviewing what's known about the cause of burnout. In 2019, PagerDuty published [_Unplanned work: The human impact of an always-on world_][3]. More than 35% of the study's respondents are considering leaving their jobs due to stress and work/life balance issues, also known as burnout. Companies that utilize automation and have documented response plans have fewer unplanned incidents and less stressed employees. + +Modern software organizations use automation and documented response plans to move faster. Moving faster is necessary to stay competitive. We are in this endless cycle where customers expect more, which puts more pressure on companies to deliver more and deliver it faster, which in turn creates pressure on employees. + +However, it is possible to move fast while having protections to prevent unplanned work and burnout. The Accelerate State of DevOps Report has been tracking trends in DevOps for six years. It allows teams to benchmark against others in the industry as low, medium, high, or elite performers. One of the findings from the [2019 State of DevOps report][4] was: "Productivity can drive improvements in work/life balance and reductions in burnout, and organizations can make smart investments to support it." + +Productivity means more work gets done. Therefore, more value is delivered. The catch to productivity is balance: Don't do more work in the short term at the expense of burning out your people. Processes and tooling need to be in place to prevent people from feeling overworked and overwhelmed. + +To support productivity that does not lead to burnout, organizations need to make smart investments in tooling and reduce technical debt. Investing in tooling means purchasing useful and easy-to-use solutions. The preference for building rather than buying may lead productivity to decrease and burnout to emerge. How? Instead of focusing on building features that are competitive differentiators and help the company achieve key business objectives, the developers spend countless hours trying to build something that a vendor could have quickly provided. + +As developers spend time building non-core solutions, technical debt accrues, and features are pushed out. Instead of building all the things, buy the tooling that supports the business but is not strategic, and build the things that are core to your business strategy. You wouldn't use development resources to build your own email program, so treat other tooling the same way. Twenty percent of tools used by low-performing teams are developed primarily in-house and proprietary to the organization, compared to 5% to 6% in medium, high, and elite teams. + +### Worthwhile solutions to burnout + +If you want to prevent burnout, here are some areas to invest in. It's no coincidence they overlap with frequent discussions [in DevOps articles][5]. + +#### Communication and collaboration + +Communication is at the heart of everything we do. [Laurie Barth][6] sums it up nicely: "Over time, I've learned that the biggest source of failure is often due to people and teams. A lack of communication and coordination can cause serious problems." Use tools like videoconferencing, Confluence, and Slack to ensure communication and collaboration happen. + +But create rules around the use of these tools. Make sure to turn off Slack notifications during off-hours. I disable my notifications from 6pm to 8am. + +Define what type of communication is best for which situations. Slack is useful for real-time, ephemeral communication, but it can lead to people feeling the need to always be on. If they're not online, they may miss an important conversation. If major or minor decisions are made in a Slack thread, document those in a longer-living system of record, giving all team members access to the necessary information. + +Trying to debug an incident? Communicate via Slack. Need to write up a post-incident review? Post that to Confluence or a wiki. + +Videoconferencing tools like Zoom or BlueJeans help enable remote work. Having the ability to work remotely, part-time or full-time, can reduce the stress of commuting or relocating. Videoconferences make it easy to stay connected with distributed teams because sometimes it is easier to hash things out in a face-to-face conversation than over email or Slack. + +These tools should not be used to encourage people to work while on vacation. Time off means time away from work to rest, recover, and recharge. + +#### Releases and deploys + +According to the 2019 State of DevOps report, elite teams deploy code 208 times more frequently than low performers, and their lead time from committing code to deployment is 106 times faster. It may seem that the more deploys you do, the greater the likelihood of burnout, but that isn't necessarily the case. Teams that utilize continuous delivery have processes in place to deploy safely. + +First, separate releases from deploys—just because you deployed code doesn't mean that all users should have access to it. Ring deploys make features available to a small group of people, like internal employees or beta customers. These users can help you identify bugs or provide feedback to fine-tune a feature before releasing it widely. + +Next, create feedback loops regarding the quality of a deployment. Things don't always go as planned when deploying your code. You need the ability to rapidly stop when things go wrong. Feedback loops include implementing monitoring and observability tools. By using telemetry data along with kill switches, you can quickly turn off a poorly behaving feature rather than rolling back an entire deployment. + +Finally, run A/B tests and experiments to learn what customers respond to. A metrics-based approach provides insight into what works and what doesn't and can help you validate a hypothesis. Instead of creating technical debt with a partial feature, collect data to see if the feature provides the expected conversions early on. If it doesn't, don't release it. + +#### Incident resolution + +Part of resolving incidents means knowing what to do when something breaks. And constantly putting out fires can lead to burnout. We can't prevent all incidents from happening, but we can be better prepared. Running chaos experiments or game days with tools like Gremlin can help companies prepare for the unexpected. + +With chaos experiments, you can learn how your systems, services, and applications respond under specific scenarios. Knowing how things behave when they're broken can shorten incident-resolution times. They can also help you identify and fix vulnerabilities before an incident occurs. + +What can you automate to reduce toil during incident resolution? For example, when you're actively working on an incident, can a Slack channel dedicated to the incident be automatically generated? Or can you create [feature flags][7] with a solution like LaunchDarkly (full disclosure: I work there) to perform common tasks during incident resolution? These could include: + + * Dynamic configuration changes, like automatically adjusting logging levels to collect more information when an alert is triggered + * Load-shedding to disable non-critical elements when systems are under heavy load to ensure essential tasks complete + * Kill switches or circuit breakers to turn off features when they are impacting your service reliability + + + +### It's not magic + +There is no magic bullet to resolve burnout; it requires having the right people, processes, and tools. The people help create an environment of psychological safety where people are free to ask questions, experiment, make mistakes, and be creative. Think about what is most important to your organization, and invest in the right tools to support those goals and the people working towards them. + +This month we look at ways to balance your workload, gracefully say "no," and avoid burnout. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/devops-burnout-solution + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_incentives.png?itok=IhIL1xyT (A person choosing between several different incentives) +[2]: https://opensource.com/article/19/11/burnout-open-source-communities +[3]: https://www.pagerduty.com/resources/reports/unplanned-work/ +[4]: https://services.google.com/fh/files/misc/state-of-devops-2019.pdf +[5]: https://opensource.com/tags/devops +[6]: https://laurieontech.com/ +[7]: https://martinfowler.com/articles/feature-toggles.html From fe36b54e08223dff6886b4540c2379977e4a952c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 5 Jan 2020 01:00:19 +0800 Subject: [PATCH 0096/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200104=20Indu?= =?UTF-8?q?strial=20Internet=20Consortium=20teams=20up=20with=20blockchain?= =?UTF-8?q?-focused=20security=20group?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md --- ... with blockchain-focused security group.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md diff --git a/sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md b/sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md new file mode 100644 index 0000000000..cd5f8f23c2 --- /dev/null +++ b/sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Industrial Internet Consortium teams up with blockchain-focused security group) +[#]: via: (https://www.networkworld.com/article/3512062/industrial-internet-consortium-teams-up-with-blockchain-focused-security-group.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Industrial Internet Consortium teams up with blockchain-focused security group +====== +A merger between a prominent industrial-IoT umbrella group and a blockchain-centered corporate memebership program highlights a new focus on bringing finished IoT solutions to market. +Leo Wolfert / Getty Images + +The Industrial Internet Consortium and the Trusted IoT Alliance announced today that they would merge memberships, in an effort to drive more collaborative approaches to [industrial IoT][1] and help create more market-ready products. + +The Trusted IoT Alliance will now operate under the aegis of the IIC, a long-standing umbrella group for vendors operating in the IIoT market. The idea is to help create more standardized approaches to common use cases in IIoT, enabling companies to get solutions to market more quickly. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“This consolidation will strengthen the ability of the IIC to provide guidance and advance best practices on the uses of distributed-ledger technology across industries, and boost the commercialization of these products and services,” said 451 Research senior [blockchain][3] and DLT analyst Csilla Zsigri in a statement. + +Gartner vice president and analyst Al Velosa said that it’s possible the move to team up with TIoTA was driven in part by a new urgency to reach potential customers. Where other players in the IoT marketplace, like the major cloud vendors, have raked in billions of dollars in revenue, the IIoT vendors themselves haven’t been as quick to hit their sales targets. “This approach is them trying to explore new vectors for revenue that they haven’t before,” Velosa said in an interview. + +The IIC, whose founding members include Cisco, IBM, Intel, AT&T and GE, features 19 different working groups, covering everything from IIoT technology itself to security to marketing to strategy. Adding TIoTA’s blockchain focus to the mix could help answer questions about security, which are centrally important to the continued success of enterprise and industrial IoT products. + +Indeed, research from Gartner released late last year shows that IoT users are already gravitating toward blockchain and other distributed-ledger technologies. Fully three-quarters of IoT technology adopters in the U.S. have either brought that type of technology into their stack already or are planning to do so by the end of 2020. While almost two-thirds of respondents to the survey cited security and trust as the biggest drivers of their embrace of blockchain, almost as many noted that the technology had allowed them to increase business efficiency and lower costs. + +**[ Also see [What is edge computing?][4] and [How edge networking and IoT will reshape data centers][5].]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3512062/industrial-internet-consortium-teams-up-with-blockchain-focused-security-group.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3243928/what-is-the-industrial-internet-of-things-essentials-of-iiot.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html +[4]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html +[5]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From dba8b36c0b6facb3de8fc99e07ebcc18011331ed Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 5 Jan 2020 08:34:56 +0800 Subject: [PATCH 0097/3057] Rename sources/tech/20200104 DevOps is a solution to burnout worth investing in.md to sources/talk/20200104 DevOps is a solution to burnout worth investing in.md --- ...20200104 DevOps is a solution to burnout worth investing in.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200104 DevOps is a solution to burnout worth investing in.md (100%) diff --git a/sources/tech/20200104 DevOps is a solution to burnout worth investing in.md b/sources/talk/20200104 DevOps is a solution to burnout worth investing in.md similarity index 100% rename from sources/tech/20200104 DevOps is a solution to burnout worth investing in.md rename to sources/talk/20200104 DevOps is a solution to burnout worth investing in.md From 4182d564cf9b7fcc1e6a2a241a24b4e41b2e8c54 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 08:41:54 +0800 Subject: [PATCH 0098/3057] PRF @geekpi --- ...nable to Open the MRL- Error -Quick Tip.md | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md index 004f300c56..c94e4cdf2f 100644 --- a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md +++ b/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) @@ -10,11 +10,13 @@ 修复 “VLC is Unable to Open the MRL” 错误 ====== +![](https://img.linux.net.cn/data/attachment/album/202001/05/084139mzlt1lfivilnnbkl.jpg) + 一个使用 [VLC 的技巧][1]是使用 [VLC] [2] 播放 YouTube 和其他在线视频。这可以帮助你[观看带有字幕的在线视频][3]。 但是事情并不总是这么简单,因为有时使用 VLC 打开 YouTube 视频时会遇到此错误: -**Your input can’t be opened: VLC is unable to open the MRL ‘. Check the log for details.** +> Your input can’t be opened: VLC is unable to open the MRL ‘. Check the log for details. ![VLC error while playing YouTube videos][4] @@ -26,19 +28,17 @@ 对于 VLC 也是如此。如果你[在 Ubuntu 或任何你用的系统中安装了最新的 VLC][7],那么可能不会看到此错误。 -### 修复 ”VLC is unable to open the MRL“ 错误 +### 修复 “VLC is unable to open the MRL” 错误 让我向你展示对于 YouTube 的修复步骤。 -进入 VLC 媒体播放器的官方 Github 仓库页面,并使用 Ctrl+S 保存文件: +进入 VLC 媒体播放器的官方 Github 仓库页面的[这个页面][8],并使用 `Ctrl+S` 保存文件: -[Download youtube.lua file][8] - -现在,你需要做的是用此下载文件替换 lib/vlc/lua/playlist 目录中的 youtube.luac(注意 luac 中的 “c”)。 +现在,你需要做的是用此下载文件替换 `lib/vlc/lua/playlist` 目录中的 `youtube.luac`(注意 luac 中的 “c”)。 #### Linux 中的步骤 -如果你使用的是 Linux,请打开终端并使用 [locate 命令][9]查找 youtube.luac 文件的确切位置: +如果你使用的是 Linux,请打开终端并使用 [locate 命令][9]查找 `youtube.luac` 文件的确切位置: ``` locate youtube.luac @@ -49,7 +49,7 @@ locate youtube.luac 对我而言,以下是文件路径: ``` -[email protected]:~$ locate youtube.lua +abhishek@itsfoss:~$ locate youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac ``` @@ -65,10 +65,8 @@ sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtu 如果你使用的是 Windows,那么应遵循以下步骤: - * 将下载的 youtube.lua 文件重命名为 youtube.luac - * 复制此文件并将其粘贴到 C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\ - - + * 将下载的 `youtube.lua` 文件重命名为 `youtube.luac` + * 复制此文件并将其粘贴到 `C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\` 就是这些了。 @@ -83,7 +81,7 @@ via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b99de9587e8b5cea0a576dbfe5e166a479ebe3d7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 08:42:46 +0800 Subject: [PATCH 0099/3057] PUB @geekpi https://linux.cn/article-11748-1.html --- ...xing -VLC is Unable to Open the MRL- Error -Quick Tip.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md (95%) diff --git a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/published/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md similarity index 95% rename from translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md rename to published/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md index c94e4cdf2f..51b076d906 100644 --- a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md +++ b/published/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11748-1.html) [#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) [#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) @@ -16,7 +16,7 @@ 但是事情并不总是这么简单,因为有时使用 VLC 打开 YouTube 视频时会遇到此错误: -> Your input can’t be opened: VLC is unable to open the MRL ‘. Check the log for details. +> Your input can’t be opened: VLC is unable to open the MRL ''. Check the log for details. ![VLC error while playing YouTube videos][4] From 21ab432f7d8164af90f6f712f40783c3f70a05ff Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 09:46:12 +0800 Subject: [PATCH 0100/3057] PRF @lxbwolf --- ...219 Kubernetes namespaces for beginners.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/translated/tech/20191219 Kubernetes namespaces for beginners.md b/translated/tech/20191219 Kubernetes namespaces for beginners.md index 5c1f6267b0..06a5c4bf50 100644 --- a/translated/tech/20191219 Kubernetes namespaces for beginners.md +++ b/translated/tech/20191219 Kubernetes namespaces for beginners.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Kubernetes namespaces for beginners) @@ -9,42 +9,44 @@ Kubernetes 命名空间入门 ====== -命名空间是什么?你为什么需要它? -![Ship captain sailing the Kubernetes seas][1] -kubernetes 命名空间是什么?Shakespeare 以前写过,我们声称的命名空间,或者任何其他名字,仍是一个虚拟集群。命名空间,意味着 kubernetes 可以在单个集群上提供多个 kubernetes 的集群,类似一个对其主机进行抽象的虚拟机。[kubernetes 文档][2] 中的解释: +> 命名空间是什么?你为什么需要它? + +![](https://img.linux.net.cn/data/attachment/album/202001/05/094542qnq3qc3nrkkrjanh.jpg) + +kubernetes 命名空间namespace是什么?正如 Shakespeare 以前写过的,我们所谓的命名空间,或者任何其他名字,就是虚拟集群。通过虚拟集群,意味着 kubernetes 可以在单个集群上提供多个 kubernetes 的集群,类似一个在其主机抽象出来的虚拟机。[kubernetes 文档][2] 中的解释: > kubernetes 在一个物理集群上提供了多个虚拟集群。这些虚拟集群被称为命名空间。 -你为什么需要命名空间?一句话概括:隔离。 +你为什么需要命名空间?一言以蔽之:隔离。 -隔离有很多优点,如它提供了安全和干净的环境。如果你是基础设施的所属者,并且为开发者提供环境,隔离就相当重要。你最不需要的就是,一个不熟悉你集群是如何搭建的人去修改系统配置 — 这可能导致所有人都无法登录。 +隔离有很多优点,如它提供了安全和干净的环境。如果你是基础设施的所属者,并且要为开发者提供环境,隔离就相当重要。你最不需要的就是,一个不熟悉你集群是如何搭建的人去修改系统配置 —— 这可能导致所有人都无法登录。 ### 初始命名空间 - 一个集群的三个初始命名空间:**default**、**kube-system** 和 **kube-public**。虽然你可以用这三个命名空间作技术部署,但我还是推荐你把这三个命名空间留作系统配置用,而不是你的项目。 +一个集群的三个初始命名空间:`default`、`kube-system` 和 `kube-public`。虽然技术上你可以用这三个命名空间作部署,但我还是推荐你把这三个命名空间留作系统配置用,而不是你的项目。 - * **Default** 某些部署没有指明命名空间,这样部署可以快速创建一个网格,但如果做了很多错误信息的部署,就很能去清理。我不去修改它,因为它在为某一个目的服务时,会在不止一种情况下误导我。 - * **Kube-system** 系统相关的所有对象组成的命名空间。任何此命名空间的部署都可能是危险的操作,可能对系统本身造成不可挽回的破坏。没错,我试过;所以我不推荐。 - * **Kube-public** 所有人可读,但是这个命名空间是为系统保留的。 +* `Default` 用于某些没有指明命名空间的部署,这是一种快速创建混乱的做法,如果你在没有正确信息的情况下做了很多部署,将很难清理。我不会去动它,因为它只有这一个用途,而且在不止一种情况下误导过我。 +* `Kube-system` 是 Kubernetes 系统相关的所有对象组成的命名空间。任何对此命名空间的部署都可能是危险的操作,可能对系统本身造成不可挽回的破坏。没错,我试过;所以我不推荐。 +* `Kube-public` 所有人可读,但是这个命名空间是为系统保留的。 ### 用命名空间来实现隔离 -我用了多种方式通过命名空间来实现隔离。我经常用命名空间来把多个用户项目分割到不同的环境。这种方式可以有效防止跨项目的污染,因为命名空间提供了独立的环境。例如,使用者可以安装不同版本的 Jenkins,如果它们的环境变量是在不同的命名空间,就不会冲突。 +我用了多种方式通过命名空间来实现隔离。我经常用命名空间来把多个用户项目分割到不同的环境。这种方式可以有效防止跨项目的污染,因为命名空间提供了独立的环境。例如,用户可以安装不同版本的 Jenkins,如果它们的环境变量是在不同的命名空间,就不会冲突。 -这种隔离对于清理也很有帮助。如果部署组的多个项目被废弃,你可以用命令 `kubectl delete ns <$NAMESPACENAME>` 一键删除命名空间,清理命名空间内的所有东西。(请确认被删除的是正确的命名空间。我曾经在生产环境删除了错误的命名空间,这很不好。) +这种隔离对于清理也很有帮助。如果开发小组的多个项目突然被废弃,你可以用命令 `kubectl delete ns <$NAMESPACENAME>` 一键删除命名空间,清理命名空间内的所有东西。(请确认被删除的是正确的命名空间。我曾经在生产环境删除了错误的命名空间,这很不好。) -如果你是基础设施所有者,请谨慎操作,因为这可能会引发其他团队的的故障或引发其他问题。例如,如果你创建了一个特定的命名空间,里面有 DNS 函数,其他人删除了它,那么命名空间内的所有 pod 和它们运行的应用都会被清空。所有的**删除**操作在真正实施之前都应该由同事(通过 [GitOps][3])评审一下。 +如果你是基础设施所有者,请谨慎操作,因为这可能会引发其他团队的的故障或引发其他问题。例如,如果你创建了一个特定的命名空间,里面有特殊的额外安全的 DNS 功能,但是其他人删除了它,那么命名空间内的所有 pod 和它们运行的应用都会被清空。所有的**删除**操作在真正实施之前都应该由同事(通过 [GitOps][3])评审一下。 虽然官方文档不建议 [10 人以下团队][2] 使用多个命名空间,但出于架构需要,在我自己的集群上还是用了多个命名空间。集群越干净越好。 ### 关于命名空间管理员应该知道的 -首先,命名空间不能嵌套。部署只能在一个命名空间中进行。对于版本化项目,你不一定要用命名空间,你可以使用标签来区分有相同名字的版本化应用。命名空间使用配额来为不同的用户划分资源;例如,*某个命名空间最多能有 x 个 node*。最后,所有的命名空间对于资源类型只能使用一个独一无二的名字。 +首先,命名空间不能嵌套。部署只能在一个命名空间中进行。对于版本化项目,你不一定要用命名空间,你可以使用标签来区分有相同名字的版本化应用。命名空间使用配额来为不同的用户划分资源;例如,*某个命名空间最多能有 x 个节点*。最后,所有的命名空间对于该资源类型只能使用一个独一无二的名字。 ### 命名空间命令操作 -你需要安装 [Minikube][4]、 [Helm][5] 和 [kubectl][6] 命令行,才能使用下面的命名空间命令。我的文章 [_安全浏览你的 DevOps 流水线_][7] 中有它们的安装教程,你也可以去每个工程的官方主页去找安装教程。我使用的是最新的 Minikube。手动安装很快,第一次就能成功运行。 +你需要安装 [Minikube][4]、[Helm][5] 和 [kubectl][6] 命令行,才能使用下面的命名空间命令。我的文章《[安全扫描你的 DevOps 流水线][7]》中有它们的安装教程,你也可以去每个项目的官方主页去找安装教程。我使用的是最新的 Minikube。手动安装很快,第一次就能成功运行。 获取你的第一组命名空间: @@ -63,7 +65,7 @@ jess@Athena:~$ kubectl create namespace athena namespace/athena created ``` -现在开发者可以部署到你创建的命名空间;例如,这里是一个简短的 Helm 结构信息: +现在开发者可以部署到你创建的命名空间了;例如,这里是一个简短的 Helm chart: ``` jess@Athena:~$ helm install teset-deploy stable/redis --namespace athena @@ -74,7 +76,7 @@ STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: -** Please be patient while the chart is being deployed ** +` Please be patient while the chart is being deployed ` Redis can be accessed via port 6379 on the following DNS names from within your cluster: teset-deploy-redis-master.athena.svc.cluster.local for read/write operations @@ -98,6 +100,7 @@ export REDIS_PASSWORD=$(kubectl get secret --namespace athena teset-deploy-redis ``` 2. 使用 Redis CLI 连接: + ```bash redis-cli -h teset-deploy-redis-master -a $REDIS_PASSWORD redis-cli -h teset-deploy-redis-slave -a $REDIS_PASSWORD @@ -110,11 +113,10 @@ kubectl port-forward --namespace athena svc/teset-deploy-redis-master 6379:6379 redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD ``` -现在这一套部署已经完成了,你有一个在命名空间 **test-deploy** 中部署的图表。 +现在这一套部署已经完成了,你有一个在命名空间 `test-deploy` 中部署的 chart。 查看你的命名空间中有哪些 pod: - ``` jess@Athena:~$ kubectl get pods --namespace athena NAME                            READY   STATUS  RESTARTS   AGE @@ -127,7 +129,6 @@ teset-deploy-redis-slave-1      1/1     Running   0             90s 一键删除所有东西: - ```bash jess@Athena:~$ kubectl delete namespace athena namespace "athena" deleted @@ -137,7 +138,6 @@ namespace "athena" deleted 再次检查一下所有东西是否被删除了: - ```bash jess@Athena:~$ kubectl get pods --all-namespaces NAMESPACE       NAME                            READY   STATUS  RESTARTS   AGE @@ -156,11 +156,11 @@ kube-system   storage-provisioner               1/1     Running   0 ### 命名空间实践 -现在我是为了安全使用命名空间,如限制用户的权限。你可以限制所有的东西 — 从哪些角色可以访问命名空间,到命名空间可使用的集群资源(CPU 等)的配额等级。例如,我通过资源配额和基于角色的访问控制(role-based access control,RBAC)配置来确保只有允许的服务账号可以访问命名空间。 +当前我是出于安全考虑才使用命名空间,如限制用户的权限。你可以限制所有的东西 —— 从哪些角色可以访问命名空间,到命名空间可使用的集群资源(CPU 等)的配额等级。例如,我通过资源配额和基于角色的访问控制role-based access control(RBAC)配置来确保只有允许的服务账号可以访问命名空间。 -对于隔离方面的安全,我不希望我的私人 Jenkins 应用可以通过一个信任的本地网络被当做有公共 IP 地址的安全镜像来访问(我不得不假定,可能会做出妥协)。 +对于隔离方面的安全,我不希望我的私人 Jenkins 应用可以通过一个信任的本地网络被当做一个有公共 IP 地址的安全镜像来访问(我不得不假定,可能会被侵袭)。 -如果你很难提前计算出到底要在你的云平台上部署多少 node(就我而言,在把我的私人服务器放到 [segfaulting][8] 之前可以部署多少个 node),那么命名空间在预算方面也很有用。虽然这超出了本文的讨论范围,而且很复杂,但值得你去调研和使用来防止你的集群过分扩展。 +如果你很难提前计算出到底要在你的云平台上部署多少节点(或者,就我而言,是在[搞崩][8]我的家庭服务器之前我能部署多少个),那么命名空间在预算方面也很有用。虽然这超出了本文的讨论范围,而且很复杂,但值得你去调研和使用来防止你的集群过分扩展。 ### 总结 @@ -173,7 +173,7 @@ via: https://opensource.com/article/19/12/kubernetes-namespaces 作者:[Jessica Cherry][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 37c8828eee2b213dcdadf927e2e163923fbc94c0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 09:46:40 +0800 Subject: [PATCH 0101/3057] PUB @lxbwolf https://linux.cn/article-11749-1.html --- .../20191219 Kubernetes namespaces for beginners.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191219 Kubernetes namespaces for beginners.md (99%) diff --git a/translated/tech/20191219 Kubernetes namespaces for beginners.md b/published/20191219 Kubernetes namespaces for beginners.md similarity index 99% rename from translated/tech/20191219 Kubernetes namespaces for beginners.md rename to published/20191219 Kubernetes namespaces for beginners.md index 06a5c4bf50..c45aa74d42 100644 --- a/translated/tech/20191219 Kubernetes namespaces for beginners.md +++ b/published/20191219 Kubernetes namespaces for beginners.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11749-1.html) [#]: subject: (Kubernetes namespaces for beginners) [#]: via: (https://opensource.com/article/19/12/kubernetes-namespaces) [#]: author: (Jessica Cherry https://opensource.com/users/jrepka) From cbcfbc8dd7330da93819934bd6131128f0230766 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 10:20:23 +0800 Subject: [PATCH 0102/3057] PRF @wxy --- ...ming resources for coders of all levels.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20191231 12 programming resources for coders of all levels.md b/translated/tech/20191231 12 programming resources for coders of all levels.md index c3687187b3..c61d0aa4c3 100644 --- a/translated/tech/20191231 12 programming resources for coders of all levels.md +++ b/translated/tech/20191231 12 programming resources for coders of all levels.md @@ -1,39 +1,39 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (12 programming resources for coders of all levels) [#]: via: (https://opensource.com/article/19/12/programming-resources) [#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) -12 个给码农们的编程资源 +12 个给全等级码农们的编程资源 ====== > 无论你身处编程旅程中的何处,这 12 篇编程文章都有你需要学习一些东西。 -![Woman sitting in front of her computer][1] +![](https://img.linux.net.cn/data/attachment/album/202001/05/102002cdjy66jucbcfs6dg.jpg) > “学习计算机编程的最佳时间是 20 年前,其次是现在。” -> — (也许是)计算机科学的谚语 +> — 计算机科学的谚语(也许是) -你是新程序员、经验丰富的 Web 开发人员、后端大师、头发花白的系统程序员,还是其他神秘物种的计算机极客?无论你身处广阔的软件开发人员生态系统中的何处,在我们领域中唯一不变的就是需要了解新技术及其应用方法。这是过去一年来阅读量最大的 Opensource.com 文章的集合,我很高兴在这里与你分享它们。 +无论你是新程序员、经验丰富的 Web 开发人员、后端大师、头发花白的系统程序员,还是其他神秘物种的计算机极客?无论你身处广阔的软件开发人员生态系统中的何处,在我们领域中唯一不变的就是需要了解新技术及其应用方法。这是过去一年来阅读量最大的 Opensource.com 文章的集合,我很高兴在这里与你分享它们。 ### 好好学习 无论你的技能或兴趣是什么,学习如何编写计算机程序都可以将特定领域的知识变成一种超能力。不幸的是,至少从现在开始,还不可能通过坐在计算机前面接受电磁辐射就能学会如何编程。在这之前,我推荐这些出色的文章来帮助激发你的编程技能。它们解决了一些重要的问题,例如考虑学习哪种语言以及不同的入门方式。 -* [你应该学习哪种编程语言?][2] -* [学习 Python 的 12 个方式][3] -* [你可以使用树莓派学习的三种流行编程语言][4] -* [利用 Python 引导孩子的计算机思维][5] +* [你应该学习哪种编程语言?][2](译文) +* [学习 Python 的 12 个方式][3](译文) +* [你可以使用树莓派学习的三种流行编程语言][4](译文) +* [利用 Python 引导孩子的计算机思维][5](译文) ### 天天向上 经验丰富的程序员知道,与学习编程相比,唯一更难的就是使你的技能和知识保持最新。但是我们是[自学成才][6]的一族,总是希望提高我们的专业知识和理解力。即使我们不期望使用新技术,我们也知道总会有人问起它们。这些有关 Rust、WebAssembly 和 Podman 的文章是开始学习软件技术一些即将出现的趋势的好地方。 * [为什么要在 WebAssembly 中使用 Rust?][7] -* [使用 WebAssembly 提升命令行游乐场][8] +* [使用 WebAssembly 扩展命令行领域][8] * [免 root 的 Podman 如何工作?][9] * [为什么选择 Rust 作为你的下一种编程语言][10] @@ -42,8 +42,8 @@ 尽管新技术层出不穷,但回顾过去可以帮助你前进。当今惊人的技术是建立在昨天的工具之上的,即使我们从未使用这些传奇语言编写过代码,它也将使我们很好地理解这些工具的功能和局限性。这一系列文章集中于 C 语言、用 AWK 编写的实际应用程序,以及对流行度下降但也许还没有消亡的计算机语言的有趣讨论。 * [C 的巨大影响] [11] -* [如何写好 C main 函数][12] -* [用 AWK 喝咖啡][13] +* [如何写好 C main 函数][12](译文) +* [用 AWK 喝咖啡][13](译文) * [你最喜欢的“死”语言是什么?][14] ### 学习不止 @@ -57,7 +57,7 @@ via: https://opensource.com/article/19/12/programming-resources 作者:[Erik O'Shaughnessy][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 833d4892d808f3b0db96e43d32ee02d990861be3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 10:20:59 +0800 Subject: [PATCH 0103/3057] PUB @wxy https://linux.cn/article-11751-1.html --- ...91231 12 programming resources for coders of all levels.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191231 12 programming resources for coders of all levels.md (98%) diff --git a/translated/tech/20191231 12 programming resources for coders of all levels.md b/published/20191231 12 programming resources for coders of all levels.md similarity index 98% rename from translated/tech/20191231 12 programming resources for coders of all levels.md rename to published/20191231 12 programming resources for coders of all levels.md index c61d0aa4c3..2e32ec2515 100644 --- a/translated/tech/20191231 12 programming resources for coders of all levels.md +++ b/published/20191231 12 programming resources for coders of all levels.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11751-1.html) [#]: subject: (12 programming resources for coders of all levels) [#]: via: (https://opensource.com/article/19/12/programming-resources) [#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) From 24c143416f9463a5c00a2e5351d6be60a1d95d46 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 5 Jan 2020 14:29:55 +0800 Subject: [PATCH 0104/3057] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...w to write a Python web API with Django.md | 247 ------------------ ...w to write a Python web API with Django.md | 230 ++++++++++++++++ 2 files changed, 230 insertions(+), 247 deletions(-) delete mode 100644 sources/tech/20191129 How to write a Python web API with Django.md create mode 100644 translated/tech/20191129 How to write a Python web API with Django.md diff --git a/sources/tech/20191129 How to write a Python web API with Django.md b/sources/tech/20191129 How to write a Python web API with Django.md deleted file mode 100644 index 38acb243cd..0000000000 --- a/sources/tech/20191129 How to write a Python web API with Django.md +++ /dev/null @@ -1,247 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to write a Python web API with Django) -[#]: via: (https://opensource.com/article/19/11/python-web-api-django) -[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) - -How to write a Python web API with Django -====== -Django is one of the most popular frameworks for Python API development. -Learn how to use it in this quick tutorial. -![Hands on a keyboard with a Python book ][1] - -[Django][2] is the comprehensive web framework by which all other frameworks are measured. One of the most popular names in Python API development, Django has surged in popularity since its start in 2005. - -Django is maintained by the Django Software Foundation and has experienced great community support, with over 11,600 members worldwide. On Stack Overflow, Django has around 191,000 tagged questions. Websites like Spotify, YouTube, and Instagram rely on Django for application and data management. - -This article demonstrates a simple API to fetch data from a server using the GET method of the HTTP protocol. - -### Set up a project - -First, create a structure for your Django application; you can do this at any location on your system: - - -``` -$ mkdir myproject -$ cd myproject -``` - -Then, create a virtual environment to isolate package dependencies locally within the project directory: - - -``` -$ python3 -m venv env -$ source env/bin/activate -``` - -On Windows, use the command **env\Scripts\activate** to activate your Python virtual environment. - -### Install Django and the Django REST framework - -Next, install the Python modules for Django and Django REST: - - -``` -$ pip3 install django -$ pip3 install djangorestframework -``` - -### Instantiate a new Django project - -Now that you have a work environment for your app, you must instantiate a new Django project. Unlike a minimal framework like [Flask][3], Django includes dedicated commands for this process (note the trailing **.** character in the first command): - - -``` -$ django-admin startproject tutorial . -$ cd tutorial -$ django-admin startapp quickstart -``` - -Django uses a database as its backend, so you should sync your database before beginning development. The database can be managed with the **manage.py** script that was created when you ran the **django-admin** command. Because you're currently in the **tutorial** directory, use the **../** notation to run the script, located one directory up: - - -``` -$ python3 ../manage.py makemigrations -No changes detected -$ python4 ../manage.py migrate -Operations to perform: -  Apply all migrations: admin, auth, contenttypes, sessions -Running migrations: -  Applying contenttypes.0001_initial... OK -  Applying auth.0001_initial... OK -  Applying admin.0001_initial... OK -  Applying admin.0002_logentry_remove_auto_add... OK -  Applying admin.0003_logentry_add_action_flag_choices... OK -  Applying contenttypes.0002_remove_content_type_name... OK -  Applying auth.0002_alter_permission_name_max_length... OK -  Applying auth.0003_alter_user_email_max_length... OK -  Applying auth.0004_alter_user_username_opts... OK -  Applying auth.0005_alter_user_last_login_null... OK -  Applying auth.0006_require_contenttypes_0002... OK -  Applying auth.0007_alter_validators_add_error_messages... OK -  Applying auth.0008_alter_user_username_max_length... OK -  Applying auth.0009_alter_user_last_name_max_length... OK -  Applying auth.0010_alter_group_name_max_length... OK -  Applying auth.0011_update_proxy_permissions... OK -  Applying sessions.0001_initial... OK -``` - -### Create users in Django - -Create an initial user named **admin** with the example password of **password123**: - - -``` -$ python3 ../manage.py createsuperuser \ -  --email [admin@example.com][4] \ -  --username admin -``` - -Create a password when you're prompted. - -### Implement serializers and views in Django - -For Django to be able to pass information over to an HTTP GET request, the information object must be translated into valid response data. Django implements **serializers** for this. - -In your project, define some serializers by creating a new module named **quickstart/serializers.py**, which you'll use for data representations: - - -``` -from django.contrib.auth.models import User, Group -from rest_framework import serializers - -class UserSerializer(serializers.HyperlinkedModelSerializer): -    class Meta: -        model = User -        fields = ['url', 'username', 'email', 'groups'] - -class GroupSerializer(serializers.HyperlinkedModelSerializer): -    class Meta: -        model = Group -        fields = ['url', 'name'] -``` - -A [view][5] in Django is a function that takes a web request and returns a web response. The response can be HTML, or an HTTP redirect, or an HTTP error, a JSON or XML document, an image or TAR file, or anything else you can get over the internet. To create a view, open **quickstart/views.py** and enter the following code. This file already exists and has some boilerplate text in it, so keep that and append this text to the file: - - -``` -from django.contrib.auth.models import User, Group -from rest_framework import viewsets -from tutorial.quickstart.serializers import UserSerializer, GroupSerializer - -class UserViewSet(viewsets.ModelViewSet): -    """ -    API endpoint  allows users to be viewed or edited. -    """ -    queryset = User.objects.all().order_by('-date_joined') -    serializer_class = UserSerializer - -class GroupViewSet(viewsets.ModelViewSet): -    """ -    API endpoint  allows groups to be viewed or edited. -    """ -    queryset = Group.objects.all() -    serializer_class = GroupSerializer -``` - -### Generate URLs with Django - -Now you can generate URLs so people can access your fledgling API. Open **urls.py** in a text editor and replace the default sample code with this code: - - -``` -from django.urls import include, path -from rest_framework import routers -from tutorial.quickstart import views - -router = routers.DefaultRouter() -router.register(r'users', views.UserViewSet) -router.register(r'groups', views.GroupViewSet) - -# Use automatic URL routing -# Can also include login URLs for the browsable API -urlpatterns = [ -    path('', include(router.urls)), -    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) -] -``` - -### Adjust your Django project settings - -The settings module for this example project is stored in **tutorial/settings.py**, so open that in a text editor and add **rest_framework** to the end of the **INSTALLED_APPS** list: - - -``` -INSTALLED_APPS = [ -    ... -    'rest_framework', -] -``` - -### Test your Django API - -You're now ready to test the API you've built. First, start up the built-in server from the command line: - - -``` -`$ python3 manage.py runserver` -``` - -You can access your API by navigating to the URL **** using **curl**: - - -``` -$ curl --get -[{"url":" -``` - -Or use Firefox or the [open source web browser][6] of your choice: - -![A simple Django API][7] - -For more in-depth knowledge about RESTful APIs using Django and Python, see the excellent [Django documentation][8]. - -### Why should I use Django? - -The major benefits of Django: - - 1. The size of the Django community is ever-growing, so you have lots of resources for guidance, even on a complicated project. - 2. Features like templating, routing, forms, authentication, and management tools are included by default. You don't have to hunt for external tools or worry about third-party tools introducing compatibility issues. - 3. Simple constructs for users, loops, and conditions allow you to focus on writing code. - 4. It's a mature and optimized framework that is extremely fast and reliable. - - - -The major drawbacks of Django are: - - 1. Django is complex! From a developer's point of view, Django can be trickier to learn than a simpler framework. - 2. There's a big ecosystem around Django. This is great once you're comfortable with Django, but it can be overwhelming when you're still learning. - - - -Django is a great option for your application or API. Download it, get familiar with it, and start developing an amazing project! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/python-web-api-django - -作者:[Rachel Waston][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/rachelwaston -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) -[2]: https://www.djangoproject.com/ -[3]: https://opensource.com/article/19/11/python-web-api-flask -[4]: mailto:admin@example.com -[5]: https://docs.djangoproject.com/en/2.2/topics/http/views/ -[6]: https://opensource.com/article/19/7/open-source-browsers -[7]: https://opensource.com/sites/default/files/uploads/django-api.png (A simple Django API) -[8]: https://docs.djangoproject.com/en/2.2 diff --git a/translated/tech/20191129 How to write a Python web API with Django.md b/translated/tech/20191129 How to write a Python web API with Django.md new file mode 100644 index 0000000000..aaf4acefb8 --- /dev/null +++ b/translated/tech/20191129 How to write a Python web API with Django.md @@ -0,0 +1,230 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a Python web API with Django) +[#]: via: (https://opensource.com/article/19/11/python-web-api-django) +[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) + +如何借助 Django 来编写一个 Python Web API +====== +Django 是 Python API 开发中最流行的框架之一,在这个教程中,我们来学习如何使用它。 +![拿起 Python 书来学习吧][1] + +[Django][2] 所有 Web 框架中最全面的,也是最受欢迎的一个。自 2005 年以来,其流行度大幅上升。 + +Django 是由 Django 软件基金会维护,并且获得了社区的大力支持,在全球拥有超过 11,600 名会员。在 Stack Overflow 上,Django 约有 191,000 个带标签的问题。Spotify、YouTube 和 Instagram 等都使用 Django 来构建应用程序和数据管理。 + +本文演示了一个简单的 API,通过它可以使用 HTTP 协议的 GET 方法来从服务器获取数据。 + +### 构建一个项目 + +首先,为你的 Django 应用程序创建一个目录结构,你可以在系统的任何位置创建: + +``` +$ mkdir myproject +$ cd myproject +``` + +然后,在项目目录中创建一个虚拟环境来隔离本地包依赖关系: + +``` +$ python3 -m venv env +$ source env/bin/activate +``` + +在 Windows 上,使用命令 **env\Scripts\activate** 来激活虚拟环境: + +### 安装 Django 和 Django REST framework + +然后,安装 Django 和 Django REST: + +``` +$ pip3 install django +$ pip3 install djangorestframework +``` + +### 实例化一个新的 Django 项目 + +现在你的应用程序已经有了一个工作环境,你必须实例化一个新的 Django 项目。与 [Flask][3] 这样微框架不同的是,Django 有专门的命令来创建(注意第一条命令后的 **.** 字符)。 + +``` +$ django-admin startproject tutorial . +$ cd tutorial +$ django-admin startapp quickstart +``` + +Django 使用数据库来管理后端,所以你应该在开始开发之前同步数据库,数据库可以通过 **manage.py** 脚本管理,它是在你运行 **django-admin** 命令时创建的。因为你现在在 **tutorial** 目录,所以使用 **../** 符号来运行脚本,它位于上一层目录: + +``` +$ python3 ../manage.py makemigrations +No changes detected +$ python4 ../manage.py migrate +Operations to perform: +  Apply all migrations: admin, auth, contenttypes, sessions +Running migrations: +  Applying contenttypes.0001_initial... OK +  Applying auth.0001_initial... OK +  Applying admin.0001_initial... OK +  Applying admin.0002_logentry_remove_auto_add... OK +  Applying admin.0003_logentry_add_action_flag_choices... OK +  Applying contenttypes.0002_remove_content_type_name... OK +  Applying auth.0002_alter_permission_name_max_length... OK +  Applying auth.0003_alter_user_email_max_length... OK +  Applying auth.0004_alter_user_username_opts... OK +  Applying auth.0005_alter_user_last_login_null... OK +  Applying auth.0006_require_contenttypes_0002... OK +  Applying auth.0007_alter_validators_add_error_messages... OK +  Applying auth.0008_alter_user_username_max_length... OK +  Applying auth.0009_alter_user_last_name_max_length... OK +  Applying auth.0010_alter_group_name_max_length... OK +  Applying auth.0011_update_proxy_permissions... OK +  Applying sessions.0001_initial... OK +``` + +### 在 Django 中创建用户 + +创建一个名为 **admin**,密码为 **password123** 的初始用户: + +``` +$ python3 ../manage.py createsuperuser \ +  --email [admin@example.com][4] \ +  --username admin +``` + +在提示时创建密码。 + +### 在 Django 中实现序列化和视图 + +为了使 Django 能够将信息传递给 HTTP GET 请求,必须将信息对象转化为有效的响应数据。Django 为此实现了“序列化类”。 + +在你的项目中,创建一个名为 **quickstart/serializers.py** 的新模块,使用它来定义一些序列化器,模块将用于数据展示: + +``` +from django.contrib.auth.models import User, Group +from rest_framework import serializers + +class UserSerializer(serializers.HyperlinkedModelSerializer): +    class Meta: +        model = User +        fields = ['url', 'username', 'email', 'groups'] + +class GroupSerializer(serializers.HyperlinkedModelSerializer): +    class Meta: +        model = Group +        fields = ['url', 'name'] +``` + +Django 中的 [view][5] 是一个接受 Web 请求并返回 Web 响应的函数。响应可以是 HTML、HTTP 重定向、HTTP 错误、JSON 或 XML 文档、图像或 TAR 文件,或者可以是从 Internet 获得的任何其他内容。要创建视图,打开 **quickstart/views.py** 并输入以下代码。该文件已经存在,并且其中包含一些示例文本,保留这些文本并将以下代码添加到文件中: + +``` +from django.contrib.auth.models import User, Group +from rest_framework import viewsets +from tutorial.quickstart.serializers import UserSerializer, GroupSerializer + +class UserViewSet(viewsets.ModelViewSet): +    """ +    API 允许查看或编辑用户 +    """ +    queryset = User.objects.all().order_by('-date_joined') +    serializer_class = UserSerializer + +class GroupViewSet(viewsets.ModelViewSet): +    """ +    API 允许查看或编辑组 +    """ +    queryset = Group.objects.all() +    serializer_class = GroupSerializer +``` + +### 使用 Django 生成 URL + +现在,你可以生成 URL 以便人们可以访问你刚起步的 API。在文本编辑器中打开 urls.py 并将默认示例代码替换为以下代码: + +``` +from django.urls import include, path +from rest_framework import routers +from tutorial.quickstart import views + +router = routers.DefaultRouter() +router.register(r'users', views.UserViewSet) +router.register(r'groups', views.GroupViewSet) + +# 使用自动路由 URL +# 还有登录 URL +urlpatterns = [ +    path('', include(router.urls)), +    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) +] +``` + +### 调整你的 Django 项目设置 + +这个示例项目的设置模块存储在 **tutorial/settings.py** 中,因此在文本编辑器中将其打开,然后在 **INSTALLED_APPS** 列表的末尾添加 **rest_framework**: + +``` +INSTALLED_APPS = [ +    ... +    'rest_framework', +] +``` + +### 测试 Django API + +现在,你可以测试构建的 API。首先,从命令行启动内置服务器: + +``` +`$ python3 manage.py runserver` +``` + +你可以通过使用 **curl** 导航至 URL **** 来访问 API: + +``` +$ curl --get +[{"url":" +``` + +使用 Firefox 或[开源浏览器][6]: + +![一个简单的 Django API][7] + +有关使用 Django 和 Python 的 RESTful API 的更多深入知识,参考出色的 [Django 文档][8]。 + +### 为什么要使用 Djago? + +Django 的主要优点: + + 1. Django 社区的规模正在不断扩大,因此即使你做一个复杂项目,也会有大量的指导资源。 + 2. 默认包含模板、路由、表单、身份验证和管理工具等功能,你不必寻找外部工具,也不必担心第三方工具会引入兼容性问题。 + 3. 用户,循环和条件的简单结构使你可以专注于编写代码。 + 4. 这是一个成熟且经过优化的框架,它非常快速且可靠。 + +Django 的主要缺点是: + + 1. Django 很复杂!从开发人员视角的角度来看,它可能比简单的框架更难学。 + 2. Django 有一个很大的生态系统。一旦你熟悉它,这会很棒,但是当你深入学习时,它可能会令人感到无所适从。 + +对你的应用程序或 API 来说,Django 是绝佳选择。下载并熟悉它,开始开发一个迷人的项目! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/python-web-api-django + +作者:[Rachel Waston][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rachelwaston +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://www.djangoproject.com/ +[3]: https://opensource.com/article/19/11/python-web-api-flask +[4]: mailto:admin@example.com +[5]: https://docs.djangoproject.com/en/2.2/topics/http/views/ +[6]: https://opensource.com/article/19/7/open-source-browsers +[7]: https://opensource.com/sites/default/files/uploads/django-api.png (A simple Django API) +[8]: https://docs.djangoproject.com/en/2.2 From 73017730a98b1f330565628ab3c4b013d8a0d178 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sun, 5 Jan 2020 19:09:25 +0800 Subject: [PATCH 0105/3057] translating by lxbwolf --- sources/tech/20191210 Lessons learned from programming in Go.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md index 1702d36c47..0c9aeea2e2 100644 --- a/sources/tech/20191210 Lessons learned from programming in Go.md +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1a18060ceafa26e3ec53d7943f74a06cda233400 Mon Sep 17 00:00:00 2001 From: summer2233 Date: Sun, 5 Jan 2020 21:29:00 +0800 Subject: [PATCH 0106/3057] Update 20171130 Excellent Business Software Alternatives For Linux.md --- ...171130 Excellent Business Software Alternatives For Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20171130 Excellent Business Software Alternatives For Linux.md b/sources/tech/20171130 Excellent Business Software Alternatives For Linux.md index 3469c62569..4a40b993f3 100644 --- a/sources/tech/20171130 Excellent Business Software Alternatives For Linux.md +++ b/sources/tech/20171130 Excellent Business Software Alternatives For Linux.md @@ -1,3 +1,5 @@ +summer2233 is translating + Excellent Business Software Alternatives For Linux ------- From 6ba21f4ddb9a1ce58ecf32a1e7d7f6ed54bf7c4a Mon Sep 17 00:00:00 2001 From: summer2233 Date: Sun, 5 Jan 2020 21:31:19 +0800 Subject: [PATCH 0107/3057] Update 20191226 10 Linux command tutorials for beginners and experts.md --- ...1226 10 Linux command tutorials for beginners and experts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md index 3172f26ea1..03fc77a8e1 100644 --- a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md +++ b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (summer2233) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 42dedf47444a6b0fd340182c185f042fdcef75b0 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 5 Jan 2020 22:31:00 +0800 Subject: [PATCH 0108/3057] Translating --- ...180522 Advanced use of the less text file viewer in Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md b/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md index e080c39b57..9d8ea93869 100644 --- a/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md +++ b/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md @@ -1,3 +1,5 @@ +Translating by MjSeven + Advanced use of the less text file viewer in Linux ====== From 5a1c090897bafe146ffdf3ca2d54d49c2304f422 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 22:46:48 +0800 Subject: [PATCH 0109/3057] PRF @MjSeven --- ... Python interfaces using zope.interface.md | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md index 9827cb9b28..e2797b9e40 100644 --- a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md +++ b/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (An advanced look at Python interfaces using zope.interface) @@ -9,42 +9,44 @@ 借助 zope.interface 深入了解 Python 接口 ====== -Zope.interface 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 + +> Zope.interface 可以帮助声明存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 + ![Snake charmer cartoon with a yellow snake and a blue snake][1] -**zope.interface** 库可以克服 Python 接口设计中的歧义性。让我们来研究一下。 +`zope.interface` 库可以克服 Python 接口设计中的歧义性。让我们来研究一下。 ### 隐式接口不是 Python 之禅 -[Python 之禅][2] 很宽松,但是有点自相矛盾,你可以从中证明一切。让我们来思考其中最著名的原则之一:“显示胜于隐式”。 +[Python 之禅][2] 很宽松,但是有点自相矛盾,以至于你可以用它来例证任何东西。让我们来思考其中最著名的原则之一:“显示胜于隐式”。 -在 Python 中会隐含的一件事是预期的接口。比如函数已经记录了它期望一个“类文件对象”或“序列”。但是什么是类文件对象呢?它支持 **.writelines** 和 **.seek** 吗?什么是一个“序列”?是否支持分步切片,例如 **a[1:10:2]**? +传统上,在 Python 中会隐含的一件事是预期的接口。比如函数已经记录了它期望一个“类文件对象”或“序列”。但是什么是类文件对象呢?它支持 `.writelines`吗?`.seek` 呢?什么是一个“序列”?是否支持步进切片,例如 `a[1:10:2]`? -最初,Python 的答案是所谓的“鸭子类型”,取自短语“如果它像鸭子一样行走,像鸭子一样嘎嘎叫,那么它可能就是鸭子”。换句话说,“试试看”,这可能是你能得到的最含蓄的表达。 +最初,Python 的答案是所谓的“鸭子类型”,取自短语“如果它像鸭子一样行走,像鸭子一样嘎嘎叫,那么它可能就是鸭子”。换句话说,“试试看”,这可能是你能得到的最具隐式的表达。 -为了使这些内容显式地表达出来,你需要一种方法来表达期望的接口。最早用 Python 编写的大型系统之一是 [Zope][3] Web 框架,它迫切需要这些东西来明确地呈现代码,例如,期望从“类似用户的对象”获得什么。 +为了使这些内容显式地表达出来,你需要一种方法来表达期望的接口。[Zope][3] Web 框架是最早用 Python 编写的大型系统之一,它迫切需要这些东西来使代码明确呈现出来,例如,期望从“类似用户的对象”获得什么。 -**zope.interface** 由 Zope 开发,但作为单独的 Python 包发布。**Zope.interface** 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 +`zope.interface` 由 Zope 开发,但作为单独的 Python 包发布。`Zope.interface` 可以帮助声明存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 -想象编写一个简单的 2D 游戏,它需要各种东西来支持 sprite 接口(to 校正:这里不知道如何翻译)。例如,表示一个边界框,但也表示对象何时与一个框相交。与一些其他语言不同,在 Python 中,将属性访问作为公共接口一部分是一种常见的做法,而不是实现 getter 和 setter。边界框应该是一个属性,而不是一个方法。 +想象编写一个简单的 2D 游戏,它需要各种东西来支持精灵界面(LCTT 译注:“精灵 Sprite”是指游戏面板中各个组件)。例如,表示一个边界框,但也要表示对象何时与一个框相交。与一些其他语言不同,在 Python 中,将属性访问作为公共接口一部分是一种常见的做法,而不是实现 getter 和 setter。边界框应该是一个属性,而不是一个方法。 -呈现外观列表的方法可能类似于: +呈现精灵列表的方法可能类似于: ``` def render_sprites(render_surface, sprites):     """     sprites 应该是符合 Sprite 接口的对象列表: -    * 一个属性 "bounding_box",包含了边界框 -    * "intersects" 方法,它接受一个 box 并返回 True 或 False +    * 一个名为 "bounding_box" 的属性,包含了边界框 +    * 一个名为 "intersects" 的方法,它接受一个边界框并返回 True 或 False     """ -    pass # 一些代码会渲染 +    pass # 一些做实际渲染的代码 ``` -游戏将具有许多处理 sprite 的功能(函数)。在每个功能(函数)中,你都必须在文档中指定预期。 +该游戏将具有许多处理精灵的函数。在每个函数中,你都必须在随附文档中指定预期。 -此外,某些功能可能期望使用更复杂的 Sprite 对象,例如具有 Z-order 的对象。我们必须跟踪哪些方法需要 Sprite 对象,哪些方法需要 SpriteWithZ 对象。 +此外,某些函数可能期望使用更复杂的精灵对象,例如具有 Z 序的对象。我们必须跟踪哪些方法需要 Sprite 对象,哪些方法需要 SpriteWithZ 对象。 -如果能够使 sprite 的内容显式出来,这样方法就可以声明“我需要一个 sprite”,并严格定义接口,这不是很好吗?来看看 **zope.interface**。 +如果能够使精灵是显式而直观的,这样方法就可以声明“我需要一个精灵”,并有个严格定义的接口,这不是很好吗?来看看 `zope.interface`。 ``` from zope import interface @@ -52,18 +54,18 @@ from zope import interface class ISprite(interface.Interface):     bounding_box = interface.Attribute( -        "The bounding box" +        "边界框"     )     def intersects(box):         "它和一个框相交吗?" ``` -乍看起来,这段代码有点奇怪。这些方法不包括 "self",而包含 "self" 是一种常见的做法,并且它有一个属性。这是在 zope.interface 中声明接口的方法。这看起来很奇怪,因为大多数人不习惯严格声明接口。 +乍看起来,这段代码有点奇怪。这些方法不包括 `self`,而包含 `self` 是一种常见的做法,并且它有一个**属性**。这是在 `zope.interface` 中声明接口的方法。这看起来很奇怪,因为大多数人不习惯严格声明接口。 这样做的原因是接口显示了如何调用方法,而不是如何定义方法。因为接口不是超类,所以它们可以用来声明数据属性。 -下面是一个可能的接口实现: +下面是一个能带有圆形精灵的接口的一个实现: ``` @implementer(ISprite) @@ -89,13 +91,13 @@ class CircleSprite:             for choose_y_from (top_left, bottom_right):                 x = choose_x_from[0]                 y = choose_y_from[1] -                if (((x - self.x) ** 2 + (y - self.y) ** 2) <= -                    self.radius ** 2): +                if (((x - self.x) ` 2 + (y - self.y) ` 2) <= +                    self.radius ` 2):                      return True         return False ``` -这 _显式_ 声明了 **CircleSprite** 类实现接口。它甚至能让我们验证该类是否正确实现了接口: +这**显式**声明了实现了该接口的 `CircleSprite` 类。它甚至能让我们验证该类是否正确实现了接口: ``` from zope.interface import verify @@ -105,7 +107,7 @@ def test_implementation():     verify.verifyObject(ISprite, sprite) ``` -这可以由 **pytest**、**nose** 或其他测试框架运行,它将验证创建的 sprite 是否符合接口。测试通常是局部的:它不会测试文档中没有提及的内容,甚至不会测试方法是否可以在没有异常的情况下被调用!但是,它会检查是否存在正确的方法和属性。这是对单元测试套件一个很好的补充,至少可以防止简单的拼写错误通过测试。 +这可以由 pytest、nose 或其他测试框架运行,它将验证创建的精灵是否符合接口。测试通常是局部的:它不会测试仅在文档中提及的内容,甚至不会测试方法是否可以在没有异常的情况下被调用!但是,它会检查是否存在正确的方法和属性。这是对单元测试套件一个很好的补充,至少可以防止简单的拼写错误通过测试。 -------------------------------------------------------------------------------- @@ -114,7 +116,7 @@ via: https://opensource.com/article/19/9/zopeinterface-python-package 作者:[Moshe Zadka][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d499842bd3be1bf62a1bc3de70efe0202606f187 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 22:47:31 +0800 Subject: [PATCH 0110/3057] PUB @MjSeven https://linux.cn/article-11752-1.html --- ...advanced look at Python interfaces using zope.interface.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190924 An advanced look at Python interfaces using zope.interface.md (98%) diff --git a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/published/20190924 An advanced look at Python interfaces using zope.interface.md similarity index 98% rename from translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md rename to published/20190924 An advanced look at Python interfaces using zope.interface.md index e2797b9e40..f2918057fc 100644 --- a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md +++ b/published/20190924 An advanced look at Python interfaces using zope.interface.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11752-1.html) [#]: subject: (An advanced look at Python interfaces using zope.interface) [#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package) [#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg) From cdee6de4b6aaac4953a4055873acaf3490b905ee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 23:49:32 +0800 Subject: [PATCH 0111/3057] PRF&PUB @nacyro https://linux.cn/article-11753-1.html --- ... and guides to enhance your tech skills.md | 85 ++++++++++++++++++ ... and guides to enhance your tech skills.md | 88 ------------------- 2 files changed, 85 insertions(+), 88 deletions(-) create mode 100644 published/20200101 9 cheat sheets and guides to enhance your tech skills.md delete mode 100644 translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md diff --git a/published/20200101 9 cheat sheets and guides to enhance your tech skills.md b/published/20200101 9 cheat sheets and guides to enhance your tech skills.md new file mode 100644 index 0000000000..966b7aee3a --- /dev/null +++ b/published/20200101 9 cheat sheets and guides to enhance your tech skills.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: (nacyro) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11753-1.html) +[#]: subject: (9 cheat sheets and guides to enhance your tech skills) +[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +九个提升程序员技术技能的备忘单和指南 +====== + +> 用我们最新的编程备忘单和指南来为新年开局,它适合所有技能水平的人。 + +![](https://img.linux.net.cn/data/attachment/album/202001/05/233115etzm6hv4a3z5yvhg.jpg) + +对刚接触命令行的新程序员来说备忘单是完美的。然而,即便是最有经验的程序员也需要时不时地依靠参考资料。假如你刚好敲不出那个讨厌的快捷键,那么手边有个备忘单就很赞了。这是一份我们可供下载指南的综述,它将助你在 2020 年取得成功。 + +### 备忘单 + +#### Markdown + +[Markdown][2] 不仅针对程序员,任何人都可以借助它为纯文本文档增添语法和结构。此备忘单提供了使用 CommonMark 规范的 Markdown 基础要点。它还包括 GitHub 和 GitLab 的语法。 + +#### Linux 权限和用户 + +用这个 Linux 备忘单把[用户管理][3]命令放在手边。快速学习如何增删用户、查看历史以及设置权限。 + +#### Bash + +一旦你了解了 [Bash][4],在命令行中就蕴含了无限可能。我们的 Bash 备忘单可以帮助你更有效地使用键盘快捷键。不知不觉间,你就能在睡眠中(字面意义上)运行脚本。 + +#### Linux 常用命令 + +毫不奇怪,我们的 [Linux 常用命令备忘单][5]是如此受欢迎。这个备忘单包含了开始安装软件和导览文件系统的要点。为自己和你的同事打印出来吧。 + +#### 微服务 + +似乎每个人都在谈论[微服务][6],而且理由很充分。微服务使应用程序模块化,因此更容易构建和维护。它不再只是这个备忘单上的流行语。在[微服务开源指南][7]中了解重要的术语并学习更多关于微服务的基础知识。 + +#### Java + +此备忘单非常适合初级和中级 [Java][8] 程序员。它包括重要的上下文以及处理导入、变量、类等的代码。 + +#### pip + +程序员爱用 [pip][9] 命令来帮助安装、管理和使用 Python 软件包。然而,pip 可以做的远不止这些。这个备忘单将教你如何构建 wheels 和 record 包。 + +### 指南 + +#### 七个不可或缺的 PyPI 库 + +[这组 Python 教程][10]将帮助你学习如何更快地编写扩展、格式化代码、自动化测试、确保代码一致性,以及更多使用 PyPI 库的方法。 + +#### 开始学习 Kubernetes + +在这份平易近人的[指南][11]中,作者 Scott McCarty 用了一个出人意料的类比来解释 Kubernetes 的价值和上手步骤。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cheat-sheets-guides + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[nacyro](https://github.com/nacyro) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://opensource.com/downloads/cheat-sheet-markdown +[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet +[4]: https://opensource.com/downloads/bash-cheat-sheet +[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[6]: https://opensource.com/downloads/microservices-cheat-sheet +[7]: https://opensource.com/article/19/11/microservices-cheat-sheet +[8]: https://opensource.com/downloads/java-cheat-sheet +[9]: https://opensource.com/downloads/pip-cheat-sheet +[10]: https://opensource.com/downloads/7-essential-pypi-libraries +[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook +[12]: https://opensource.com/users/fatherlinux +[13]: https://opensource.com/downloads/cheat-sheets +[14]: https://opensource.com/email-newsletter diff --git a/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md deleted file mode 100644 index 15c10736ed..0000000000 --- a/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md +++ /dev/null @@ -1,88 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (nacyro) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 cheat sheets and guides to enhance your tech skills) -[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) -[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) - -九个提升你技术技能的备忘单和指南 -====== -用我们最新的编程备忘单和指南来为新年开局,它适合所有技能水平的人。来参加我们的投票,让我们知道你接下来想看什么! - -![a checklist for a team][1] - -对刚接触命令行的新程序员来说备忘单是完美的。然而,即便是最有经验的程序员也需要时不时地依靠参考资料。假如你刚好敲不出那个讨厌的快捷键,那么手边有个备忘单就很赞了。这是一份我们可供下载指南的综述,它将助你在 2020 年取得成功。 - -### 备忘单 - -#### [Markdown][2] - -Markdown 不仅针对程序员,任何人都可以借助它为纯文本文档增添语法和结构。此备忘单提供了使用 CommonMark 规范的 Markdown 要点。它还包括 GitHub 和 GitLab 的语法。 - -#### [Linux 权限和用户][3] - -用这个 Linux 备忘单把用户管理命令放在手边。快速学习如何增删用户、查看历史以及设置权限。 - -#### [Bash][4] - -一旦您了解了 Bash,在命令行中就蕴含了无限可能。我们的 Bash 备忘单可以帮助您更有效地使用键盘快捷键。不知不觉间,您就能易如反掌地运行脚本。 - -#### [Linux 常用命令][5] - -毫不奇怪,我们的 Linux 常用命令备忘单是如此受欢迎。这个备忘单包含了开始安装软件和导览文件系统的要点。为自己和你的同事打印出来吧。 - -#### [微服务][6] - -似乎每个人都在谈论微服务,而且理由很充分。微服务使应用程序模块化,因此更容易构建和维护。它不再只是这个备忘单上的流行语。在 [微服务开源指南][7] 中了解重要的术语并学习更多关于微服务的基础知识。 - -#### [Java][8] - -此备忘单非常适合初级和中级 Java 程序员。它包括重要的上下文以及处理导入、变量、类等的代码。 - -#### [pip][9] - -程序员爱用 pip 命令来帮助安装、管理和使用 Python 软件包。然而,pip 可以做的远不止这些。这个备忘单将教你如何构建 wheels 和 record 包。 - -### 指南 - -#### [七个不可或缺的 PyPI 库][10] - -这组 Python 教程将帮助您学习如何更快地编写扩展、格式化代码、自动化测试、确保代码一致性,以及更多使用 PyPI 库的方法。 - -#### [开始学习 Kubernetes][11] - -在这份平易近人的指南中,作者 [Scott McCarty][12] 用了一个出人意料的类比来解释 Kubernetes 的价值和上手步骤。 - -* * * - -我们想听听你的意见:你对新的备忘单或指南有什么高见?参加我们的投票,从选项中选择一个,或者在评论中告诉我们。点击 [这里][13] 查看我们所有的下载。通过 [注册][14] 我们的电子邮件通讯获得关于新备忘单的提醒。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/cheat-sheets-guides - -作者:[Lauren Pritchett][a] -选题:[lujun9972][b] -译者:[nacyro](https://github.com/nacyro) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/lauren-pritchett -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) -[2]: https://opensource.com/downloads/cheat-sheet-markdown -[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet -[4]: https://opensource.com/downloads/bash-cheat-sheet -[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet -[6]: https://opensource.com/downloads/microservices-cheat-sheet -[7]: https://opensource.com/article/19/11/microservices-cheat-sheet -[8]: https://opensource.com/downloads/java-cheat-sheet -[9]: https://opensource.com/downloads/pip-cheat-sheet -[10]: https://opensource.com/downloads/7-essential-pypi-libraries -[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook -[12]: https://opensource.com/users/fatherlinux -[13]: https://opensource.com/downloads/cheat-sheets -[14]: https://opensource.com/email-newsletter From 52b33c1280863165623cc6a188441a9f69a16889 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 6 Jan 2020 00:56:19 +0800 Subject: [PATCH 0112/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200105=207=20?= =?UTF-8?q?Ways=20NOT=20to=20manage=20your=20remote=20team?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200105 7 Ways NOT to manage your remote team.md --- ...5 7 Ways NOT to manage your remote team.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20200105 7 Ways NOT to manage your remote team.md diff --git a/sources/tech/20200105 7 Ways NOT to manage your remote team.md b/sources/tech/20200105 7 Ways NOT to manage your remote team.md new file mode 100644 index 0000000000..b4e223a03e --- /dev/null +++ b/sources/tech/20200105 7 Ways NOT to manage your remote team.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Ways NOT to manage your remote team) +[#]: via: (https://opensource.com/article/20/1/ways-not-manage-remote-team) +[#]: author: (Matt Shealy https://opensource.com/users/mshealy) + +7 Ways NOT to manage your remote team +====== +Learn to let go and let your team shine with these simple steps. +![World locations with red dots with a sun burst background][1] + +Building a remote development team presents unique challenges. Trying to build a cross-functional team, full of various personalities, virtually can lead to communication disasters. Fortunately, through planning, smart hiring, training, and communication, project leaders can build and lead virtual development teams successfully. + +The demand for remote teams continues to grow. The increased demand for software developers and [new communication technology][2] has removed the barriers of geography. Even with these advancements, disparate team members from different backgrounds may find it challenging to learn how to interact with one another. + +It's easy for misunderstandings and miscommunications to occur. It's becoming more and more critical to [rethink collaboration][3] in a work environment growing increasingly more remote. As a result, project leaders must rethink the needs of teams spread out across the globe. + +By avoiding a few key pitfalls, your team can overcome these challenges consistently. If you follow a few time-tested, in-house practices, and some that apply specifically to remote teams, you can manage a range of personalities and complete your build successfully. + +The following are seven practices to avoid when managing a remote team. + +### Don't slack on training + +A variety of different perspectives is the top benefit of working with diverse remote team members. However, it’s essential to understand and acknowledge those differences during training. + +Addressing language differences is only one part of acknowledging team diversity. When recruiting programmers, it would be best if you focus on candidates with an aptitude for working in a multicultural environment and even in a multi-coding language environment. + +Also, don’t make the mistake of thinking that personal characteristics are unimportant because team members aren’t working face-to-face. Team members still have to collaborate, so their personalities must mesh. + +Training isn’t all technical skills. Emotional training can also help a team work well together remotely. Emotional intelligence [training can help coworkers develop skills like empathy and awareness][4] that can make teams work better together. Emotional distance can make it challenging to establish bonds between new trainees and team leaders from the get-go, which can immediately loosen bonds in what could be a strong remote team. Consider what remote team-building training you can do via video or on Slack. Remember that is it important to constantly be proactive in strengthening relationships throughout the life of your team. + +### Don't use an ad hoc communication system + +When working with diverse remote team members, it’s essential that you use straightforward, effective code management and communication software. Ideally, you want the most uncomplicated resources available. + +The process may need to be further simplified for newer team members and freelancers who do not have the time to learn everything about the ins and outs of the organization’s policies. + +Create standard ways to communicate with team members. Maybe all work discussion happens in Slack or one of its [open source alternatives][5], while teams use [project management software][6] to keep work on schedule. + +Having a clear space for each type of conversation will help those who need to focus on work, while also offering an outlet for fun. Team members must use these resources daily, if not hourly. If your solutions are too complicated, learning to navigate the tools will pull focus from design and implementation work. + +### Don't lose sight of the big picture + +Avoid the pitfalls of focusing too closely on daily goals. It is essential you stay focused on the overall project. You should work with team members to establish your goals and milestones, and make sure team members stay on schedule. As the project leader, it’s your job to make sure these key events contribute to deliverable milestones. + +### Don't micromanage your team + +Some project managers, especially those with a coding background, find it difficult to delegate responsibility. It’s natural to gravitate toward solving familiar problems. However, it’s your job to guide the ship, not develop solutions. + +In [a micromanaged environment][7], the project manager tells the programmers what the code is, and exactly how to craft it. However, this management style ultimately leads to employee dissatisfaction. + +Your team should feel free to explore solutions, initiate positive change, and use innovation for exciting new ideas. + +If you don’t give your coders space to innovate and use their creativity, they feel undervalued. If this sentiment persists, your remote staff members are unlikely to produce the best work possible. + +### Use this opportunity to promote diversity + +If you are going to build a remote team, you must understand and acknowledge that [team members will have different backgrounds][8]. This circumstance is especially beneficial. The diverse viewpoints of staff members will enable your team to offer insights that expand beyond that of a centrally located talent pool. + +Also, your diverse remote team will give you access to experience with global trends. Furthermore, your team will be less likely to suffer from the effect of crowd mentality thinking. + +With the freedom to innovate, team members will feel more comfortable offering their input. Together, these benefits will enable your team as a whole to build a product better suited for multiple regions and verticals. + +### Don't forget to keep an eye on costs + +Ballooning costs are a top challenge for development teams. Despite project planning best practices, scope creep is a real problem for even the most experienced teams. There are two underlying factors that need to be addressed if this problem is to be solved. + +The first is the fact that the more analysis that is done throughout the development process, the more complexity arises and is ultimately added to the system. The second factor is the fact that people who have been through system development before know that there won’t ever be a "second phase" of the project. They know that there will only be one shot at the project, so they try and fit everything possible into the initial project phase. + +These two self-reinforcing factors lead to a death spiral of problems. Too much analysis leads to system complexity and loads of features being crammed into the first phase. A lack of trust between IT and business teams inevitably forms because of this. The design requirements become too big and complicated for there to be any chance of staying on schedule or on budget. Inevitably, blame lands with the IT team. + +The answer to this problem is to restrict analysis to only what the business team needs right now. IT should refrain from speculating on what may be needed in the future or asking business team members what they may need down the line. + +These requirements allow IT to build a reliable project plan and overall budget. If your team is looking to outsource the project at least in part, [calculating the app development costs][9] for each individual team or project component can help to keep things on track. + +### Don't think of time zone differences as a barrier + +Do not view time zone differences as a challenge. You can leverage time zones to your advantage and build your team in a way that will keep the project running around the clock. + +What is more important is choosing candidates who work independently. Good remote coders are responsible, organize their time effectively, and communicate well with team members. With an effective communication system, time differences will have no effect on the successful outcome of your team. + +Remote team members benefit significantly from predictable and straightforward engagement. The relatively new remote work environment demands that staff members establish a new standard for clear, concise communication. To promote a collaborative environment, teams must establish norms, such as universal jargon and consensus on communication tools. + +In an environment that thrives on innovation, predictability is an asset when it comes to teamwork. Everyone is different, and innovation is a sought-after commodity in software development. However, in the remote environment, consistent behavior helps team members communicate effectively. + +### Conclusion + +Remote work is quickly becoming the new default for software development. Be sure to avoid these pitfalls to set your teams up for success. + +Do you have any tips to recommend? Please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/ways-not-manage-remote-team + +作者:[Matt Shealy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mshealy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_remote_teams.png?itok=Wk1yBFv6 (World locations with red dots with a sun burst background) +[2]: https://www.chamberofcommerce.com/business-advice/strategies-and-tools-for-remote-team-collaboration +[3]: https://hbr.org/2018/02/how-to-collaborate-effectively-if-your-team-is-remote +[4]: https://www.skillsoft.com/content-solutions/business-skills-training/emotional-intelligence-training/ +[5]: https://opensource.com/alternatives/slack +[6]: https://opensource.com/business/16/2/top-issue-support-and-bug-tracking-tools +[7]: https://blog.trello.com/how-to-stop-micromanaging-your-remote-team +[8]: https://opensource.com/article/18/10/think-global-communication-challenges +[9]: https://www.appdevelopmentcost.com/#the-definitive-guide-to-understanding-app-development-costs From 0dd01ded175d6f05ede6d9b7b2124d5ea077aa51 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 6 Jan 2020 08:53:02 +0800 Subject: [PATCH 0113/3057] translated --- ...al- A Secure, Open Source Messaging App.md | 122 ------------------ ...al- A Secure, Open Source Messaging App.md | 122 ++++++++++++++++++ 2 files changed, 122 insertions(+), 122 deletions(-) delete mode 100644 sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md create mode 100644 translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md diff --git a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md deleted file mode 100644 index fbb741b9f5..0000000000 --- a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Signal: A Secure, Open Source Messaging App) -[#]: via: (https://itsfoss.com/signal-messaging-app/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Signal: A Secure, Open Source Messaging App -====== - -**_Brief: Signal is a secure open-source messaging app for smartphones. It also offers a standalone desktop app for Linux, Windows, and macOS_. _Here, we take a look at its features and usability._** - -### Signal is an Excellent Alternative to WhatsApp (and Telegram) for Privacy Concerned People - -![Signal App On Linux][1] - -Signal is an open source application with a keen focus on privacy. It is recommended by privacy advocates like [Edward Snowden][2]. - -It may not have as many features as Telegram or WhatsApp – but if you want to enhance your privacy while having a conversation, this is a solid open-source solution. - -You can install it on your smartphone ([iOS][3]/[Android][4]) and it is also available for Linux, Windows, and macOS. - -### Features of Signal Messenger - -**Note:** _Some of the features are specific/exclusive to smartphones. You may not observe all the features mentioned in the desktop app._ - -As I already mentioned, this is tailored to enhance your privacy. So, the user experience may not be the “best” you’ve ever seen. But, privacy/security-wise, I think it is a good option to have. - -![Signal Features][5] - -#### Disappearing Messages - -You can set a timer for messages in a conversation – so that it will be automatically deleted as per the timer. - -Essentially, anyone in the conversation can activate this feature. So, you control if the messages should stay in a conversation or disappear. - -#### Use it As Default SMS App - -If you want to utilize an open-source app for all your SMSs, you can simply go to Signal’s app settings and set it as the default for SMS and MMS. - -#### Screen Security - -There’s a neat feature to block screenshots in-app, “Screen Security”. - -If you enable it, you won’t be able to take a screenshot of any conversation in the app. You can find the option to enable or disable it from the app settings. - -It may not be useful to everyone – but you can try it out. - -#### Safety Number - -If you want to verify the security of your encryption with a friend, you can simply tap on the profile and scroll down to find “View Safety Number”. - -You can either scan it to verify or simply take a look at it to mark it verified. - -#### Locked Messages - -If you protect the app with a lock (pin/fingerprint), even if your device has been unlocked, you won’t be able to see the messages on your notifications. - -So, when you get a notification while Signal is locked, you will notice the content of the notification as “**Locked Message**” – which is a plus for privacy-oriented users. - -#### Other Features - -![][6] - -As you would expect in a messaging app – you get a couple of stickers to utilize and you can also create a group if you want. - -However, you won’t have the ability to moderate your group – you can just add members and change the profile picture. - -In addition to this, Signal also supports biometric security for its app. - -### Installing Signal on Ubuntu/Linux - -Unfortunately, you don’t get a .**deb** or .**AppImage** to install it on your Linux distro. So, you will need to utilize the terminal as per the [official installation instructions][7]. - -Here’s what you have to type in the terminal: - -``` -curl -s https://updates.signal.org/desktop/apt/keys.asc | sudo apt-key add - -echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/signal-xenial.list -sudo apt update && sudo apt install signal-desktop -``` - -Simply copy-paste the commands one by one in the terminal and you should be good to go. - -[Download Signal for Other Devices][7] - -### My Thoughts On Signal - -I’ve been using Signal for a few years now and it has improved with what it offers. However, I still feel that the user experience can be improved. - -Privacy-wise, it is definitely a good alternative to what we already have (in my opinion). You can give it a try and see how well it works for your usage. - -You can also take a look at their [GitHub page][8] for the latest developments and beta releases if you want to try them out. - -Signal app may not be a popular messaging app when compared to WhatsApp or even [Telegram on Linux][9]. But, you can try it for yourself and encourage your friends to use an open-source messaging app. - -Have you tried it yet? Let me know what you think about the ‘Signal’ app in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/signal-messaging-app/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot.jpg?ssl=1 -[2]: https://en.wikipedia.org/wiki/Edward_Snowden -[3]: https://apps.apple.com/us/app/signal-private-messenger/id874139669 -[4]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&hl=en_IN -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-phone.jpg?ssl=1 -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot-1.jpg?ssl=1 -[7]: https://signal.org/download/ -[8]: https://github.com/signalapp -[9]: https://itsfoss.com/install-telegram-desktop-linux/ diff --git a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md new file mode 100644 index 0000000000..812a97f32f --- /dev/null +++ b/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Signal: A Secure, Open Source Messaging App) +[#]: via: (https://itsfoss.com/signal-messaging-app/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Signal:安全、开源的聊天应用 +====== + +** _简介:Signal 是一款智能手机上的安全开源聊天应用。它还提供了适用于 Linux、Windows 和 macOS 的独立桌面应用。在本文中,我们来看看它的功能和可用性。_** + +### 对于关注隐私的人来说,Signal 是 WhatsApp(和 Telegram)的绝佳替代品 + +![Signal App On Linux][1] + +Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样的隐私权倡导者建议使用它。 + +它可能没有 Telegram 或 WhatsApp 这么多的功能。但是,如果你想在交流时增强隐私,这是一个可靠的开源方案。 + +你可以在智能手机(iOS][3]/[Android][4])上安装,也可以在 Linux、Windows 和 macOS 上安装。 + +### Signal 的功能 + +**注意:** _某些功能是智能手机特有的。你可能无法在桌面应用上看到所有功能。_ + +正如我已经提到的,这是为增强你的隐私而量身定制的。因此,用户体验可能不是你见过“最佳”的。但是,从隐私/安全角度考虑,我认为这是一个不错的选择。 + +![Signal Features][5] + +#### 消失的消息 + +你可以为对话中的消息设置一个计时器,以便根据它自动删除消息。 + +本质上,对话中的任何人都可以激活此功能。因此,你可以控制对话中的消息时保留还是消失。 + +#### 用作默认短信应用 + +如果你想在短信中使用开源应用,那么只需口进入 Signal 的设置,并将其设置为短信和彩信的默认设置。 + +#### 屏幕安全 + +有一个巧妙的功能可以阻止应用内截图,它就是“屏幕安全”。 + +如果你开启它,那么你将无法为应用中的任何对话截图。你可以从应用设置中找到启用或禁用它的选项。 + +它可能并不是对所有人有用,但你可以尝试一下。 + +#### 安全数字 + +如果你想与朋友一起验证加密的安全性,只需点击个人资料并向下滚动找到“查看安全数字”。 + +你可以扫描验证或者看一眼并标记为已验证。 + +#### 锁定消息 + +如果你使用了锁(密码/指纹)来保护应用,那么即使你的设备已解锁,你也无法在通知中看到消息。 + +因此,当 Signal 处于锁定状态收到通知时,你会注意到通知的内容为 “**Locked Message**”,这对于注重隐私的用户来说是一个加分项。 + +#### 其它功能 + +![][6] + +如你所期待的聊天应用,你可以使用几个标签,并且可以根据需要创建一个组。 + +但是,你无法管理你的组,你只能添加成员和更改群头像。 + +此外,Signal 还为其应用支持生物识别。 + +### 在 Ubuntu/Linux 上安装 Signal + +不幸的是,你无法在你的 Linux 发行版上找到 .**deb** 或者 .**AppImage**。因此,你需要根据[官方安装说明][7]在终端上安装。 + +在终端中输入以下内容: + +``` +curl -s https://updates.signal.org/desktop/apt/keys.asc | sudo apt-key add - +echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/signal-xenial.list +sudo apt update && sudo apt install signal-desktop +``` + +只需在终端中一个接一个地复制并粘贴命令。 + +[Download Signal for Other Devices][7] + +### 我对 Signal 的想法 + +我已经使用 Signal 有几年了,它的功能已经得到了改善。但是,我仍然认为可以改善用户体验。 + +在隐私方面,(在我看来)这绝对是我们已有软件的一个很好的替代方案。你可以尝试一下,看看它的使用效果如何。 + +如果你想尝试一下它,也可以看看它的 [GitHub 页面][8]以获取最新的开发和 beta 版本。 + +与 WhatsApp 甚至 [Linux 上的 Telegram][9] 相比,Signal 可能不是流行的聊天应用。但是,你可以自己尝试一下,并鼓励你的朋友使用它。 + +你尝试过了吗?在下面的评论中,让我知道你对 “Signal” 的看法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/signal-messaging-app/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot.jpg?ssl=1 +[2]: https://en.wikipedia.org/wiki/Edward_Snowden +[3]: https://apps.apple.com/us/app/signal-private-messenger/id874139669 +[4]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&hl=en_IN +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-phone.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot-1.jpg?ssl=1 +[7]: https://signal.org/download/ +[8]: https://github.com/signalapp +[9]: https://itsfoss.com/install-telegram-desktop-linux/ From b5ff457b11f128e839a5ed7e717e0a96f53e1165 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 6 Jan 2020 08:59:47 +0800 Subject: [PATCH 0114/3057] translating --- .../20191214 Make VLC More Awesome With These Simple Tips.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md index de91a1105b..a4dd3b7bd5 100644 --- a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md +++ b/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From df0fe6f778abded40c96df3c823fd629a6882678 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 6 Jan 2020 11:21:54 +0800 Subject: [PATCH 0115/3057] Rename sources/tech/20200105 7 Ways NOT to manage your remote team.md to sources/talk/20200105 7 Ways NOT to manage your remote team.md --- .../20200105 7 Ways NOT to manage your remote team.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200105 7 Ways NOT to manage your remote team.md (100%) diff --git a/sources/tech/20200105 7 Ways NOT to manage your remote team.md b/sources/talk/20200105 7 Ways NOT to manage your remote team.md similarity index 100% rename from sources/tech/20200105 7 Ways NOT to manage your remote team.md rename to sources/talk/20200105 7 Ways NOT to manage your remote team.md From b72910f7ce18adc4cee91a7ac5d07adfb1bbbb72 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 6 Jan 2020 22:58:24 +0800 Subject: [PATCH 0116/3057] PRF @lxbwolf --- ...1017 Intro to the Linux useradd command.md | 71 ++++++++++--------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/translated/tech/20191017 Intro to the Linux useradd command.md b/translated/tech/20191017 Intro to the Linux useradd command.md index ffebd61d47..d38143f55e 100644 --- a/translated/tech/20191017 Intro to the Linux useradd command.md +++ b/translated/tech/20191017 Intro to the Linux useradd command.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Intro to the Linux useradd command) @@ -9,8 +9,10 @@ Linux useradd 命令介绍 ====== -使用 useradd 命令来添加用户(并且根据需要修改账号)。 -![people in different locations who are part of the same team][1] + +> 使用 useradd 命令来添加用户(并且根据需要修改账号)。 + +![](https://img.linux.net.cn/data/attachment/album/202001/06/225733hv1u7f4z4vbt8u5x.jpg) 任何计算机系统中,添加用户都是最重要的事之一;本文着重介绍如何在 Linux 系统中添加用户。 @@ -29,21 +31,21 @@ $ file `which adduser` ### 默认处理 -`useradd` 的基本用法相当简单:通过一个用户名就可以添加一个用户 +`useradd` 的基本用法相当简单:提供一个用户名就可以添加一个用户。 ```bash $ sudo useradd sonny ``` -在本例中,`useradd` 命令创建了一个名为 *sonny* 的账号。此命令同时创建了一个同名的组,*sonny* 被放进了这个组,这个组也是 *sonny* 账号的主组。命令执行时,根据配置文件 `/etc/default/useradd` 和 `/etc/login.defs` 中的不同设置,也会有其他的参数处理,如语言和 shell。对于一个私人系统或微小的单服务商业环境,这些参数已经足够了。 +在本例中,`useradd` 命令创建了一个名为 `sonny` 的账号。此命令同时创建了一个同名的组,`sonny` 被放进了这个组,这个组也是 `sonny` 账号的主组。命令执行时,根据配置文件 `/etc/default/useradd` 和 `/etc/login.defs` 中的不同设置,也会有其他的参数,如语言和 shell。对于一个私人系统或微小的单服务商业环境,这些参数已经足够了。 上面两个文件控制 `useradd` 的处理,用户的信息保存在 `/etc` 目录下的一些其他文件中,关于这些信息的讲解会贯穿全文。 | 文件 | 描述 | 域 (加粗的表示由 useradd 命令设置) | | ------ | ------------------------------------ | ------------------------------------------------------------ | -| passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** | -| shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused | -| group | Stores group details | **groupname**:unused:**gid**:**members** | +| `passwd` | 存储用户账号信息 | 用户名:未使用:UID:GID:备注:家目录:shell | +| `shadow` | 存储用户账号的安全信息 | 用户名:加密密码:上次修改时间:最短使用天数:最长使用天数间:修改前警示天数:过期后宽限时间:未使用 | +| `group` | 存储组信息 | 组名:未使用:GID:成员列表 | ### 自定义处理 @@ -51,35 +53,35 @@ $ sudo useradd sonny #### 用户和组 ID -`useradd` 默认主组 ID(GID)与用户 ID(UID)相同,但也不完全是。虽然 UID 与 GID 相同不是必须的,但如果相同,会更方便管理员管理。 +默认情况下,`useradd` 试图使用相同的用户 ID(UID)和主组 ID(GID),但也不完全是。虽然 UID 与 GID 相同不是必须的,但如果相同,会更方便管理员管理。 -下面的场景就是一个 GID 与 UID 不同的 例子。现在我添加另一账号,名为 Timmy。通过使用 `getent` 命令来比较 *sonny* 和 *timmy* 两个账号,显示两个用户和对应的主组。 +下面的场景就是一个 GID 与 UID 不同的例子。现在我添加另一账号,名为 Timmy。通过使用 `getent` 命令来比较 `sonny` 和 `timmy` 两个账号,显示两个用户和对应的主组。 ```bash $ getent passwd sonny timmy -sonny❌1001:1002:Sonny:/home/sonny:/bin/bash -timmy❌1002:1003::/home/timmy:/bin/bash +sonny:x:1001:1002:Sonny:/home/sonny:/bin/bash +timmy:x:1002:1003::/home/timmy:/bin/bash $ getent group sonny timmy -sonny❌1002: -timmy❌1003: +sonny:x:1002: +timmy:x:1003: ``` -不幸的是,两者的 UID 和 GID 都不相同。因为默认的处理是,创建用户时,把下一个可用的 UID 赋给用户,然后把同一个数字作为主组 ID 赋给它。然而,当要使用的 ID 已经被使用时,就再把下一个可用的 GID 赋给它。为了弄清细节,我猜想 1001 这个 GID 已经被使用了,用一个命令确认了一下。 +不幸的是,两者的 UID 和 GID 都不相同。因为默认的处理是,创建用户时,把下一个可用的 UID 赋给用户,然后把同一个数字作为主组 ID 赋给它。然而,当要使用的组 ID 已经被使用时,就再把下一个可用的 GID 赋给它。为了弄清细节,我猜想 1001 这个 GID 已经被使用了,用一个命令确认了一下。 ```bash $ getent group 1001 -book❌1001:alan +book:x:1001:alan ``` -*book* 的 ID 是 *1001*,因此新创建的用户的 GID 都有偏移量 1。这就是为什么系统管理员在用户创建过程中需要多设置一些值的一个实例。为了解决这个问题,我必须先确定下一个可用的 UID 和 GID 是否相同。确定下一个可用值时,可以使用 `getent group` 和 `getent passwd` 命令,通过 `-u` 参数传递要确认的值。 +`book` 的 ID 是 `1001`,因此新创建的用户的 GID 都有偏移量 1。这就是为什么系统管理员在用户创建过程中需要多设置一些值的一个实例。为了解决这个问题,我必须先确定下一个可用的 UID 和 GID 是否相同。确定下一个可用值时,可以使用 `getent group` 和 `getent passwd` 命令,通过 `-u` 参数传递要确认的值。 ```bash $ sudo useradd -u 1004 bobby $ getent passwd bobby; getent group bobby -bobby❌1004:1004::/home/bobby:/bin/bash -bobby❌1004: +bobby:x:1004:1004::/home/bobby:/bin/bash +bobby:x:1004: ``` 另一个需要指定 ID 的场景是,通过 NFS 访问远程系统上的文件时。对于一个给定的用户,当 NFS 所有客户端和服务系统的 ID 都一样时,管理员更容易控制。在我的文章 [使用 autofs 挂载 NFS][2] 中有详细介绍。 @@ -95,12 +97,12 @@ bobby❌1004: ```bash $ sudo useradd -c "Bailey is cool" bailey $ getent passwd bailey -bailey❌1011:1011:Bailey is cool:/home/bailey:/bin/bash +bailey:x:1011:1011:Bailey is cool:/home/bailey:/bin/bash ``` #### 组 -一个用户可以被指定一个主组和多个次组。 `-g` 参数指定主组名称或 GID。如果不指定,`useradd` 会以用户名创建一个主组(前面演示过)。`-G`(大写)参数用一个逗号分隔的组列表来指定此用户所属的组,这些组就是次组。 +一个用户可以被指定一个主组和多个次组。`-g` 参数指定主组名称或 GID。如果不指定,`useradd` 会以用户名创建一个主组(前面演示过)。`-G`(大写)参数用一个逗号分隔的组列表来指定此用户所属的组,这些组就是次组。 ```bash $ sudo useradd -G tgroup,fgroup,libvirt milly @@ -110,12 +112,12 @@ uid=1012(milly) gid=1012(milly) groups=1012(milly),981(libvirt),4000(fgroup),300 #### 家目录 -`useradd` 的默认处理是,在 `/home` 目录下创建用户的家目录。然而,下面的参数可以改写家目录的 base 目录。`-b` 设置另一个可以创建家目录的 base 目录。例如 指定 `/home2` 而不是 `/home`。 +`useradd` 的默认处理是,在 `/home` 目录下创建用户的家目录。然而,下面的参数可以改写家目录的基础目录。`-b` 设置另一个可以创建家目录的基础目录。例如指定 `/home2` 而不是 `/home`。 ```bash $ sudo useradd -b /home2 vicky $ getent passwd vicky -vicky❌1013:1013::/home2/vicky:/bin/bash +vicky:x:1013:1013::/home2/vicky:/bin/bash ``` `-d` 参数可以指定一个与用户名不同的家目录。 @@ -123,24 +125,23 @@ vicky❌1013:1013::/home2/vicky:/bin/bash ```bash $ sudo useradd -d /home/ben jerry $ getent passwd jerry -jerry❌1014:1014::/home/ben:/bin/bash +jerry:x:1014:1014::/home/ben:/bin/bash ``` -#### skeleton 目录 +#### 目录模板 -`-k` 参数指定创建新用户时,会复制 `/etc/skel` 目录下的所有文件到家目录中。这些文件通常是 shell 配置文件,当然也可以是系统管理员想在新建用户时使用的任何文件。 +指定 `-k` 参数会在创建新用户时,复制 `/etc/skel` 目录下的所有文件到用户的家目录中。这些文件通常是 shell 配置文件,当然也可以是系统管理员想在新建用户时使用的任何文件。 #### Shell -`-s` 参数可以指定 shell。如果不指定,则使用默认的 shell。例如,下面的例子中 ,配置文件中定义的 shell 是 `bash`,但 `Wally` 这个用户指定的是 `zsh`。 +`-s` 参数可以指定 shell。如果不指定,则使用默认的 shell。例如,下面的例子中 ,配置文件中定义的 shell 是 `bash`,但 `wally` 这个用户指定的是 `zsh`。 ```bash -$ grep SHELL /etc/default/useradd SHELL=/bin/bash $ sudo useradd -s /usr/bin/zsh wally $ getent passwd wally -wally❌1004:1004::/home/wally:/usr/bin/zsh +wally:x:1004:1004::/home/wally:/usr/bin/zsh ``` #### 安全 @@ -153,7 +154,7 @@ $ sudo getent shadow sammy sammy:!!:18171:0:99999:7::20191231: ``` -当密码过期时,一个账号也可以自动失效。`-f` 参数指定密码过期后经过几天账号失效。如果设为 0,则立即失效。 +当密码过期时,账号也会自动失效。`-f` 参数指定密码过期后经过几天账号失效。如果设为 0,则立即失效。 ```bash $ sudo useradd -f 30 willy @@ -163,7 +164,7 @@ willy:!!:18171:0:99999:7:30:: ### 实例 -生产中,创建一个用户账号时会用到多个参数。例如,我要创建一个 Perry 账号,可能会用下面的命令: +生产环境中,创建一个用户账号时会用到多个参数。例如,我要创建一个 Perry 账号,可能会用下面的命令: ```bash $ sudo useradd -u 1020 -c "Perry Example" \ @@ -176,8 +177,8 @@ $ sudo useradd -u 1020 -c "Perry Example" \ ```bash $ getent passwd perry; getent group perry; getent shadow perry; id perry -perry❌1020:1020:Perry Example:/home2/perry:/usr/bin/zsh -perry❌1020: +perry:x:1020:1020:Perry Example:/home2/perry:/usr/bin/zsh +perry:x:1020: perry:!!:18171:0:99999:7:5:20201201: uid=1020(perry) gid=1020(perry) groups=1020(perry),3000(tgroup) ``` @@ -192,8 +193,8 @@ via: https://opensource.com/article/19/10/linux-useradd-command 作者:[Alan Formy-Duval][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ebdef401aca71102214cb466dc0899ea7e12793d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 6 Jan 2020 22:59:10 +0800 Subject: [PATCH 0117/3057] PUB @lxbwolf https://linux.cn/article-11756-1.html --- .../20191017 Intro to the Linux useradd command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191017 Intro to the Linux useradd command.md (99%) diff --git a/translated/tech/20191017 Intro to the Linux useradd command.md b/published/20191017 Intro to the Linux useradd command.md similarity index 99% rename from translated/tech/20191017 Intro to the Linux useradd command.md rename to published/20191017 Intro to the Linux useradd command.md index d38143f55e..ae1c1c2d4a 100644 --- a/translated/tech/20191017 Intro to the Linux useradd command.md +++ b/published/20191017 Intro to the Linux useradd command.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11756-1.html) [#]: subject: (Intro to the Linux useradd command) [#]: via: (https://opensource.com/article/19/10/linux-useradd-command) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) From a9580330d10e03ce5b62f895b69fbfb54b7aded0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 6 Jan 2020 23:21:01 +0800 Subject: [PATCH 0118/3057] PRF --- published/20191017 Intro to the Linux useradd command.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/published/20191017 Intro to the Linux useradd command.md b/published/20191017 Intro to the Linux useradd command.md index ae1c1c2d4a..d088a1d16d 100644 --- a/published/20191017 Intro to the Linux useradd command.md +++ b/published/20191017 Intro to the Linux useradd command.md @@ -43,9 +43,9 @@ $ sudo useradd sonny | 文件 | 描述 | 域 (加粗的表示由 useradd 命令设置) | | ------ | ------------------------------------ | ------------------------------------------------------------ | -| `passwd` | 存储用户账号信息 | 用户名:未使用:UID:GID:备注:家目录:shell | -| `shadow` | 存储用户账号的安全信息 | 用户名:加密密码:上次修改时间:最短使用天数:最长使用天数间:修改前警示天数:过期后宽限时间:未使用 | -| `group` | 存储组信息 | 组名:未使用:GID:成员列表 | +| `passwd` | 存储用户账号信息 | **用户名**:未使用:**UID**:**GID**:**备注**:**家目录**:**shell** | +| `shadow` | 存储用户账号的安全信息 | **用户名**:加密密码:上次修改时间:最短使用天数:最长使用天数间:**修改前警示天数**:**过期后宽限时间**:未使用 | +| `group` | 存储组信息 | **组名**:未使用:**GID**:**成员列表** | ### 自定义处理 From 884c9c8839641c166611347485f8c417b83ab7ed Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 6 Jan 2020 23:45:06 +0800 Subject: [PATCH 0119/3057] APL --- sources/tech/20191130 7 maker gifts for kids and teens.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191130 7 maker gifts for kids and teens.md b/sources/tech/20191130 7 maker gifts for kids and teens.md index a821b221e3..72a9debb38 100644 --- a/sources/tech/20191130 7 maker gifts for kids and teens.md +++ b/sources/tech/20191130 7 maker gifts for kids and teens.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From eef47403bf13f34fba003404cbf9694462c9fb4f Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 7 Jan 2020 00:46:38 +0800 Subject: [PATCH 0120/3057] tmp --- ... Lessons learned from programming in Go.md | 191 +++++++++--------- 1 file changed, 96 insertions(+), 95 deletions(-) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md index 0c9aeea2e2..93e9af3398 100644 --- a/sources/tech/20191210 Lessons learned from programming in Go.md +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -1,71 +1,70 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Lessons learned from programming in Go) -[#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) -[#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Lessons learned from programming in Go" +[#]: via: "https://opensource.com/article/19/12/go-common-pitfalls" +[#]: author: "Eduardo Ferreira https://opensource.com/users/edufgf" -Lessons learned from programming in Go +用 Go 编程受到的启发 ====== -Prevent future concurrent processing headaches by learning how to -address these common pitfalls. +通过学习如何定位并发处理的陷阱来避免未来处理这些问题时的困境。 ![Goland gopher illustration][1] -When you are working with complex distributed systems, you will likely come across the need for concurrent processing. At [Mode.net][2], we deal daily with real-time, fast and resilient software. Building a global private network that dynamically routes packets at the millisecond scale wouldn’t be possible without a highly concurrent system. This dynamic routing is based on the state of the network and, while there are many parameters to consider here, our focus is on link [metrics][3]. In our context, link metrics can be anything related to the status or current properties of a network link (e.g.: link latency). +在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。[Mode.net][2] 公司系统每天要处理实时、快速和灵活的以毫秒为单位动态路由数据包的全球专用网络和数据,需要高度并发的系统。他们的动态路由是基于网络状态的,而这个过程需要考虑众多因素,我们只考虑关系链的监控。在我们的环境中,调用关系链监控可以是任何跟网络调用关系链有关的状态和当前属性(如连接延迟)。 -### Concurrent probing for link metrics +### 并发探测链接指标 -[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing), our dynamic routing algorithm relies partially on link metrics to compute its routing table. Those metrics are collected by an independent component that sits on each [PoP][5] (Point of Presence). PoPs are machines that represent a single routing entity in our networks, connected by links and spread around multiple locations shaping our network. This component probes neighboring machines using network packets, and those neighbors will bounce back the initial probe. Link latency values can be derived from the received probes. Because each PoP has more than one neighbor, the nature of such a task is intrinsically concurrent: we need to measure latency for each neighboring link in real-time. We can’t afford sequential processing; each probe must be processed as soon as possible in order to compute this metric. +[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing,译注:逐跳自适应链路状态最佳路由), 我们的动态路由算法部分依赖于链路度量来计算路由表。 这些指标由位于每个PoP(译注:存活节点)上的独立组件收集。PoP是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有多个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探针。 ![latency computation graph][6] -### Sequence numbers and resets: A reordering situation +### 序列号和重置:一个记录场景 -Our probing component exchanges packets and relies on sequence numbers for packet processing. This aims to avoid processing of packet duplication or out-of-order packets. Our first implementation relied on a special sequence number 0 to reset sequence numbers. Such a number was only used during initialization of a component. The main problem was that we were considering an increasing sequence number value that always started at 0. After the component restarts, packet reordering could happen, and a packet could easily replace the sequence number with the value that was being used before the reset. This meant that the following packets would be ignored until it reaches the sequence number that was in use just before the reset. +我们的探测组件互相发送和接收数据包并依靠序列号进行数据包处理。旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号0来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们只考虑了始终从 0 开始递增的序列号。组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,直到排到重置之前用到的值之前,它后面的包都会被忽略掉。 -### UDP handshake and finite state machine +### UDP 握手和有限状态机 -The problem here was proper agreement of a sequence number after a component restarts. There are a few ways to handle this and, after discussing our options, we chose to implement a 3-way handshake protocol with a clear definition of states. This handshake establishes sessions over links during initialization. This guarantees that nodes are communicating over the same session and using the appropriate sequence number for it. +这里的问题是重启前后的序列号是否一致。有几种方法可以解决这个问题,经过讨论,我们选择了实现一个带有清晰状态定义的三向交握协议。这个握手过程在初始化时通过链接建立 session。这样可以确保节点通过同一个 session 进行通信且使用了适当的序列号。 -To properly implement this, we have to define a finite state machine with clear states and transitions. This allows us to properly manage all corner cases for the handshake formation. +为了正确实现这个过程,我们必须顶一个一个有清晰状态和过渡的有限状态机。这样我们就可以正确管理握手过程中的所有极端情况。 ![finite state machine diagram][7] -Session IDs are generated by the handshake initiator. A full exchange sequence is as follows: +session ID 由握手的初始化程序生成。一个完整的交换顺序如下: - 1. The sender sends out a **SYN (ID)*** *packet. - 2. The receiver stores the received **ID** and sends a **SYN-ACK (ID)**. - 3. The sender receives the **SYN-ACK (ID) *_and sends out an **ACK (ID)**._ *It also starts sending packets starting with sequence number 0. - 4. The receiver checks the last received **ID*** _and accepts the **ACK (ID)**_ *if the ID matches. It also starts accepting packets with sequence number 0. + 1. sender 发送一个 **SYN (ID)** 数据包。 + 2. receiver 存储接收到的 **ID** 并发送一个 **SYN-ACK (ID)**. + 3. sender 接收到 **SYN-ACK (ID)** _并发送一个 **ACK (ID)**_。它还发送一个从序列号 0 开始的数据包。 + 4. receiver 检查最后接收到的 **ID**,如果 ID 匹配,_则接受 **ACK (ID)**_。它还开始接受序列号为 0 的数据包。 -### Handling state timeouts +### 处理状态超时 -Basically, at each state, you need to handle, at most, three types of events: link events, packet events, and timeout events. And those events show up concurrently, so here you have to handle concurrency properly. +Basically, at each state, you need to handle, at most, three types of events: link events, packet events, and timeout events. And those events show up concurrently, so here you have to handle concurrency properly.基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 - * Link events are either link up or link down updates. This can either initiate a link session or break an existing session. - * Packet events are control packets **(SYN/SYN-ACK/ACK)** or just probe responses. - * Timeout events are the ones triggered after a scheduled timeout expires for the current session state. + * 链接事件包括连接和断开,连接时会初始化一个链接 session,断开时会断开一个已建立的 seesion。 + * 数据包事件是控制数据包 **(SYN/SYN-ACK/ACK)** 或只是探测响应。 + * 超时事件在当前 session 状态的预定超时时间到期后触发。 -The main challenge here is how to handle concurrent timeout expiration and other events. And this is where one can easily fall into the traps of deadlocks and race conditions. +这里面临的最主要的问题是如何处理并发超时到期和其他事件。这里很容易陷入死锁和资源竞争的陷阱。 -### A first approach +### 第一种方法 -The language used for this project is [Golang][8]. It does provide native synchronization mechanisms such as native channels and locks and is able to spin lightweight threads for concurrent processing. +本项目使用的语言是 [Golang][8]. 它确实提供了原生的同步机制,如自带的 channel 和锁,并且能够使用轻量级线程来进行并发处理。 ![gophers hacking together][9] gophers hacking together -You can start first by designing a structure that represents our **Session** and **Timeout Handlers**. +首先,你可以设计两个分别表示我们的 **Session** 和 **Timeout Handlers** 的结构体。 -``` +```go type Session struct {     State SessionState     Id SessionId   @@ -80,21 +79,21 @@ type TimeoutHandler struct {   } ``` -**Session** identifies the connection session, with the session ID, neighboring link IP, and the current session state. +**Session** 标识连接 session,内有表示 session ID、临近的连接点的 IP 和当前 session 状态的字段。 -**TimeoutHandler** holds the callback function, the session for which it should run, the duration, and a pointer to the scheduled timer. +**TimeoutHandler** 包含回调函数、对应的 session、持续时间和指向调度计时器的 timer 指针。 -There is a global map that will store, per neighboring link session, the scheduled timeout handler. +每一个临近连接点的 session 都包含一个保存调度 `TimeoutHandler` 的全局 map。 ``` `SessionTimeout map[Session]*TimeoutHandler` ``` -Registering and canceling a timeout is achieved by the following methods: +下面方法注册和取消超时: -``` +```go // schedules the timeout callback function.   func (timeout* TimeoutHandler) Register() {     timeout.timer = time.AfterFunc(time.Duration(timeout.duration) * time.Second, func() {   @@ -110,10 +109,10 @@ func (timeout* TimeoutHandler) Cancel() {   } ``` -For the timeouts creation and storage, you can use a method like the following: +你可以使用类似下面的方法来创建和存储超时: -``` +```go func CreateTimeoutHandler(callback func(Session), session Session, duration int) *TimeoutHandler {     if sessionTimeout[session] == nil {       sessionTimeout[session] := new(TimeoutHandler)   @@ -127,12 +126,12 @@ func CreateTimeoutHandler(callback func(Session), session Session, duration int) } ``` -Once the timeout handler is created and registered, it runs the callback after _duration_ seconds have elapsed. However, some events will require you to reschedule a timeout handler (as it happens at **SYN** state — every 3 seconds). +超时 handler 创建后,会在经过了设置的 _duration_ 时间(秒)后执行回调函数。然而,有些事件会使你重新调度一个超时 handler(与 **SYN** 状态时的处理一样 — 每 3 秒一次)。 -For that, you can have the callback rescheduling a new timeout: +为此,你可以让回调函数重新调度一次超时: -``` +```go func synCallback(session Session) {     sendSynPacket(session) @@ -144,34 +143,34 @@ func synCallback(session Session) {   } ``` -This callback reschedules itself in a new timeout handler and updates the global **sessionTimeout** map. +这次回调在新的超时 handler 中重新调度自己,并更新全局 map **sessionTimeout**。 -### **Data race and references** +### 数据竞争和引用 -Your solution is ready. One simple test is to check that a timeout callback is executed after the timer has expired. To do this, register a timeout, sleep for its duration, and then check whether the callback actions were done. After the test is executed, it is a good idea to cancel the scheduled timeout (as it reschedules), so it won’t have side effects between tests. +你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,在 *duration* 时间内 sleep,然后检查是否执行的回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 -Surprisingly, this simple test found a bug in the solution. Canceling timeouts using the cancel method was just not doing its job. The following order of events would cause a data race condition: +令人惊讶的是,这个简单的测试发现了这个解决方案中的一个 bug。使用 cancel 方法来取消超时并没有正确处理。以下顺序的事件会导致数据资源竞争: - 1. You have one scheduled timeout handler. - 2. Thread 1: -a) You receive a control packet, and you now want to cancel the registered timeout and move on to the next session state. (e.g. received a **SYN-ACK** **after you sent a **SYN**). -b) You call **timeout.Cancel()**, which calls a **timer.Stop()**. (Note that a Golang timer stop doesn’t prevent an already expired timer from running.) - 3. Thread 2: -a) Right before that cancel call, the timer has expired, and the callback was about to execute. -b) The callback is executed, it schedules a new timeout and updates the global map. - 4. Thread 1: -a) Transitions to a new session state and registers a new timeout, updating the global map. + 1. 你有一个已调度的超时 handler。 + 2. 线程 1: +a) 你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个 session 状态(如 发送 **SYN** 后接收到一个 **SYN-ACK**) +b) 你调用了 **timeout.Cancel()**,这个函数调用了 **timer.Stop()**。(请注意,Golang 计时器的 stop 不会终止一个已过期的计时器。) + 3. 线程 2: +a) 在调用 cancel 之前,计时器已过期,回调即将执行。 +b) 执行回调,它调度一次新的超时并更新全局 map。 + 4. 线程 1: +a) 切换到新的 session 状态并注册新的超时,更新全局 map。 -Both threads were updating the timeout map concurrently. The end result is that you failed to cancel the registered timeout, and then you also lost the reference to the rescheduled timeout done by thread 2. This results in a handler that keeps executing and rescheduling for a while, doing unwanted behavior. +两个线程同时更新超时 map。最终结果是你无法取消注册的超时,然后你也会丢失对线程 2 重新调度的超时的引用。这导致 handler 在一段时间内持续执行和重新调度,出现非预期行为。 -### When locking is not enough +### 锁也解决不了问题 -Using locks also doesn’t fix the issue completely. If you add locks before processing any event and before executing a callback, it still doesn’t prevent an expired callback to run: +使用锁也不能完全解决问题。如果你在处理所有事件和执行回调之前加锁,它仍然不能阻止一个过期的回调运行: -``` +```go func (timeout* TimeoutHandler) Register() {     timeout.timer = time.AfterFunc(time.Duration(timeout.duration) * time._Second_, func() {       stateLock.Lock()   @@ -182,26 +181,26 @@ func (timeout* TimeoutHandler) Register() {   } ``` -The difference now is that the updates in the global map are synchronized, but this doesn’t prevent the callback from running after you call the **timeout.Cancel() **— This is the case if the scheduled timer expired but didn’t grab the lock yet. You should again lose reference to one of the registered timeouts. +现在的区别就是全局 map 的更新是同步的,但是这还是不能阻止在你调用 **timeout.Cancel() ** 后回调的执行 — 这种情况出现在调度计时器过期了但是还没有拿到锁的时候。你还是会丢失一个已注册的超时的引用。 -### Using cancellation channels +### 使用取消 channel -Instead of relying on golang’s **timer.Stop()**, which doesn’t prevent an expired timer to execute, you can use cancellation channels. +你可以使用取消 channel,而不必依赖不能阻止到期的计时器执行的 golang 函数 **timer.Stop()**。 -It is a slightly different approach. Now you won’t do a recursive re-scheduling through callbacks; instead, you register an infinite loop that waits for cancellation signals or timeout events. +这是一个略有不同的方法。现在你可以不用再通过回调进行递归地重新调度;而是注册一个死循环,这个循环接收到取消信号或超时事件是终止。 -The new **Register()** spawns a new go thread that runs your callback after a timeout and schedules a new timeout after the previous one has been executed. A cancellation channel is returned to the caller to control when the loop should stop. +新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用发一个取消 channel,用来控制循环的终止。 -``` +```go func (timeout *TimeoutHandler) Register() chan struct{} {     cancelChan := make(chan struct{})         go func () {       select {   -    case _ = <\- cancelChan:   +    case _ = <- cancelChan:         return   -    case _ = <\- time.AfterFunc(time.Duration(timeout.duration) * time.Second):   +    case _ = <- time.AfterFunc(time.Duration(timeout.duration) * time.Second):         func () {           stateLock.Lock()           defer stateLock.Unlock() @@ -218,23 +217,23 @@ func (timeout* TimeoutHandler) Cancel() {     if timeout.cancelChan == nil {       return     }   -  timeout.cancelChan <\- struct{}{}   +  timeout.cancelChan <- struct{}{}   } ``` -This approach gives you a cancellation channel for each timeout you register. A cancel call sends an empty struct to the channel and triggers the cancellation. However, this doesn’t resolve the previous issue; the timeout can expire right before you call cancel over the channel, and before the lock is grabbed by the timeout thread. +这个方法提供了你注册的所有超时的取消 channel。对 cancel 的一次调用向 channel 发送一个空结构体并触发取消操作。然而,这并不能解决前面的问题;可能在你通过 channel 调用 cancel 超时线程还没有拿到锁之前,超时时间就已经到了。 -The solution here is to check the cancellation channel inside the timeout scope after you grab the lock. +这里的解决方案是,在拿到锁之后,检查一下超时范围内的取消 channel。 -``` -  case _ = <\- time.AfterFunc(time.Duration(timeout.duration) * time.Second):   +```go +  case _ = <- time.AfterFunc(time.Duration(timeout.duration) * time.Second):       func () {         stateLock.Lock()         defer stateLock.Unlock()               select {   -      case _ = <\- handler.cancelChan:   +      case _ = <- handler.cancelChan:           return         default:           timeout.callback(timeout.session)   @@ -243,47 +242,49 @@ The solution here is to check the cancellation channel inside the timeout scope   } ``` -Finally, this guarantees that the callback is only executed after you grab the lock and no cancellation was triggered. +最终,这可以确保在拿到锁之后执行回调,不会触发取消操作。 -### Beware of deadlocks +### 小心死锁 -This solution seems to work; however, there is one hidden pitfall here: [deadlocks][10]. +这个解决方案看起来有效;但是还是有个隐患:[死锁][10]。 -Please read the code above again and try to find it yourself. Think of concurrent calls to any of the methods described. +请阅读上面的代码,试着自己找到它。考虑下描述的所有函数的并发调用。 -The last problem here is with the cancellation channel itself. We made it an unbuffered channel, which means that sending is a blocking call. Once you call cancel in a timeout handler, you only proceed once that handler is canceled. The problem here is when you have multiple calls to the same cancelation channel, where a cancel request is only consumed once. And this can easily happen if concurrent events were to cancel the same timeout handler, like a link down or control packet event. This results in a deadlock situation, possibly bringing the application to a halt. +这里的问题在取消 channel 本身。我们创建的是无缓冲 channel,即发送是阻塞调用。当你在一个超时 handler 中调用取消函数时,只有在该 handler 被取消后才能继续处理。问题出现在,当你有多个调用请求到同一个取消 channel 时,这时一个取消请求只被处理一次。当多个事件同时取消同一个超时 handler 时,如链接断开或控制包事件,很容易出现这种情况。这会导致死锁,可能会使应用程序 halt。 ![gophers on a wire, talking][11] -Is anyone listening? +还有人吗? -By Trevor Forrey. Used with permission. +已获得 Trevor Forrey 授权。 -The solution here is to at least make the channel buffered by one, so sends are not always blocking, and also explicitly make the send non-blocking in case of concurrent calls. This guarantees the cancellation is sent once and won’t block the subsequent cancel calls. +这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会则色后续的取消调用。 -``` +```go func (timeout* TimeoutHandler) Cancel() {     if timeout.cancelChan == nil {       return     }         select {   -  case timeout.cancelChan <\- struct{}{}:   +  case timeout.cancelChan <- struct{}{}:     default:       // can’t send on the channel, someone has already requested the cancellation.     }   } ``` -### Conclusion +### 总结 -You learned in practice how common mistakes can show up while working with concurrent code. Due to their non-deterministic nature, those issues can go easily undetected, even with extensive testing. Here are the three main problems we encountered in the initial implementation. +在实践中你学到了并发操作时出现的常见错误。由于其不确定性,即使进行大量的测试,也不容易发现这些问题。下面是我们在最初的实现中遇到的三个主要问题: -#### Updating shared data without synchronization +#### 在非同步的情况下更新共享数据 This seems like an obvious one, but it’s actually hard to spot if your concurrent updates happen in different locations. The result is data race, where multiple updates to the same data can cause update loss, due to one update overriding another. In our case, we were updating the scheduled timeout reference on the same shared map. (Interestingly, if Go detects a concurrent read/write on the same Map object, it throws a fatal error —you can try to run Go’s [data race detector][12]). This eventually results in losing a timeout reference and making it impossible to cancel that given timeout. Always remember to use locks when they are needed. + + ![gopher assembly line][13] don’t forget to synchronize gophers’ work @@ -317,18 +318,18 @@ via: https://opensource.com/article/19/12/go-common-pitfalls [a]: https://opensource.com/users/edufgf [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny (Goland gopher illustration) +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny "Goland gopher illustration" [2]: http://mode.net [3]: https://en.wikipedia.org/wiki/Metrics_%28networking%29 [4]: https://people.ece.cornell.edu/atang/pub/15/HALO_ToN.pdf [5]: https://en.wikipedia.org/wiki/Point_of_presence -[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png (latency computation graph) -[7]: https://opensource.com/sites/default/files/uploads/image3_0.png (finite state machine diagram) +[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png "latency computation graph" +[7]: https://opensource.com/sites/default/files/uploads/image3_0.png "finite state machine diagram" [8]: https://golang.org/ -[9]: https://opensource.com/sites/default/files/uploads/image4.png (gophers hacking together) +[9]: https://opensource.com/sites/default/files/uploads/image4.png "gophers hacking together" [10]: https://en.wikipedia.org/wiki/Deadlock -[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg (gophers on a wire, talking) +[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg "gophers on a wire, talking" [12]: https://golang.org/doc/articles/race_detector.html -[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg (gopher assembly line) +[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg "gopher assembly line" [14]: https://en.wikipedia.org/wiki/Monitor_%28synchronization%29#Condition_variables -[15]: https://opensource.com/sites/default/files/uploads/image7.png (gopher boot camp) +[15]: https://opensource.com/sites/default/files/uploads/image7.png "gopher boot camp" From 6dacee06787746bfe551626c3c1f4fa2fd2ce2e1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:55:40 +0800 Subject: [PATCH 0121/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Bash?= =?UTF-8?q?=20Script=20to=20Check=20How=20Long=20the=20High=20CPU/Memory?= =?UTF-8?q?=20Consumption=20Processes=20Runs=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md --- ...ory Consumption Processes Runs on Linux.md | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md diff --git a/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md b/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md new file mode 100644 index 0000000000..fc3818c344 --- /dev/null +++ b/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux) +[#]: via: (https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux +====== + +In the past, we have written three different articles to identify this using Linux commands. + +You can access them immediately by going to the relevant URLs below. + + * **[How to Find High CPU Consumption Processes in Linux][1]** + * **[How to Find Out Top Memory Consuming Processes in Linux][2]** + * **[Five Ways to Check How Long a Process Has Been Running in Linux][3]** + + + +Two scripts are included in this tutorial, which helps you to identify how long the high CPU/memory consumption processes are running on Linux. + +The script will show you the process ID, the owner of the process, the name of the process and how long the processes are running. + +This will help you identify which jobs are running overtime (which must be completed beforehand). + +This can be achieved using the ps command. + +### What’s ps Command + +ps stands for processes status, it display the information about the active/running processes on the system. + +It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc. + +### 1) Bash Script to Check How Long the High CPU Consumption Processes Runs on Linux + +This script will help you to identify how long the high CPU consumption processes has been running on Linux. + +``` +# vi /opt/scripts/long-running-cpu-proc.sh + +#!/bin/bash +ps -eo pid,user,ppid,%mem,%cpu,cmd --sort=-%cpu | head | tail -n +2 | awk '{print $1}' > /tmp/long-running-processes.txt +echo "--------------------------------------------------" +echo "UName PID CMD Process_Running_Time" +echo "--------------------------------------------------" +for userid in `cat /tmp/long-running-processes.txt` +do +username=$(ps -u -p $userid | tail -1 | awk '{print $1}') +pruntime=$(ps -p $userid -o etime | tail -1) +ocmd=$(ps -p $userid | tail -1 | awk '{print $4}') +echo "$username $userid $ocmd $pruntime" +done | column -t +echo "--------------------------------------------------" +``` + +Set an executable **[Linux file permission][4]** to **“long-running-cpu-proc.sh”** file. + +``` +# chmod +x /opt/scripts/long-running-cpu-proc.sh +``` + +When you run this script, you will get an output like the one below. + +``` +# sh /opt/scripts/long-running-cpu-proc.sh + +---------------------------------------------------- +UName PID CMD Process_Running_Time +---------------------------------------------------- +daygeek 5214 Web 01:18:48 +daygeek 5748 Web 01:08:20 +daygeek 8043 inkscape 22:11 +daygeek 5269 Web 01:18:31 +daygeek 1712 Web 10:44:50 +daygeek 5335 RDD 01:17:54 +daygeek 1639 firefox 10:44:51 +daygeek 7793 nautilus 24:14 +daygeek 6301 Web 57:40 +---------------------------------------------------- +``` + +### 2) Bash Script to Check How Long the High Memory Consumption Processes Runs on Linux + +This script will help you to identify how long the top memory consumption processes has been running on Linux. + +``` +# sh /opt/scripts/long-running-memory-proc.sh + +#!/bin/bash +ps -eo pid,user,ppid,%mem,%cpu,cmd --sort=-%mem | head | tail -n +2 | awk '{print $1}' > /tmp/long-running-processes-1.txt +echo "--------------------------------------------------" +echo "UName PID CMD Process_Running_Time" +echo "--------------------------------------------------" +for userid in `cat /tmp/long-running-processes-1.txt` +do +username=$(ps -u -p $userid | tail -1 | awk '{print $1}') +pruntime=$(ps -p $userid -o etime | tail -1) +ocmd=$(ps -p $userid | tail -1 | awk '{print $4}') +echo "$username $userid $ocmd $pruntime" +done | column -t +echo "--------------------------------------------------" +``` + +Set an executable Linux file permission to **“long-running-memory-proc.sh”** file. + +``` +# chmod +x /opt/scripts/long-running-memory-proc.sh +``` + +When you run this script, you will get an output like the one below. + +``` +# sh /opt/scripts/long-running-memory-proc.sh + +---------------------------------------------------- +UName PID CMD Process_Running_Time +---------------------------------------------------- +daygeek 1639 firefox 10:44:56 +daygeek 2997 Web 10:39:54 +daygeek 5269 Web 01:18:37 +daygeek 1712 Web 10:44:55 +daygeek 8043 inkscape 22:17 +daygeek 5214 Web 01:18:54 +daygeek 1898 Web 10:44:48 +daygeek 1129 Xorg 10:45:07 +daygeek 6301 Web 57:45 +---------------------------------------------------- +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/ +[2]: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ +[3]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ +[4]: https://www.2daygeek.com/understanding-linux-file-permissions/ From 8ae7e83dcbaa294e82bbc08a2e20cfe37354a9d3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:56:32 +0800 Subject: [PATCH 0122/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200106=20Open?= =?UTF-8?q?=20Source=20Supply=20Chain:=20A=20Matter=20of=20Trust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md --- ... Source Supply Chain- A Matter of Trust.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md diff --git a/sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md b/sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md new file mode 100644 index 0000000000..3484c3ca55 --- /dev/null +++ b/sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source Supply Chain: A Matter of Trust) +[#]: via: (https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Open Source Supply Chain: A Matter of Trust +====== + +[![][1]][2] + +_**Co-authored by Curtis Franklin, Jr**_ + +Open source software is often considered safer and more secure than proprietary software because users can, if they want, compile the software from the source code. They know the source of the code running in their environment.  Every component that they are running in their environment can be audited and the developer held accountable.   + +However, users and vendors are moving away from complexity that comes with total control and embracing convenience and ease of use. + +“I am often taken aback when I see a talk around security and privacy and then the presenter runs the ‘docker run’ command to install and run some random binary downloaded from the internet,” said [Dirk Hohndel, Vice-President and Chief Open Source Officer at VMware.][3] “Those two things seem to be a little bit at odds with each other.” + +The software supply chain — the process that takes an application from coding through packaging and distribution to its ultimate user — is complicated. If done wrong, it could be potentially risky, especially for open source software.  A malevolent player can get access to the backend and start inserting any random binary code onto a user’s system without that user’s knowledge or control. + +It’s not a problem specific to the cloud-native world. It can be seen in modern app development environments, including JavaScript, npm, PyPI, RubyGems, and so on.  Even Homebrew on Mac used to be provided through source code that a user would compile themselves.  + +“Today, you just download the binary and install it, hoping that it’s built from the same source code that you have access to,” said Hohndel. “As an industry, we need to pay more attention to our supply chain.  It’s something that is extremely important to me and that I’m trying to get more people interested in it.”  + +It’s not simply a binary versus source code equation, though. There are huge advantages to just running a binary instead of having to build everything from sources.   It allows developers to be more flexible and more responsive in their turnaround. They can cycle very quickly through new development and product releases by reusing some binaries. + +“It would be nice if there was a way to sign these binaries and have an ‘on-the-fly’ verification mechanism so users know they can trust these,” said Hohndel. + +Linux distributions have solved this problem as the distributions act as gatekeepers who check the integrity of packages that go into supported repositories.  + +“Packages offered through distributions like Debian are signed with a key. It takes a lot of work to ensure that this is really the software that should be in the distribution. They have solved the supply chain problem,” said Hohndel. + +But even on Linux distribution, people want to simplify things and trade correctness and security for speed. There are now projects like AppImage, Snap and Flatpack that have adopted the binary route, bringing the trust issue to Linux distributions. It’s the same problem of docker containers all over again. + +“The ideal solution would be to find a way for us as a community to devise a system of trust which ensures that if a binary was signed with a key that is in the network of trust, it can be trusted and provides us with the ability to reliably go back to the sources and do an audit,” suggested Hohndel. + +However, all this additional steps incur costs that most projects are either unwilling or unable to afford. Some projects are trying to find ways around the problem. NPM, for example, has begun to encourage those submitting packages to properly authenticate and secure their accounts to improve trustworthiness on the platform.  + +**Open Source Community Is Good At Solving Problems** + +Hohndel is involved with many efforts to solve the open source supply chain problem and is spreading awareness about it. Last year, [VMware acquired Bitnami,][4] which is a great place for curating open source applications that are signed by VMware.  + +“We are talking with upstream open source communities in various ecosystems to raise awareness about it. We are also discussing technical solutions that will make it easier for these communities to solve the underlying problems,” said Hohndel. + +The open source community has historically been diligent at ensuring software quality, including the mechanisms for security and privacy. Still, Hohndel says, “The biggest concern that I have is that, in the excitement about the next new thing, we often ignore the underlying engineering discipline that we really need.” + +Ultimately, Hohndel feels that answer will come from the open source community itself. “Open source is an engineering methodology and it’s a social experiment. Open source is all about people trusting each other, working with each other, collaborating across borders, between companies, amongst competitors in ways that we didn’t do before,” he explains. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920-1068x801.jpg (hand-1137978_1920) +[2]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920.jpg +[3]: https://www.swapnilbhartiya.com/open-source-leaders-dirk-hohndel-brings-open-source-to-vmware/ +[4]: https://techcrunch.com/2019/05/15/vmware-acquires-bitnami-to-deliver-packaged-applications-anywhere/ From f9c2412d4a61667987ac979d9bc42c88650c4b7e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:57:01 +0800 Subject: [PATCH 0123/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Kali?= =?UTF-8?q?=20Linux=20Will=20No=20Longer=20Have=20The=20Default=20Root=20U?= =?UTF-8?q?ser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md --- ...ll No Longer Have The Default Root User.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md diff --git a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md new file mode 100644 index 0000000000..2ffcd8f715 --- /dev/null +++ b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Kali Linux Will No Longer Have The Default Root User) +[#]: via: (https://itsfoss.com/kali-linux-root-user/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Kali Linux Will No Longer Have The Default Root User +====== + +Kali Linux is a specialized Linux distribution for cyber security testing and hacking related tasks. + +If you’ve used [Kali Linux][1], you probably know that it followed a default root user policy. In other words, you are always root in Kali Linux. Whatever you do – you will be accessing tools/applications as root by default. + +It looks like everything back then was kind of “root for all” for everything. So, the default root user policy existed. + +They also explained the history for this in their [announcement post][2]: + +> A lot of those tools back then either required root access to run or ran better when ran as root. With this operating system that would be ran from a CD, never be updated, and had a lot of tools that needed root access to run it was a simple decision to have a “everything as root” security model. It made complete sense for the time. + +### Kali Linux will now have a default non-root user (like most other distributions) + +![][3] + +A default non-root model was necessary because a lot of users now use Kali Linux as their daily driver. + +Of course, they [do not recommend using Kali Linux][4] as a replacement for stable distributions like Ubuntu/Fedora/Manjaro – however, with its active development, some users do consider using it on a day-to-day basis instead of just using it for its tools. + +So, with a wide mainstream usage of the distro, the Kali Linux team thought of switching to a default non-root model because nowadays a lot of applications/tools do not require root access. + +> While we don’t encourage people to run Kali as their day to day operating system, over the last few years more and more users have started to do so _(even if they are not using it to do penetration testing full time)_, including some members of the Kali development team. When people do so, they obviously don’t run as default root user. With this usage over time, there is the obvious conclusion that default root user is no longer necessary and Kali will be better off moving to a more traditional security model. + +So I am reiterating that you should not consider Kali Linux to be fit for your daily tasks if you do not utilize security-related [Kali Linux tools][5]. Feel free to experiment – but I wouldn’t be so sure to rely on it. + +So from the next release, when you install Kali Linux, you’ll be asked to create non-root user that will have admin privileges. Tools and commands that require root access will be run with sudo. + +![][6] + +#### [Pretend to be Using Windows with Kali Linux Undercover Mode][7] + +The new undercover mode in Kali Linux switches the desktop layout to make it look like Windows 10. Find out how to activate the undercover mode. + +### New default user and password for Kali Linux live mode + +![Kali Linux has new user-password in the live system][8] + +Technically, you won’t find a groundbreaking difference. Just note that the default user ID and password in live mode is “**kali**“. + +You can find the new non-root model implemented in the new daily/weekly builds if you want to test it early. + +In either case, you can wait for the 2020.1 release scheduled for late January to take a look at the new default non-root user model. + +### Getting back the old root model in Kali Linux + +If you are a long time Kali Linux user, you may not find it convenient to add sudo before commands and then manually enter the password. + +The good news here is that you can still get the old password-less root rights with this command: + +``` +sudo dpkg-reconfigure kali-grant-root +``` + +What do you think about the default non-root user model? Is it a good decision? Let me know your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kali-linux-root-user/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.kali.org/ +[2]: https://www.kali.org/news/kali-default-non-root-user/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali_linux_default_root_user.png?ssl=1 +[4]: https://itsfoss.com/kali-linux-review/ +[5]: https://itsfoss.com/best-kali-linux-tools/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/kali_linux_undercover_mode.jpg?fit=800%2C450&ssl=1 +[7]: https://itsfoss.com/kali-linux-undercover-mode/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali-linux-live-password.png?ssl=1 From 23bed4dc448b9e84f2a9cec6796ad0ebe3b0fe6c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:57:21 +0800 Subject: [PATCH 0124/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20App?= =?UTF-8?q?=20Highlight:=20Catfish=20Desktop=20File=20Searching=20Tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md --- ...ht- Catfish Desktop File Searching Tool.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md diff --git a/sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md b/sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md new file mode 100644 index 0000000000..d485682215 --- /dev/null +++ b/sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Catfish Desktop File Searching Tool) +[#]: via: (https://itsfoss.com/catfish/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +App Highlight: Catfish Desktop File Searching Tool +====== + +_****Brief: Catfish is a nifty file searching GUI tool for Linux desktop. The interface is lightweight and simple and the tool allows to refine your search with** criteria like time, file type etc.**_ + +The Linux purists use commands like locate, find and grep to search for files in the terminal. + +But as a desktop Linux user, you don’t need to leave the comfort of the graphical user interface (GUI) and deep dive into the command line interface (CLI) just for searching files on your desktop. + +Most Linux distributions provide a basic desktop search feature either via the file manager or through the desktop environment itself. + +On GNOME desktop, you can search for files in the Activities area (use the Windows key to bring it up). Files (previously known as Nautilus) also has a built-in search button. + +![Nautilus file manager already has advanced search feature][1] + +You can extend this search and add options like time and type of the file. One thing it doesn’t do is to search inside the files. For example, you cannot use it to get all the files that contains “university”. + +This is where a desktop file search tool like Catfish could help you. + +### Catfish: A nifty GUI tool for searching files on Linux + +[Catfish][2] is a GUI tool that enables you to search your desktop for any kind of files. It uses locate and find commands underneath. The autocompletion feature uses [Zeitgeist][3] daemon and [locate command][4]. It’s a lightweight tool and uses GTK+. + +Catfish is developed by [Christian Dywan][5], the same person who develops the [lightweight Midori web browser][6]. + +![Catfish interface on MX Linux][7] + +Some of the main features of Catfish are: + + * Search for files anywhere on your system, **including the mounted partitions** + * **Search inside the files** for its contents (can be enabled from preferences) + * Search hidden files as well + * Refine your search based on modification time + * Refine your search based on file type (images, videos, documents etc) + * Refine your search based on location (Documents, Downloads, Pictures or other folders) + * Exclude certain directories and paths from your search + * Lightweight and simple interface + * **Support for Wayland** display server (from version 1.4.12) + + + +Catfish is now a Xfce project and it is providing the search feature to Xfce’s Thunar file manager. + +### Installing Catfish on Ubuntu and other Linux distributions + +Let’s see how to install Catfish on your Linux distributions. + +**Ubuntu-based distributions** + +Catfish is available in the universe repository for Ubuntu based distributions such as Xubuntu, Linux Mint, Linux Lite etc. + +You can install it from the software center by searching for Catfish + +![Catfish in Ubuntu Software Center][8] + +or, use the terminal to install it: + +``` +sudo apt install catfish +``` + +The version provided by Ubuntu may not be the latest. The [official PPA][9] has been abandoned so this means that to get the latest Catfish version, you’ll have to [install it from the source code][10]. + +**On other distributions** + +Catfish is also available in most major Linux distributions. It is certainly available on Fedora and if you check your distribution’s package manager or software center, you should find it there and install it like any other program. + +**Conclusion** + +In this week’s Linux application highlight, you learned about this handy little utility. However, Catfish is not the only tool of its kind. You may check some other search tools like [ANGRYSearch][11] or [SearchMonkey][12]. + +Have you ever used a GUI tool for searching files or do you rely on the good old command line? And what do you think of Catfish? Do you look forward to use it? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/catfish/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/search-files-gnome.jpg?ssl=1 +[2]: https://launchpad.net/catfish-search/ +[3]: https://wiki.archlinux.org/index.php/Zeitgeist +[4]: https://linuxhandbook.com/locate-command/ +[5]: http://www.twotoasts.de/index.php/about/ +[6]: https://itsfoss.com/midori-browser/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/catfish_screenshot.png?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/catfish_ubuntu_software_center.jpg?ssl=1 +[9]: https://itsfoss.com/ppa-guide/ +[10]: https://itsfoss.com/install-software-from-source-code/ +[11]: https://itsfoss.com/angrysearch/ +[12]: https://itsfoss.com/searchmonkey-search-text-files-linux/ From 8638c00497c6dfed4f6918147985517e351fe2df Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:58:19 +0800 Subject: [PATCH 0125/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200106=20How?= =?UTF-8?q?=20to=20write=20a=20Python=20web=20API=20with=20Pyramid=20and?= =?UTF-8?q?=20Cornice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md --- ...Python web API with Pyramid and Cornice.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md diff --git a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md new file mode 100644 index 0000000000..2b10ef953a --- /dev/null +++ b/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a Python web API with Pyramid and Cornice) +[#]: via: (https://opensource.com/article/20/1/python-web-api-pyramid-cornice) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +How to write a Python web API with Pyramid and Cornice +====== +Use Pyramid and Cornice to build and document scalable RESTful web +services. +![Searching for code][1] + +[Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs. + +[Pyramid][3] is a Python web framework designed to scale up with an application: it's simple for simple applications but can grow for big, complex applications. Among other things, Pyramid powers PyPI, the Python package index. [Cornice][4] provides helpers to build and document REST-ish web services with Pyramid. + +This article will use the example of a web service to get famous quotes to show how to use these tools. + +### Set up a Pyramid application + +Start by creating a virtual environment for your application and a file to hold the code: + + +``` +$ mkdir tutorial +$ cd tutorial +$ touch main.py +$ python3 -m venv env +$ source env/bin/activate +(env) $ pip3 install cornice twisted +``` + +### Import the Cornice and Pyramid modules + +Import these modules with: + + +``` +from pyramid.config import Configurator +from cornice import Service +``` + +### Define the service + +Define the quotes service as a **Service** object: + + +``` +QUOTES = Service(name='quotes', +                 path='/', +                 description='Get quotes') +``` + +### Write the quotes logic + +So far, this only supports **GET**ing quotes. Decorate the function with **QUOTES.get**; this is how you can tie in the logic to the REST service: + + +``` +@QUOTES.get() +def get_quote(request): +    return { +        'William Shakespeare': { +            'quote': ['Love all, trust a few, do wrong to none', +            'Some are born great, some achieve greatness, and some have greatness thrust upon them.'] +    }, +    'Linus': { +        'quote': ['Talk is cheap. Show me the code.'] +        } +    } +``` + +Note that unlike in other frameworks, the **get_quote** function is _not_ changed by the decorator. If you import this module, you can still call the function regularly and inspect the result. + +This is useful when writing unit tests for Pyramid RESTful services. + +### Define the application object + +Finally, use **scan** to find all decorated functions and add them to the configuration:  + + +``` +with Configurator() as config: +    config.include("cornice") +    config.scan() +    application = config.make_wsgi_app() +``` + +The default for scan is to scan the current module. You can also give the name of a package if you want to scan all modules in a package. + +### Run the service + +I use Twisted's WSGI server to run the application, but you can use any other [WSGI][5] server, like Gunicorn or uWSGI, if you want: + + +``` +`(env)$ python -m twisted web --wsgi=main.application` +``` + +By default, Twisted's WSGI server runs on port 8080. You can test the service with [HTTPie][6]: + + +``` +(env) $ pip install httpie +... +(env) $ http GET +HTTP/1.1 200 OK +Content-Length: 220 +Content-Type: application/json +Date: Mon, 02 Dec 2019 16:49:27 GMT +Server: TwistedWeb/19.10.0 +X-Content-Type-Options: nosniff + +{ +    "Linus": { +        "quote": [ +            "Talk is cheap. Show me the code." +        ] +    }, +    "William Shakespeare": { +        "quote": [ +            "Love all,trust a few,do wrong to none", +            "Some are born great, some achieve greatness, and some greatness thrust upon them." +        ] +    } +} +``` + +### Why use Pyramid? + +Pyramid is not the most popular framework, but it is used in some high-profile projects like [PyPI][7]. I like Pyramid because it is one of the frameworks that took unit testing seriously: because the decorators do not modify the function and there are no thread-local variables, functions are callable directly from unit tests. For example, functions that need access to the database will get it from the **request** object passed in via **request.config**. This allows a unit tester to put a mock (or real) database object in the request, instead of carefully setting globals, thread-local variables, or other framework-specific things. + +If you're looking for a well-tested library to build your next API, give Pyramid a try. You won't be disappointed. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/python-web-api-pyramid-cornice + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://opensource.com/resources/python +[3]: https://opensource.com/article/18/5/pyramid-framework +[4]: https://cornice.readthedocs.io/en/latest/ +[5]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface +[6]: https://opensource.com/article/19/8/getting-started-httpie +[7]: https://pypi.org/ From dd1cfb171b21de63db5570da5b9ea1d24ed1bec1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:58:47 +0800 Subject: [PATCH 0126/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200106=20Crea?= =?UTF-8?q?te=20fancy=20text=20for=20your=20social=20media=20posts=20with?= =?UTF-8?q?=20this=20Gawk=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md --- ...ocial media posts with this Gawk script.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md diff --git a/sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md b/sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md new file mode 100644 index 0000000000..361bac0726 --- /dev/null +++ b/sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create fancy text for your social media posts with this Gawk script) +[#]: via: (https://opensource.com/article/20/1/gawk-scripting-social-media) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Create fancy text for your social media posts with this Gawk script +====== +Add a little style to your status updates by posting text in script, +fraktur, or double-strike characters. +![Chat via email][1] + +Like almost everyone on the planet, I have a few social media accounts. I mostly stick to Facebook to stay up to date with friends and family and Twitter to follow a few other people. + +Have you ever wanted to make a post that includes italics or some other fancy formatting? You can easily change the text to italics or bold when you're writing an email, but most social media platforms don't provide many formatting options. + +And sometimes, I just want to put a little _emphasis_ into what I'm writing. If I've had a really good day and I want to share that with my friends, I might want to put that text in italics. For other posts, I might want to use different formatting that will help my text stand out. Sure, you can use emoji, but sometimes a little text formatting can add that extra pizzazz to your posts. + +I found a way to do just that. With a short [Gawk][2] script I wrote, I can create fancy formatting that I can copy and paste into my social media posts. + +### Special HTML + +HTML includes a bunch of special characters for mathematics, symbols, and other languages that most people are not aware of. Within the Mathematical Markup Language ([MathML][3]) math character support, HTML includes alternate versions of the alphabet for script, fraktur, and double-strike (shown respectively in this image) characters. + +![script, fraktur, and double-strike text][4] + +You can use these alternate versions of the alphabet to create fancy text. + +The script alphabet variation is written as the letter followed by **scr**. Characters can be uppercase or lowercase. For example, to print the script letter **a** in an HTML page, type **&ascr;**, and to print the script letter **Z** in HTML, type **&Zscr;**. + +The fraktur and double-strike variations are referenced in similar ways. The fraktur mathematical lower-case **a** is **&afr;**, and the capital **Y** is **&Yfr;**. The mathematical double-strike **a** is referenced as **&aopf;**, and the double-strike **X** is **&Xopf;**. + +### Gawk functions + +Once you know how to reference the alternate versions of each letter, it's easy to define a few Gawk functions to print those HTML entities. Since these alternate characters exist only for letters and not punctuation or numbers, start with a simple wrapper function to determine if a character is an uppercase or lowercase letter. + + +``` +#!/usr/bin/gawk -f +# Echo the input as different "fonts." Redirect this into an html +# page and copy/paste fancy text into twitter or facebook. + +BEGIN { alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; } + +function is_alpha(c) { +  return(index(alpha, c)); +} +``` + +The **BEGIN** statement defines an alphabet string called **alpha** that contains all letters a–z and A–Z. The **is_alpha(c)** function uses the built-in **index()** function to return the location of the character **c** in the string **alpha**. If the character **c** is not a letter, **index()** returns zero, which the script uses as a False value. + +Because the **is_alpha(c)** function just "wraps" a call to the **index()** function without doing anything else; this is called a _wrapper_ function. Think of it as shorthand that makes the Gawk script easier to read. + +With that, it's easy to define a few functions that convert single letters into each of the alternate versions of the alphabet. In general, each function calls **is_alpha(c)** to determine if a character is a letter a–z or A–Z. If it is (i.e., if the returned value is non-zero), then the function prints the HTML entity for that letter as script, fraktur, and double-strike. Otherwise, the function prints the letter. + + +``` +function print_script(c) { +  if ( is_alpha(c) ) { printf("&%cscr;", c); } else { printf("%c", c); } +} +function print_fraktur(c) { +  if ( is_alpha(c) ) { printf("&%cfr;", c); }  else { printf("%c", c); } +} +function print_double(c) { +  if ( is_alpha(c) ) { printf("&%copf;", c); } else { printf("%c", c); } +} +``` + +The **print_script(c)** function prints a single letter in script. Similarly, the **print_fraktur(c)** function prints a letter in fraktur, and the **print_double(c)** function prints a single letter in double-strike. + +All that's left is a Gawk loop to convert plain text into each of the alternate alphabet characters. This script loops over each line three times and prints the text in script, fraktur, or double-strike. Each line is wrapped in **<p>** and **</p>** HTML tags. + + +``` +{ text=$0; +  len=length(text); + +  print "<p>"; +  for (i=1; i<=len; i++) { +    print_script( substr(text, i, 1) ); +  } +  print "</p><p>"; +  for (i=1; i<=len; i++) { +    print_fraktur( substr(text, i, 1) ); +  } +  print "</p><p>"; +  for (i=1; i<=len; i++) { +    print_double( substr(text, i, 1) ); +  } +  print "</p>"; +} +``` + +### Putting it all together + +I saved the above lines in a script file called **htmlecho** and put it in my **~/bin** directory. + + +``` +$ htmlecho > /tmp/hello.html +Hello world +^Z +``` + +Whenever I want to add fancy text to my Facebook and Twitter posts, I just run the script and save the output to a temporary HTML page. I open the temporary page in a web browser and copy and paste the fancy text I like best into my social media posts. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/gawk-scripting-social-media + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://www.gnu.org/software/gawk/ +[3]: https://en.wikipedia.org/wiki/MathML +[4]: https://opensource.com/sites/default/files/uploads/hello_world.png (script, fraktur, and double-strike text) From 299bf6e3e090c4a0446ef4d689becabc21607800 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:59:07 +0800 Subject: [PATCH 0127/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200105=20Pape?= =?UTF-8?q?rWM:=20tiled=20window=20management=20for=20GNOME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200105 PaperWM- tiled window management for GNOME.md --- ...erWM- tiled window management for GNOME.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/tech/20200105 PaperWM- tiled window management for GNOME.md diff --git a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md new file mode 100644 index 0000000000..0948014fba --- /dev/null +++ b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PaperWM: tiled window management for GNOME) +[#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/) +[#]: author: (Julia Evans https://jvns.ca/) + +PaperWM: tiled window management for GNOME +====== + +When I started using Linux on my personal computer, one of the first things I got excited about was tiny lightweight window managers, largely because my laptop at the time had 32MB of RAM and anything else was unusable. + +Then I got into tiling window managers like [xmonad][1]! I could manage my windows with my keyboard! They were so fast! I could configure xmonad by writing a Haskell program! I could customize everything in all kinds of fun ways (like using [dmenu][2] as a launcher)! I used 3 or 4 different tiling window managers over the years and it was fun. + +About 6 years ago I decided configuring my tiling window manager wasn’t fun for me anymore and switched to using the Ubuntu stock desktop environment: Gnome. (which is much faster now that I have 500x more RAM in my laptop :) ) + +So I’ve been using Gnome for a long time, but I still kind of missed tiling window managers. Then 6 months ago a friend told me about [PaperWM][3], which lets you tile your windows in Gnome! I installed it immediately and I’ve been using it ever since. + +### PaperWM: tiling window management for Gnome + +The basic idea of [PaperWM][3] is: you want to keep using Gnome (because all kinds of things Just Work in Gnome) but you also kinda wish you were using a tiling window manager. + +It’s a Gnome extension (instead of being a standalone window manager) and it’s in Javascript. + +### “Paper” means all of your windows are in a line + +The main idea in PaperWM is it puts all your windows in a line, which is actually quite different from traditional tiling window managers where you can tile your windows any way you want. Here’s a gif of me moving between / resizing some windows while writing this blog post (there’s a browser and two terminal windows): + +![][4] + +PaperWM’s Github README links to this video: , which describes a similar system as a “linear window manager”. + +I’d never heard of this way of organizing windows before but I like the simplicity of it – if I’m looking for a specific window I just move left/right until I find it. + +### everything I do in PaperWM + +there are lots of other features but these are the only ones I use: + + * move left and right between windows (`Super + ,`, `Super + .`) + * move the window left/right in the ordering (`Super+Shift+,`, `Super+Shift+.`) + * full screen a window (`Super + f`) + * make a window smaller (`Super + r`) + + + +### I like tools that I don’t have to configure + +I’ve been using PaperWM for 6 months on a laptop and I really like it! I also really appreciate that even though it’s configurable (by writing a Javascript configuration file), it does the things I want out of the box without me having to research how to configure it. + +The [fish shell][5] is another delightful tool like that – I basically don’t configure fish at all (except to set environment variables etc) and I really like the default feature set. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/01/05/paperwm/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://xmonad.org/ +[2]: https://wiki.archlinux.org/index.php/Dmenu +[3]: https://github.com/paperwm/PaperWM +[4]: https://jvns.ca/images/paperwm.gif +[5]: https://jvns.ca/blog/2017/04/23/the-fish-shell-is-awesome/ From 645361a2416b45bba0b7b078755a89f55b49147f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 01:01:14 +0800 Subject: [PATCH 0128/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200105=20Frie?= =?UTF-8?q?nd=20of=20a=20Friend:=20The=20Facebook=20That=20Could=20Have=20?= =?UTF-8?q?Been?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md --- ...iend- The Facebook That Could Have Been.md | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md diff --git a/sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md b/sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md new file mode 100644 index 0000000000..bbdb88f4f3 --- /dev/null +++ b/sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Friend of a Friend: The Facebook That Could Have Been) +[#]: via: (https://twobithistory.org/2020/01/05/foaf.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +Friend of a Friend: The Facebook That Could Have Been +====== + +> _I express my network in a FOAF file, and that is the start of the revolution._ —Tim Berners-Lee (2007) + +The FOAF standard, or Friend of a Friend standard, is a now largely defunct/ignored/superseded[1][1] web standard dating from the early 2000s that hints at what social networking might have looked like had Facebook not conquered the world. Before we talk about FOAF though, I want to talk about the New York City Subway. + +The New York City Subway is controlled by a single entity, the Metropolitan Transportation Agency, better known as the MTA. The MTA has a monopoly on subway travel in New York City. There is no legal way to travel in New York City by subway without purchasing a ticket from the MTA. The MTA has no competitors, at least not in the “subway space.” + +This wasn’t always true. Surprisingly, the subway system was once run by two corporations that competed with each other. The Inter-borough Rapid Transit Company (IRT) operated lines that ran mostly through Manhattan, while the Brooklyn-Manhattan Transit Corporation (BMT) operated lines in Brooklyn, some of which extended into Manhattan also. In 1932, the City opened its own service called the Independent Subway System to compete with the IRT and BMT, and so for a while there were _three_ different organizations running subway lines in New York City. + +One imagines that this was not an effective way to run a subway. It was not. Constructing interchanges between the various systems was challenging because the IRT and BMT used trains of different widths. Interchange stations also had to have at least two different fare-collection areas since passengers switching trains would have to pay multiple operators. The City eventually took over the IRT and BMT in 1940, bringing the whole system together under one operator, but some of the inefficiencies that the original division entailed are still problems today: Trains designed to run along lines inherited from the BMT (e.g. the A, C, or E) cannot run along lines inherited from the IRT (e.g. the 1, 2, or 3) because the IRT tunnels are too narrow. As a result, the MTA has to maintain two different fleets of mutually incompatible subway cars, presumably at significant additional expense relative to other subway systems in the world that only have to deal with a single tunnel width. + +This legacy of the competition between the IRT and BMT suggests that subway systems naturally tend toward monopoly. It just makes more sense for there to be a single operator than for there to be competing operators. Average passengers are amply compensated for the loss of choice by never having to worry about whether they brought their IRT MetroCard today but forgot their BMT MetroCard at home. + +Okay, so what does the Subway have to do with social networking? Well, I have wondered for a while now whether Facebook has, like the MTA, a natural monopoly. Facebook does seem to have _a_ monopoly, whether natural or unnatural—not over social media per se (I spend much more time on Twitter), but over my internet social connections with real people I know. It has a monopoly over, as they call it, my digitized “social graph”; I would quit Facebook tomorrow if I didn’t worry that by doing so I might lose many of those connections. I get angry about this power that Facebook has over me. I get angry in a way that I do not get angry about the MTA, even though the Subway is, metaphorically and literally, a sprawling trash fire. And I suppose I get angry because at root I believe that Facebook’s monopoly, unlike the MTA’s, is not a natural one. + +What this must mean is that I think Facebook owns all of our social data now because they happened to get there first and then dig a big moat around themselves, not because a world with competing Facebook-like platforms is inefficient or impossible. Is that true, though? There are some good reasons to think it isn’t: Did Facebook simply get there first, or did they instead just do social networking better than everyone else? Isn’t the fact that there is only one Facebook actually convenient if you are trying to figure out how to contact an old friend? In a world of competing Facebooks, what would it mean if you and your boyfriend are now Facebook official, but he still hasn’t gotten around to updating his relationship status on VisageBook, which still says he is in a relationship with his college ex? Which site will people trust? Also, if there were multiple sites, wouldn’t everyone spend a lot more time filling out web forms? + +In the last few years, as the disadvantages of centralized social networks have dramatically made themselves apparent, many people have attempted to create decentralized alternatives. These alternatives are based on open standards that could potentially support an ecosystem of inter-operating social networks (see e.g. [the Fediverse][2]). But none of these alternatives has yet supplanted a dominant social network. One obvious explanation for why this hasn’t happened is the power of network effects: With everyone already on Facebook, any one person thinking of leaving faces a high cost for doing so. Some might say this proves that social networks are natural monopolies and stop there; I would say that Facebook, Twitter, et al. chose to be walled gardens, and given that people have envisioned and even built social networks that inter-operate, the network effects that closed platforms enjoy tell us little about the inherent nature of social networks. + +So the real question, in my mind, is: Do platforms like Facebook continue to dominate merely because of their network effects, or is having a single dominant social network more efficient in the same way that having a single operator for a subway system is more efficient? + +Which finally brings me back to FOAF. Much of the world seems to have forgotten about the FOAF standard, but FOAF was an attempt to build a decentralized and open social network before anyone had even heard of Facebook. If any decentralized social network ever had a chance of occupying the redoubt that Facebook now occupies before Facebook got there, it was FOAF. Given that a large fraction of humanity now has a Facebook account, and given that relatively few people know about FOAF, should we conclude that social networking, like subway travel, really does lend itself to centralization and natural monopoly? Or does the FOAF project demonstrate that decentralized social networking was a feasible alternative that never became popular for other reasons? + +### The Future from the Early Aughts + +The FOAF project, begun in 2000, set out to create a universal standard for describing people and the relationships between them. That might strike you as a wildly ambitious goal today, but aspirations like that were par for the course in the late 1990s and early 2000s. The web (as people still called it then) had just trounced closed systems like America Online and [Prodigy][3]. It could only have been natural to assume that further innovation in computing would involve the open, standards-based approach embodied by the web. + +Many people believed that the next big thing was for the web to evolve into something called the Semantic Web. [I have written about][4] what exactly the Semantic Web was supposed to be and how it was supposed to work before, so I won’t go into detail here. But I will sketch the basic vision motivating the people who worked on Semantic Web technologies, because the FOAF standard was an application of that vision to social networking. + +There is an essay called [“How Google beat Amazon and Ebay to the Semantic Web”][5] that captures the lofty dream of the Semantic Web well. It was written by Paul Ford in 2002. The essay imagines a future (as imminent as 2009) in which Google, by embracing the Semantic Web, has replaced Amazon and eBay as the dominant e-commerce platform. In this future, you can search for something you want to purchase—perhaps a second-hand Martin guitar—by entering `buy:martin guitar` into Google. Google then shows you all the people near your zipcode selling Martin guitars. Google knows about these people and their guitars because Google can read RDF, a markup language and core Semantic Web technology focused on expressing relationships. Regular people can embed RDF on their web pages to advertise (among many other things) the items they have to sell. Ford predicts that as the number of people searching for and advertising products this way grows, Amazon and eBay will lose their near-monopolies over, respectively, first-hand and second-hand e-commerce. Nobody will want to search a single centralized database for something to buy when they could instead search the whole web. Even Google, Ford writes, will eventually lose its advantage, because in theory anyone could crawl the web reading RDF and offer a search feature similar to Google’s. At the very least, if Google wanted to make money from its Semantic Web marketplace by charging a percentage of each transaction, that percentage would probably by forced down over time by competitors offering a more attractive deal. + +Ford’s imagined future was an application of RDF, or the Resource Description Framework, to e-commerce, but the exciting thing about RDF was that hypothetically it could be used for anything. The RDF standard, along with a constellation of related standards, once widely adopted, was supposed to blow open database-backed software services on the internet the same way HTML had blown open document publishing on the internet. + +One arena that RDF and other Semantic Web technologies seemed poised to takeover immediately was social networking. The FOAF project, known originally as “RDF Web Ring” before being renamed, was the Semantic Web effort offshoot that sought to accomplish this. FOAF was so promising in its infancy that some people thought it would inevitably make all other social networking sites obsolete. A 2004 Guardian article about the project introduced FOAF this way: + +> In the beginning, way back in 1996, it was SixDegrees. Last year, it was Friendster. Last week, it was Orkut. Next week, it could be Flickr. All these websites, and dozens more, are designed to build networks of friends, and they are currently at the forefront of the trendiest internet development: social networking. But unless they can start to offer more substantial benefits, it is hard to see them all surviving, once the Friend Of A Friend (FOAF) standard becomes a normal part of life on the net.[2][6] + +The article goes on to complain that the biggest problem with social networking is that there are too many social networking sites. Something is needed that can connect all of the different networks together. FOAF is the solution, and it will revolutionize social networking as a result. + +FOAF, according to the article, would tie the different networks together by doing three key things: + + * It would establish a machine-readable format for social data that could be read by any social networking site, saving users from having to enter this information over and over again + * It would allow “personal information management programs,” i.e. your “Contacts” application, to generate a file in this machine-readable format that you could feed to social networking sites + * It would further allow this machine-readable format to be hosted on personal homepages and read remotely by social networking sites, meaning that you would be able to keep your various profiles up-to-date by just pushing changes to your own homepage + + + +It is hard to believe today, but the problem in 2004, at least for savvy webizens and technology columnists aware of all the latest sites, was not the lack of alternative social networks but instead the proliferation of them. Given _that_ problem—so alien to us now—one can see why it made sense to pursue a single standard that promised to make the proliferation of networks less of a burden. + +### The FOAF Spec + +According to the description currently given on the FOAF project’s website, FOAF is “a computer language defining a dictionary of people-related terms that can be used in structured data.” Back in 2000, in a document they wrote to explain the project’s goals, Dan Brickley and Libby Miller, FOAF’s creators, offered a different description that suggests more about the technology’s ultimate purpose—they introduced FOAF as a tool that would allow computers to read the personal information you put on your homepage the same way that other humans do.[3][7] FOAF would “help the web do the sorts of things that are currently the proprietary offering of centralised services.”[4][8] By defining a standard vocabulary for people and the relationships between them, FOAF would allow you to ask the web questions such as, “Find me today’s web recommendations made by people who work for Medical organizations,” or “Find me recent publications by people I’ve co-authored documents with.” + +Since FOAF is a standardized vocabulary, the most important output of the FOAF project was the FOAF specification. The FOAF specification defines a small collection of RDF _classes_ and RDF _properties_. (I’m not going to explain RDF here, but again see [my post about the Semantic Web][4] if you want to know more.) The RDF _classes_ defined by the FOAF specification represent subjects you might want to describe, such as people (the `Person` class) and organizations (the `Organization` class). The RDF _properties_ defined by the FOAF specification represent logical statements you might make about the different subjects. A person could have, for example, a first name (the `givenName` property), a last name (the `familyName` property), perhaps even a personality type (the `myersBriggs` property), and be near another person or location (the `based_near` property). The idea was that these classes and properties would be sufficient to represent the kind of the things people say about themselves and their friends on their personal homepage. + +The FOAF specification gives the following as an example of a well-formed FOAF document. This example uses XML, though an equivalent document could be written using JSON or a number of other formats: + +``` + + Dan Brickley + + + + +``` + +This FOAF document describes a person named “Dan Brickley” (one of the specification’s authors) that has a homepage at `http://danbri.org`, something called an “open ID,” and a picture available at `/images/me.jpg`, presumably relative to the base address of Brickley’s homepage. The FOAF-specific terms are prefixed by `foaf:`, indicating that they are part of the FOAF namespace, while the more general RDF terms are prefixed by `rdf:`. + +Just to persuade you that FOAF isn’t tied to XML, here is a similar FOAF example from Wikipedia, expressed using a format called JSON-LD[5][9]: + +``` +{ + "@context": { + "name": "http://xmlns.com/foaf/0.1/name", + "homepage": { + "@id": "http://xmlns.com/foaf/0.1/workplaceHomepage", + "@type": "@id" + }, + "Person": "http://xmlns.com/foaf/0.1/Person" + }, + "@id": "https://me.example.com", + "@type": "Person", + "name": "John Smith", + "homepage": "https://www.example.com/" +} +``` + +This FOAF document describes a person named John Smith with a homepage at `www.example.com`. + +Perhaps the best way to get a feel for how FOAF works is to play around with [FOAF-a-matic][10], a web tool for generating FOAF documents. It allows you to enter information about yourself using a web form, then uses that information to create the FOAF document (in XML) that represents you. FOAF-a-matic demonstrates how FOAF could have been used to save everyone from having to enter their social information into a web form ever again—if every social networking site could read FOAF, all you’d need to do to sign up for a new site is point the site to the FOAF document that FOAF-a-matic generated for you. + +Here is a slightly more complicated FOAF example, representing me, that I created using FOAF-a-matic: + +``` + + + + + + + + + Sinclair Target + Sinclair + Target + + + + + John Smith + + + + + + +``` + +This example has quite a lot of preamble setting up the various XML namespaces used by the document. There is also a section containing data about the tool that was used to generate the document, largely so that, it seems, people know whom to email with complaints. The `foaf:Person` element describing me tells you my name, email address, and homepage. There is also a nested `foaf:knows` element telling you that I am friends with John Smith. + +This example illustrates another important feature of FOAF documents: They can link to each other. If you remember from the previous example, my friend John Smith has a homepage at `www.example.com`. In this example, where I list John Smith as a `foaf:person` with whom I have a `foaf:knows` relationship, I also provide a `rdfs:seeAlso` element that points to John Smith’s FOAF document hosted on his homepage. Because I have provided this link, any program reading my FOAF document could find out more about John Smith by following the link and reading his FOAF document. In the FOAF document we have for John Smith above, John did not provide any information about his friends (including me, meaning, tragically, that our friendship is unidirectional). But if he had, then the program reading my document could find out not only about me but also about John, his friends, their friends, and so on, until the program has crawled the whole social graph that John and I inhabit. + +This functionality will seem familiar to anyone that has used Facebook, which is to say that this functionality will seem familiar to you. There is no `foaf:wall` property or `foaf:poke` property to replicate Facebook’s feature set exactly. Obviously, there is also no slick blue user interface that everyone can use to visualize their FOAF social network; FOAF is just a vocabulary. But Facebook’s core feature—the feature that I have argued is key to Facebook’s monopoly power over, at the very least, myself—is here provided in a distributed way. FOAF allows a group of friends to represent their real-life social graph digitally by hosting FOAF documents on their own homepages. It allows them to do this without surrendering control of their data to a centralized database in the sky run by a billionaire android-man who spends much of his time apologizing before congressional committees. + +### FOAF on Ice + +If you visit the current FOAF project homepage, you will notice that, in the top right corner, there is an image of the character Fry from the TV series Futurama, stuck inside some sort of stasis chamber. This is a still from the pilot episode of Futurama, in which Fry gets frozen in a cryogenic tank in 1999 only to awake a millennium later in 2999. Brickley, whom I messaged briefly on Twitter, told me that he put that image there as a way communicating that the FOAF project is currently “in stasis,” though he hopes that there will be a future opportunity to resuscitate the project along with its early 2000s optimism about how the web should work. + +FOAF never revolutionized social networking the way that the 2004 Guardian article about it expected it would. Some social networking sites decided to support the standard: LiveJournal and MyOpera are examples.[6][11] FOAF even played a role in Howard Dean’s presidential campaign in 2004—a group of bloggers and programmers got together to create a network of websites they called “DeanSpace” to promote the campaign, and these sites used FOAF to keep track of supporters and volunteers.[7][12] But today FOAF is known primarily for being one of the more widely used vocabularies of RDF, itself a niche standard on the modern web. If FOAF is part of your experience of the web today at all, then it is as an ancestor to the technology that powers Google’s “knowledge panels” (the little sidebars that tell you the basics about a person or a thing if you searched for something simple). Google uses vocabularies published by the schema.org project—the modern heir to the Semantic Web effort—to populate its knowledge panels.[8][13] The schema.org vocabulary for describing people seems to be somewhat inspired by FOAF and serves many of the same purposes. + +So why didn’t FOAF succeed? Why do we all use Facebook now instead? Let’s ignore that FOAF is a simple standard with nowhere near as many features as Facebook—that’s true today, clearly, but if FOAF had enjoyed more momentum it’s possible that applications could have been built on top of it to deliver a Facebook-like experience. The interesting question is: Why didn’t this nascent form of distributed social networking catch fire when Facebook was not yet around to compete with it? + +There probably is no single answer to that question, but if I had to pick one, I think the biggest issue is that FOAF only makes sense on a web where everyone has a personal website. In the late 1990s and early 2000s, it might have been easy to assume the web would eventually look like this, especially since so many of the web’s early adopters were, as far as I can tell, prolific bloggers or politically engaged technologists excited to have a platform. But the reality is that regular people don’t want to have to learn how to host a website. FOAF allows you to control your own social information and broadcast it to social networks instead of filling out endless web forms, which sounds pretty great if you already have somewhere to host that information. But most people in practice found it easier to just fill out the web form and sign up for Facebook than to figure out how to buy a domain and host some XML. + +What does this mean for my original question about whether or not Facebook’s monopoly is a natural one? I think I have to concede that the FOAF example is evidence that social networking _does_ naturally lend itself to monopoly. + +That people did not want to host their own data isn’t especially meaningful itself—modern distributed social networks like [Mastodon][14] have solved that problem by letting regular users host their profiles on nodes set up by more savvy users. It is a sign, however, of just how much people hate complexity. This is bad news for decentralized social networks, because they are inherently more complex under the hood than centralized networks in a way that is often impossible to hide from users. + +Consider FOAF: If I were to write an application that read FOAF data from personal websites, what would I do if Sally’s FOAF document mentions a John Smith with a homepage at `example.com`, and Sue’s FOAF document mentions a John Smith with a homepage at `example.net`? Are we talking about a single John Smith with two websites or two entirely different John Smiths? What if the both FOAF documents list John Smith’s email as `johnsmith@gmail.com`? This issue of identity was an acute one for FOAF. In a 2003 email, Brickley wrote that because there does not exist and probably should not exist a “planet-wide system for identifying people,” the approach taken by FOAF is “pluralistic.”[9][15] Some properties of FOAF people, such as email addresses and homepage addresses, are special in that their values are globally unique. So these different properties can be used to merge (or, as Libby Miller called it, “smoosh”) FOAF documents about people together. But none of these special properties are privileged above the others, so it’s not obvious how to handle our John Smith case. Do we trust the homepages and conclude we have two different people? Or do we trust the email addresses and conclude we have a single person? Could I really write an application capable of resolving this conflict without involving (and inconveniencing) the user? + +Facebook, with its single database and lack of political qualms, could create a “planet-wide system for identifying people” and so just gave every person a unique Facebook ID. Problem solved. + +Complexity alone might not doom distributed social networks if people cared about being able to own and control their data. But FOAF’s failure to take off demonstrates that people have never valued control very highly. As one blogger has put it, “‘Users want to own their own data’ is an ideology, not a use case.”[10][16] If users do not value control enough to stomach additional complexity, and if centralized systems are more simple than distributed ones—and if, further, centralized systems tend to be closed and thus the successful ones enjoy powerful network effects—then social networks are indeed natural monopolies. + +That said, I think there is still a distinction to be drawn between the subway system case and the social networking case. I am comfortable with the MTA’s monopoly on subway travel because I expect subway systems to be natural monopolies for a long time to come. If there is going to be only one operator of the New York City Subway, then it ought to be the government, which is at least nominally more accountable than a private company with no competitors. But I do not expect social networks to stay natural monopolies. The Subway is carved in granite; the digital world is writ in water. Distributed social networks may now be more complicated than centralized networks in the same way that carrying two MetroCards is more complicated than carrying one. In the future, though, the web, or even the internet, could change in fundamental ways that make distributed technology much easier to use. + +If that happens, perhaps FOAF will be remembered as the first attempt to build the kind of social network that humanity, after a brief experiment with corporate mega-databases, does and always will prefer. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][17] on Twitter or subscribe to the [RSS feed][18] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> I know it's been too long since my last post, but my new one is here! I wrote almost 5000 words on John Carmack, Doom, and the history of the binary space partitioning tree. +> +> — TwoBitHistory (@TwoBitHistory) [November 6, 2019][19] + + 1. Please note that I did not dare say “dead.” [↩︎][20] + + 2. Jack Schofield, “Let’s be Friendsters,” The Guardian, February 19, 2004, accessed January 5, 2020, . [↩︎][21] + + 3. Dan Brickley and Libby Miller, “Introducing FOAF,” FOAF Project, 2008, accessed January 5, 2020, . [↩︎][22] + + 4. ibid. [↩︎][23] + + 5. Wikipedia contributors, “JSON-LD,” Wikipedia: The Free Encyclopedia, December 13, 2019, accessed January 5, 2020, . [↩︎][24] + + 6. “Data Sources,” FOAF Project Wiki, December 11 2009, accessed January 5, 2020, . [↩︎][25] + + 7. Aldon Hynes, “What is Dean Space?”, Extreme Democracy, accessed January 5, 2020, . [↩︎][26] + + 8. “Understand how structured data works,” Google Developer Portal, accessed January 5, 2020, . [↩︎][27] + + 9. tef, “Why your distributed network will not work,” Progamming is Terrible, January 2, 2013, . [↩︎][28] + + 10. Dan Brickley, “Identifying things in FOAF,” rdfweb-dev Mailing List, July 10, 2003, accessed on January 5, 2020, . [↩︎][29] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2020/01/05/foaf.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: tmp.k5HszJyQ4D#fn:1 +[2]: https://en.wikipedia.org/wiki/Fediverse +[3]: https://en.wikipedia.org/wiki/Prodigy_(online_service) +[4]: https://twobithistory.org/2018/05/27/semantic-web.html +[5]: https://www.ftrain.com/google_takes_all +[6]: tmp.k5HszJyQ4D#fn:2 +[7]: tmp.k5HszJyQ4D#fn:3 +[8]: tmp.k5HszJyQ4D#fn:4 +[9]: tmp.k5HszJyQ4D#fn:5 +[10]: http://www.ldodds.com/foaf/foaf-a-matic +[11]: tmp.k5HszJyQ4D#fn:6 +[12]: tmp.k5HszJyQ4D#fn:7 +[13]: tmp.k5HszJyQ4D#fn:8 +[14]: https://en.wikipedia.org/wiki/Mastodon_(software) +[15]: tmp.k5HszJyQ4D#fn:9 +[16]: tmp.k5HszJyQ4D#fn:10 +[17]: https://twitter.com/TwoBitHistory +[18]: https://twobithistory.org/feed.xml +[19]: https://twitter.com/TwoBitHistory/status/1192196764239093760?ref_src=twsrc%5Etfw +[20]: tmp.k5HszJyQ4D#fnref:1 +[21]: tmp.k5HszJyQ4D#fnref:2 +[22]: tmp.k5HszJyQ4D#fnref:3 +[23]: tmp.k5HszJyQ4D#fnref:4 +[24]: tmp.k5HszJyQ4D#fnref:5 +[25]: tmp.k5HszJyQ4D#fnref:6 +[26]: tmp.k5HszJyQ4D#fnref:7 +[27]: tmp.k5HszJyQ4D#fnref:8 +[28]: tmp.k5HszJyQ4D#fnref:9 +[29]: tmp.k5HszJyQ4D#fnref:10 From ff78995b346ce77f6db2b91bf4e1e41626b6ce28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 7 Jan 2020 08:14:14 +0800 Subject: [PATCH 0129/3057] Translated --- ...n Source Disk Partitioning Tool GParted.md | 116 ------------------ ...n Source Disk Partitioning Tool GParted.md | 116 ++++++++++++++++++ 2 files changed, 116 insertions(+), 116 deletions(-) delete mode 100644 sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md create mode 100644 translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md diff --git a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md deleted file mode 100644 index fe72f5695a..0000000000 --- a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md +++ /dev/null @@ -1,116 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) -[#]: via: (https://itsfoss.com/gparted/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -App Highlight: Open Source Disk Partitioning Tool GParted -====== - -_**Brief: GParted is an incredibly popular and free partition editor available for Linux distros. Here, we take a look at what it offers in brief.**_ - -### GParted: A Free & Open-Source GUI-based Partition Manager - -![][1] - -GParted is undoubtedly one of the [best partition managers for Linux][2] out there. The user interface is very simple and gets the job done. - -In some cases, you end up using [GParted][3] to fix or format your USB drive as well. I had a [USB disk which I couldn’t format in Ubuntu][4] using the “Disks” app – this is where GParted came to the rescue. - -So, it is a quite useful tool with a lot of good features. Let me highlight them for you. - -Warning! - -Playing with disk partitioning is a risky task. Don’t do it unless it’s absolutely necessary. Or else, you might just end up wiping the entire disk. - -### Features of GParted - -You can do a lot of things with GParted, ranging from a simple format task to important partitioning tasks. I’ll highlight the key features with some screenshots to help you know more about it before installing it. - -#### Create partition tables - -You can create a new partition table for your new disks or erase the content of your existing disk to modify the partition table. - -![][5] - -You will be able to select msdos, gpt, atari, and a lot more types of partition tables. - -#### Create, move, label, delete & modify partitions - -You can easily create, label, delete or modify the partitions with a bunch of options available within GParted. - -![][6] - -Of course, you will have to be careful about what you want to do. - -The good thing is that GParted makes sure that you do not directly apply any changes – it queues up your selected operations/tasks and asks for another final confirmation before you hit it. - -The tick mark symbol ✓on the top allows you to confirm the changes and then only your changes take into effect. - -Here’s another screenshot for the options you have available for the partitions: - -![][7] - -#### Attempt data rescue - -Apart from editing partitions, you can also try to [recover your lost data in Linux][8] using the “**Attempt Data Rescue**” feature as shown in the screenshot below. - -![][9] - -It is worth noting that you do not have this feature installed by default – you only see the option visible. So, for the data recovery feature to work, you have to install gpart separately using the following command (on Ubuntu/Debian-based distributions): - -``` -sudo apt install gpart -``` - -In addition to all the key features, it supports a wide range of storage devices and filesystems. You can learn more about it from the [list of features][10] on their official website. - -### Installing GParted on Ubuntu and other Linux distributions - -You might have GParted pre-installed. So, make sure to verify that. If you do not have it installed, you can head into the software center to get it installed. - -In case you want to use the terminal, simply type in the following command: - -``` -sudo apt install gparted -``` - -As I mentioned above, if you want the data recovery option, you should install gpart package in addition to gparted package. - -If you’re using any other Linux distribution, you can either find it in the respective software manager or simply check out the [official download instructions][11]. - -[Download GParted][11] - -**Wrapping Up** - -GParted is a very useful and important tool when it comes to dealing with disk management and partitions. However, you will have to be careful while using it for the obvious reasons. - -Have you tried GParted? Which other partitioning tool you use on Linux? Feel free to share your experiences in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gparted/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-screenshot.png?ssl=1 -[2]: https://itsfoss.com/partition-managers-linux/ -[3]: https://gparted.org/ -[4]: https://itsfoss.com/format-usb-drive-sd-card-ubuntu/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-create-partition-table.png?ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-modify-partitions.png?ssl=1 -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-partition-options.png?ssl=1 -[8]: https://itsfoss.com/recover-deleted-files-linux/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-attempt-data-rescue-feature.png?ssl=1 -[10]: https://gparted.org/features.php -[11]: https://gparted.org/download.php diff --git a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md new file mode 100644 index 0000000000..6fa07d80a3 --- /dev/null +++ b/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) +[#]: via: (https://itsfoss.com/gparted/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +应用程序推荐:开源磁盘分区工具 GParted +====== + +_**摘要:GParted 是一个非常流行的自由的可用于 Linux 发行版的分区编辑器。在这里,我们简单地看看它提供了什么。**_ + +### GParted:一个基于自由和开放源码的图形化分区管理器 + +![][1] + +GParted 无疑是[在 Linux 下的最好的分区管理器][2]之一。用户界面非常简单,可用完成任务。 + +在一些情况下,你最终也需要使用 [GParted][3] 来修复或格式化你的 USB 驱动器。我有一个[我不能在 Ubuntu 中格式化的 USB 磁盘][4],使用该“磁盘”应用程序 – 这里是 GParted 用来救援的地方。 + +所以,它是非常有用的工具,有很多好的特色。让我为你们推荐一下。 + +警告! + +玩弄磁盘分区是一件危险的工作。除非绝对必要,否则不要做。否则,你可能最终会擦除整个磁盘。 + +### GParted 的特色 + +你可以使用 GParted 做很多事,排列一下简单地格式化任务到重要的分区任务。我将使用一些屏幕截图推荐关键特色,以帮助你在安装它前了解更多信息。 + +#### 创建分区表 + +你可以为你的新的磁盘创建一个新的分区表,或者擦除你现存的磁盘内容来修改分区表。 + +![][5] + +你将能够选择 msdos ,gpt ,atari ,以及更多类型的分区表。 + +#### 创建,移动,标记,删除和修改分区表 + +你可以使用 GParted 中一系列可用的选项来简单地创建,标记,删除或修改分区表。 + +![][6] + +当然,你将不得不小心你想做什么。 + +好的一些东西是,GParted 确保你不能直接应用任何更改 – 在你点击应用更改之前,它将排队你选择的操作/任务,并询问另外一处最后的确认。 + +在顶部的对号标记符号 ✓ 允许你来确认更改,只有你更改时开始生效。 + +这样有另一个你可用的分区选项的屏幕截图: + +![][7] + +#### 尝试数据救援 + +除了编辑分区,你也可以尝试使用“**尝试数据救援**”特色以[在Linux 中恢复你丢失的数据][8],像下面的屏幕截图所示。 + +![][9] + +值得注意的是,默认情况下你没有安装这个功能 – 你仅能看到可见的选项。所以,对于数据恢复特色作业来说,你必需使用下面的命令来单独地安装 gpart (在基于 Ubuntu/Debian 的发行版上): + +``` +sudo apt install gpart +``` + +除了所有关键的特色外,它支持大量的存储设备和文件系统。在它们的官方网站上,你可以从[特色列表][10]中学到很多。 + +### 在 Ubuntu 和其它 Linux 发行版上安装 GParted + +你可能已经预先安装 GParted 。所以,务必核实一下。如果你没有安装它,你可以前往进入软件中心安装它。 + +以备你想使用终端,简单地键入下面的命令: + +``` +sudo apt install gparted +``` + +像我如上所述,如果你想要数据恢复选项,除了 gparted 软件包外,你应该安装 gpart 软件包。 + +如果你正在使用一些其它 Linux 发行版,你可以在各自的软件管理器中找到它,或者简单地查看[官方下载操作指南][11]。 + +[下载 GParted][11] + +**总结** + +当涉及处理磁盘管理和分区时,GParted 是一个非常有用和重要的工具。但是,因为显而易见的原因,当你使用它时,你将不得不小心。 + +你尝试过 GParted 吗?你在 Linux 上使用的其它分区工具是什么?请在下面的评论中分享你的体验。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gparted/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-screenshot.png?ssl=1 +[2]: https://itsfoss.com/partition-managers-linux/ +[3]: https://gparted.org/ +[4]: https://itsfoss.com/format-usb-drive-sd-card-ubuntu/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-create-partition-table.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-modify-partitions.png?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-partition-options.png?ssl=1 +[8]: https://itsfoss.com/recover-deleted-files-linux/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-attempt-data-rescue-feature.png?ssl=1 +[10]: https://gparted.org/features.php +[11]: https://gparted.org/download.php From e2970c5d5149b477378c48886ab4c41dacaa6ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 7 Jan 2020 08:25:42 +0800 Subject: [PATCH 0130/3057] Translating --- sources/tech/20191121 Simulate gravity in your Python game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191121 Simulate gravity in your Python game.md b/sources/tech/20191121 Simulate gravity in your Python game.md index 977c234d8d..45e4b4ce50 100644 --- a/sources/tech/20191121 Simulate gravity in your Python game.md +++ b/sources/tech/20191121 Simulate gravity in your Python game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1f3269c9014cacb7cab002a2ffe3ffd69ec976e6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 7 Jan 2020 08:44:15 +0800 Subject: [PATCH 0131/3057] translated --- ...et- Screen Recorder. Here-s How to Use it.md | 103 ----------------- ...et- Screen Recorder. Here-s How to Use it.md | 104 ++++++++++++++++++ 2 files changed, 104 insertions(+), 103 deletions(-) delete mode 100644 sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md create mode 100644 translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md diff --git a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md deleted file mode 100644 index f761c28dd1..0000000000 --- a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) -[#]: via: (https://itsfoss.com/gnome-screen-recorder/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it! -====== - -[GNOME][1] is one of the [most popular desktop environments][2] and for good reasons. It has a modern UI and it comes with a number of GNOME-specific applications that blend well with the overall desktop appearance. - -You can [tweak GNOME][3] to your liking as much as you want but I am not here to discuss that. GNOME desktop has some hidden features that you probably are not aware of. - -One of such not-so-obvious feature is a built in screen recorder. - -Yes, you read that right. If you are using GNOME desktop, you don’t necessarily need to install other [screen recorders in Linux][4]. You just need to know the correct keyboard shortcut. - -### Instantly record your screen with GNOME Screen Recorder - -To quickly access the GNOME screen recorder, you have to press this [keyboard shortcut in Ubuntu][5] or other distributions using GNOME desktop: - -``` -Ctrl + Alt + Shift + R -``` - -This will immediately start recording your desktop. You can tell that the screen recording is in progress by looking at the red dot in the system tray area of the top panel: - -![The red dot in the system tray area indicates that screen recording is in progress][6] - -#### Increase the screencast duration - -The default maximum record time is just 30 seconds. It can be increased though. - -Open a terminal and use the following command: - -``` -gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300 -``` - -In the above command, I have increased the maximum length of the recording to 300 seconds (i.e. 5 minutes). You can change it to any other value but it should be in seconds. - -If you **don’t want any limit on the maximum recording time, set it to 0** and then the recording won’t stop until you manually stop it or your disk runs out of space. - -#### Stop the screen recording - -As I mentioned, your desktop recording will stop automatically after it reaches the maximum time limit. - -To stop the recording before that, you can press the same key combination: - -``` -Ctrl + Alt + Shift + R -``` - -Your recordings are saved in [webm][7] format in the Videos folder of your Home directory. - -#### Limitations - -While it might be handy to record your desktop quickly with this handy little tool, it has its several limitations when compared to a full-fledged screen recording tool like [Simple Screen Recorder][8]. - - * There is no time delay option before the recording starts - * There is no pause and play option - * It records the entire screen. No option to record only an application window or a ceratin area or a certain monitor (if you have a multi-monitor setup). - * Videos are saved in webm format in the user’s Videos directory. You cannot change it. You’ll have to use a tool like [HandBrake to convert the videos to other format][9]. - - - -As you can see, the secret GNOME screen recorder is no where near to the features provided by the likes of [Kazam][10] or other such tools. - -But it doesn’t try to be a full-fledged screen recorder. It just provides you a quick way of recording a small screencast. That’s it. - -GNOME is a versatile modern desktop environments. You can [tweak GNOME][3] extensively. The [GNOME Extensions][11] provide another dimension to the desktop customization. - -This screen recorder is one of the hidden features of GNOME like the suspend option that you won’t easily find on your own. - -_How do you like it? Do you know some other hidden GNOME features that you would like to share with us? The comment section is all yours._ - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gnome-screen-recorder/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://gnome.org/ -[2]: https://itsfoss.com/best-linux-desktop-environments/ -[3]: https://itsfoss.com/gnome-tweak-tool/ -[4]: https://itsfoss.com/best-linux-screen-recorders/ -[5]: https://itsfoss.com/ubuntu-shortcuts/ -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/gnome_screen_recording.jpg?ssl=1 -[7]: https://www.webmproject.org/about/ -[8]: https://itsfoss.com/record-screen-ubuntu-simplescreenrecorder/ -[9]: https://itsfoss.com/handbrake/ -[10]: https://itsfoss.com/kazam-screen-recorder/ -[11]: https://itsfoss.com/best-gnome-extensions/ diff --git a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md new file mode 100644 index 0000000000..84d72051eb --- /dev/null +++ b/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) +[#]: via: (https://itsfoss.com/gnome-screen-recorder/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +GNOME 有一个“秘密”的屏幕录像机。下面是使用方法! +====== + +[GNOME][1]是[最受欢迎的桌面环境][2]之一。它有现代的 UI,并且带有许多特定于 GNOME 的应用,这些应用与桌面整体外观完美融合。 + +你可以根据自己的喜好来[调整 GNOME][3],但我不在这里讨论。GNOME 桌面有一些你可能不知道的隐藏功能。 + +这种不太明显的功能之一是内置的屏幕录像机。 + +是的,你没有看错。如果你使用的是 GNOME 桌面,那么不必安装其他的 [Linux 屏幕录像机][4]。你只需要知道正确的快捷键即可。 + +### 立即使用 GNOME 屏幕录像机录制屏幕 + +要快速打开 GNOME 屏幕录像机,你需要[在 Ubuntu 或其他带有 GNOME 桌面的发行版中按下此快捷键][5]: + +``` +Ctrl + Alt + Shift + R +``` + +这将会立即开始录制你的桌面。你可以通过顶部的系统托盘区域的红点了解到正在录制: + +![The red dot in the system tray area indicates that screen recording is in progress][6] + +#### 增加录制时间 + +默认的最大录制时间仅为 30 秒。但是可以增加。 + +打开终端并使用以下命令: + +``` +gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300 +``` + +在上面的命令中,我将录音的最大长度增加到 300 秒(即5分钟)。你可以将其更改为任何其他值,但应以秒为单位。 + +如果你**不希望最长录音时间有任何限制,请将其设置为0**,之后它会在你手动停止或者磁盘空间不足才会停止。 + +#### 停止屏幕录制 + +如前所述,你的桌面录制将在达到最大时间限制后自动停止。 + +要在此之前停止录制,你可以按下相同的组合键: + +``` +Ctrl + Alt + Shift + R +``` + +你的录制内容将以 [webm][7 ]格式保存在家目录的 “Videos” 文件夹中。 + +#### 局限性 + +尽管使用这个小工具可以方便地快速录制桌面,但是与功能强大的 [Simple Screen Recorder][8] 这样的屏幕录制工具相比,它有一些局限性。 + + + * 录制开始之前没有时间延迟选项 +  * 没有暂停和播放选项 +  * 它录制整个屏幕。无法仅录制应用窗口、特定区域或特定屏幕(如果你有多个屏幕)。 +  * 视频以 webm 格式保存在用户的 “Videos” 目录中。你无法更改。你必须使用 [HandBrake 之类的工具将视频转换为其他格式][9]。 + + + +如你所见,秘密的 GNOME 屏幕录像机与 [Kazam][10] 之类的工具或其他此类工具所提供的功能相差很远。 + +但是,它并不会尝试成为全功能的屏幕录像机。它只是为你提供录制屏幕的快速方法。 + +GNOME 是一个多功能的现代桌面环境。你可以大量地[调整 GNOME][3]。[GNOME 扩展][11]为桌面自定义提供了另一个维度。 + +该屏幕录像机是 GNOME 的隐藏功能之一,就像你自己很难轻易找到的挂起选项。 + +_你喜欢它吗?你是否还想与我们分享其他隐藏的 GNOME 功能?请在评论区留言。_ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-screen-recorder/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://gnome.org/ +[2]: https://itsfoss.com/best-linux-desktop-environments/ +[3]: https://itsfoss.com/gnome-tweak-tool/ +[4]: https://itsfoss.com/best-linux-screen-recorders/ +[5]: https://itsfoss.com/ubuntu-shortcuts/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/gnome_screen_recording.jpg?ssl=1 +[7]: https://www.webmproject.org/about/ +[8]: https://itsfoss.com/record-screen-ubuntu-simplescreenrecorder/ +[9]: https://itsfoss.com/handbrake/ +[10]: https://itsfoss.com/kazam-screen-recorder/ +[11]: https://itsfoss.com/best-gnome-extensions/ From 83fab6c4a597314ba0e57516a697b2b45cbfb722 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 7 Jan 2020 08:54:37 +0800 Subject: [PATCH 0132/3057] translating --- ...200103 My Raspberry Pi retrospective- 6 projects and more.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md index b68e15a924..181276fb45 100644 --- a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md +++ b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 98fade2a5db741a607d63a5ccee3a42983da5195 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 09:00:12 +0800 Subject: [PATCH 0133/3057] TSL --- ...191130 7 maker gifts for kids and teens.md | 185 ------------------ ...191130 7 maker gifts for kids and teens.md | 176 +++++++++++++++++ 2 files changed, 176 insertions(+), 185 deletions(-) delete mode 100644 sources/tech/20191130 7 maker gifts for kids and teens.md create mode 100644 translated/tech/20191130 7 maker gifts for kids and teens.md diff --git a/sources/tech/20191130 7 maker gifts for kids and teens.md b/sources/tech/20191130 7 maker gifts for kids and teens.md deleted file mode 100644 index 72a9debb38..0000000000 --- a/sources/tech/20191130 7 maker gifts for kids and teens.md +++ /dev/null @@ -1,185 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 maker gifts for kids and teens) -[#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) -[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) - -7 maker gifts for kids and teens -====== -Make your holiday gift shopping easy with this guide to gifts sure to -spark creativity and innovation in babies, kids, tweens, teens, and -beyond. -![Gift box opens with colors coming out][1] - -Struggling with what gifts to give the young person in your life this holiday season? Here are my top picks for open source presents that will spark creativity and inspire for years to come. - -### Hummingbird Robotics Kit - -![Hummingbird Robotics Kit][2] - -**Ages**: 8 to adult - -**What it is:** The [Hummingbird Robotics Kit][3] is a complete robotics kit with a microcontroller, motors, LEDs, and sensors. The robot brain has special ports that little hands can easily attach robot components to. The Hummingbird kits don't come with a body, empowering users to create their own. - -**Why I love it:** The Hummingbird works with multiple programming languages—from visual (BirdBlox, MakeCode, Snap) to text (Python and Java)— making it scalable as users' coding skills increase. All the components are exactly as you'd find them at an electronics store, not obscured by plastic like other robot kits. This demystifies the inner workings of robots and makes it easy to source more parts if needed. - -Because there is no set project, the Hummingbird is the perfect robot for creativity. - -The Hummingbird Bit has open source software and firmware. It works on Linux, Windows, Mac, Chromebook, Android, and iOS. - -**Cost:** Starts at US$ 99. - -### Makey Makey Classic - -![Makey Makey Classic][4] - -**Ages:** 6 to adult - -**What it is:** [Makey Makey Classic][5] turns any conductive object, from marshmallows to a friend, into a computer key. - -You use alligator clips to connect the Makey Makey to the conductive object of your choice. Then, you close the circuit between the ground connection and any trigger key by touching both conductive objects at the same time. The Makey Makey is a good way to safely explore electricity at home while creating interesting ways to interact with your computer. - -**Why I love it:** Makey Makey can be paired with video games made in Scratch to create unique controllers that further immerse users in the game. The possibilities are endless, from instruments made of toilet rolls and foil to interactive art and stories. It works on Linux, Windows, and Mac computers with a USB port. - -**Cost:** US$ 49.95 - -### Arduino Uno - -![Arduino Uno][6] - -**Ages**: 10 to adult - -**What it is:** Arduinos are microcontrollers that can be purchased with or without an electronics kit, and they come in many different flavors, though I like the [Arduino Uno][7] the best. Additional components, such as LEDs, motors, and sensors can be purchased as needed from any electronics shop. - -**Why I love it:** The Arduino Uno is well-documented, so it's easy for makers to find tutorials online. The Arduino can bring a wide variety of electronic projects to life, from simple to complex. The Arduino features open source firmware and hardware. It works on Linux, Mac, and Windows. - -**Cost:** Starts at US$ 22.00 for the board. The overall cost varies depending on projects and skill level. - -### DIY maker kit - -![A maker kit assembled in a quick trip to the hardware store][8] - -**Ages**: 8 to adult - -**What it is:** Many of today's makers, creators, and programmers started out tinkering with objects that happened to be lying around. You can create an awesome maker kit for the young person in your life with a quick trip to the nearest electronics store. Here's what's in my maker kit: - - * Eye goggles - * Hammer - * Nails and screws - * Scraps of wood - * Screwdrivers - * Wire - * LEDs - * Piezo buzzer - * Motors - * AA battery pack with leads - * Wire cutters - * Cardboard - * Masking tape - * Scrap fabric - * Buttons - * Thread - * Needles - * Zippers - * Hooks - * A cool tackle box to store everything in - - - -**Why I love it: **Remember when you were a kid and your parents brought home an empty cardboard box that you turned into a spaceship or a house or a supercomputer? That's what a DIY maker kit can be for older kids. - -Raw components empower kids to experiment and use their imaginations. A DIY maker kit can be completely customized for the recipient. Be sure to throw in some components the giftee may have never thought to create with, like giving an avid sewer some LEDs or a woodworker fabric. - -**Cost:** Variable - -### Heuristic play basket - -![Heuristic play kit][9] - -**Ages:** 8 months to 5 years - -**What it is:** Heuristic play baskets are filled with interesting objects made from natural, non-toxic materials for infants and toddlers to explore using their five senses. It's open-ended, self-directed play at its best. The idea is that an adult will supervise (but not direct) a child's use of the basket and its items for a half-hour, then put the basket away until the next time. - -It's easy to create a lovely play basket with common household objects. Try to include items with varying textures, sounds, smells, shapes, and weights. Here are some ideas to get you started. - - * Colander or ridged wicker basket to hold everything - * Wooden spoon - * Metal whisks and spoons - * Scrubbing brush - * Sponge - * Small egg carton - * Cardboard tubes - * Small rolling pin - * Textured washcloth - * Rocks - * Handbells - * Crochet doily - * Small tin with a lid - - - -Play baskets should not include anything easily breakable or small enough to fit inside a paper towel roll, as these are choking hazards, and all objects should be cleaned thoroughly before being given to a child. - -**Why I love it:** Play baskets are fantastic for sensory development and helping young children ask questions and explore the world around them. This is an important part of developing a maker mindset! - -It's easy to obtain suitable items for a play basket; you probably already have many interesting objects in your home or at your nearest second-hand store. Toddlers will use their play baskets differently than infants. These objects will grow with children as they begin to mimic adult life and tell stories through their play. - -**Cost:** Variable - -### Hello Ruby - -![Hello Ruby book cover][10] - -**Ages**: 5–8 - -**What it is:** _[Hello Ruby][11]: Adventures in Coding_ is an illustrated book by Linda Liukas that introduces children to programming concepts through a fun narrative about a girl who encounters problems and friends, each of which represents code. Liukas' other _Hello Ruby_ books are subtitled _Expedition to the Internet_ and _Journey Inside the Computer_, and _Adventures in Coding_ has been published in more than 20 languages. - -**Why I love it:** The author accompanies the book with a number of free, fun, and unplugged activities that can be downloaded and printed out from the Hello Ruby website. These activities teach coding concepts and also touch on artistic expression, communication, and even time management. - -**Cost:** List price for the hardcover book is US$ 17.99, but you may find it at a lower price through local or online booksellers. - -### Girls Who Code: Learn to Code and Change the World - -![Girls Who Code book cover][12] - -**Ages**: 10 to adult - -**What it is:** Written by Reshma Saujani, the founder of Girls Who Code, _[Girls Who Code: Learn to Code and Change the World][13]_ gives practical information about the tech world for young girls (and boys). It covers a wide variety of topics, including coding languages, use-cases, terminology and vocabulary, career options, and profiles and interviews with people in the tech industry. - -**Why I love it:** This book tells the story of tech in ways even most websites meant for adults miss out on. Technology encompasses so many disciplines, and it's important for young people to understand they can use it to solve real-world problems and make a difference. - -**Cost:** List price for the hardcover book is US$ 17.99 and US$ 10.99 for the paperback, but you may find it at a lower price through local or online booksellers. - -I can see the brightness of curiosity in my six year old niece Shuchi's eyes when she explores a... - -Scratch is a free educational programming language for kids, available in 50 different languages... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/maker-gifts-kids - -作者:[Jess Weichler][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/cyanide-cupcake -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) -[2]: https://opensource.com/sites/default/files/uploads/hummingbird.png (Hummingbird Robotics Kit) -[3]: https://www.birdbraintechnologies.com/hummingbirdbit/ -[4]: https://opensource.com/sites/default/files/uploads/makeymakey2.jpg (Makey Makey Classic) -[5]: https://makeymakey.com/ -[6]: https://opensource.com/sites/default/files/uploads/arduinouno.jpg (Arduino Uno) -[7]: https://www.arduino.cc/ -[8]: https://opensource.com/sites/default/files/makerbox-makerkit.jpg (A maker kit assembled in a quick trip to the hardware store) -[9]: https://opensource.com/sites/default/files/makerbox-sensorykit.jpg (Heuristic play kit) -[10]: https://opensource.com/sites/default/files/uploads/helloruby2.jpg (Hello Ruby book cover) -[11]: https://www.helloruby.com/ -[12]: https://opensource.com/sites/default/files/uploads/girlswhocodebook.jpg (Girls Who Code book cover) -[13]: https://girlswhocode.com/book/girls-code-learn-code-change-world/ diff --git a/translated/tech/20191130 7 maker gifts for kids and teens.md b/translated/tech/20191130 7 maker gifts for kids and teens.md new file mode 100644 index 0000000000..59bc3fc837 --- /dev/null +++ b/translated/tech/20191130 7 maker gifts for kids and teens.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 maker gifts for kids and teens) +[#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +7 个给儿童和少年的创客礼物 +====== +> 这份礼物指南可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力,使你轻松完成节日礼物的采购。 + +![Gift box opens with colors coming out][1] + +还在纠结这个假期给年轻人买什么礼物?这是我精选的开源礼物,这些礼物将激发未来的创意和灵感。 + +### 蜂鸟机器人套件 + +![Hummingbird Robotics Kit][2] + +**年龄:**8 岁 - 成人 + +**这是什么:**[蜂鸟机器人套件][3]是一套完整的机器人套件,带有微控制器、电机、LED 和传感器。机器人的大脑具有特殊的端口,小手可以轻松地将其连接到机器人的组件上。蜂鸟套件并没有身体,鼓励用户自己创建一个。 + +**为什么我喜欢它:**蜂鸟可以使用多种编程语言 —— 从可视化编程(BirdBlox、MakeCode、Snap)到代码编程(Python 和 Java)—— 可以随着用户编码技能的提高而可扩展。所有组件均与你在电子商店中找到的组件完全相同,没有像其他机器人套件那样被塑料所遮盖。这使机器人的内部工作不再神秘,并在你需要时易于采购更多零件。 + +由于没有固定组合项目,因此蜂鸟是发挥创造力的完美机器人。 + +蜂鸟具有开源的软件和固件。它适用于 Linux、Windows、Mac、Chromebook、Android 和 iOS。 + +**费用:**起价为 99 美元。 + +### Makey Makey 经典版 + +![Makey Makey Classic][4] + +**年龄:** 6岁 - 成人 + +**这是什么:** [Makey Makey 经典版][5]可将任何导电物体(从棉花糖到朋友)变成计算机钥匙。 + +你可以使用鳄鱼夹将 Makey Makey 连接到你选择的导电物体上。然后,通过同时触摸两个导电物体来闭合接地和任何触发键之间的电路。Makey Makey 是一种安全的方法,可以安全地在家中探索电力,同时创造与计算机进行交互的有趣方式。 + +**为什么我喜欢它:** Makey Makey 可以与 Scratch 开发的视频游戏搭配使用,以创建独特的控制器,使用户进一步沉浸在游戏中。从用卫生纸卷和铝箔制成的工具到互动艺术和故事,可能性是无限的。它可以在具有 USB 端口的 Linux、Windows 和 Mac 计算机上使用。 + +**费用:** 49.95 美金 + +### Arduino Uno + +![Arduino Uno][6] + +**年龄:** 10 岁 - 成人 + +**这是什么:** Arduino 是随同电子套件购买的微控制器,也可以单独购买,它们具有多种版本,尽管我最喜欢[Arduino Uno][7]。可以根据需要从任何电子商店购买其他组件,例如 LED、电机和传感器。 + +**为什么我喜欢它:** Arduino Uno 的文档很完善,因此创客们很容易在线上找到教程。Arduino 可以实现从简单到复杂的各种电子项目。Arduino 具有开源的固件和硬件。它适用于 Linux、Mac 和 Windows。 + +**费用:**主板的起价为 22.00 美元。总成本取决于项目和技能水平。 + +### DIY 创客套件 + +![A maker kit assembled in a quick trip to the hardware store][8] + +**年龄**:8 岁 - 成人 + +**这是什么:**当今许多创客、发明家和程序员都是从碰巧修补附加的东西开始的。你可以快速前往最近的电子产品商店,为家里的年轻人创建一套出色的创客工具包。这是我的创客工具包中的内容: + +* 护目镜 +* 锤子 +* 钉子和螺丝 +* 碎木 +* 螺丝起子 +* 电线 +* LED +* 压电蜂鸣器 +* 马达 +* 带引线的AA电池组 +* 剪线钳 +* 纸板 +* 美纹纸胶带 +* 废布 +* 纽扣 +* 线程 +* 针 +* 拉链 +* 钩子 +* 一个很酷的工具盒,用来存放所有东西 +   +**我为什么喜欢它:**还记得小时候,你把父母带回家的空纸箱变成了宇宙飞船、房屋或超级计算机吗?这就是为大孩子们准备的 DIY 创客工具包。 + +原始的组件使孩子们可以尝试并运用他们的想象力。DIY 创客工具包可以完全针对接收者定制。可以放入一些接受这份礼品的人可能从未想到过用之发挥创意的某些组件,例如为下水道提供一些 LED 或木工结构。 + +**费用:**不等 + +### 启发式游戏篮 + +![Heuristic play kit][9] + +**年龄:** 8 个月至 5 岁 + +**这是什么:**启发式游戏篮充满了由天然、无毒材料制成的有趣物品,可供婴幼儿使用其五种感官进行探索。这是一种开放式、自娱自乐的游戏。其想法是,成年人将监督(但不指导)儿童使用篮子及其物品半小时,然后将篮子拿走下一次再玩。 + +创建带有常见家用物品的可爱游戏篮很容易。尝试包括质地、声音、气味、形状和重量各不相同的物品。这里有一些想法可以帮助您入门。 + +* 漏勺或脊状柳条篮可容纳所有物品 +* 木勺子 +* 金属打蛋器和汤匙 +* 板刷 +* 海绵 +* 小鸡蛋纸箱 +* 纸板管 +* 小擀面杖 +* 带纹理的毛巾 +* 岩石 +* 手铃 +* 钩针桌巾 +* 带盖的小铁罐 +   +游戏篮中不应包括任何容易破碎的东西或足够小到可以装入纸巾卷的东西,因为它们有窒息危险,应将所有物品彻底清洁后再交给孩子。 + +**我为什么喜欢它:**游戏篮非常适合感官发育,并可以帮助幼儿提出问题和探索周围的世界。这是培养创客思维方式的重要组成部分! + +很容易获得适合这个游戏篮的物品。你可能已经在家中或附近的二手店里有很多有趣的物品。幼儿使用游戏篮的方式与婴儿不同。随着孩子开始模仿成人生活并通过他们的游戏讲故事,这些物品将随孩子一起成长。 + +**费用:**不等 + +### 《Hello Ruby》 + +![Hello Ruby book cover][10] + +**年龄**:5-8 岁 + +**这是什么:** 《[Hello Ruby][11]:编码历险记》是 Linda Liukas 的插图书,通过有趣的故事讲述了一个遇到各种问题和朋友(每个都用一个码代表)的女孩,向孩子们介绍了编程概念。Liukas 还有其他副标题为《互联网探险》和《计算机内的旅程》的《Hello Ruby》书籍,而《编码历险记》已以 20 多种语言出版。 + +**为什么我喜欢它:**作者在书中附带了许多免费、有趣和无障碍的活动,可以从 Hello Ruby 网站下载和打印这些活动。这些活动教授编码概念、还涉及艺术表达、沟通、甚至时间安排。 + +**费用:**精装书的标价为 17.99 美元,但你可以通过本地或在线书店以较低的价格买到这本书。 + +### 《编程少女:学会编程和改变世界》 + +![Girls Who Code book cover][12] + +**年龄**:10 岁 - 成人 + +**内容是什么:**由《编程少女》的创始人 Reshma Saujani 撰写,《[编程少女:学会编程和改变世界][13]》为年轻女孩(以及男孩)提供了科技领域的实用信息。它涵盖了广泛的主题,包括编程语言、用例、术语和词汇、职业选择以及技术行业人士的个人简介和访谈。 + +**为什么我喜欢它:**本书以讲述了大多数面向成年人的网站没有的技术故事。技术涉及许多学科,对于年轻人来说,重要的是要了解他们可以使用它来解决现实世界中的问题并有所作为。 + +**成本:**精装书的标价为 17.99 美元,平装书的标价为 10.99 美元,但你可以通过本地或在线书店以更低的价格找到。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/maker-gifts-kids + +作者:[Jess Weichler][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://opensource.com/sites/default/files/uploads/hummingbird.png (Hummingbird Robotics Kit) +[3]: https://www.birdbraintechnologies.com/hummingbirdbit/ +[4]: https://opensource.com/sites/default/files/uploads/makeymakey2.jpg (Makey Makey Classic) +[5]: https://makeymakey.com/ +[6]: https://opensource.com/sites/default/files/uploads/arduinouno.jpg (Arduino Uno) +[7]: https://www.arduino.cc/ +[8]: https://opensource.com/sites/default/files/makerbox-makerkit.jpg (A maker kit assembled in a quick trip to the hardware store) +[9]: https://opensource.com/sites/default/files/makerbox-sensorykit.jpg (Heuristic play kit) +[10]: https://opensource.com/sites/default/files/uploads/helloruby2.jpg (Hello Ruby book cover) +[11]: https://www.helloruby.com/ +[12]: https://opensource.com/sites/default/files/uploads/girlswhocodebook.jpg (Girls Who Code book cover) +[13]: https://girlswhocode.com/book/girls-code-learn-code-change-world/ From 0968a3bb4ecea07d8c0c117c8600be79e60e9240 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 7 Jan 2020 09:01:55 +0800 Subject: [PATCH 0134/3057] Rename sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md to sources/talk/20200106 Open Source Supply Chain- A Matter of Trust.md --- .../20200106 Open Source Supply Chain- A Matter of Trust.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200106 Open Source Supply Chain- A Matter of Trust.md (100%) diff --git a/sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md b/sources/talk/20200106 Open Source Supply Chain- A Matter of Trust.md similarity index 100% rename from sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md rename to sources/talk/20200106 Open Source Supply Chain- A Matter of Trust.md From 1eca447b19eddb900bd0ea73f4f75c11d780f2fa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 09:33:32 +0800 Subject: [PATCH 0135/3057] PRF @lxbwolf --- ...01 5 predictions for Kubernetes in 2020.md | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md index f760fcfe4a..f87eb41b9f 100644 --- a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md +++ b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -1,42 +1,49 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 predictions for Kubernetes in 2020) [#]: via: (https://opensource.com/article/20/1/kubernetes-2020) [#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) -2020 年对 Kubernetes 的 5 项预测 +2020 年对 Kubernetes 的 5 个预测 ====== -请先回顾下 2019 年网站上最受欢迎的 Kubernetes 的文章。 + +> 以及,对 2019 年最受欢迎的 Kubernetes 文章的回顾。 + ![Person drinking a hat drink at the computer][1] -你怎么追踪一个广受欢迎的项目(如 Kubernetes)的发展轨迹?你怎么能了解它发展到什么程度了?如果你在为这个项目作贡献或加入了 SIG(Special Interest Group),可能你会在潜移默化中了解到它的发展轨迹,但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。 +你是怎么追踪一个广受欢迎的项目(如 Kubernetes)的发展轨迹?你是怎么了解它发展到什么程度了?如果你在为这个项目作贡献或加入了特殊兴趣组(SIG),可能你会在潜移默化中了解到它的发展轨迹,但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。 -今年,Kubernetes 取得了很大的进展。除了去查看源码、文档、会议笔记,你也可以去浏览博客。为了深入了解,我在 Opensource.com 上看了 Kubernetes 的 top 10 文章。通过这些文章,我们能了解开发者们更喜欢读和写哪些话题的文章。我们开始吧! +今年,Kubernetes 取得了很大的进展。除了去查看源码、文档、会议笔记,你也可以去浏览博客。为了深入了解,我在 Opensource.com 上找到了 Kubernetes 排名前十的文章。通过这些文章,我们能了解开发者们更喜欢读和写哪些话题的文章。我们开始吧! -(2019 年末获取 Kubernetes 文章的 top 10。) +- [为什么数据科学家喜欢Kubernetes][13] +- [Kubernetes 机密信息和 ConfigMap 简介][14] +- [怎样在 Kubernetes 上运行 PostgreSQL][15](译文) +- [为什么说 Kubernetes 是一辆翻斗车][16](译文) +- [安全扫描你的 DevOps 流程][17] +- [在 Kubernetes 上部署 InfluxDB 和 Grafana 以收集 Twitter 统计信息][18] +- [使用 Kubernetes 操作器扩展 PostgreSQL][19] +- [使用 Kubernetes 控制器减少系统管理员的工作量][20] +- [将 Kubernetes 带到裸金属边缘计算][21] +- [为什么你不必担心 Kubernetes][22] -首先,我要指明这些文章中有 5 篇是关于 Kubernetes 工作负载的扩展以及它们可以运行在什么场景。这些工作负载涵盖数据科学、PostgreSQL、InfluxDB、Grafana(不仅仅监控集群本身)和 Edge。从历史角度看,Kubernetes 和容器都是在虚拟机上运行的,尤其是运行在由云提供的基础设施上时。抛开对于 Kubernetes 的兴趣因素,这也表明了终端用户们极度希望在裸机上安装 Kubernetes(参照[OpenShift 环境安装 Kubernetes][2])。 +首先,我要指明这些文章中有 5 篇是关于 Kubernetes 工作负载的扩展以及它们可以运行在什么场景。这些工作负载涵盖数据科学、PostgreSQL、InfluxDB、Grafana(不仅仅监控集群本身)和边缘计算。从历史角度看,Kubernetes 和容器都是在虚拟机上运行的,尤其是运行在由云提供的基础设施上时。抛开对于 Kubernetes 的兴趣因素,这也表明了终端用户们极度希望在裸机上安装 Kubernetes(参照 [用 OpenShift 在裸机环境运行 Kubernetes][2])。 -其次,也有很多开发者希望了解操作相关的知识以及 Kubernetes 的最佳实践。从 [Kubernetes 操作][3] 到 [Kubernetes 控制器][4],从 [Secrets][5] 到 [ConfigMaps][6],开发者和运维人员都希望能找到简化部署和管理工作的最佳实践。我们经常纠结在怎么去修改配置文件或别人会怎么配置,而不去回头想想这些配置是怎么让应用部署运转的(不是怎么安装,也不是怎么运行 Kubernetes)。 +其次,也有很多开发者希望了解操作相关的知识以及 Kubernetes 的最佳实践。从 [Kubernetes 操作器][3] 到 [Kubernetes 控制器][4],从 [机密信息][5] 到 [ConfigMaps][6],开发者和运维人员都希望能找到简化部署和管理工作的最佳实践。我们经常纠结在怎么去修改配置文件或别人会怎么配置,而不去回头想想这些配置是怎么让应用部署运转的(不是怎么安装,也不是怎么运行 Kubernetes)。 -最后,人们似乎对入门教程真的感兴趣。事实上,构建 Kubernetes 所需了解的信息太多了,以至于让人们望而却步,也使他们走了错误的路。流行度高的文章中有几篇讲述了为什么你需要了解用 Kubernetes 运行应用程序,而不仅仅是安装它。就是最佳实践类的文章一样,人们也通常不会回头分析在入门时他们应该在什么地方花费时间。我一直秉持的理念是,把有限的时间和金钱投入到如何使用某项技术上,而不是如何构建它。 +最后,人们似乎对入门教程真的感兴趣。事实上,构建 Kubernetes 所需了解的信息太多了,以至于让人们望而却步,也使他们走了错误的路。流行度高的文章中有几篇讲述了为什么你需要了解用 Kubernetes 运行应用程序,而不仅仅是安装它。就像最佳实践类的文章一样,人们也通常不会回头分析在入门时他们应该在什么地方花费时间。我一直秉持的理念是,把有限的时间和金钱投入到如何使用某项技术上,而不是如何构建它。 -### 2020 年对 Kubernetes 的 5 项预测 +### 2020 年对 Kubernetes 的 5 个预测 -回顾下 2019 年的相关主题,这些主题告诉我们 2020 年将如何发展?结合这些文章中的观点,加上我自己的看法,我来分享下我对于 2020 年以及未来发展趋势的想法: +回顾了 2019 年的相关主题,这些主题告诉我们 2020 年将如何发展?结合这些文章中的观点,加上我自己的看法,我来分享下我对于 2020 年以及未来发展趋势的想法: - 1. 工作负载扩展。我会关注高性能计算,AI/ML 以及使用 Operator 的有状态工作负载。 - - 2. 更多的生产中的最佳实践,尤其是跟一些成熟的标准相关的,像 PCI,HIPAA,NIST 等等. - - 3. rootless 相关的更好的安全性和 [runtimes classes][7](如 [gVisor][8],[Kata Containers][9] 等等)更高的安全性。 - - 4. 在部署和开发者们共享应用时,把 Kubernetes 清单的更好的规范标准作为部署的核心要素。如 [podman generate kube][10], [podman play kube][11], 还有多合一 Kubernetes 环境,如 [CodeReady Containers (CRC)][12] - - 5. 一个前所未有的网络、存储和专业硬件(如 GPU 等等)供应商的生态系统,为 Kubernetes 提供 BoB(译注:best of breed,单项最佳品牌)解决方案(在免费软件中,我们相信开放的生态系统好过垂直整合的解决方案)。 +1. 工作负载扩展。我会关注高性能计算、AI/ML 以及使用操作器的有状态工作负载。 +2. 更多的生产中的最佳实践,尤其是跟一些成熟的标准相关的,像 PCI、HIPAA、NIST 等等。 +3. 提升免 root 和更安全的[运行时类][7](如 [gVisor][8]、[Kata Containers][9] 等等)的安全性。 +4. 在部署和开发者们共享应用时,把 Kubernetes 清单的更好的规范标准作为部署的核心要素。如 [podman 生成 kube][10]、[podman 运行 kube][11],还有多合一 Kubernetes 环境,如 [CodeReady Containers (CRC)][12] +5. 一个前所未有的网络、存储和专业硬件(如 GPU 等等)供应商的生态系统,为 Kubernetes 提供 BoB(LCTT 译注:best of breed,单项最佳品牌)解决方案(在自由软件中,我们相信开放的生态系统好过垂直整合的解决方案)。 期待 Kubernetes 在新的一年里再创辉煌! @@ -47,7 +54,7 @@ via: https://opensource.com/article/20/1/kubernetes-2020 作者:[Scott McCarty][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -65,3 +72,13 @@ via: https://opensource.com/article/20/1/kubernetes-2020 [10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ [11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities [12]: https://developers.redhat.com/products/codeready-containers/overview +[13]: https://opensource.com/article/19/1/why-data-scientists-love-kubernetes +[14]: https://opensource.com/article/19/6/introduction-kubernetes-secrets-and-configmaps +[15]: https://linux.cn/article-10762-1.html +[16]: https://linux.cn/article-11011-1.html +[17]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[18]: https://opensource.com/article/19/2/deploy-influxdb-grafana-kubernetes +[19]: https://opensource.com/article/19/2/scaling-postgresql-kubernetes-operators +[20]: https://opensource.com/article/19/3/reducing-sysadmin-toil-kubernetes-controllers +[21]: https://opensource.com/article/19/3/bringing-kubernetes-bare-metal-edge +[22]: https://opensource.com/article/19/10/kubernetes-complex-business-problem From 1b5a922346f752a62b238fcd96d16344cd9a462e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 09:44:59 +0800 Subject: [PATCH 0136/3057] PUB @lxbwolf https://linux.cn/article-11758-1.html --- .../20200101 5 predictions for Kubernetes in 2020.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200101 5 predictions for Kubernetes in 2020.md (97%) diff --git a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md b/published/20200101 5 predictions for Kubernetes in 2020.md similarity index 97% rename from translated/tech/20200101 5 predictions for Kubernetes in 2020.md rename to published/20200101 5 predictions for Kubernetes in 2020.md index f87eb41b9f..2ad58abd67 100644 --- a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md +++ b/published/20200101 5 predictions for Kubernetes in 2020.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11758-1.html) [#]: subject: (5 predictions for Kubernetes in 2020) [#]: via: (https://opensource.com/article/20/1/kubernetes-2020) [#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) @@ -12,7 +12,7 @@ > 以及,对 2019 年最受欢迎的 Kubernetes 文章的回顾。 -![Person drinking a hat drink at the computer][1] +![](https://img.linux.net.cn/data/attachment/album/202001/07/094358qucr5o2lu2lo23od.jpg) 你是怎么追踪一个广受欢迎的项目(如 Kubernetes)的发展轨迹?你是怎么了解它发展到什么程度了?如果你在为这个项目作贡献或加入了特殊兴趣组(SIG),可能你会在潜移默化中了解到它的发展轨迹,但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。 From 923e0da51ed798d772ab2a283d831cf23664657c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 23:12:11 +0800 Subject: [PATCH 0137/3057] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @BrunoJu 恭喜你完成了第一篇翻译贡献! --- ...es to accelerate your automation skills.md | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md index f50180a6d7..f7805c35f0 100644 --- a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md +++ b/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md @@ -1,43 +1,45 @@ [#]: collector: (lujun9972) [#]: translator: (BrunoJu) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (10 Ansible resources to accelerate your automation skills) [#]: via: (https://opensource.com/article/19/12/ansible-resources) [#]: author: (James Farrell https://opensource.com/users/jamesf) -提升自动化技巧的10大Ansible资源 +提升自动化技巧的 10 篇 Ansible 文章 ====== -今年,准备好,用出色的Ansible自动化技能装备自己的技能包吧。 -![Gears above purple clouds][1] +> 今年,准备好,用出色的 Ansible 自动化技能装备自己的技能包吧。 -今年我关注了大量关于Ansible的文章,以下这些内容都值得每个人学习,无论是否是Ansible的新手。 +![](https://img.linux.net.cn/data/attachment/album/202001/07/231057fbtfjwrn29ficxj0.jpg) -这些文章值得大家标记为书签,或者设置个计划任务(亦或者是设置一个Tower/AWX job),用来提醒自己常读常新。 -如果你是Ansible的新手,那么就从这些文章开始着手吧: - * [_A quickstart guide to Ansible_][2] 拥有一些对新手非常有用的信息,同时还有一些更高级的话题。 - * [_10 Ansible modules you need to know_][3] 和 [_5 ops tasks to do with Ansible_][4] 这篇文章有每一位Ansible的管理者都应该熟悉并认真研习的一些最基础的Ansible功能 - * [_How to use Ansible to document procedures_][5] 这篇文章是对一些额外话题的纵览,我猜你一定会感到很有趣。 +今年我关注了大量关于 Ansible 的文章,以下这些内容都值得每个人学习,无论是否是 Ansible 的新手。 +这些文章值得大家标记为书签,或者设置个计划任务(亦或者是设置一个 Tower/AWX 任务),用来提醒自己常读常新。 -剩余的这些文章包含了更多高级的话题,比如Windows管理,测试、硬件、云和容器,甚至包括了一个案例研究,如何管理那些对技术有兴趣的孩子的需求。 +如果你是 Ansible 的新手,那么就从这些文章开始着手吧: -我希望你能像我一样好好享受Ansible带来的乐趣。不要停止学习哦! - 1. _[How Ansible brought peace to my home][6]_ 这个异想天开的案例,你能看到如何利用Ansible为孩子们快速部署一个新的笔记本(或者重装旧笔记本) - 2. _[Ansible for the Windows admin][7]_ 你知道Ansible也可以管理Windows的节点吗?这篇文章以部署一个IIS为案例,阐述了基础的Ansible服务器和Windows客户端的安装。 - 3. _[10 Ansible modules you need to know][3]_ 这是个学习你最应该知道的那些最常见最基础Ansible模块的好文章。执行命令、安装系统包和操作文件是许多有用的自动化工作的基础。 - 4. _[How to use Ansible to document procedures][5]_  Ansible的YAML文件易于阅读,因此它们可以被用于记录完成任务所需的手动步骤。这一特性可以帮助你调试与扩展,这令工作变得异常轻松。同时,这篇文章还包含关于测试和分析等Ansible相关主题的指导。 - 5. _[Using Testinfra with Ansible to verify server state][8]_ 测试环节是任何一个 CI/CD 开发型运维场景不可或缺的一部分。所以为什么不把测试Ansible的运行结果也纳入其中呢?这个有关于Ansible测试架构的入门级文章可以被用来帮助你配置。 - 6. _[Hardware bootstrapping with Ansible][9]_ 这个世界并不是完全已经被容器和虚拟机所占据。许多系统管理员仍然需要管理众多硬件资源。通过Ansible与PXE、DHCP以及其他一些技术的结合,你可以创建一个简单的管理框架,对硬件实施控制。 - 7. _[What you need to know about Ansible modules][10]_ 模块给Ansible带来了巨大的潜力,许多模块我们已经可以拿来利用。但如果没有你所需的模块,那你可以尝试给自己造一个。看看这篇文章吧,它能让你了解如何从零开始打造自己所需的模块。 - 8. _[5 ops tasks to do with Ansible][4]_ 这是另一个有关于如何使用Ansible来管理常见的系统操作任务的文章。这里描述了一系列可以取代命令行操作的Tower(AWX)的案例。 - 9. _[A quickstart guide to Ansible][2]_ 这篇文章是个可以下载的PDF文档。它可以作为一本随时拿来翻阅的手册。这篇文章的开头有助于初学者入门。同时,还包括了一些其他的研究领域,比如模块测试、系统管理任务和针对K8S对象的管理。 - 10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ 这是一篇每月进行总结更新的文章,充满了有趣的链接。话题包括了Ansible的基础内容、管理Netapp的E系列存储产品、调试、打补丁包和其他一些相关内容。文章中还包括了一些视频以及指导性文章的链接。击这里查看详情! +* 《[Ansible 快速入门指南][2]》拥有一些对新手非常有用的信息,同时还介绍了一些更高级的话题。 +* 《[你需要知道的 10 个 Ansible 模块][3]》和《[5 个 Ansible 运维任务][4]》(译文)这两篇文章有每一位 Ansible 管理员都应该熟悉并认真研习的一些最基础的 Ansible 功能。 +* 《[如何使用 Ansible 记录流程][5]》这篇文章是对一些额外话题的纵览,我猜你一定会感到很有趣。 +剩余的这些文章包含了更多高级的话题,比如 Windows 管理、测试、硬件、云和容器,甚至包括了一个案例研究,如何管理那些对技术有兴趣的孩子的需求。 -如果你也有一些你喜爱的Ansible文章,那请留言告诉我们吧。 +我希望你能像我一样好好享受 Ansible 带来的乐趣。不要停止学习哦! + +1. 《[Ansible 如何为我的家庭带来和平][6]》这个异想天开的案例,你能看到如何利用 Ansible 为孩子们快速部署一个新的笔记本(或者重装旧笔记本) +2. Taz Brown 和 Abner Malivert 的《[适用于 Windows 管理员的 Ansible][7]》:你知道 Ansible 也可以管理 Windows 的节点吗?这篇文章以部署一个 IIS 为案例,阐述了基础的 Ansible 服务器和 Windows 客户端的安装。 +3. Shashank Hegde 的《[你需要知道的 10 个 Ansible 模块][3]》是个学习你最应该知道的那些最常见、最基础的 Ansible 模块的好文章。运行命令、安装软件包和操作文件是许多有用的自动化工作的基础。 +4. Marco Bravo 的《[如何使用 Ansible 记录流程][5]》:Ansible 的 YAML 文件易于阅读,因此它们可以被用于记录完成任务所需的手动步骤。这一特性可以帮助你调试与扩展,这令工作变得异常轻松。同时,这篇文章还包含关于测试和分析等 Ansible 相关主题的指导。 +5. Clement Verna 的《[使用 Testinfra 和 Ansible 验证服务器状态][8]》(译文):测试环节是任何一个 CI/CD DevOps 流程不可或缺的一部分。所以为什么不把测试 Ansible 的运行结果也纳入其中呢?这个测试架构 Testinfra 的入门级文章可以帮助你检查配置结果。 +6. Mark Phillips 的《[Ansible 硬件起步][9]》:这个世界并不是完全已经被容器和虚拟机所占据。许多系统管理员仍然需要管理众多硬件资源。通过 Ansible 与一点 PXE、DHCP 以及其他技巧的结合,你可以创建一个方便的管理框架使硬件易于启动和运行。 +7. Jairo da Silva Junior 的《[你需要了解的关于 Ansible 模块的知识][10]》:模块给 Ansible 带来了巨大的潜力,已经有许多模块可以拿来利用。但如果没有你所需的模块,那你可以尝试给自己打造一个。看看这篇文章吧,它能让你了解如何从零开始打造自己所需的模块。 +8. Mark Phillips 的《[5 个 Ansible 运维任务][4]》(译文):这是另一个有关于如何使用 Ansible 来管理常见的系统操作任务的文章。这里描述了一系列可以取代命令行操作的 Tower(或 AWX)的案例。 +9. Chris Short 的《[Ansible 快速入门指南][2]》是个可以下载的 PDF 文档。它可以作为一本随时拿来翻阅的手册。这篇文章的开头有助于初学者入门。同时,还包括了一些其他的研究领域,比如模块测试、系统管理任务和针对 K8S 对象的管理。 +10. Mark Phillips 的《[Ansible 参考指南,带有 Ansible Tower 和 GitHub 的 CI/CD,等等][11]》:这是一篇每月进行总结更新的文章,充满了有趣的链接。话题包括了 Ansible 的基础内容、管理 Netapp 的 E 系列存储产品、调试、打补丁包和其他一些相关内容。文章中还包括了一些视频以及一些聚会的链接。请查看详情。 + +如果你也有一些你喜爱的 Ansible 文章,那请留言告诉我们吧。 -------------------------------------------------------------------------------- @@ -45,8 +47,8 @@ via: https://opensource.com/article/19/12/ansible-resources 作者:[James Farrell][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/BrunoJu) -校对:[校对者ID](https://github.com/校对者ID) +译者:[BrunoJu](https://github.com/BrunoJu) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -55,11 +57,11 @@ via: https://opensource.com/article/19/12/ansible-resources [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) [2]: https://opensource.com/article/19/2/quickstart-guide-ansible [3]: https://opensource.com/article/19/9/must-know-ansible-modules -[4]: https://opensource.com/article/19/8/ops-tasks-ansible +[4]: https://linux.cn/article-11312-1.html [5]: https://opensource.com/article/19/4/ansible-procedures [6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops [7]: https://opensource.com/article/19/2/ansible-windows-admin -[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state +[8]: https://linux.cn/article-10943-1.html [9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible [10]: https://opensource.com/article/19/3/developing-ansible-modules [11]: https://opensource.com/article/19/7/ansible-news-edition-one From 9de7cd49aa0d08d79a379e08ffd875f2d72ff746 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 23:13:18 +0800 Subject: [PATCH 0138/3057] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @BrunoJu 本文首发地址:https://linux.cn/article-11760-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/BrunoJu 请注册以领取 LCCN:https://lctt.linux.cn/ --- ... Ansible resources to accelerate your automation skills.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191231 10 Ansible resources to accelerate your automation skills.md (98%) diff --git a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/published/20191231 10 Ansible resources to accelerate your automation skills.md similarity index 98% rename from translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md rename to published/20191231 10 Ansible resources to accelerate your automation skills.md index f7805c35f0..00d31b98a2 100644 --- a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md +++ b/published/20191231 10 Ansible resources to accelerate your automation skills.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (BrunoJu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11760-1.html) [#]: subject: (10 Ansible resources to accelerate your automation skills) [#]: via: (https://opensource.com/article/19/12/ansible-resources) [#]: author: (James Farrell https://opensource.com/users/jamesf) From d817e328b23780246cb240b9f19e1f1fc4af841b Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 8 Jan 2020 00:20:46 +0800 Subject: [PATCH 0139/3057] translated --- ... Lessons learned from programming in Go.md | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md index 93e9af3398..682b6c798c 100644 --- a/sources/tech/20191210 Lessons learned from programming in Go.md +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -7,28 +7,28 @@ [#]: via: "https://opensource.com/article/19/12/go-common-pitfalls" [#]: author: "Eduardo Ferreira https://opensource.com/users/edufgf" -用 Go 编程受到的启发 +Go 编程中的经验教训 ====== 通过学习如何定位并发处理的陷阱来避免未来处理这些问题时的困境。 ![Goland gopher illustration][1] -在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。[Mode.net][2] 公司系统每天要处理实时、快速和灵活的以毫秒为单位动态路由数据包的全球专用网络和数据,需要高度并发的系统。他们的动态路由是基于网络状态的,而这个过程需要考虑众多因素,我们只考虑关系链的监控。在我们的环境中,调用关系链监控可以是任何跟网络调用关系链有关的状态和当前属性(如连接延迟)。 +在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。[Mode.net][2] 公司系统每天要处理实时、快速和灵活的以毫秒为单位动态路由数据包的全球专用网络和数据,需要高度并发的系统。这个动态路由是基于网络状态的,而这个过程需要考虑众多因素,我们只考虑关系链的监控。在我们的环境中,调用关系链监控可以是任何跟网络调用关系链有关的状态和当前属性(如链接延迟)。 -### 并发探测链接指标 +### 并发探测链接监控 -[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing,译注:逐跳自适应链路状态最佳路由), 我们的动态路由算法部分依赖于链路度量来计算路由表。 这些指标由位于每个PoP(译注:存活节点)上的独立组件收集。PoP是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有多个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探针。 +[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing,译注:逐跳自适应链路状态最佳路由),我们的动态路由算法部分依赖于链路度量来计算路由表。 这些指标由位于每个PoP(译注:存活节点)上的独立组件收集。PoP是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有不止一个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探针。 ![latency computation graph][6] ### 序列号和重置:一个记录场景 -我们的探测组件互相发送和接收数据包并依靠序列号进行数据包处理。旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号0来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们只考虑了始终从 0 开始递增的序列号。组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,直到排到重置之前用到的值之前,它后面的包都会被忽略掉。 +我们的探测组件互相发送和接收数据包并依靠序列号进行数据包处理。旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号 0 来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们只考虑了始终从 0 开始递增的序列号。组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,直到排到重置之前用到的值之前,它后面的包都会被忽略掉。 ### UDP 握手和有限状态机 这里的问题是重启前后的序列号是否一致。有几种方法可以解决这个问题,经过讨论,我们选择了实现一个带有清晰状态定义的三向交握协议。这个握手过程在初始化时通过链接建立 session。这样可以确保节点通过同一个 session 进行通信且使用了适当的序列号。 -为了正确实现这个过程,我们必须顶一个一个有清晰状态和过渡的有限状态机。这样我们就可以正确管理握手过程中的所有极端情况。 +为了正确实现这个过程,我们必须定义一个有清晰状态和过渡的有限状态机。这样我们就可以正确管理握手过程中的所有极端情况。 ![finite state machine diagram][7] @@ -43,7 +43,7 @@ session ID 由握手的初始化程序生成。一个完整的交换顺序如下 ### 处理状态超时 -Basically, at each state, you need to handle, at most, three types of events: link events, packet events, and timeout events. And those events show up concurrently, so here you have to handle concurrency properly.基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 +基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 * 链接事件包括连接和断开,连接时会初始化一个链接 session,断开时会断开一个已建立的 seesion。 * 数据包事件是控制数据包 **(SYN/SYN-ACK/ACK)** 或只是探测响应。 @@ -59,7 +59,7 @@ Basically, at each state, you need to handle, at most, three types of events: li ![gophers hacking together][9] -gophers hacking together +gopher 们聚众狂欢 首先,你可以设计两个分别表示我们的 **Session** 和 **Timeout Handlers** 的结构体。 @@ -147,19 +147,19 @@ func synCallback(session Session) {   ### 数据竞争和引用 -你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,在 *duration* 时间内 sleep,然后检查是否执行的回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 +你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,在 *duration* 时间内 sleep,然后检查是否执行了回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 令人惊讶的是,这个简单的测试发现了这个解决方案中的一个 bug。使用 cancel 方法来取消超时并没有正确处理。以下顺序的事件会导致数据资源竞争: 1. 你有一个已调度的超时 handler。 2. 线程 1: -a) 你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个 session 状态(如 发送 **SYN** 后接收到一个 **SYN-ACK**) -b) 你调用了 **timeout.Cancel()**,这个函数调用了 **timer.Stop()**。(请注意,Golang 计时器的 stop 不会终止一个已过期的计时器。) +a)你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个 session 状态(如 发送 **SYN** 后接收到一个 **SYN-ACK**) +b)你调用了 **timeout.Cancel()**,这个函数调用了 **timer.Stop()**。(请注意,Golang 计时器的 stop 不会终止一个已过期的计时器。) 3. 线程 2: -a) 在调用 cancel 之前,计时器已过期,回调即将执行。 -b) 执行回调,它调度一次新的超时并更新全局 map。 +a)在调用 cancel 之前,计时器已过期,回调即将执行。 +b)执行回调,它调度一次新的超时并更新全局 map。 4. 线程 1: -a) 切换到新的 session 状态并注册新的超时,更新全局 map。 +a)切换到新的 session 状态并注册新的超时,更新全局 map。 @@ -187,9 +187,9 @@ func (timeout* TimeoutHandler) Register() {   你可以使用取消 channel,而不必依赖不能阻止到期的计时器执行的 golang 函数 **timer.Stop()**。 -这是一个略有不同的方法。现在你可以不用再通过回调进行递归地重新调度;而是注册一个死循环,这个循环接收到取消信号或超时事件是终止。 +这是一个略有不同的方法。现在你可以不用再通过回调进行递归地重新调度;而是注册一个死循环,这个循环接收到取消信号或超时事件时终止。 -新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用发一个取消 channel,用来控制循环的终止。 +新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用方一个取消 channel,用来控制循环的终止。 ```go @@ -254,11 +254,11 @@ func (timeout* TimeoutHandler) Cancel() {   ![gophers on a wire, talking][11] -还有人吗? +有人在听吗? 已获得 Trevor Forrey 授权。 -这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会则色后续的取消调用。 +这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会阻塞后续的取消调用。 ```go @@ -281,29 +281,29 @@ func (timeout* TimeoutHandler) Cancel() {   #### 在非同步的情况下更新共享数据 -This seems like an obvious one, but it’s actually hard to spot if your concurrent updates happen in different locations. The result is data race, where multiple updates to the same data can cause update loss, due to one update overriding another. In our case, we were updating the scheduled timeout reference on the same shared map. (Interestingly, if Go detects a concurrent read/write on the same Map object, it throws a fatal error —you can try to run Go’s [data race detector][12]). This eventually results in losing a timeout reference and making it impossible to cancel that given timeout. Always remember to use locks when they are needed. +这似乎是个很明显的问题,但如果并发更新发生在不同的位置,就很难发现。结果就是数据竞争,由于一个更新会覆盖另一个,因此对同一数据的多次更新中会有某些更新丢失。在我们的案例中,我们是在同时更新同一个共享 map 里的调度超时引用。有趣的是,(如果 Go 检测到在同一个 map 对象上的并发读写,会抛出 fatal 错误 — 你可以尝试下运行 Go 的[数据竞争检测器](https://golang.org/doc/articles/race_detector.html))。这最终会导致丢失超时引用,且无法取消给定的超时。当有必要时,永远不要忘记使用锁。 ![gopher assembly line][13] -don’t forget to synchronize gophers’ work +不要忘记同步 gopher 们的工作 -#### Missing condition checks +#### 缺少条件检查 -Condition checks are needed in situations where you can’t rely only on the lock exclusivity. Our situation is a bit different, but the core idea is the same as [condition variables][14]. Imagine a classic situation where you have one producer and multiple consumers working with a shared queue. A producer can add one item to the queue and wake up all consumers. The wake-up call means that some data is available at the queue, and because the queue is shared, access must be synchronized through a lock. Every consumer has a chance to grab the lock; however, you still need to check if there are items in the queue. A condition check is needed because you don’t know the queue status by the time you grab the lock. +在不能仅依赖锁的独占性的情况下,就需要进行条件检查。我们遇到的场景稍微有点不一样,但是核心思想跟[条件变量][14]是一样的。假设有个经典的一个生产者和多个消费者使用一个共享队列的场景,生产者可以将一个元素添加到队列并唤醒所有消费者。这个唤醒调用意味着队列中的数据是可访问的,并且由于队列是共享的,消费者必须通过锁来进行同步访问。每个消费者都可能拿到锁;然而,你仍然需要检查队列中是否有元素。因为在你拿到锁的瞬间并不知道队列的状态,所以还是需要进行条件检查。 -In our example, the timeout handler got a ‘wake up’ call from a timer expiration, but it still needed to check if a cancel signal was sent to it before it could proceed with the callback execution. +在我们的例子中,超时 handler 收到了计时器到期时发出的「唤醒」调用,但是它仍需要检查是否已向其发送了取消信号,然后才能继续执行回调。 ![gopher boot camp][15] -condition checks might be needed if you wake up multiple gophers +如果你要唤醒多个 gopher,可能就需要进行条件检查 -#### Deadlocks +#### 死锁 -This happens when one thread is stuck, waiting indefinitely for a signal to wake up, but this signal will never arrive. Those can completely kill your application by halting your entire program execution. +当一个线程被卡住,无限期地等待一个唤醒信号,但是这个信号永远不会到达时,就会发生这种情况。死锁可以通过让你的整个程序 halt 来彻底杀死你的应用。 -In our case, this happened due to multiple send calls to a non-buffered and blocking channel. This meant that the send call would only return after a receive is done on the same channel. Our timeout thread loop was promptly receiving signals on the cancellation channel; however, after the first signal is received, it would break off the loop and never read from that channel again. The remaining callers are stuck forever. To avoid this situation, you need to carefully think through your code, handle blocking calls with care, and guarantee that thread starvation doesn’t happen. The fix in our example was to make the cancellation calls non-blocking—we didn’t need a blocking call for our needs. +在我们的案例中,这种情况的发生是由于多次发送请求到一个非缓冲且阻塞的 channel。这意味着向 channel 发送数据只有在从这个 channel 接收完数据后才能 return。我们的超时线程循环迅速从取消 channel 接收信号;然而,在接收到第一个信号后,它将跳出循环,并且再也不会从这个 channel 读取数据。其他的调用会一直被卡住。为避免这种情况,你需要仔细检查代码,谨慎处理阻塞调用,并确保不会发生线程饥饿。我们例子中的解决方法是使取消调用成为非阻塞调用 — 我们不需要阻塞调用。 -------------------------------------------------------------------------------- @@ -311,7 +311,7 @@ via: https://opensource.com/article/19/12/go-common-pitfalls 作者:[Eduardo Ferreira][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lxbwolf](https://github.com/lxbwolf) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e37b92517847b91b7e86bcbb64f0897f44f1f50a Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 8 Jan 2020 00:23:40 +0800 Subject: [PATCH 0140/3057] modify md --- ... Lessons learned from programming in Go.md | 47 ++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md index 682b6c798c..0c17e142a8 100644 --- a/sources/tech/20191210 Lessons learned from programming in Go.md +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -1,11 +1,11 @@ -[#]: collector: "lujun9972" -[#]: translator: "lxbwolf" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "Lessons learned from programming in Go" -[#]: via: "https://opensource.com/article/19/12/go-common-pitfalls" -[#]: author: "Eduardo Ferreira https://opensource.com/users/edufgf" +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Lessons learned from programming in Go) +[#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) +[#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) Go 编程中的经验教训 ====== @@ -39,8 +39,6 @@ session ID 由握手的初始化程序生成。一个完整的交换顺序如下 3. sender 接收到 **SYN-ACK (ID)** _并发送一个 **ACK (ID)**_。它还发送一个从序列号 0 开始的数据包。 4. receiver 检查最后接收到的 **ID**,如果 ID 匹配,_则接受 **ACK (ID)**_。它还开始接受序列号为 0 的数据包。 - - ### 处理状态超时 基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 @@ -49,8 +47,6 @@ session ID 由握手的初始化程序生成。一个完整的交换顺序如下 * 数据包事件是控制数据包 **(SYN/SYN-ACK/ACK)** 或只是探测响应。 * 超时事件在当前 session 状态的预定超时时间到期后触发。 - - 这里面临的最主要的问题是如何处理并发超时到期和其他事件。这里很容易陷入死锁和资源竞争的陷阱。 ### 第一种方法 @@ -63,7 +59,6 @@ gopher 们聚众狂欢 首先,你可以设计两个分别表示我们的 **Session** 和 **Timeout Handlers** 的结构体。 - ```go type Session struct {     State SessionState   @@ -85,14 +80,12 @@ type TimeoutHandler struct {   每一个临近连接点的 session 都包含一个保存调度 `TimeoutHandler` 的全局 map。 - ``` `SessionTimeout map[Session]*TimeoutHandler` ``` 下面方法注册和取消超时: - ```go // schedules the timeout callback function.   func (timeout* TimeoutHandler) Register() {   @@ -111,7 +104,6 @@ func (timeout* TimeoutHandler) Cancel() {   你可以使用类似下面的方法来创建和存储超时: - ```go func CreateTimeoutHandler(callback func(Session), session Session, duration int) *TimeoutHandler {     if sessionTimeout[session] == nil {   @@ -130,7 +122,6 @@ func CreateTimeoutHandler(callback func(Session), session Session, duration int) 为此,你可以让回调函数重新调度一次超时: - ```go func synCallback(session Session) {     sendSynPacket(session) @@ -161,15 +152,12 @@ b)执行回调,它调度一次新的超时并更新全局 map。 4. 线程 1: a)切换到新的 session 状态并注册新的超时,更新全局 map。 - - 两个线程同时更新超时 map。最终结果是你无法取消注册的超时,然后你也会丢失对线程 2 重新调度的超时的引用。这导致 handler 在一段时间内持续执行和重新调度,出现非预期行为。 ### 锁也解决不了问题 使用锁也不能完全解决问题。如果你在处理所有事件和执行回调之前加锁,它仍然不能阻止一个过期的回调运行: - ```go func (timeout* TimeoutHandler) Register() {     timeout.timer = time.AfterFunc(time.Duration(timeout.duration) * time._Second_, func() {   @@ -191,7 +179,6 @@ func (timeout* TimeoutHandler) Register() {   新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用方一个取消 channel,用来控制循环的终止。 - ```go func (timeout *TimeoutHandler) Register() chan struct{} {     cancelChan := make(chan struct{})   @@ -225,7 +212,6 @@ func (timeout* TimeoutHandler) Cancel() {   这里的解决方案是,在拿到锁之后,检查一下超时范围内的取消 channel。 - ```go   case _ = <- time.AfterFunc(time.Duration(timeout.duration) * time.Second):       func () {   @@ -260,7 +246,6 @@ func (timeout* TimeoutHandler) Cancel() {   这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会阻塞后续的取消调用。 - ```go func (timeout* TimeoutHandler) Cancel() {     if timeout.cancelChan == nil {   @@ -283,8 +268,6 @@ func (timeout* TimeoutHandler) Cancel() {   这似乎是个很明显的问题,但如果并发更新发生在不同的位置,就很难发现。结果就是数据竞争,由于一个更新会覆盖另一个,因此对同一数据的多次更新中会有某些更新丢失。在我们的案例中,我们是在同时更新同一个共享 map 里的调度超时引用。有趣的是,(如果 Go 检测到在同一个 map 对象上的并发读写,会抛出 fatal 错误 — 你可以尝试下运行 Go 的[数据竞争检测器](https://golang.org/doc/articles/race_detector.html))。这最终会导致丢失超时引用,且无法取消给定的超时。当有必要时,永远不要忘记使用锁。 - - ![gopher assembly line][13] 不要忘记同步 gopher 们的工作 @@ -318,18 +301,18 @@ via: https://opensource.com/article/19/12/go-common-pitfalls [a]: https://opensource.com/users/edufgf [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny "Goland gopher illustration" +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny (Goland gopher illustration) [2]: http://mode.net [3]: https://en.wikipedia.org/wiki/Metrics_%28networking%29 [4]: https://people.ece.cornell.edu/atang/pub/15/HALO_ToN.pdf [5]: https://en.wikipedia.org/wiki/Point_of_presence -[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png "latency computation graph" -[7]: https://opensource.com/sites/default/files/uploads/image3_0.png "finite state machine diagram" +[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png (latency computation graph) +[7]: https://opensource.com/sites/default/files/uploads/image3_0.png (finite state machine diagram) [8]: https://golang.org/ -[9]: https://opensource.com/sites/default/files/uploads/image4.png "gophers hacking together" +[9]: https://opensource.com/sites/default/files/uploads/image4.png (gophers hacking together) [10]: https://en.wikipedia.org/wiki/Deadlock -[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg "gophers on a wire, talking" +[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg (gophers on a wire, talking) [12]: https://golang.org/doc/articles/race_detector.html -[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg "gopher assembly line" +[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg (gopher assembly line) [14]: https://en.wikipedia.org/wiki/Monitor_%28synchronization%29#Condition_variables -[15]: https://opensource.com/sites/default/files/uploads/image7.png "gopher boot camp" +[15]: https://opensource.com/sites/default/files/uploads/image7.png (gopher boot camp) From 327565767baa82996ecd556f11f27a6907183d03 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 8 Jan 2020 00:24:07 +0800 Subject: [PATCH 0141/3057] move file --- .../tech/20191210 Lessons learned from programming in Go.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191210 Lessons learned from programming in Go.md (100%) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/translated/tech/20191210 Lessons learned from programming in Go.md similarity index 100% rename from sources/tech/20191210 Lessons learned from programming in Go.md rename to translated/tech/20191210 Lessons learned from programming in Go.md From 90dcfb8cbe828bff61e12427e2aebf571a89ca9c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 8 Jan 2020 00:54:36 +0800 Subject: [PATCH 0142/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=205=20?= =?UTF-8?q?ways=20to=20improve=20your=20Bash=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 5 ways to improve your Bash scripts.md --- ...107 5 ways to improve your Bash scripts.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20200107 5 ways to improve your Bash scripts.md diff --git a/sources/tech/20200107 5 ways to improve your Bash scripts.md b/sources/tech/20200107 5 ways to improve your Bash scripts.md new file mode 100644 index 0000000000..ae4dd4fcf7 --- /dev/null +++ b/sources/tech/20200107 5 ways to improve your Bash scripts.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to improve your Bash scripts) +[#]: via: (https://opensource.com/article/20/1/improve-bash-scripts) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +5 ways to improve your Bash scripts +====== +Find out how Bash can help you tackle the most challenging tasks. +![A person working.][1] + +A system admin often writes Bash scripts, some short and some quite lengthy, to accomplish various tasks. + +Have you ever looked at an installation script provided by a software vendor? They often add a lot of functions and logic in order to ensure that the installation works properly and doesn’t result in damage to the customer’s system. Over the years, I’ve amassed a collection of various techniques for enhancing my Bash scripts, and I’d like to share some of them in hopes they can help others. Here is a collection of small scripts created to illustrate these simple examples. + +### Starting out + +When I was starting out, my Bash scripts were nothing more than a series of commands, usually meant to save time with standard shell operations like deploying web content. One such task was extracting static content into the home directory of an Apache web server. My script went something like this: + + +``` +cp january_schedule.tar.gz /usr/apache/home/calendar/ +cd /usr/apache/home/calendar/ +tar zvxf january_schedule.tar.gz +``` + +While this saved me some time and typing, it certainly was not a very interesting or useful script in the long term. Over time, I learned other ways to use Bash scripts to accomplish more challenging tasks, such as creating software packages, installing software, or backing up a file server. + +### 1\. The conditional statement + +Just as with so many other programming languages, the conditional has been a powerful and common feature. A conditional is what enables logic to be performed by a computer program. Most of my examples are based on conditional logic. + +The basic conditional uses an "if" statement. This allows us to test for some condition that we can then use to manipulate how a script performs. For instance, we can check for the existence of a Java bin directory, which would indicate that Java is installed. If found, the executable path can be updated with the location to enable calls by Java applications. + + +``` +if [ -d "$JAVA_HOME/bin" ] ; then +    PATH="$JAVA_HOME/bin:$PATH" +``` + +### 2\. Limit execution + +You might want to limit a script to only be run by a specific user. Although Linux has standard permissions for users and groups, as well as SELinux for enabling this type of protection, you could choose to place logic within a script. Perhaps you want to be sure that only the owner of a particular web application can run its startup script. You could even use code to limit a script to the root user. Linux has a couple of environment variables that we can test in this logic. One is **$USER**, which provides the username. Another is **$UID**, which provides the user’s identification number (UID) and, in the case of a script, the UID of the executing user. + +#### User + +The first example shows how I could limit a script to the user jboss1 in a multi-hosting environment with several application server instances. The conditional "if" statement essentially asks, "Is the executing user not jboss1?" When the condition is found to be true, the first echo statement is called, followed by the **exit 1,** which terminates the script. + + +``` +if [ "$USER" != 'jboss1' ]; then +     echo "Sorry, this script must be run as JBOSS1!" +     exit 1 +fi +echo "continue script" +``` + +#### Root + +This next example script ensures that only the root user can execute it. Because the UID for root is 0, we can use the **-gt** option in the conditional if statement to prohibit all UIDs greater than zero. + + +``` +if [ "$UID" -gt 0 ]; then +     echo "Sorry, this script must be run as ROOT!" +     exit 1 +fi +echo "continue script" +``` + +### 3\. Use arguments + +Just like any executable program, Bash scripts can take arguments as input. Below are a few examples. But first, you should understand that good programming means that we don’t just write applications that do what we want; we must write applications that _can’t_ do what we _don’t_ want. I like to ensure that a script doesn’t do anything destructive in the case where there is no argument. Therefore, this is the first check that y. The condition checks the number of arguments, **$#**, for a value of zero and terminates the script if true. + + +``` +if [ $# -eq 0 ]; then +    echo "No arguments provided" +    exit 1 +fi +echo "arguments found: $#" +``` + +#### Multiple arguments + +You can pass more than one argument to a script. The internal variables that the script uses to reference each argument are simply incremented, such as **$1**, **$2**, **$3**, and so on. I’ll just expand my example above with the following line to echo the first three arguments. Obviously, additional logic will be needed for proper argument handling based on the total number. This example is simple for the sake of demonstration. + + +``` +`echo $1 $2 $3` +``` + +While we’re discussing these argument variables, you might have wondered, "Did he skip zero?" + +Well, yes, I did, but I have a great reason! There is indeed a **$0** variable, and it is very useful. Its value is simply the name of the script being executed. + + +``` +`echo $0` +``` + +An important reason to reference the name of the script during execution is to generate a log file that includes the script’s name in its own name. The simplest form might just be an echo statement. + + +``` +`echo test >> $0.log` +``` + +However, you will probably want to add a bit more code to ensure that the log is written to a location with the name and information that you find helpful to your use case. + +### 4\. User input + +Another useful feature to use in a script is its ability to accept input during execution. The simplest is to offer the user some input. + + +``` +echo "enter a word please:" + read word + echo $word +``` + +This also allows you to provide choices to the user. + + +``` +read -p "Install Software ?? [Y/n]: " answ + if [ "$answ" == 'n' ]; then +   exit 1 + fi +   echo "Installation starting..." +``` + +### 5\. Exit on failure + +Some years ago, I wrote a script for installing the latest version of the Java Development Kit (JDK) on my computer. The script extracts the JDK archive to a specific directory, updates a symbolic link, and uses the alternatives utility to make the system aware of the new version. If the extraction of the JDK archive failed, continuing could break Java system-wide. So, I wanted the script to abort in such a situation. I don’t want the script to make the next set of system changes unless the archive was successfully extracted. The following is an excerpt from that script: + + +``` +tar kxzmf jdk-8u221-linux-x64.tar.gz -C /jdk --checkpoint=.500; ec=$? +if [ $ec -ne 0 ]; then +     echo "Installation failed - exiting." +     exit 1 +fi +``` + +A quick way for you to demonstrate the usage of the **$?** variable is with this short one-liner: + + +``` +`ls T; ec=$?; echo $ec` +``` + +First, run **touch T** followed by this command. The value of **ec** will be 0. Then, delete **T**, **rm T**, and repeat the command. The value of **ec** will now be 2 because ls reports an error condition since **T** was not found. + +You can take advantage of this error reporting to include logic, as I have above, to control the behavior of your scripts. + +### Takeaway + +We might assume that we need to employ languages, such as Python, C, or Java, for higher functionality, but that’s not necessarily true. The Bash scripting language is very powerful. There is a lot to learn to maximize its usefulness. I hope these few examples will shed some light on the potential of coding with Bash. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/improve-bash-scripts + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) From 909fa992fb18d393ca1463f0f2d57ec01e9d0c51 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 8 Jan 2020 00:55:09 +0800 Subject: [PATCH 0143/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20How?= =?UTF-8?q?=20piwheels=20will=20save=20Raspberry=20Pi=20users=20time=20in?= =?UTF-8?q?=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md --- ...ll save Raspberry Pi users time in 2020.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md diff --git a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md new file mode 100644 index 0000000000..aa43d04f90 --- /dev/null +++ b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How piwheels will save Raspberry Pi users time in 2020) +[#]: via: (https://opensource.com/article/20/1/piwheels) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +How piwheels will save Raspberry Pi users time in 2020 +====== +By making pre-compiled Python packages for Raspberry Pi available, the +piwheels project saves users significant time and effort. +![rainbow colors on pinwheels in the sun][1] + +Piwheels automates building Python wheels (pre-compiled Python packages) for all of the projects on [PyPI][2], the Python Package Index, using Raspberry Pi hardware to ensure compatibility. This means that when a Raspberry Pi user wants to install a Python library using **pip**, they get a ready-made compiled version that's guaranteed to work on the Raspberry Pi. This makes it much easier for Raspberry Pi users to dive in and get started with their projects. + +![Piwheels logo][3] + +When I wrote [_piwheels: Speedy Python package installation for the Raspberry Pi_][4] in October 2018, the piwheels project was in its first year and already proving its purpose of saving Raspberry Pi users considerable time and effort. But the project, which makes pre-compiled Python packages available for Raspberry Pi, has come a long way in its second year. + +![Raspberry Pi 4][5] + +### How it works + +[Raspbian][6], the primary OS for Raspberry Pi, comes pre-configured to use piwheels, so users don't need to do anything special to get access to the wheels. + +The configuration file (at **/etc/pip.conf**) tells pip to use [piwheels.org][7] as an _additional index_, so pip looks at PyPI first, then piwheels. The Piwheels website is hosted on a Raspberry Pi 3, and all the wheels built by the project are hosted on that Pi. It serves over 1 million packages per month—not bad for a $35 computer! + +In addition to the main Raspberry Pi that serves the website, the piwheels project uses seven other Pis to build the packages. Some run Raspbian Jessie, building wheels for Python 3.4, some run Raspbian Stretch for Python 3.5, and some run Raspbian Buster for Python 3.7. The project doesn't generally support other Python versions. There's also a "proper server"—a virtual machine running the Postgres database. Since the Pi 3 has just 1GB of RAM, the (very large) database doesn't run well on it, so we moved it to a VM. The Pi 4 with 4GB RAM would probably be suitable, so we may move to this in the future. + +The Pis are all on an IPv6-only network in a "Pi Cloud"—a brilliant service provided by Cambridge-based hosting company [Mythic Beasts][8]. + +![Mythic Beasts hosting service][9] + +### Downloads and trends + +Every time a wheel file is downloaded, it is logged in the database. This provides insight into what packages are most popular and what Python versions and operating systems people are using. We don't have much information from the user agent, but because the architecture of Pi 1/Zero shows as "armv6" and Pi 2/3/4 show as "armv7," we can tell them apart. + +As of mid-December 2019, over 14 million packages have been downloaded from piwheels, with nearly 9 million in 2019 alone. + +The 10 most popular packages since the project's inception are: + + 1. [pycparser][10] (821,060 downloads) + 2. [PyYAML][11] (366,979) + 3. [numpy][12] (354,531) + 4. [cffi][13] (336,982) + 5. [MarkupSafe][14] (318,878) + 6. [future][15] (282,349) + 7. [aiohttp][16] (277,046) + 8. [cryptography][17] (276,167) + 9. [home-assistant-frontend][18] (266,667) + 10. [multidict][19] (256,185) + + + +Note that many pure-Python packages, such as [urllib3][20], are provided as wheels on PyPI; because these are compatible across platforms, they're not usually downloaded from piwheels because PyPI takes precedence. + +We also see trends in things like which Python versions are used over time. This shows the quick takeover of Python 3.7 from 3.5 when Raspbian Buster was released: + +![Data from piwheels on Python versions used over time][21] + +You can see more trends in our [stats blog posts][22]. + +### Time saved + +Every package build is logged in the database, and every download is also stored. Cross-referencing downloads with build duration shows how much time has been saved. One example is numpy—the latest version took about 11 minutes to build. + +So far, piwheels has saved users a total of over 165 years of build time. At the current usage rate, piwheels saves _over 200 days per day_. + +As well as saving build time, having pre-compiled wheels also means people don't have to install various development tools to build packages. Some packages require other apt packages for them to access shared libraries. Figuring out which ones you need can be a pain, so we made that step easier, too. First, we figured out the process and [documented it on our blog][23]. Then we added this logic to the build process so that when a wheel is built, its dependencies are automatically calculated and added to the package's project page: + +![numpy dependencies][24] + +### What next for piwheels? + +We launched project pages (e.g., [numpy][25]) this year, which are a really useful way to let people look up information about a project in a human-readable way. They also make it easier for people to report issues, such as if a project is missing from piwheels or they have an issue with a package they've downloaded. + +In early 2020, we're planning to roll out some upgrades to piwheels that will enable a new JSON API, so you can automatically check which versions are available, look up dependencies for a project, and lots more. + +The next Debian/Raspbian upgrade won't happen until mid-2021, so we won't start building wheels for any new Python versions until then. + +You can read more about piwheels on the project's [blog][26], where I'll be publishing a 2019 roundup early in 2020. You can also follow [@piwheels][27] on Twitter, where you'll see daily and monthly stats along with any milestones reached. + +Of course, piwheels is an open source project, and you can see the entire project [source code on GitHub][28]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/piwheels + +作者:[Ben Nuttall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rainbow-pinwheel-piwheel-diversity-inclusion.png?itok=di41Wd3V (rainbow colors on pinwheels in the sun) +[2]: https://pypi.org/ +[3]: https://opensource.com/sites/default/files/uploads/piwheels.png (Piwheels logo) +[4]: https://opensource.com/article/18/10/piwheels-python-raspberrypi +[5]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4_0.jpg (Raspberry Pi 4) +[6]: https://www.raspberrypi.org/downloads/raspbian/ +[7]: http://piwheels.org +[8]: https://www.mythic-beasts.com/order/rpi +[9]: https://opensource.com/sites/default/files/uploads/pi-cloud.png (Mythic Beasts hosting service) +[10]: https://www.piwheels.org/project/pycparser +[11]: https://www.piwheels.org/project/PyYAML +[12]: https://www.piwheels.org/project/numpy +[13]: https://www.piwheels.org/project/cffi +[14]: https://www.piwheels.org/project/MarkupSafe +[15]: https://www.piwheels.org/project/future +[16]: https://www.piwheels.org/project/aiohttp +[17]: https://www.piwheels.org/project/cryptography +[18]: https://www.piwheels.org/project/home-assistant-frontend +[19]: https://www.piwheels.org/project/multidict +[20]: https://piwheels.org/project/urllib3/ +[21]: https://opensource.com/sites/default/files/uploads/pyvers2019.png (Data from piwheels on Python versions used over time) +[22]: https://blog.piwheels.org/piwheels-stats-for-2019/ +[23]: https://blog.piwheels.org/how-to-work-out-the-missing-dependencies-for-a-python-package/ +[24]: https://opensource.com/sites/default/files/uploads/numpy-deps.png (numpy dependencies) +[25]: https://www.piwheels.org/project/numpy/ +[26]: https://blog.piwheels.org/ +[27]: https://twitter.com/piwheels +[28]: https://github.com/piwheels/ From e1088cdf2c4aee98fff42e8232b1227161721579 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Wed, 8 Jan 2020 01:20:21 +0800 Subject: [PATCH 0144/3057] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E8=AF=A5=E6=96=87?= =?UTF-8?q?=E7=AB=A0=EF=BC=8C=E7=BF=BB=E8=AF=9150%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20181105 5 Minimal Web Browsers for Linux.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index 1fbc18aeae..34c0c1e18e 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MonkeyDEcho ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (5 Minimal Web Browsers for Linux) @@ -9,19 +9,27 @@ 5 Minimal Web Browsers for Linux ====== +linux上的五种微型浏览器 +====== + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. +有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. +web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. +但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. +让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! ### GNOME Web GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. +GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: From 42f1a83728463efea3411631f34a871d0e1305c6 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Wed, 8 Jan 2020 01:23:58 +0800 Subject: [PATCH 0145/3057] fix --- sources/tech/20181105 5 Minimal Web Browsers for Linux.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index 34c0c1e18e..e3ee66f40a 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -9,27 +9,20 @@ 5 Minimal Web Browsers for Linux ====== -linux上的五种微型浏览器 -====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. -有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. -web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. -但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. -让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! ### GNOME Web GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. -GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: From ad719218b29a617feb3d0fe931e90c9976409350 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Wed, 8 Jan 2020 01:31:32 +0800 Subject: [PATCH 0146/3057] Update 20181105 5 Minimal Web Browsers for Linux.md --- sources/tech/20181105 5 Minimal Web Browsers for Linux.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index e3ee66f40a..70d75f74e7 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -9,7 +9,6 @@ 5 Minimal Web Browsers for Linux ====== - ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. From 1cd57105714a3362b0c1acc0e74a58da5c0c5c79 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Wed, 8 Jan 2020 01:35:03 +0800 Subject: [PATCH 0147/3057] fix --- sources/tech/20181105 5 Minimal Web Browsers for Linux.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index 70d75f74e7..34c0c1e18e 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -9,19 +9,27 @@ 5 Minimal Web Browsers for Linux ====== +linux上的五种微型浏览器 +====== + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. +有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. +web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. +但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. +让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! ### GNOME Web GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. +GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: From 0e6d1adb756702f050b674b34988029175449188 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 8 Jan 2020 08:43:15 +0800 Subject: [PATCH 0148/3057] translated --- ...VLC More Awesome With These Simple Tips.md | 131 ----------------- ...VLC More Awesome With These Simple Tips.md | 132 ++++++++++++++++++ 2 files changed, 132 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md create mode 100644 translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md diff --git a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md deleted file mode 100644 index a4dd3b7bd5..0000000000 --- a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md +++ /dev/null @@ -1,131 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Make VLC More Awesome With These Simple Tips) -[#]: via: (https://itsfoss.com/simple-vlc-tips/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Make VLC More Awesome With These Simple Tips -====== - -[VLC][1] is one of the [best open source video players][2], if not the best. What most people don’t know about it is that it is a lot more than just a video player. - -You can do a lot of complex tasks like broadcasting live videos, capturing devices etc. Just open its menu and you’ll see how many options it has. - -It’s FOSS has a detailed tutorial discussing some of the [pro VLC tricks][3] but those are way too complicated for normal users. - -This is why I am writing another article to show you some of the simple tips that you can use with VLC. - -### Do more with VLC with these simple tips - -Let’s see what can you do with VLC other than just playing a video file. - -#### 1\. Watch YouTube videos with VLC - -![][4] - -If you do not want to watch the annoying advertisements on [YouTube][5] or simply want a distraction-free experience for watching a YouTube video, you can use VLC. - -Yes, it is very easy to stream a YouTube video on VLC. - -Simply launch the VLC player, head to the Media settings and click on “**Open Network Stream**” or **CTRL + N** as a shortcut to that. - -![][6] - -Next, you just have to paste the URL of the video that you want to watch. There are some options to tweak – usually, you should not bother using them. But, if you are curious you can click on the “**Advanced options**” to explore. - -You can also add subtitles to the YouTube videos this way. However, an easier way to [watch YouTube or any online video with subtitles is using Penguin subtitle player][7]. - -#### 2\. Convert videos to different formats - -![][8] - -You can [use ffmpeg to convert videos in Linux command line][9]. You can also use a graphical tool like [HandBrake to convert video formats][10]. - -But if you do not want a separate app to transcode videos, you can use VLC media player to get the job done. - -To do that, just head on to the Media option on VLC and then click on “**Convert/Save**” or press CTRL + R as a shortcut to get there while you have VLC media player active. - -Next, you will need to either import the video from your computer/disk or paste the URL of the video that you want to save/convert. - -Whatever your input source is – just hit the “**Convert/Save**” button after selecting the file. - -Now, you will find another window that gives you the option to change the “**Profile**” from the settings. Click on it and choose a format that you’d like the video to be converted to (and saved). - -You can also change the storage path for the converted file by setting the destination folder at the bottom of the screen before converting it. - -#### 3\. Record Audio/Video From Source - -![Vlc Advanced Controls][11] - -Do you want to record the audio/video you’re playing on VLC Media Player? - -If yes, there’s an easy solution to that. Simply navigate your way through **View->click on “Advanced Controls”**. - -Once you do that, you should observe new buttons (including a red record button in your VLC player). - -#### 4\. Download subtitles automatically - -![][12] - -Yes, you can [automatically download subtitles with VLC][13]. You do not even have to look for it on a separate website. You just have to navigate your way to **View->VLSub**. - -By default, it is deactivated, so when you click on the option it gets activated and lets you search/download the subtitles you wanted. - -[VLC also lets you synchronize the subtitles][14] with simple keyboard shortcuts. - -#### 5\. Take A Snapshot - -![][15] - -With VLC, you can get some screenshots/images of the video while watching it. - -You just need to right-click on the player while the video is playing/paused, you will notice a bunch of options now, navigate through **Video->Take Snapshot**. - -If you have an old version installed, you might observe the snapshot option right after performing a right-click. - -#### Bonus Tip: Add Audio/Video Effects to a video - -From the menu, go to the “**Tools**” option. Now, click on “**Effects and Filters**” or simply press **CTRL + E** from the VLC player window to open up the option. - -Here, you can observe audio effects and video effects that you can add to your video. You may not be able to see all the changes in real-time, so you will have to tweak it and save it in order to see what happens. - -![][16] - -I’ll suggest keeping a backup of the original video before you modify the video. - -#### What’s your favorite VLC tip? - -I shared some of my favourite VLC tips. Do you know some cool tip that you use regularly with VLC? Why not share it with us? I may add it to the list here. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/simple-vlc-tips/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.videolan.org/ -[2]: https://itsfoss.com/video-players-linux/ -[3]: https://itsfoss.com/vlc-pro-tricks-linux/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-stream.jpg?ssl=1 -[5]: https://www.youtube.com/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-play.jpg?ssl=1 -[7]: https://itsfoss.com/penguin-subtitle-player/ -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-video-convert.jpg?ssl=1 -[9]: https://itsfoss.com/ffmpeg/ -[10]: https://itsfoss.com/handbrake/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-advanced-controls.png?ssl=1 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-subtitles-automatic.png?ssl=1 -[13]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/ -[14]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/ -[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-snapshot.png?ssl=1 -[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-effects-screenshot.jpg?ssl=1 diff --git a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md new file mode 100644 index 0000000000..7363cb7992 --- /dev/null +++ b/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make VLC More Awesome With These Simple Tips) +[#]: via: (https://itsfoss.com/simple-vlc-tips/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +这些简单的技巧使 VLC 更加出色 +====== + +如果 [VLC][1] 不是最好的播放器,那它是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。 + +你可以进行许多复杂的任务,如直播视频、捕捉设备等。只需打开菜单,你就可以看到它有多少选项。 + +它的 FOSS 页面有一个详细的教程,讨论一些[专业的 VLC 技巧][3],但这些对于普通用户太复杂。 + +这就是为什么我写另一篇文章的原因,来向你展示一些可以在 VLC 中使用的简单技巧。 + +### 使用这些简单技巧让 VLC 做更多事 + +Let’s see what can you do with VLC other than just playing a video file. +让我们看看除了播放视频文件之外,你还可以使用 VLC 做什么。 + +#### 1\. 使用 VLC 观看 YouTube 视频 + +![][4] + +如果你不想在 [YouTube][5] 上观看令人讨厌的广告,或者只想体验没有打扰地观看 YouTube 视频,你可以使用 VLC。 + +是的,在 VLC 上流式传输 YouTube 视频是非常容易的。 + +只需启动 VLC 播放器,前往媒体设置,然后单击 ”**Open Network Stream**“ 或使用快捷方式 **CTRL + N**。 + +![][6] + +接下来,你只需要粘贴要观看的视频的 URL。有一些选项可以调整,但通常你无需担心这些。如果你好奇,你可以点击 ”**Advanced options**“ 来探索。 + +你还可以通过这种方式向 YouTube 视频添加字幕。然而,[一个更简单的带字幕观看 Youtube 视频的办法是使用 Penguin 字幕播放器][7]。 + +#### 2\. 将视频转换为不同格式 + +![][8] + +你可以[在 Linux 命令行使用 ffmpeg 转换视频][9]。你还可以使用图形工具,如 [HandBrake 转换视频格式][10]。 + +但是,如果你不想用一个单独的应用转码视频,你可以使用 VLC 播放器来完成该工作。 + +为此,只需点击 VLC 上的媒体选项,然后单击 **Convert/Save**,或者在 VLC 播放器处于活动状态时按下快捷键 CTRL + R。 + +接下来,你需要从计算机/硬盘或者 URL 导入你想保存/转换的的视频。 + +不管什么来源,只需选择文件后点击 ”**Convert/Save**“ 按钮 + +你现在会看到另外一个窗口给你更改 ”**Profile**“ 设置。点击并选择你想转换的格式(并保存)。 + +你还可以在转换之前通过在屏幕底部设置目标文件夹来更改转换文件的存储路径。 + +#### 3\. 从源录制音频/视频 + +![Vlc Advanced Controls][11] + +你是否想在 VLC 播放器中录制正在播放的音频/视频? + +如果是的话,有一个简单的解决方案。只需**通过 View,然后点击 ”Advanced Controls“**。 + +完成后,你会看到一个新按钮(包括 VLC 播放器中的红色录制按钮)。 + +#### 4\. 自动下载字幕 + +![][12] + +是的,你可以[使用 VLC 自动下载字幕][13]。你甚至不必在单独的网站上查找字幕。你只需点击 **View->VLSub**。 + +默认情况下,它是禁用的,因此当你单击该选项时,它会被激活,并允许你搜索/下载想要的字幕。 + +[VLC 还能让你使用简单的键盘快捷键同步字幕][14] + +#### 5\. 截图 + +![][15] + +你可以在观看视频时使用 VLC 获取一些视频的截图/图像。 + +你只需在视频播放/暂停时右击播放器,你会看到一组选项,点击 **Video->Take Snapshot**。 + +如果安装了旧版本,你可能在右键时看到截图选项。 + +#### 额外技巧:给视频添加音频/视频效果 + +在菜单中,进入 ”**Tools**“ 选项。单击 ”**Effects and Filters**“,或者在 VLC 播放器窗口中按 **CTRL + E** 打开选项。 + +好了,你可以观察你给视频添加的音频和视频效果了。你也许无法实时看到效果,因此你需要调整并保存来看发生了什么。 + +![][16] + +我建议在修改视频之前保存一份原始视频备份。 + +#### 你最喜欢的 VLC 技巧是什么? + +我分享了一些我最喜欢的 VLC 技巧。你知道什么你经常使用的很酷的 VLC 技巧吗?为什么不和我们分享呢?我可以把它添加到列表中。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/simple-vlc-tips/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.videolan.org/ +[2]: https://itsfoss.com/video-players-linux/ +[3]: https://itsfoss.com/vlc-pro-tricks-linux/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-stream.jpg?ssl=1 +[5]: https://www.youtube.com/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-play.jpg?ssl=1 +[7]: https://itsfoss.com/penguin-subtitle-player/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-video-convert.jpg?ssl=1 +[9]: https://itsfoss.com/ffmpeg/ +[10]: https://itsfoss.com/handbrake/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-advanced-controls.png?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-subtitles-automatic.png?ssl=1 +[13]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/ +[14]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-snapshot.png?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-effects-screenshot.jpg?ssl=1 From 4a0eed84886d7440734a2900198135556a798d83 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 8 Jan 2020 08:47:19 +0800 Subject: [PATCH 0149/3057] translating --- .../tech/20200105 PaperWM- tiled window management for GNOME.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md index 0948014fba..fa99f6c352 100644 --- a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md +++ b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f213a05ee5b45f7a12ca8772157b6ccc91268dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=B3=A5?= <24203166+fuzheng1998@users.noreply.github.com> Date: Wed, 8 Jan 2020 10:29:19 +0800 Subject: [PATCH 0150/3057] Update 20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md --- ...- EA is Permanently Banning Linux Gamers on Battlefield V.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md b/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md index b0d8bb3874..b0818e5fe8 100644 --- a/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md +++ b/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (fuzheng1998) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d25e4d31152b2f43164afb5e92fdac207274fb37 Mon Sep 17 00:00:00 2001 From: BrunoJu Date: Wed, 8 Jan 2020 11:59:16 +0800 Subject: [PATCH 0151/3057] Update 20200107 Kali Linux Will No Longer Have The Default Root User.md --- ...0107 Kali Linux Will No Longer Have The Default Root User.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md index 2ffcd8f715..0f087529b9 100644 --- a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md +++ b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (BrunoJu) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7114530f7fa58b5a473b638039ad6bcf7db09bca Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 8 Jan 2020 13:55:50 +0800 Subject: [PATCH 0152/3057] PRF @wxy --- ...191130 7 maker gifts for kids and teens.md | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/translated/tech/20191130 7 maker gifts for kids and teens.md b/translated/tech/20191130 7 maker gifts for kids and teens.md index 59bc3fc837..002e97e442 100644 --- a/translated/tech/20191130 7 maker gifts for kids and teens.md +++ b/translated/tech/20191130 7 maker gifts for kids and teens.md @@ -1,15 +1,16 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (7 maker gifts for kids and teens) [#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) [#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) -7 个给儿童和少年的创客礼物 +给儿童和青少年的 7 件创客礼物 ====== -> 这份礼物指南可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力,使你轻松完成节日礼物的采购。 + +> 这份礼物指南使你轻松完成节日礼物的采购,它们可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力。 ![Gift box opens with colors coming out][1] @@ -19,13 +20,13 @@ ![Hummingbird Robotics Kit][2] -**年龄:**8 岁 - 成人 +**年龄:**8 岁 - 成人 -**这是什么:**[蜂鸟机器人套件][3]是一套完整的机器人套件,带有微控制器、电机、LED 和传感器。机器人的大脑具有特殊的端口,小手可以轻松地将其连接到机器人的组件上。蜂鸟套件并没有身体,鼓励用户自己创建一个。 +**这是什么:**[蜂鸟机器人套件][3]是一套完整的机器人套件,带有微控制器、电机、LED 和传感器。机器人的大脑具有特殊的端口,小手可以轻松地将其连接到机器人的组件上。蜂鸟套件并没有身体,而是鼓励用户自己创建一个。 **为什么我喜欢它:**蜂鸟可以使用多种编程语言 —— 从可视化编程(BirdBlox、MakeCode、Snap)到代码编程(Python 和 Java)—— 可以随着用户编码技能的提高而可扩展。所有组件均与你在电子商店中找到的组件完全相同,没有像其他机器人套件那样被塑料所遮盖。这使机器人的内部工作不再神秘,并在你需要时易于采购更多零件。 -由于没有固定组合项目,因此蜂鸟是发挥创造力的完美机器人。 +由于没有固定组装项目,因此蜂鸟是发挥创造力的完美机器人。 蜂鸟具有开源的软件和固件。它适用于 Linux、Windows、Mac、Chromebook、Android 和 iOS。 @@ -37,7 +38,7 @@ **年龄:** 6岁 - 成人 -**这是什么:** [Makey Makey 经典版][5]可将任何导电物体(从棉花糖到朋友)变成计算机钥匙。 +**这是什么:** [Makey Makey 经典版][5]可将任何导电物体(从棉花糖到你的朋友)变成计算机钥匙。 你可以使用鳄鱼夹将 Makey Makey 连接到你选择的导电物体上。然后,通过同时触摸两个导电物体来闭合接地和任何触发键之间的电路。Makey Makey 是一种安全的方法,可以安全地在家中探索电力,同时创造与计算机进行交互的有趣方式。 @@ -51,11 +52,11 @@ **年龄:** 10 岁 - 成人 -**这是什么:** Arduino 是随同电子套件购买的微控制器,也可以单独购买,它们具有多种版本,尽管我最喜欢[Arduino Uno][7]。可以根据需要从任何电子商店购买其他组件,例如 LED、电机和传感器。 +**这是什么:** Arduino 是随同电子套件购买的微控制器,也可以单独购买,它们具有多种版本,而我最喜欢 [Arduino Uno][7]。你可以根据需要从任何电子商店购买其他组件,例如 LED、电机和传感器。 **为什么我喜欢它:** Arduino Uno 的文档很完善,因此创客们很容易在线上找到教程。Arduino 可以实现从简单到复杂的各种电子项目。Arduino 具有开源的固件和硬件。它适用于 Linux、Mac 和 Windows。 -**费用:**主板的起价为 22.00 美元。总成本取决于项目和技能水平。 +**费用:** 主板的起价为 22.00 美元。总成本取决于项目和技能水平。 ### DIY 创客套件 @@ -63,7 +64,7 @@ **年龄**:8 岁 - 成人 -**这是什么:**当今许多创客、发明家和程序员都是从碰巧修补附加的东西开始的。你可以快速前往最近的电子产品商店,为家里的年轻人创建一套出色的创客工具包。这是我的创客工具包中的内容: +**这是什么:**当今许多创客、发明家和程序员都是从鼓捣碰巧出现在身边东西开始的。你可以快速前往最近的电子产品商店,为家里的年轻人创建一套出色的创客工具包。这是我的创客工具包中的内容: * 护目镜 * 锤子 @@ -74,7 +75,7 @@ * LED * 压电蜂鸣器 * 马达 -* 带引线的AA电池组 +* 带引线的 AA 电池组 * 剪线钳 * 纸板 * 美纹纸胶带 @@ -85,7 +86,7 @@ * 拉链 * 钩子 * 一个很酷的工具盒,用来存放所有东西 -   + **我为什么喜欢它:**还记得小时候,你把父母带回家的空纸箱变成了宇宙飞船、房屋或超级计算机吗?这就是为大孩子们准备的 DIY 创客工具包。 原始的组件使孩子们可以尝试并运用他们的想象力。DIY 创客工具包可以完全针对接收者定制。可以放入一些接受这份礼品的人可能从未想到过用之发挥创意的某些组件,例如为下水道提供一些 LED 或木工结构。 @@ -98,7 +99,7 @@ **年龄:** 8 个月至 5 岁 -**这是什么:**启发式游戏篮充满了由天然、无毒材料制成的有趣物品,可供婴幼儿使用其五种感官进行探索。这是一种开放式、自娱自乐的游戏。其想法是,成年人将监督(但不指导)儿童使用篮子及其物品半小时,然后将篮子拿走下一次再玩。 +**这是什么:**启发式游戏篮充满了由天然、无毒材料制成的有趣物品,可供婴幼儿使用其五种感官进行探索。这是一种开放式、自娱自乐的游戏。其想法是,成年人将监督(但不指导)儿童使用篮子及其物品半小时,然后将篮子拿走,等下一次再玩。 创建带有常见家用物品的可爱游戏篮很容易。尝试包括质地、声音、气味、形状和重量各不相同的物品。这里有一些想法可以帮助您入门。 @@ -107,7 +108,7 @@ * 金属打蛋器和汤匙 * 板刷 * 海绵 -* 小鸡蛋纸箱 +* 小型鸡蛋纸箱 * 纸板管 * 小擀面杖 * 带纹理的毛巾 @@ -120,7 +121,7 @@ **我为什么喜欢它:**游戏篮非常适合感官发育,并可以帮助幼儿提出问题和探索周围的世界。这是培养创客思维方式的重要组成部分! -很容易获得适合这个游戏篮的物品。你可能已经在家中或附近的二手店里有很多有趣的物品。幼儿使用游戏篮的方式与婴儿不同。随着孩子开始模仿成人生活并通过他们的游戏讲故事,这些物品将随孩子一起成长。 +很容易获得适合这个游戏篮的物品。你可能已经在家中或附近的二手商店里找到了很多有趣的物品。幼儿使用游戏篮的方式与婴儿不同。随着孩子们开始模仿成人生活并通过他们的游戏讲故事,这些物品将随孩子一起成长。 **费用:**不等 @@ -130,7 +131,7 @@ **年龄**:5-8 岁 -**这是什么:** 《[Hello Ruby][11]:编码历险记》是 Linda Liukas 的插图书,通过有趣的故事讲述了一个遇到各种问题和朋友(每个都用一个码代表)的女孩,向孩子们介绍了编程概念。Liukas 还有其他副标题为《互联网探险》和《计算机内的旅程》的《Hello Ruby》书籍,而《编码历险记》已以 20 多种语言出版。 +**这是什么:** 《[Hello Ruby][11]:编码历险记》是 Linda Liukas 的插图书,通过有趣的故事讲述了一个遇到各种问题和朋友(每个都用一个码代表)的女孩,向孩子们介绍了编程概念。Liukas 还有其他副标题为《互联网探险》和《计算机内的旅程》的《Hello Ruby》系列书籍,而《编码历险记》已以 20 多种语言出版。 **为什么我喜欢它:**作者在书中附带了许多免费、有趣和无障碍的活动,可以从 Hello Ruby 网站下载和打印这些活动。这些活动教授编码概念、还涉及艺术表达、沟通、甚至时间安排。 @@ -144,7 +145,7 @@ **内容是什么:**由《编程少女》的创始人 Reshma Saujani 撰写,《[编程少女:学会编程和改变世界][13]》为年轻女孩(以及男孩)提供了科技领域的实用信息。它涵盖了广泛的主题,包括编程语言、用例、术语和词汇、职业选择以及技术行业人士的个人简介和访谈。 -**为什么我喜欢它:**本书以讲述了大多数面向成年人的网站没有的技术故事。技术涉及许多学科,对于年轻人来说,重要的是要了解他们可以使用它来解决现实世界中的问题并有所作为。 +**为什么我喜欢它:**本书以讲述了大多数面向成年人的网站都没有的技术故事。这些技术涉及许多学科,对于年轻人来说,重要的是要了解他们可以使用它来解决现实世界中的问题并有所作为。 **成本:**精装书的标价为 17.99 美元,平装书的标价为 10.99 美元,但你可以通过本地或在线书店以更低的价格找到。 @@ -155,7 +156,7 @@ via: https://opensource.com/article/19/11/maker-gifts-kids 作者:[Jess Weichler][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5fea83c3ca13a218e3c68bf908fdf9c11c93033f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 8 Jan 2020 14:08:32 +0800 Subject: [PATCH 0153/3057] PUB @wxy https://linux.cn/article-11762-1.html --- .../20191130 7 maker gifts for kids and teens.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191130 7 maker gifts for kids and teens.md (98%) diff --git a/translated/tech/20191130 7 maker gifts for kids and teens.md b/published/20191130 7 maker gifts for kids and teens.md similarity index 98% rename from translated/tech/20191130 7 maker gifts for kids and teens.md rename to published/20191130 7 maker gifts for kids and teens.md index 002e97e442..c92bcc29c9 100644 --- a/translated/tech/20191130 7 maker gifts for kids and teens.md +++ b/published/20191130 7 maker gifts for kids and teens.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11762-1.html) [#]: subject: (7 maker gifts for kids and teens) [#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) [#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) @@ -12,7 +12,7 @@ > 这份礼物指南使你轻松完成节日礼物的采购,它们可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力。 -![Gift box opens with colors coming out][1] +![](https://img.linux.net.cn/data/attachment/album/202001/08/140516t4ewey9ryu24tpz5.jpg) 还在纠结这个假期给年轻人买什么礼物?这是我精选的开源礼物,这些礼物将激发未来的创意和灵感。 From 50e8ec4229d440d6ca3ab56aa765b1d1eaaecef7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:53:24 +0800 Subject: [PATCH 0154/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200108=20How?= =?UTF-8?q?=20to=20setup=20multiple=20monitors=20in=20sway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200108 How to setup multiple monitors in sway.md --- ... How to setup multiple monitors in sway.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20200108 How to setup multiple monitors in sway.md diff --git a/sources/tech/20200108 How to setup multiple monitors in sway.md b/sources/tech/20200108 How to setup multiple monitors in sway.md new file mode 100644 index 0000000000..f156d204dc --- /dev/null +++ b/sources/tech/20200108 How to setup multiple monitors in sway.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to setup multiple monitors in sway) +[#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) +[#]: author: (arte219 https://fedoramagazine.org/author/arte219/) + +How to setup multiple monitors in sway +====== + +![][1] + +Sway is a tiling Wayland compositor which has mostly the same features, look and workflow as the [i3 X11 window manager][2]. Because Sway uses Wayland instead of X11, the tools to setup X11 don’t always work in sway. This includes tools like _xrandr_, which are used in X11 window managers or desktops to setup monitors. This is why monitors have to be setup by editing the sway config file, and that’s what this article is about. + +## **Getting your monitor ID’s** + +First, you have to get the names sway uses to refer to your monitors. You can do this by running: + +``` +$ swaymsg -t get_outputs +``` + +You will get information about all of your monitors, every monitor separated by an empty line. + +You have to look for the first line of every section, and for what’s after “Output”. For example, when you see a line like “_Output DVI-D-1 ‘Philips Consumer Electronics Company’_”, the output ID is “DVI-D-1”. Note these ID’s and which physical monitors they belong to. + +## **Editing the config file** + +If you haven’t edited the Sway config file before, you have to copy it to your home directory by running this command: + +``` +cp -r /etc/sway/config ~/.config/sway/config +``` + +Now the default config file is located in _~/.config/sway_ and called “config”. You can edit it using any text editor. + +Now you have to do a little bit of math. Imagine a grid with the origin in the top left corner. The units of the X and Y coordinates are pixels. The Y axis is inverted. This means that if you, for example, start at the origin and you move 100 pixels to the right and 80 pixels down, your coordinates will be (100, 80). + +You have to calculate where your displays are going to end up on this grid. The locations of the displays are specified with the top left pixel. For example, if we want to have a monitor with name HDMI1 and a resolution of 1920×1080, and to the right of it a laptop monitor with name eDP1 and a resolution of 1600×900, you have to type this in your config file: + +``` +output HDMI1 pos 0 0 +output eDP1 pos 1920 0 +``` + +You can also specify the resolutions manually by using the _res_ option:  + +``` +output HDMI1 pos 0 0 res 1920x1080 +output eDP1 pos 1920 0 res 1600x900 +``` + +## **Binding workspaces to monitors** + +Using sway with multiple monitors can be a little bit tricky with workspace management. Luckily, you can bind workspaces to a specific monitor, so you can easily switch to that monitor and use your displays more efficiently. This can simply be done by the workspace command in your config file. For example, if you want to bind workspace 1 and 2 to monitor DVI-D-1 and workspace 8 and 9 to monitor HDMI-A-1, you can do that by using: + +``` +workspace 1 output DVI-D-1 +workspace 2 output DVI-D-1 +``` + +``` +workspace 8 output HDMI-A-1 +workspace 9 output HDMI-A-1 +``` + +That’s it! These are the basics of multi monitor setup in sway. A more detailed guide can be found at . + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ + +作者:[arte219][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/arte219/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/sway-multiple-monitors-816x345.png +[2]: https://fedoramagazine.org/getting-started-i3-window-manager/ From 233e9833d0e95677b396bf973cd430454f508085 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:53:46 +0800 Subject: [PATCH 0155/3057] add done: 20200108 How to setup multiple monitors in sway.md --- ...duction to the Linux goto shell utility.md | 599 ++++++++++++++++++ 1 file changed, 599 insertions(+) create mode 100644 sources/tech/20200107 Introduction to the Linux goto shell utility.md diff --git a/sources/tech/20200107 Introduction to the Linux goto shell utility.md b/sources/tech/20200107 Introduction to the Linux goto shell utility.md new file mode 100644 index 0000000000..b683f34449 --- /dev/null +++ b/sources/tech/20200107 Introduction to the Linux goto shell utility.md @@ -0,0 +1,599 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to the Linux goto shell utility) +[#]: via: (https://opensource.com/article/20/1/directories-autocomplete-linux) +[#]: author: (Lazarus Lazaridis https://opensource.com/users/iridakos) + +Introduction to the Linux goto shell utility +====== +Learn how to use goto to alias and navigate to directories with +autocomplete in Linux. +![Files in a folder][1] + +The goto shell utility allows users to navigate to aliased directories and also supports autocompletion. + +## How it works + +Before you can use goto, you need to register your directory aliases. For example: + + +``` +`goto -r dev /home/iridakos/development` +``` + +then change to that directory, e.g.: + + +``` +`goto dev` +``` + +![goto demo][2] + +## Autocompletion in goto + +**goto** comes with a nice autocompletion script—whenever you press the Tab key after the **goto** command, Bash or Zsh will prompt you with suggestions of the aliases that are available: + + +``` +$ goto <tab> +bc /etc/bash_completion.d                     +dev /home/iridakos/development +rubies /home/iridakos/.rvm/rubies +``` + +## Installing goto + +There are several ways to install goto. + +### Via script + +Clone the repository and run the install script as a superuser or root: + + +``` +git clone +cd goto +sudo ./install +``` + +### Manually + +Copy the file **goto.sh** somewhere in your filesystem and add a line in your **.zshrc** or **.bashrc** to source it. + +For example, if you placed the file in your home folder, all you have to do is add the following line to your **.zshrc** or **.bashrc** file: + + +``` +`source ~/goto.sh` +``` + +### MacOS Homebrew + +A formula named **goto** is available for the Bash shell in MacOS: + + +``` +`brew install goto` +``` + +### Add colored output + + +``` +`echo -e "\$include /etc/inputrc\nset colored-completion-prefix on" >> ~/.inputrc` +``` + +**Notes:** + + * You need to restart your shell after installation. + * You need to have the Bash completion feature enabled for Bash in MacOS (see this [issue][3]). + * You can install it with **brew install bash-completion** if you don't have it enabled. + + + +## Ways to use goto + +### Change to an aliased directory + +To change to an aliased directory, type: + + +``` +`goto ` +``` + +For example: + + +``` +`goto dev` +``` + +### Register an alias + +To register a directory alias, type: + + +``` +`goto -r ` +``` + +or + + +``` +`goto --register ` +``` + +For example: + + +``` +`goto -r blog /mnt/external/projects/html/blog` +``` + +or + + +``` +`goto --register blog /mnt/external/projects/html/blog` +``` + +**Notes:** + + * **goto** **expands** the directories, so you can easily alias your current directory with the following command and it will automatically be aliased to the whole path: [code]`goto -r last_release .` +``` + * Pressing the Tab key after the alias name provides the shell's default directory suggestions. + + + +### Unregister an alias + +To unregister an alias, use: +``` +`goto -u ` +``` +or +``` +`goto --unregister ` +``` +For example: +``` +`goto -u last_release` +``` +or +``` +`goto --unregister last_release` +``` +**Note:** By pressing the Tab key after the command (**-u** or **\--unregister**), the completion script will prompt you with the list of registered aliases. + +### List aliases + +To get a list of your currently registered aliases, use: +``` +`goto -l` +``` +or +``` +`goto --list` +``` +### Expand an alias + +To expand an alias to its value, use: +``` +`goto -x ` +``` +or +``` +`goto --expand ` +``` +For example: +``` +`goto -x last_release` +``` +or +``` +`goto --expand last_release` +``` +### Clean up aliases + +To clean up the aliases from directories that are no longer accessible in your filesystem, use: +``` +`goto -c` +``` +or +``` +`goto --cleanup` +``` +### Get help + +To view the tool's help information, use: +``` +`goto -h` +``` +or +``` +`goto --help` +``` +### Check the version + +To view the tool's version, use: +``` +`goto -v` +``` +or +``` +`goto --version` +``` +### Push before changing directories + +To push the current directory onto the directory stack before changing directories, type: +``` +`goto -p ` +``` +or +``` +`goto --push ` +``` +### Revert to a pushed directory + +To return to a pushed directory, type: +``` +`goto -o` +``` +or +``` +`goto --pop` +``` +**Note:** This command is equivalent to **popd** but within the **goto** command. + +## Troubleshooting + +If you see the error **command not found: compdef** in Zsh, it means you need to load **bashcompinit**. To do so, append this to your **.zshrc** file: +``` + + +autoload bashcompinit +bashcompinit + +``` +## Get involved + +The goto tool is open source under the [MIT License][4] terms, and contributions are welcomed. To learn more, visit the [Contributing][5] section in goto's GitHub repository. + +## The goto script +``` + + +goto() +{ +  local target +  _goto_resolve_db + +  if [ -z "$1" ]; then +    # display usage and exit when no args +    _goto_usage +    return +  fi + +  subcommand="$1" +  shift +  case "$subcommand" in +    -c|--cleanup) +      _goto_cleanup "$@" +      ;; +    -r|--register) # Register an alias +      _goto_register_alias "$@" +      ;; +    -u|--unregister) # Unregister an alias +      _goto_unregister_alias "$@" +      ;; +    -p|--push) # Push the current directory onto the pushd stack, then goto +      _goto_directory_push "$@" +      ;; +    -o|--pop) # Pop the top directory off of the pushd stack, then change that directory +      _goto_directory_pop +      ;; +    -l|--list) +      _goto_list_aliases +      ;; +    -x|--expand) # Expand an alias +      _goto_expand_alias "$@" +      ;; +    -h|--help) +      _goto_usage +      ;; +    -v|--version) +      _goto_version +      ;; +    *) +      _goto_directory "$subcommand" +      ;; +  esac +  return $? +} + +_goto_resolve_db() +{ +  GOTO_DB="${GOTO_DB:-$HOME/.goto}" +  touch -a "$GOTO_DB" +} + +_goto_usage() +{ +  cat <<\USAGE +usage: goto [<option>] <alias> [<directory>] + +default usage: +  goto <alias> \- changes to the directory registered for the given alias + +OPTIONS: +  -r, --register: registers an alias +    goto -r|--register <alias> <directory> +  -u, --unregister: unregisters an alias +    goto -u|--unregister <alias> +  -p, --push: pushes the current directory onto the stack, then performs goto +    goto -p|--push <alias> +  -o, --pop: pops the top directory from the stack, then changes to that directory +    goto -o|--pop +  -l, --list: lists aliases +    goto -l|--list +  -x, --expand: expands an alias +    goto -x|--expand <alias> +  -c, --cleanup: cleans up non existent directory aliases +    goto -c|--cleanup +  -h, --help: prints this help +    goto -h|--help +  -v, --version: displays the version of the goto script +    goto -v|--version +USAGE +} + +# Displays version +_goto_version() +{ +  echo "goto version 1.2.4.1" +} + +# Expands directory. +# Helpful for ~, ., .. paths +_goto_expand_directory() +{ +  builtin cd "$1" 2>/dev/null && pwd +} + +# Lists registered aliases. +_goto_list_aliases() +{ +  local IFS=$' ' +  if [ -f "$GOTO_DB" ]; then +    while read -r name directory; do +      printf '\e[1;36m%20s  \e[0m%s\n' "$name" "$directory" +    done < "$GOTO_DB" +  else +    echo "You haven't configured any directory aliases yet." +  fi +} + +# Expands a registered alias. +_goto_expand_alias() +{ +  if [ "$#" -ne "1" ]; then +    _goto_error "usage: goto -x|--expand <alias>" +    return +  fi + +  local resolved + +  resolved=$(_goto_find_alias_directory "$1") +  if [ -z "$resolved" ]; then +    _goto_error "alias '$1' does not exist" +    return +  fi + +  echo "$resolved" +} + +# Lists duplicate directory aliases +_goto_find_duplicate() +{ +  local duplicates= + +  duplicates=$(sed -n 's:[^ ]* '"$1"'$:&:p' "$GOTO_DB" 2>/dev/null) +  echo "$duplicates" +} + +# Registers and alias. +_goto_register_alias() +{ +  if [ "$#" -ne "2" ]; then +    _goto_error "usage: goto -r|--register <alias> <directory>" +    return 1 +  fi + +  if ! [[ $1 =~ ^[[:alnum:]]+[a-zA-Z0-9_-]*$ ]]; then +    _goto_error "invalid alias - can start with letters or digits followed by letters, digits, hyphens or underscores" +    return 1 +  fi + +  local resolved +  resolved=$(_goto_find_alias_directory "$1") + +  if [ -n "$resolved" ]; then +    _goto_error "alias '$1' exists" +    return 1 +  fi + +  local directory +  directory=$(_goto_expand_directory "$2") +  if [ -z "$directory" ]; then +    _goto_error "failed to register '$1' to '$2' - can't cd to directory" +    return 1 +  fi + +  local duplicate +  duplicate=$(_goto_find_duplicate "$directory") +  if [ -n "$duplicate" ]; then +    _goto_warning "duplicate alias(es) found: \\\n$duplicate" +  fi + +  # Append entry to file. +  echo "$1 $directory" >> "$GOTO_DB" +  echo "Alias '$1' registered successfully." +} + +# Unregisters the given alias. +_goto_unregister_alias() +{ +  if [ "$#" -ne "1" ]; then +    _goto_error "usage: goto -u|--unregister <alias>" +    return 1 +  fi + +  local resolved +  resolved=$(_goto_find_alias_directory "$1") +  if [ -z "$resolved" ]; then +    _goto_error "alias '$1' does not exist" +    return 1 +  fi + +  # shellcheck disable=SC2034 +  local readonly GOTO_DB_TMP="$HOME/.goto_" +  # Delete entry from file. +  sed "/^$1 /d" "$GOTO_DB" > "$GOTO_DB_TMP" && mv "$GOTO_DB_TMP" "$GOTO_DB" +  echo "Alias '$1' unregistered successfully." +} + +# Pushes the current directory onto the stack, then goto +_goto_directory_push() +{ +  if [ "$#" -ne "1" ]; then +    _goto_error "usage: goto -p|--push <alias>" +    return +  fi + +  { pushd . || return; } 1>/dev/null 2>&1 + +  _goto_directory "$@" +} + +# Pops the top directory from the stack, then goto +_goto_directory_pop() +{ +  { popd || return; } 1>/dev/null 2>&1 +} + +# Unregisters aliases whose directories no longer exist. +_goto_cleanup() +{ +  if ! [ -f "$GOTO_DB" ]; then +    return +  fi + +  while IFS= read -r i && [ -n "$i" ]; do +    echo "Cleaning up: $i" +    _goto_unregister_alias "$i" +  done <<< "$(awk '{al=$1; $1=""; dir=substr($0,2); +                    system("[ ! -d \"" dir "\" ] && echo " al)}' "$GOTO_DB")" +} + +# Changes to the given alias' directory +_goto_directory() +{ +  local target + +  target=$(_goto_resolve_alias "$1") || return 1 + +  builtin cd "$target" 2> /dev/null || \ +    { _goto_error "Failed to goto '$target'" && return 1; } +} + +# Fetches the alias directory. +_goto_find_alias_directory() +{ +  local resolved + +  resolved=$(sed -n "s/^$1 \\\\(.*\\\\)/\\\1/p" "$GOTO_DB" 2>/dev/null) +  echo "$resolved" +} + +# Displays the given error. +# Used for common error output. +_goto_error() +{ +  (>&2 echo -e "goto error: $1") +} + +# Displays the given warning. +# Used for common warning output. +_goto_warning() +{ +  (>&2 echo -e "goto warning: $1") +} + +# Displays entries with aliases starting as the given one. +_goto_print_similar() +{ +  local similar + +  similar=$(sed -n "/^$1[^ ]* .*/p" "$GOTO_DB" 2>/dev/null) +  if [ -n "$similar" ]; then +    (>&2 echo "Did you mean:") +    (>&2 column -t <<< "$similar") +  fi +} + +# Fetches alias directory, errors if it doesn't exist. +_goto_resolve_alias() +{ +  local resolved + +  resolved=$(_goto_find_alias_directory "$1") + +  if [ -z "$resolved" ]; then +    _goto_error "unregistered alias $1" +    _goto_print_similar "$1" +    return 1 +  else +    echo "${resolved}" +  fi +} + +# Completes the goto function with the available commands +_complete_goto_commands() +{ +  local IFS=$' \t\n' + +  # shellcheck disable=SC2207 +  COMPREPLY=($(compgen -W "-r --register -u --unregister -p --push -o --pop -l --list -x --expand -c --cleanup -v --version" -- "$1")) +} + +# Completes the goto function with the available aliases +_complete_goto_aliases() +{ +  local IFS=$'\n' matches +  _goto_resolve_db + +  # shellcheck disable=SC2207 +  matches=($(sed -n "/^$1/p" "$GOTO_DB" 2>/dev/null)) + +  if [ "${#matches[@]}" -eq "1" ]; then +    # remove the filenames attribute from the completion method +    compopt +o filenames 2>/dev/null + +    # if you find only one alias don't append the directory +    COMPREPLY=("${matches[0]// *}") +  else +    for i in "${!matches[@]}"; do +      # remove the filenames attribute from the completion method +      compopt +o filenames 2>/dev/null + +      if ! [[ $(uname -s) =~ Darwin* ]]; then +        matches[$i]=$(printf '%*s' "-$COLUMNS" "${matches[$i]}") + +        COMPREPLY+=("$(compgen -W "${matches[$i]}")") +      els \ No newline at end of file From e1c683242121cb7793991a55ca35754e11cdb387 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:57:11 +0800 Subject: [PATCH 0156/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20Huaw?= =?UTF-8?q?ei=E2=80=99s=20Linux=20Distribution=20openEuler=20is=20Availabl?= =?UTF-8?q?e=20Now!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md --- ...Distribution openEuler is Available Now.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md diff --git a/sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md new file mode 100644 index 0000000000..93c4330b52 --- /dev/null +++ b/sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Huawei’s Linux Distribution openEuler is Available Now!) +[#]: via: (https://itsfoss.com/openeuler/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Huawei’s Linux Distribution openEuler is Available Now! +====== + +Huawei offers a CentOS based enterprise Linux distribution called EulerOS. Recently, Huawei has released a community edition of EulerOS called [openEuler][1]. + +The source code of openEuler is released as well. You won’t find it on Microsoft owned GitHub – the source code is available at [Gitee][2], a Chinese [alternative of GitHub][3]. + +There are two separate repositories, one for the [source code][2] and the other as a [package source][4] to store software packages that help to build the OS. + +![][5] + +The openEuler infrastructure team shared their experience to make the source code available: + +> We are very excited at this moment. It was hard to imagine that we will manage thousands of repositories. And to ensure that they can be compiled successfully, we would like to thank all those who participated in contributing + +### openEuler is a Linux distribution based on CentOS + +Like EulerOS, openEuler OS is also based on [CentOS][6] but is further developed by Huawei Technologies for enterprise applications. + +It is tailored for ARM64 architecture servers and Huawei claims to have made changes to boost its performance. You can read more about it at [Huawei’s dev blog][7]. + +![][8] + +At the moment, as per the official openEuler announcement, there are more than 50 contributors with nearly 600 commits for openEuler. + +The contributors made it possible to make the source code available to the community. + +It is also worth noting that the repositories also include two new projects (or sub-projects) associated with it, [iSulad][9] **and A-Tune**. + +A-Tune is an AI-based OS tuning software and iSulad is a lightweight container runtime daemon that is designed for IoT and Cloud infrastructure, as mentioned on [Gitee][2]. + +Also, the official [announcement post][10] mentioned that these systems are built on the Huawei Cloud through script automation. So, that is definitely something interesting. + +### Downloading openEuler + +![][11] + +As of now, you won’t find the documentation for it in English – so you will have to wait for it or choose to help them with the [documentation][12]. + +You can download the ISO directly from its [official website][13] to test it out: + +[Download openEuler][13] + +### What do you think of Huawei openEuler? + +As per cnTechPost, Huawei had announced that EulerOS would become open source under the new name openEuler. + +At this point, it’s not clear if openEuler is replacing EulerOS or both will exist together like CentOS (community edition) and Red Hat (commercial edition). + +I haven’t tested it yet so I cannot say if openEuler is suitable for English speaking users or not. + +Are you willing to give this a try? In case you’ve already tried it out, feel free to let me know your experience with it in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/openeuler/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://openeuler.org/en/ +[2]: https://gitee.com/openeuler +[3]: https://itsfoss.com/github-alternatives/ +[4]: https://gitee.com/src-openeuler +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/openEuler-website.jpg?ssl=1 +[6]: https://www.centos.org/ +[7]: https://developer.huaweicloud.com/en-us/euleros/euleros-introduction.html +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/openeuler-gitee.jpg?ssl=1 +[9]: https://gitee.com/openeuler/iSulad +[10]: https://openeuler.org/en/news/20200101.html +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/openEuler.jpg?ssl=1 +[12]: https://gitee.com/openeuler/docs +[13]: https://openeuler.org/en/download.html From 2fde18756ccb5a314085545668e8b2a53dc0c5e8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:57:48 +0800 Subject: [PATCH 0157/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200108=206=20?= =?UTF-8?q?requirements=20of=20cloud-native=20software?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200108 6 requirements of cloud-native software.md --- ...6 requirements of cloud-native software.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/tech/20200108 6 requirements of cloud-native software.md diff --git a/sources/tech/20200108 6 requirements of cloud-native software.md b/sources/tech/20200108 6 requirements of cloud-native software.md new file mode 100644 index 0000000000..fcdbe9818c --- /dev/null +++ b/sources/tech/20200108 6 requirements of cloud-native software.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 requirements of cloud-native software) +[#]: via: (https://opensource.com/article/20/1/cloud-native-software) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +6 requirements of cloud-native software +====== +A checklist for developing and implementing cloud-native +(container-first) software. +![Team checklist][1] + +For many years, monolithic applications were the standard enterprise architecture for achieving business requirements. But that changed significantly once cloud infrastructure began treating business acceleration at scale and speed. Application architectures have also transformed to fit into the cloud-native applications and the [microservices][2], [serverless][3], and event-driven services that are running on immutable infrastructures across hybrid and multi-cloud platforms. + +### The cloud-native connection to Kubernetes + +According to the [Cloud Native Computing Foundation][4] (CNCF): + +> "Cloud native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach. +> +> "These techniques enable loosely coupled systems that are resilient, manageable, and observable. Combined with robust automation, they allow engineers to make high-impact changes frequently and predictably with minimal toil." + +Container orchestration platforms like [Kubernetes][5] allow DevOps teams to build immutable infrastructures to develop, deploy, and manage application services. The speed at which rapid iteration is possible now aligns with business needs. Developers building containers to run in Kubernetes need an effective place to do so. + +### Requirements for cloud-native software + +What capabilities are required to create a cloud-native application architecture, and what benefits will developers gain from it? + +While there are many ways to build and architect cloud-native applications, the following are some ingredients to consider: + + * **Runtimes:** They are more likely to be written in the container-first or/and Kubernetes-native language, which means runtimes such as Java, Node.js, Go, Python, and Ruby. + * **Security:** When deploying and maintaining applications in a multi-cloud or hybrid cloud application environment, security is of utmost importance and should be part of the environment. + * **Observability:** Use tools such as Prometheus, Grafana, and Kiali that can enhance observability by providing realtime metrics and more information about how applications are being used and behave in the cloud. + * **Efficiency:** Focus on a tiny memory footprint, small artifact size, and fast boot time to make applications portable across hybrid/multi-cloud platforms. + * **Interoperability:** Integrate cloud-native apps with open source technologies that enable you to meet the requirements listed above, including Infinispan, MicroProfile, Hibernate, Kafka, Jaeger, Prometheus, and more, for building standard runtime architectures. + * **DevOps/DevSecOps:** These methodologies are designed for continuous deployment to production, in-line with the minimum viable product (MVP) and with security as part of the tooling. + + + +### Making cloud-native concrete + +Cloud-native can seem like an abstract term, but reviewing the definition and thinking like a developer can make it more concrete. In order for cloud-native applications to be successful, they need to include a long, well-defined list of ingredients. + +How are you planning for cloud-native application design? Share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cloud-native-software + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) +[2]: https://opensource.com/resources/what-are-microservices +[3]: https://opensource.com/article/18/11/open-source-serverless-platforms +[4]: https://github.com/cncf/toc/blob/master/DEFINITION.md +[5]: https://opensource.com/resources/what-is-kubernetes From 97617dac363ed042ac5eb37338cfd2741aa08e8d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:58:21 +0800 Subject: [PATCH 0158/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200108=20Auto?= =?UTF-8?q?mating=20the=20creation=20of=20research=20artifacts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200108 Automating the creation of research artifacts.md --- ...ting the creation of research artifacts.md | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 sources/tech/20200108 Automating the creation of research artifacts.md diff --git a/sources/tech/20200108 Automating the creation of research artifacts.md b/sources/tech/20200108 Automating the creation of research artifacts.md new file mode 100644 index 0000000000..e5d3f96163 --- /dev/null +++ b/sources/tech/20200108 Automating the creation of research artifacts.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automating the creation of research artifacts) +[#]: via: (https://opensource.com/article/20/1/automating-documentation) +[#]: author: (Kiko Fernandez-Reyes https://opensource.com/users/kikofernandez) + +Automating the creation of research artifacts +====== +A simple way to automate generating source code documentation, creating +HTML and PDF versions of user documentation, compiling a technical +(research) document to PDF, generating the bibliography, and +provisioning virtual machines. +![Files in a folder][1] + +In my work as a programming language researcher, I need to create [artifacts][2] that are easy to understand and well-documented. To make my work easier, I found a simple way to automate generating source code documentation, creating HTML and PDF versions of user documentation, compiling a technical (research) document to PDF, generating the bibliography, and provisioning of virtual machines with the software artefact installed for ease of reproducibility of my research. + +The tools I use are: + + * [Make][3] makefiles for overall orchestration of all components + * [Haddock][4] for generating source code documentation + * [Pandoc][5] for generating PDF and HTML files from a Markdown file + * [Vagrant][6] for provisioning virtual machines + * [Stack][7] for downloading Haskell dependencies, compiling, running tests, etc + * [pdflaTeX][8] for compiling a LaTeX file to PDF format + * [BibTeX][9] for generating a bibliography + * [Zip][10] to pack everything and get it ready for distribution + + + +I use the following folder and file structure: + + +``` +├── Makefile +├── Vagrantfile +├── code +│   └── typechecker-oopl (Project) +│       ├── Makefile +│       └── ... +│ +├── documentation +│   ├── Makefile +│   ├── README.md +│   ├── assets +│   │   ├── pandoc.css (Customised CSS for Pandoc) +│   │   └── submitted-version.pdf (PDF of your research) +│   └── meta.yaml +│ +├── research +│   ├── Makefile +│   ├── ACM-Reference-Format.bst +│   ├── acmart.cls +│   ├── biblio.bib +│   └── typecheckingMonad.tex +``` + +The Makefile glues together the output from all of the tools listed above. The **code** folder contains the source code of the tool/language I created. The **documentation** folder contains a Makefile that has instructions on how to generate PDF and HTML versions of the user instructions, located in the README.md file. I generate the PDF and HTML user documentation using Pandoc. The **assets** are simply the CSS style to use and a PDF of my research article that will be hyperlinked from the user-generated documentation, so that it is easy to follow. **meta.yaml** contains meta instructions for generating the user documentation, used by Pandoc for e.g., for author names. The **research** folder contains my research article in LaTeX format, but it could hold any other technical document. + +As you can see in the structure, I have a [Makefile][11] for each folder to decouple each Makefile's responsibility and keep a (somewhat) maintainable design. Here is an overview of the top-level Makefile, which orchestrates generating the user documentation, research paper, bibliography, documentation from source code, and provisioning of a virtual machine. + + +``` +all: doc gen + +doc: +        make -C $(DOC_SRC) $@ +        make -C $(CODE_PATH) $@ +        make -C $(RESEARCH) + +gen: +        # Creation of folder with artefact, empty at the moment +        mkdir -p $(ARTEFACT_FOLDER) + +        # Moving user documentation to artefact folder +        cp $(DOC_SRC)/$(README).pdf $(ARTEFACT_FOLDER) +        cp $(DOC_SRC)/$(README).html $(ARTEFACT_FOLDER) +        cp -r $(DOC_SRC)/$(ASSETS) $(ARTEFACT_FOLDER) + +        # Moving research article to artefact folder +        cp $(RESEARCH)/$(RESEARCH_PAPER).pdf $(ARTEFACT_FOLDER)/$(ASSETS)/submitted-version.pdf + +        # Moving code and autogenerated doc to artefact folder +        cp -r $(CODE_PATH) $(ARTEFACT_FOLDER) +        cd $(ARTEFACT_FOLDER)/$(CODE_SRC) +        $(STACK) +        cd ../.. +        rm -rf $(ARTEFACT_FOLDER)/$(DOC_SRC) +        mv $(ARTEFACT_FOLDER)/$(CODE_SRC)/$(HADDOCK) $(ARTEFACT_FOLDER)/$(DOC_SRC) + +        # zip it! +        zip $(ZIP_FILE) $(ARTEFACT_FOLDER) + +update: +        vagrant up +        vagrant provision + +clean: +        rm -rf $(ARTEFACT_FOLDER) + +.PHONY: all clean doc gen update +``` + +First, the **doc** target generates the user documentation using Pandoc, then it uses Haddock to generate the documentation from the Haskell library source code, and finally, it creates a PDF from the LaTeX file. As depicted in the image below, the generated user documentation is in HTML and CSS. The user documentation contains links to the generated source code documentation, also in HTML and CSS, and to the technical (research) paper . The generated source code documentation links directly to the source code, in case the reader would like to understand the implementation. + +![Artifact automation structure][12] + +The user documentation is generated with the following Makefile: + + +``` +DOCS=README.md +META=meta.yaml +NUMBER_SECTION_HEADINGS=-N + +.PHONY: all doc clean + +all: doc + +doc: $(DOC) +        pandoc -s $(META) $(DOCS) --listings --pdf-engine=xelatex -c assets/pandoc.css -o $(DOCS:md=pdf) +        pandoc -s $(META) $(DOCS) --self-contained -c assets/pandoc.css -o $(DOCS:md=html) + +clean: +        rm $(DOCS:md=pdf) $(DOCS:md=html) +``` + +To generate documentation from Haskell code, I use this other Makefile, which makes use of Stack to compile the library and download dependencies, and Haddock (inside its OPTS, or options) to create documentation in HMTL: + + +``` +OPTS=exec -- haddock --html --hyperlinked-source --odir=docs + +doc: +        stack $(OPTS) src/Initial/AST.hs src/Initial/Typechecker.hs \ +        src/Reader/AST.hs src/Reader/Typechecker.hs \ +        src/Backtrace/AST.hs src/Backtrace/Typechecker.hs \ +        src/Warning/AST.hs src/Warning/Typechecker.hs \ +        src/MultiError/AST.hs src/MultiError/Typechecker.hs \ +        src/PhantomFunctors/AST.hs src/PhantomFunctors/Typechecker.hs \ +        src/PhantomPhases/AST.hs src/PhantomPhases/Typechecker.hs \ +        src/Applicative/AST.hs src/Applicative/Typechecker.hs \ +        src/Final/AST.hs src/Final/Typechecker.hs + +.PHONY: doc +``` + +I compile the research paper from LaTeX to PDF with this simple Makefile: + + +``` +.PHONY: research + +research: +        pdflatex typecheckingMonad.tex +        bibtex typecheckingMonad +        pdflatex typecheckingMonad.tex +        pdflatex typecheckingMonad.tex +``` + +The virtual machine (VM) relies on Vagrant and the Vagrantfile, where I can write all the commands to set up the VM. The one thing that I do not know how to automate is moving all of the documentation, once it is generated, into the VM. If you know how to transfer the file from the host machine to the VM, please share your solution in the comments. That means that, currently, I manually enter in the VM and place the documentation in the Desktop folder. + + +``` +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| +  config.vm.box = "ubuntu/trusty64" +  config.ssh.username = "vagrant" +  config.ssh.password = "vagrant" +  config.vm.provider "virtualbox" do |vb| +    # Display the VirtualBox GUI when booting the machine +    vb.gui = true + +    # Customize the amount of memory on the VM: +    vb.memory = "2048" +    vb.customize ["modifyvm", :id, "--vram", "64"] +  end +  config.vm.provision "shell", inline: <<-SHELL +    ## Installing dependencies, comment after this has been done once. +    # sudo apt-get update -y +    # sudo apt-get install ubuntu-desktop -y +    # sudo apt-get install -y build-essential linux-headers-server + +    # echo 'PATH="/home/vagrant/.local/bin:$PATH"' >> /home/vagrant/.profile + +    ## Comment and remove the folder sharing before submission +    mkdir -p /home/vagrant/Desktop/TypeChecker +    cp -r /vagrant/artefact-submission/* /home/vagrant/Desktop/TypeChecker/ +    chown -R vagrant:vagrant /home/vagrant/Desktop/TypeChecker/ +  SHELL +end +``` + +With this final step, everything has been wired. You can see one example of the result [in HTML][13] and [in PDF][14]. I have created a [GitHub repo with all the source code][15] for ease of study and reproducibility. + +I have used this setup for two conferences—the European Conference on Object-Oriented Programming (ECOOP) and the International Conference on Software Language Engineering (SLE), where we won (in both) the Disguinshed Artifact Award. + +Pinterest software engineer Baogang Song tells us about Pinrepo, Pinterest's open source solution... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/automating-documentation + +作者:[Kiko Fernandez-Reyes][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kikofernandez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://en.wikipedia.org/wiki/Artifact_%28software_development%29 +[3]: https://en.wikipedia.org/wiki/Make_%28software%29 +[4]: https://www.haskell.org/haddock/ +[5]: https://pandoc.org/ +[6]: https://www.vagrantup.com/ +[7]: https://docs.haskellstack.org/en/stable/README/ +[8]: https://linux.die.net/man/1/pdflatex +[9]: http://www.bibtex.org/ +[10]: https://linux.die.net/man/1/zip +[11]: https://opensource.com/article/18/8/what-how-makefile +[12]: https://opensource.com/sites/default/files/uploads/makefile_pandoc_haddock.png (Artifact automation structure) +[13]: https://www.plresearcher.com/files/monadic-typechecker/README.html +[14]: https://www.plresearcher.com/files/monadic-typechecker/README.pdf +[15]: https://github.com/kikofernandez/pandoc-examples/tree/master/artefact-creation From 19eadcbbf2a66030e12856229b463f6a45cd897c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:58:49 +0800 Subject: [PATCH 0159/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200108=20Dete?= =?UTF-8?q?cting=20CPU=20steal=20time=20in=20guest=20virtual=20machines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md --- ...PU steal time in guest virtual machines.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md diff --git a/sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md b/sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md new file mode 100644 index 0000000000..ed532cecd5 --- /dev/null +++ b/sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Detecting CPU steal time in guest virtual machines) +[#]: via: (https://opensource.com/article/20/1/cpu-steal-time) +[#]: author: (Jamie Fargen https://opensource.com/users/jamiefargen) + +Detecting CPU steal time in guest virtual machines +====== +Is your VM getting all of its vitamin CPU? Use GNU top to find out +what's causing guest performance issues. +![and old computer and a new computer, representing migration to new software or hardware][1] + +CPU steal time is defined in the [GNU **top**][2] command as "time stolen from [a] VM by the hypervisor." CPU steal time occurs when a hypervisor process and a guest instance are trying to utilize the same hypervisor physical core (pCPU) at the same time. This results in less processor time available to the guest's virtual CPU (vCPU) and performance degradation for the guest. + +In today's virtualized environments (which have become nearly universal with the adoption of public and private clouds), a guest instance can experience performance CPU steal time under several scenarios: + + * Oversubscription of the hypervisor and multiple guest VMs' vCPUs with high CPU utilization are running on the same pCPUs. + * The guest vCPU and its emulator thread are pinned to the same pCPU resulting in vhost processes stealing CPU time from the guest vCPU while processing I/O. + * Hypervisor processes, like monitoring, logging, and I/O processes, are concurrently using a pCPU that is also in use by a guest VM vCPU. + + + +Normally, a systems engineer brought in to investigate an application or system performance issue will find that the system's performance is degraded due to CPU time stolen from the guest. The guest's performance issues usually become apparent in the form of low disk or network I/O performance, network packet loss, and other application performance anomalies. + +Even when a system administrator is observing the guest and the hypervisor, it can be difficult to narrow down the cause of the guest instance's degraded performance due to CPU steal time. There are a few reasons for the difficulty. First, CPU steal time is not logged by any of the commonly monitored log files. A hypervisor that is being observed may be expected to be under heavy load but steal time can occur on hypervisors that are under normal load. And finally, administrators may not be aware that hypervisor CPU contention can be observed from within the guest VM instance using GNU top. + +Fortunately, GNU top indeed makes it quite easy to detect CPU steal time on a guest VM instance. Steal time is displayed in top's output at the end of line 3, which beings with **%Cpu(s)**, as shown in the following screenshots (it is the value at the end, labeled **st**.) The first example shows a guest with little steal time: + +![Output of the top command showing low CPU steal time][3] + +Output of the top command from a guest experiencing a low CPU steal time of 0.2 st. + +This screenshot shows a guest experiencing heavy CPU steal time: + +![Output of the top command showing high CPU steal time][4] + +Output of the top command from a guest experiencing a heavy CPU steal time of 9.0 st. + +In both examples, the stress tool was executed with four processes that consumed all four vCPUs of the guest instance. In the first example, the hypervisor was relatively idle, so the guest's steal time was just 0.2. But in the second example, the stress tool was executed at the same time on the hypervisor with eight processes that consumed all eight of the hypervisors' pCPUs, which produced a high CPU steal time of 9.0. + +There is another sign of steal time in the second example: the stress utility process cannot consume ~100% of the guests' vCPUs; it can only consume 99.3%, 99.3%, 86.4%, and 74.4%, respectively. In total, this is equal to 40.3% of a guest vCPU's being stolen. This is because the hypervisor is consuming cycles on the same pCPUs that the guest vCPU's processes are using. + +### Using top to mitigate poor performance + +This example shows how the oversubscription of guest VM instances and other processes on a hypervisor can contend with a guest, and how to use GNU top to detect it based on the CPU steal time percentage on a guest VM. + +It is important to detect this type of performance degradation in a guest VM so that you can mitigate the cause of poor system and application performance. In a public cloud, the only solution might be migrating the instance or changing to an instance type with guaranteed pCPU service-level agreements (SLAs). In a private cloud, there are more options, but again, the simplest approach may be to migrate the instance to a hypervisor with lower utilization. However, if many guest instances experience high CPU steal time, you will need to make changes to how guests' and hypervisors' processes are managed to attain guest instances' performance SLAs. + +David Both explains the importance of keeping hardware cool and shares some Linux tools that can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cpu-steal-time + +作者:[Jamie Fargen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamiefargen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q (and old computer and a new computer, representing migration to new software or hardware) +[2]: https://en.wikipedia.org/wiki/Top_(software) +[3]: https://opensource.com/sites/default/files/uploads/cpu-steal-time_1.png (Output of the top command showing low CPU steal time) +[4]: https://opensource.com/sites/default/files/uploads/cpu-steal-time_2.png (Output of the top command showing high CPU steal time) From ee350a59516a6c51bce189bc7e0a8300bb70af6f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 01:01:41 +0800 Subject: [PATCH 0160/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Gene?= =?UTF-8?q?rating=20numeric=20sequences=20with=20the=20Linux=20seq=20comma?= =?UTF-8?q?nd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 Generating numeric sequences with the Linux seq command.md --- ...ic sequences with the Linux seq command.md | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 sources/tech/20200107 Generating numeric sequences with the Linux seq command.md diff --git a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md new file mode 100644 index 0000000000..9375e70fa6 --- /dev/null +++ b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Generating numeric sequences with the Linux seq command) +[#]: via: (https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Generating numeric sequences with the Linux seq command +====== +The Linux seq command can generate lists of numbers and at lightning speed. It's easy to use and flexible, too. +[Jamie][1] [(CC BY 2.0)][2] + +One of the easiest ways to generate a list of numbers in Linux is to use the **seq** (sequence) command. In its simplest form, **seq** will take a single number and then list all the numbers from 1 to that number. For example: + +``` +$ seq 5 +1 +2 +3 +4 +5 +``` + +Unless directed otherwise, **seq** always starts with 1. You can start a sequence with a different number by inserting it before the final number. + +``` +$ seq 3 5 +3 +4 +5 +``` + +### Specifying an increment + +You can also specify an increment. Say you want to list multiples of 3. Specify your starting point (first 3 in this example), increment (second 3) and end point (18). + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +$ seq 3 3 18 +3 +6 +9 +12 +15 +18 +``` + +You can elect to go from larger to smaller numbers by using a negative increment (i.e., a decrement). + +``` +$ seq 18 -3 3 +18 +15 +12 +9 +6 +3 +``` + +The **seq** command is also very fast. You can probably generate a list of a million numbers in under 10 seconds. + +Advertisement + +``` +$ time seq 1000000 +1 +2 +3 +… +… +999998 +999999 +1000000 + +real 0m9.290s <== 9+ seconds +user 0m0.020s +sys 0m0.899s +``` + +## Using a separator + +Another very useful option is to use a separator. Instead of listing a single number on each line, you can insert commas, colons or some other characters. The -s option followed by the character you wish to use. + +``` +$ seq -s: 3 3 18 +3:6:9:12:15:18 +``` + +In fact, if you simply want your numbers to be listed on a single line, you can use a blank as your separator in place of the default linefeed. + +**[ Also see [Invaluable tips and tricks for troubleshooting Linux][4]. ]** + +``` +$ seq -s' ' 3 3 18 +3 6 9 12 15 18 +``` + +### Getting to the math + +It may seem like a big leap to go from generating a sequence of numbers to doing math, but given the right separators, **seq** can easily prepare calculations that you can pass to **bc**. For example: + +``` +$ seq -s* 5 | bc +120 +``` + +What is going on in this command? Let’s take a look. First, **seq** is generating a list of numbers and using * as the separator. + +``` +$ seq -s* 5 +1*2*3*4*5 +``` + +It’s then passing the string to the calculator (**bc**) which promptly multiplies the numbers. And you can do a fairly extensive calculation in a fraction of a second. + +``` +$ time seq -s* 117 | bc +39699371608087208954019596294986306477904063601683223011297484643104\ +22041758630649341780708631240196854767624444057168110272995649603642\ +560353748940315749184568295424000000000000000000000000000 + +real 0m0.003s +user 0m0.004s +sys 0m0.000s +``` + +### Limitations + +You only get to choose one separator, so your calculations will be very limited. Use **bc** by itself for more complicated math. In addition, **seq** only works with numbers. To generate a sequence of single letters, use a command like this instead: + +``` +$ echo {a..g} +a b c d e f g +``` + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://creativecommons.org/licenses/by/2.0/ +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 535f97f782d7e1d8f43fdefb4662e1d6f0b38bc9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 01:02:19 +0800 Subject: [PATCH 0161/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Rese?= =?UTF-8?q?archers=20aim=20for=20transistors=20that=20compute=20and=20stor?= =?UTF-8?q?e=20in=20one=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md --- ...that compute and store in one component.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md diff --git a/sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md b/sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md new file mode 100644 index 0000000000..6a0bb4f471 --- /dev/null +++ b/sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Researchers aim for transistors that compute and store in one component) +[#]: via: (https://www.networkworld.com/article/3510638/researchers-aim-to-build-transistors-that-can-compute-and-store-information-in-one-component.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Researchers aim for transistors that compute and store in one component +====== +Materials incompatibilities have stalled efforts to integrate transistors and memory in a single on-chip, commercial component. That might be about to change. +iStock + +Researchers at Purdue University have made progress towards an elusive goal: building a transistor that can both process and store information. In the future, a single on-chip component could integrate the processing functions of transistors with the storage capabilities of ferroelectric RAM, potentially creating a process-memory combo that enables faster computing and is just atoms thick. + +The ability to cram more functions onto a chip, allowing for greater speed and power without increasing the footprint, is a core goal of electronics design. To get where they are today, engineers at Purdue had to overcome incompatibilities between transistors – the switching and amplification mechanisms used in almost all electronics – and ferroelectric RAM. Ferroelectric RAM is higher-performing memory technology; the material introduces non-volatility, which means it retains information when power is lost, unlike traditional dielectric-layer-constructed DRAM. + +**SEE ALSO:** [Researchers experiment with glass-based storage that doesn't require electronics cooling][1] + +In the past, materials conflicts have hampered the design of commercial electronics that integrate transistors and memory. “Researchers have been trying for decades to integrate the two, but issues happen at the interface between a ferroelectric material and silicon, the semiconductor material that makes up transistors. Instead, ferroelectric RAM operates as a separate unit on-chip, limiting its potential to make computing much more efficient,” Purdue explains in a [statement][2]. + +**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][3] ]** + +A team of engineers at Purdue, led by Peide Ye, came up with a solution: “We used a semiconductor that has ferroelectric properties. This way two materials become one material, and you don’t have to worry about the interface issues,” said Ye, who is a professor of electrical and computer engineering at the university. + +The Purdue engineers’ method revolves around a material called alpha indium selenide. It has ferroelectric properties, but it overcomes a limitation of conventional ferroelectric material, which generally acts as an insulator and doesn’t allow electricity to pass through. The alpha indium selenide material can become a semiconductor, which is necessary for the transistor element, and a room-temperature-stable, low voltage-requiring ferroelectric component, which is needed for the ferroelectric RAM. + +Advertisement + +Alpha indium selenide has a smaller band gap than other materials, the university explains. Band gaps are where no electrons can exist. That shrunken band gap, found in the material natively, means that material isn’t a serious insulator and isn’t too thick for electrical current to pass through — yet there is still a ferroelectric layer. The smaller band gap “[makes] it possible for the material to be a semiconductor without losing ferroelectric properties,” according to Purdue. + +“The result is a so-called ferroelectric semiconductor field-effect transistor, built in the same way as transistors currently used on computer chips.” + +More information is available [here][2]. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3510638/researchers-aim-to-build-transistors-that-can-compute-and-store-information-in-one-component.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3488556/researchers-experiment-with-glass-based-storage-that-doesnt-require-electronics-cooling.html +[2]: https://www.purdue.edu/newsroom/releases/2019/Q4/reorganizing-a-computer-chip-transistors-can-now-both-process-and-store-information.html +[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 527cdab9d4822f2da562833a4b53371e90007c78 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 01:03:09 +0800 Subject: [PATCH 0162/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Wi-F?= =?UTF-8?q?i=206=20is=20slowly=20gathering=20steam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md --- ...00107 Wi-Fi 6 is slowly gathering steam.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md diff --git a/sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md b/sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md new file mode 100644 index 0000000000..cc11b7fdc8 --- /dev/null +++ b/sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Wi-Fi 6 is slowly gathering steam) +[#]: via: (https://www.networkworld.com/article/3512153/wi-fi-6-will-slowly-gather-steam-in-2020.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Wi-Fi 6 is slowly gathering steam +====== +There’s a lot to look forward to about 802.11ax, aka Wi-Fi 6, just don’t expect it to be a top-to-bottom revolution in 2020. +Thinkstock + +The next big wave of Wi-Fi technology, 802.11ax, is going to become more commonplace in enterprise installations over the course of the coming year, just as the marketing teams for the makers of Wi-Fi equivalent will have you believe. Yet the rosiest predictions of revolutionary change in what enterprise Wi-Fi is capable of are still a bit farther off than 2020, according to industry experts. + +The crux of the matter is that, while access points with 802.11ax’s Wi-Fi 6 branding will steadily move into enterprise deployments in, the broader Wi-Fi ecosystem will not be dominated by the new standard for several years, according to Farpoint Group principal Craig Mathias. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] [][2] + +“Keep in mind, we’ve got lots and lots of people that are still in the middle of deploying [802.11]ac,” he said, referring to the previous top-end Wi-Fi standard. The deployment of 802.11ax will tend to follow the same pattern as the deployment of 802.11ac and, indeed, most [previous new Wi-Fi standards][3]. The most common scenario will be businesses waiting for a refresh cycle, testing the new technology and then rolling it out. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +In the near term, enterprises installing 802.11ax access points will bring performance increases – the system’s [MU-MIMO][5] antenna technology is more advanced than that present in previous versions of the Wi-Fi standard, and better suited to high-density environments with large numbers of endpoints connecting at the same time. Yet those increases will be small compared to those that will ensue once 802.11ax endpoints – that is, phones, tablets, computers and more specialized devices like [IoT][6] sensors and medical devices – hit the market. + +That, unfortunately, is still some way off, and Mathias said it will take around five years for 802.11ax to become ubiquitous. + +Advertisement + +“We’re not expecting a lot of [802.11]ax devices for a while,” he said. + +Making sure devices are compliant with modern Wi-Fi standards will be crucial in the future, though it shouldn’t be a serious issue that requires a lot of device replacement outside of fields that are using some of the aforementioned specialized endpoints, like medicine. Healthcare, heavy industry and the utility sector all have much longer-than-average expected device lifespans, which means that some may still be on 802.11ac. + +That’s bad, both in terms of security and throughput, but according to Shrihari Pandit, CEO of Stealth Communications, a fiber ISP based in New York, 802.11ax access points could still prove an advantage in those settings thanks to the technology that underpins them. + +“Wi-Fi 6 devices have eight radios inside them,” he said. “MIMO and beamforming will still mean a performance upgrade, since they’ll handle multiple connections more smoothly.” + +A critical point is that some connected devices on even older 802.11 versions – n, g, and even b in some cases – won’t be able to benefit from the numerous technological upsides of the new standard. Making sure that a given network is completely cross-compatible will be a central issue for IT staff looking to realize performance gains on networks that service legacy gear.” + +Pandit said that, increasingly, data-hungry customers like tech companies are looking to 802.11ax to act as a wireline replacement for those settings. “Lots of the tech companies we service here, some of them want Wi-Fi 6 so that they can use gigabit performance without having to run wires,” he said. + +Whether it goes by Wi-Fi 6 or 802.11ax, the next generation of Wi-Fi technology is likely to be marketed a bit differently than new Wi-Fi standards have been in the past, according to Mathias. It’s less about the mere fact that there’s a new Wi-Fi standard providing faster connectivity, and more about enabling new functionality that 802.11ax makes possible, including better handling of IoT devices and integration with AI/machine learning systems. + +Luckily, prices for top-end Wi-Fi equipment shouldn’t change much compared to the current top of the line, making it easy for almost any organization to budget for the switch. + +“We’re not expecting anyone to pay a premium for [802.11ax],” said Mathias. + +**Now see ["How to determine if Wi-Fi 6 is right for you"][2]** + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3512153/wi-fi-6-will-slowly-gather-steam-in-2020.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html +[3]: https://www.networkworld.com/article/3238664/80211-wi-fi-standards-and-speeds-explained.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3256905/13-things-you-need-to-know-about-mu-mimo-wi-fi.html +[6]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 8e70dfcf9da63cf7f69f25de3ae0b65060e0daa3 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Thu, 9 Jan 2020 01:03:43 +0800 Subject: [PATCH 0163/3057] =?UTF-8?q?=E7=BF=BB=E8=AF=9180%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...181105 5 Minimal Web Browsers for Linux.md | 55 +++++++++---------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index 34c0c1e18e..e71e21ac1e 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -7,79 +7,73 @@ [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) [#]: url: ( ) -5 Minimal Web Browsers for Linux -====== + linux上的五种微型浏览器 ====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) -There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. 有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 -The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 -There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. 但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 -Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. 让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! ### GNOME Web -GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 -Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: +Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: - * Simplicity - Feature bloat and user interface clutter are considered evil. + * Simplicity简单性 - Feature bloat and user interface clutter are considered evil功能复杂和用户界面混乱都是不被允许的. - * Standards compliance - No non-standard features will ever be introduced to the codebase. + * 规范性 - 任何非标准特性都不会引入到代码库中。 - * Software freedom - Epiphany will always be released under a license that respects freedom. + * 软件开源 - Epiphany始终遵守自由开源许可证。 - * Human interface - Epiphany follows the [GNOME Human Interface Guidelines][6]. + * 人机交互 - Epiphany 始终遵守[GNOME的人机交互指南][6]。 - * Minimal preferences - Preferences are only added when they make sense and after careful consideration. + * 最小首选项 - 经过慎重考虑才添加首选项。 - * Target audience - Non-technical users are the primary target audience (which helps to define the types of features that are included). + * 受众群体 - 非技术用户是主要的受众目标,(有助于定义所包含功能的类型)。 -GNOME Web is as clean and simple a web browser as you’ll find (Figure 1). +GNOME web浏览器就像看到的一样干净简洁 (Figure 1)。 + ![GNOME Web][8] -Figure 1: The GNOME Web browser displaying a minimal amount of preferences for the user. +Figure 1: GNOME 浏览器为用户展示最少的首选项. -[Used with permission][9] +[许可证书][9] -The GNOME Web manifesto reads: - -A web browser is more than an application: it is a way of thinking, a way of seeing the world. Epiphany's principles are simplicity, standards compliance, and software freedom. +GNOME Web 的声明如下: +web 浏览器它不仅仅是一个应用程序,还是一种思维方式,一种看世界的方式。 Epiphany 的原则是简洁,标准和自由。 ### Netsurf -The [Netsurf][10] minimal web browser opens almost faster than you can release the mouse button. Netsurf uses its own layout and rendering engine (designed completely from scratch), which is rather hit and miss in its rendering (Figure 2). +[Netsurf][10] 浏览器是最小的浏览器,他的打开速度几乎和你松开鼠标一样。Netsurf 使用自己的布局和渲染引擎(完全从零开始设计的) 在渲染过程的设计中屡屡碰壁(Figure 2). ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) -Although you might find Netsurf to suffer from rendering issues on certain sites, understand the Hubbub HTML parser is following the work-in-progress HTML5 specification, so there will be issues popup now and then. To ease those rendering headaches, Netsurf does include HTTPS support, web page thumbnailing, URL completion, scale view, bookmarks, full-screen mode, keyboard shorts, and no particular GUI toolkit requirements. That last bit is important, especially when you switch from one desktop to another. +尽管你可能在特定的站点上发现 Netsurf的问题,但如果你了解Hubbub解析器的话,知道它正在兼容html5规范,是不是的会有一点问题。Netsurf对https的支持,网页缩略图,URL解析,缩放视图,书签,全屏模式,快捷键和GUI的工具包的功能;最后一点十分重要,当你桌面来回切换时,为了缓解渲染带来的问题。 -For those curious as to the requirements for Netsurf, the browser can run on a machine as slow as a 30Mhz ARM 6 computer with 16MB of RAM. That’s impressive, by today’s standard. +对于那些对Netsurf 存在好奇的人来说,以现在的标准,他能在 16MB内存,30Mhz的ARM cpu的机器上运行,是让人惊奇的。 ### QupZilla -If you’re looking for a minimal browser that uses the Qt Framework and the QtWebKit rendering engine, [QupZilla][11] might be exactly what you’re looking for. QupZilla does include all the standard features and functions you’d expect from a web browser, such as bookmarks, history, sidebar, tabs, RSS feeds, ad blocking, flash blocking, and CA Certificates management. Even with those features, QupZilla still manages to remain a very fast lightweight web browser. Other features include: Fast startup, speed dial homepage, built-in screenshot tool, browser themes, and more. -One feature that should appeal to average users is that QupZilla has a more standard preferences tools than found in many lightweight browsers (Figure 3). So, if going too far outside the lines isn’t your style, but you still want something lighter weight, QupZilla is the browser for you. +如果你找寻使用Qt Framework 和 the QtWebKit 渲染引擎的最小浏览器,QupZilla][11]是你最佳的选择。QupZilla 包含web浏览所有的标准功能,例如:书签,历史记录,侧边栏,选项卡,RSS,广告屏蔽,flash屏蔽,和CA证书管理。及时拥有这么多的功能,QupZilla 仍然是快速,轻量级的浏览器。另外还有其他的功能:快速启动,快速拨号主页,内置屏幕截图工具,浏览器主题等。 +吸引用户的一点是,与许多轻量级浏览器相比,QupZilla有更标准的首选项工具(图3)。所以,如果你很多功能,但你仍然想要更轻量,那么QupZilla就是你最好的选择。 ![QupZilla][13] -Figure 3: The QupZilla preferences tool. +Figure 3: QupZilla 首选项工具. -[Used with permission][9] +[许可证书][9] ### Otter Browser @@ -130,11 +124,12 @@ Figure 5: The Lynx browser rendering the Linux.com page. I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). -### Plenty More Where This Came From +### Plenty More Where This Came From 更多 -There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not. +There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not.微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. +了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 -------------------------------------------------------------------------------- @@ -142,7 +137,7 @@ via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-li 作者:[Jack Wallen][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[MonkeyDEcho](https://github.com/MonkeyDEcho) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 63e67a8c6b71839c423ddaf6f8c03c6be2639aeb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 9 Jan 2020 07:49:22 +0800 Subject: [PATCH 0164/3057] Rename sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md to sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md --- ...0109 Huawei-s Linux Distribution openEuler is Available Now.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200109 Huawei-s Linux Distribution openEuler is Available Now.md (100%) diff --git a/sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md similarity index 100% rename from sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md rename to sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md From d70944391b3315f9b20ee1ceb0111473b81cffb4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 9 Jan 2020 07:56:49 +0800 Subject: [PATCH 0165/3057] PRF @geekpi --- ...al- A Secure, Open Source Messaging App.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md index 812a97f32f..a9d70b7f96 100644 --- a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md +++ b/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Signal: A Secure, Open Source Messaging App) @@ -10,7 +10,7 @@ Signal:安全、开源的聊天应用 ====== -** _简介:Signal 是一款智能手机上的安全开源聊天应用。它还提供了适用于 Linux、Windows 和 macOS 的独立桌面应用。在本文中,我们来看看它的功能和可用性。_** +> Signal 是一款智能手机上的安全开源聊天应用。它还提供了适用于 Linux、Windows 和 macOS 的独立桌面应用。在本文中,我们来看看它的功能和可用性。 ### 对于关注隐私的人来说,Signal 是 WhatsApp(和 Telegram)的绝佳替代品 @@ -20,11 +20,13 @@ Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样 它可能没有 Telegram 或 WhatsApp 这么多的功能。但是,如果你想在交流时增强隐私,这是一个可靠的开源方案。 -你可以在智能手机(iOS][3]/[Android][4])上安装,也可以在 Linux、Windows 和 macOS 上安装。 +你可以在智能手机([iOS][3]/[Android][4])上安装,也可以在 Linux、Windows 和 macOS 上安装。 ### Signal 的功能 -**注意:** _某些功能是智能手机特有的。你可能无法在桌面应用上看到所有功能。_ +**注意:** 某些功能是智能手机特有的。你可能无法在桌面应用上看到所有功能。 + +另请注意,目前,Signal 需要电话号码才能注册。如果你不想公开自己的私人电话号码,则可以使用 Google 语音或类似服务。 正如我已经提到的,这是为增强你的隐私而量身定制的。因此,用户体验可能不是你见过“最佳”的。但是,从隐私/安全角度考虑,我认为这是一个不错的选择。 @@ -38,7 +40,7 @@ Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样 #### 用作默认短信应用 -如果你想在短信中使用开源应用,那么只需口进入 Signal 的设置,并将其设置为短信和彩信的默认设置。 +如果你想在短信中使用开源应用,那么只需进入 Signal 的设置,并将其设置为短信和彩信的默认设置。 #### 屏幕安全 @@ -64,15 +66,13 @@ Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样 ![][6] -如你所期待的聊天应用,你可以使用几个标签,并且可以根据需要创建一个组。 - -但是,你无法管理你的组,你只能添加成员和更改群头像。 +如你所期待的聊天应用,你可以使用几个标签,并且可以根据需要创建一个组。但是,你无法管理你的组,你只能添加成员和更改群头像。 此外,Signal 还为其应用支持生物识别。 ### 在 Ubuntu/Linux 上安装 Signal -不幸的是,你无法在你的 Linux 发行版上找到 .**deb** 或者 .**AppImage**。因此,你需要根据[官方安装说明][7]在终端上安装。 +不幸的是,你无法在你的 Linux 发行版上找到 .deb 或者 .AppImage。因此,你需要根据[官方安装说明][7]在终端上安装。 在终端中输入以下内容: @@ -105,7 +105,7 @@ via: https://itsfoss.com/signal-messaging-app/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 18eedba7e573051ecf28bc5572210b1eddbd718a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 9 Jan 2020 07:57:16 +0800 Subject: [PATCH 0166/3057] PUB @geekpi https://linux.cn/article-11764-1.html --- .../20200101 Signal- A Secure, Open Source Messaging App.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200101 Signal- A Secure, Open Source Messaging App.md (98%) diff --git a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/published/20200101 Signal- A Secure, Open Source Messaging App.md similarity index 98% rename from translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md rename to published/20200101 Signal- A Secure, Open Source Messaging App.md index a9d70b7f96..4248470b90 100644 --- a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md +++ b/published/20200101 Signal- A Secure, Open Source Messaging App.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11764-1.html) [#]: subject: (Signal: A Secure, Open Source Messaging App) [#]: via: (https://itsfoss.com/signal-messaging-app/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From db6842b0a1e8e3ff637473dc194107f260fc5281 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 9 Jan 2020 08:51:50 +0800 Subject: [PATCH 0167/3057] translated --- ...y Pi retrospective- 6 projects and more.md | 67 ------------------- ...y Pi retrospective- 6 projects and more.md | 65 ++++++++++++++++++ 2 files changed, 65 insertions(+), 67 deletions(-) delete mode 100644 sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md create mode 100644 translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md diff --git a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md deleted file mode 100644 index 181276fb45..0000000000 --- a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md +++ /dev/null @@ -1,67 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (My Raspberry Pi retrospective: 6 projects and more) -[#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) -[#]: author: (Anderson Silva https://opensource.com/users/ansilva) - -My Raspberry Pi retrospective: 6 projects and more -====== -See what I've done with the fun, educational, and useful Raspberry Pi. -![Raspberry Pi 4 board, posterized filter][1] - -Historically and theoretically speaking, a decade, a century, or a millennium starts when the clock turns midnight on January 1 of the year one of its decimal order. For example, the 20th century started on January 1, 1901, not on January 1, 1900. The reason for this is simple: there is no year 0 in our modern calendar, so these periods of time start on year 1 (using the Gregorian calendar). But that's not how we refer to time periods colloquially and culturally; for example, when we mention '80s music or movies, we're talking about the period from 1980 to 1989. - -The recently passed 2010s, I could argue, was the decade of the cloud, social media, mobile technology, and the Internet of Things (IoT), which includes the [Raspberry Pi][2]. Recently, _Time_ magazine called the Raspberry Pi one of the [10 best gadgets of the past decade][3]. And I very much agree. - -The original Raspberry Pi launched in 2012, and it took me a couple of years to jump on the bandwagon and ride on the Pi-train. But since then, I have built many fun educational projects at home and even documented a few of them for Opensource.com. - -### The Christmas light trilogy - -I wrote three articles over three years that explored controlling Christmas lights with the Raspberry Pi and the open source project LightShowPi. The first article, [_Create your own musical light show with Raspberry Pi_][4], was a mix between a very basic introduction to electronics development and building a Christmas light show. The second article, [_SSH into your Christmas tree with Raspberry Pi_][5], went a little deeper into controlling the lights with things such as remote management and electronic buttons. The last chapter of the trilogy, [_Set the holiday mood with your Raspberry Pi_][6], reviewed changes introduced in the LightShowPi project in the prior year. - -### DIY projects - -Over the years, I've turned my Raspberry Pi into several useful devices. One time, I turned the Pi into a [music-playing device with the Pi MusicBox][7], which allows you to plug your favorite music streaming services into a common web interface and play your favorite tunes around the house. - -Making the Raspberry Pi into a [mobile video recording device][8] was another DIY project I put together. It required a few extra pieces of hardware, like a touchscreen, a Pi Camera, and a battery pack, but it worked. One of the biggest drawbacks of this setup was the small amount of memory available on the Pi at the time. I think the capabilities of this little portable camera could be a lot better if I re-did it on a Raspberry Pi 4 with 4GB of RAM. This may be a project to revisit in 2020. - -Another small project I built, a [digital clock for my living room][9], used the small Adafruit PiTFT screen. As simple as this project was, it probably was the one that I used the longest. That clock stood by my TV set for over a year, running 24 hours a day… until the day the screen burned out. - -### The Pi Day series - -Last but not least, in 2019, I contributed [14 articles in 14 days][10] leading up to Pi Day (March 14). This was by far the most challenging writing project I've ever done, but it allowed me to cover many different topics and hopefully expose readers to even more ideas about the versatility of the Raspberry Pi. - -### To infinity and beyond - -I don't know anyone in the Raspberry Pi Foundation, so I don't have any special access to its roadmaps and future plans. I could (but I won't) speculate on what the future holds for the brand and its devices that have allowed so many people of different social statuses around the world to expand their knowledge about computer science, electronics, and open source development. All I hope is for the foundation's management to stay true to its vision and mission and continue making affordable technology for people everywhere. - -The 2010s are over, and what a sweet decade it was. To me, it smelled like pie, raspberry pie. - -Having recently co-authored a book about building things with the Raspberry Pi ( Raspberry Pi Hacks... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/raspberry-pi-best - -作者:[Anderson Silva][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ansilva -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi4_board_hardware.jpg?itok=KnFU7NvR (Raspberry Pi 4 board, posterized filter) -[2]: https://www.raspberrypi.org/ -[3]: https://time.com/5745302/best-gadgets-of-the-2010s-decade/?utm_source=reddit.com -[4]: https://opensource.com/life/15/2/music-light-show-with-raspberry-pi -[5]: https://opensource.com/life/15/12/ssh-your-christmas-tree-raspberry-pi -[6]: https://opensource.com/article/18/12/lightshowpi-raspberry-pi -[7]: https://opensource.com/life/15/3/pi-musicbox-guide -[8]: https://opensource.com/life/15/9/turning-raspberry-pi-portable-streaming-camera -[9]: https://opensource.com/article/17/7/raspberry-pi-clock -[10]: https://opensource.com/article/19/3/happy-pi-day diff --git a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md new file mode 100644 index 0000000000..2e3d16258d --- /dev/null +++ b/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Raspberry Pi retrospective: 6 projects and more) +[#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +我的树莓派回顾:不止 6 个项目 +====== +看看我在有趣的、有教育意义和有用的树莓派上做了什么。 +![Raspberry Pi 4 board, posterized filter][1] + +从历史和理论上讲,十年、一个世纪或一千年从十进制一那年的 1 月 1 日物业开始。例如,20 世纪始于 1901 年 1 月 1 日,而不是 1900 年 1 月 1 日。原因很简单:现代日历中没有 0 年,因此这些时间段始于 1 年(使用公历)。但这不是我们在口语上和文化上指代时间段的方式。例如,当我们提到 80 年代的音乐或电影时,我们所说的是 1980 年至 1989 年。 + +我可以说,最近过去的 21 世纪 10 年代是云计算、社交媒体、移动技术和物联网 (IoT) 的十年,这其中包括[树莓派][2]。最近,《时代》杂志将树莓派称为[过去十年中 10 个最佳小玩意][3]之一。我非常同意这点。 + +最初的树莓派于 2012 年推出,我过了几年才使用上了它。但是从那以后,我在家中做了许多有趣的教育项目,甚至在 Opensource.com 中记录了一些。 + +### 圣诞灯三部曲 + +三年来,我写了三篇探讨如何使用树莓派和开源项目 LightShowPi 控制圣诞灯的文章。第一篇文章[_用树莓派创建你自己的音乐灯光秀_][4],是基础电子开发介绍和灯光秀的结合。第二篇文章,[_ 使用树莓派 SSH 进入你的圣诞树_][5],更深入地介绍了通过远程管理和电子按钮控制灯光的方法。三部曲的最后一章[_用树莓派设置假期心情_][6],回顾了上一年 LightShowPi 项目中引入的更改。 + +### DIY 项目 + +多年来,我已经将树莓派变成了几种有用的设备。有一次,我将树莓派变成了[带有 Pi MusicBox 的音乐播放设备][7],它可以让你在 Web 界面中导入你喜欢的音乐流并在房间中播放。 + +将树莓派做成[移动视频录制设备][8]是另一个 DIY 项目。它需要一些额外的硬件,例如触摸屏、Pi 摄像头和电池组,但是可以使用。这个设备的最大缺点之一是当时树莓派的可用内存很小。我认为如果我将它重新配置在具有 4GB 内存的树莓派 4 上,那么这款便携式摄像机的功能可能会更好。这可能是一个会在 2020 年重新做项目。 + +我做的另一个小项目[客厅的数字时钟][9]使用了 Adafruit PiTFT 小屏幕。尽管这个项目很简单,但它可能是我使用时间最长的项目。那个时钟在我的电视机上呆了一年多,一天 24 小时不间断运行,直到屏幕烧坏为止。 + +### 圆周率日系列 + +最后但并非最不重要的一点是,在 2019 年的圆周率日(3 月 14 日)之前,我在 [14 内发布了 14 篇文章][10]。这是迄今为止我完成过的最具挑战性的写作项目,但是它使我能够涵盖许多不同的主题,并希望使读者对树莓派的丰富功能有更多的了解。 + +### 走向未来 + +我在树莓派基金会中不认识任何人,因此我不了解任何它的路线图和未来计划。我可以(但我不会)推测品牌及其设备的未来,它们让世界各地这么多不同社会地位的人扩展他们对计算机科学、电子和开源开发的知识。我希望基金会的管理层能够忠于其愿景和使命,并继续为世界各地的人们提供价格合理的技术。 + +21 世纪 10 年代过去了,那是多么甜蜜的十年。对我来说,它闻起来就像树莓派馅饼。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/raspberry-pi-best + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi4_board_hardware.jpg?itok=KnFU7NvR (Raspberry Pi 4 board, posterized filter) +[2]: https://www.raspberrypi.org/ +[3]: https://time.com/5745302/best-gadgets-of-the-2010s-decade/?utm_source=reddit.com +[4]: https://opensource.com/life/15/2/music-light-show-with-raspberry-pi +[5]: https://opensource.com/life/15/12/ssh-your-christmas-tree-raspberry-pi +[6]: https://opensource.com/article/18/12/lightshowpi-raspberry-pi +[7]: https://opensource.com/life/15/3/pi-musicbox-guide +[8]: https://opensource.com/life/15/9/turning-raspberry-pi-portable-streaming-camera +[9]: https://opensource.com/article/17/7/raspberry-pi-clock +[10]: https://opensource.com/article/19/3/happy-pi-day From a58c6703ded107a8e30a6a127512efe650297462 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 9 Jan 2020 09:00:43 +0800 Subject: [PATCH 0168/3057] translating --- ...7 Generating numeric sequences with the Linux seq command.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md index 9375e70fa6..7ae48a2785 100644 --- a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md +++ b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4441d79f592697bef790364e41156f5dae9dbfca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 9 Jan 2020 13:49:35 +0800 Subject: [PATCH 0169/3057] Translated by robsean --- ...urce interior design with Sweet Home 3D.md | 142 ------------------ ...urce interior design with Sweet Home 3D.md | 141 +++++++++++++++++ 2 files changed, 141 insertions(+), 142 deletions(-) delete mode 100644 sources/tech/20191016 Open source interior design with Sweet Home 3D.md create mode 100644 translated/tech/20191016 Open source interior design with Sweet Home 3D.md diff --git a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md b/sources/tech/20191016 Open source interior design with Sweet Home 3D.md deleted file mode 100644 index 309b816f81..0000000000 --- a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md +++ /dev/null @@ -1,142 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Open source interior design with Sweet Home 3D) -[#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Open source interior design with Sweet Home 3D -====== -Try out furniture layouts, color schemes, and more in virtual reality -before you go shopping in the real world. -![Several houses][1] - -There are three schools of thought on how to go about decorating a room: - - 1. Buy a bunch of furniture and cram it into the room - 2. Take careful measurements of each item of furniture, calculate the theoretical capacity of the room, then cram it all in, ignoring the fact that you've placed a bookshelf on top of your bed - 3. Use a computer for pre-visualization - - - -Historically, I practiced the little-known fourth principle: don't have furniture. However, since I became a remote worker, I've found that a home office needs conveniences like a desk and a chair, a bookshelf for reference books and tech manuals, and so on. Therefore, I have been formulating a plan to populate my living and working space with actual furniture, made of actual wood rather than milk crates (or glue and sawdust, for that matter), with an emphasis on _plan_. The last thing I want is to bring home a great find from a garage sale to discover that it doesn't fit through the door or that it's oversized compared to another item of furniture. - -It was time to do what the professionals do. It was time to pre-viz. - -### Open source interior design - -[Sweet Home 3D][2] is an open source (GPLv2) interior design application that helps you draw your home's floor plan and then define, resize, and arrange furniture. You can do all of this with precise measurements, down to fractions of a centimeter, without having to do any math and with the ease of basic drag-and-drop operations. And when you're done, you can view the results in 3D. If you can create a basic table (not the furniture kind) in a word processor, you can plan the interior design of your home in Sweet Home 3D. - -### Installing - -Sweet Home 3D is a [Java][3] application, so it's universal. It runs on any operating system that can run Java, which includes Linux, Windows, MacOS, and BSD. Regardless of your OS, you can [download][4] the application from the website. - - * On Linux, [untar][5] the archive. Right-click on the SweetHome3D file and select **Properties**. In the **Permission** tab, grant the file executable permission. - * On MacOS and Windows, expand the archive and launch the application. You must grant it permission to run on your system when prompted. - - - -![Sweet Home 3D permissions][6] - -On Linux, you can also install Sweet Home 3D as a Snap package, provided you have **snapd** installed and enabled. - -### Measures of success - -First thing first: Break out your measuring tape. To get the most out of Sweet Home 3D, you must know the actual dimensions of the living space you're planning for. You may or may not need to measure down to the millimeter or 16th of an inch; you know your own tolerance for variance. But you must get the basic dimensions, including measuring walls and windows and doors. - -Use your best judgment for common sense. For instance, When measuring doors, include the door frame; while it's not technically part of the _door_ itself, it is part of the wall space that you probably don't want to cover with furniture. - -![Measure twice, execute once][7] - -CC-SA-BY opensource.com - -### Creating a room - -When you first launch Sweet Home 3D, it opens a blank canvas in its default viewing mode, a blueprint view in the top panel, and a 3D rendering in the bottom panel. On my [Slackware][8] desktop computer, this works famously, but my desktop is also my video editing and gaming computer, so it's got a great graphics card for 3D rendering. On my laptop, this view was a lot slower. For best performance (especially on a computer not dedicated to 3D rendering), go to the **3D View** menu at the top of the window and select **Virtual Visit**. This view mode renders your work from a ground-level point of view based on the position of a virtual visitor. That means you get to control what is rendered and when. - -It makes sense to switch to this view regardless of your computer's power because an aerial 3D rendering doesn't provide you with much more detail than what you have in your blueprint plan. Once you have changed the view mode, you can start designing. - -The first step is to define the walls of your home. This is done with the **Create Walls** tool, found to the right of the **Hand** icon in the top toolbar. Drawing walls is simple: Click where you want a wall to begin, click to anchor it, and continue until your room is complete. - -![Drawing walls in Sweet Home 3D][9] - -Once you close the walls, press **Esc** to exit the tool. - -#### Defining a room - -Sweet Home 3D is flexible on how you create walls. You can draw the outer boundary of your house first, and then subdivide the interior, or you can draw each room as conjoined "containers" that ultimately form the footprint of your house. This flexibility is possible because, in real life and in Sweet Home 3D, walls don't always define a room. To define a room, use the **Create Rooms** button to the right of the **Create Walls** button in the top toolbar. - -If the room's floor space is defined by four walls, then all you need to do to define that enclosure as a room is double-click within the four walls. Sweet Home 3D defines the space as a room and provides you with its area in feet or meters, depending on your preference. - -For irregular rooms, you must manually define each corner of the room with a click. Depending on the complexity of the room shape, you may have to experiment to find whether you need to work clockwise or counterclockwise from your origin point to avoid quirky Möbius-strip flooring. Generally, however, defining the floor space of a room is straightforward. - -![Defining rooms in Sweet Home 3D][10] - -After you give the room a floor, you can change to the **Arrow** tool and double-click on the room to give it a name. You can also set the color and texture of the flooring, walls, ceiling, and baseboards. - -![Modifying room floors, ceilings, etc. in Sweet Home 3D][11] - -None of this is rendered in your blueprint view by default. To enable room rendering in your blueprint panel, go to the **File** menu and select **Preferences**. In the **Preferences** panel, set **Room rendering in plan** to **Floor color or texture**. - -### Doors and windows - -Once you've finished the basic floor plan, you can switch permanently to the **Arrow** tool. - -You can find doors and windows in the left column of Sweet Home 3D, in the **Doors and Windows** category. You have many choices, so choose whatever is closest to what you have in your home. - -![Moving a door in Sweet Home 3D][12] - -To place a door or window into your plan, drag-and-drop it on the appropriate wall in your blueprint panel. To adjust its position and size, double-click the door or window. - -### Adding furniture - -With the base plan complete, the part of the job that feels like _work_ is over! From this point onward, you can play with furniture arrangements and other décor. - -You can find furniture in the left column, organized by the room for which each is intended. You can drag-and-drop any item into your blueprint plan and control orientation and size with the tools visible when you hover your mouse over the item's corners. Double-click on any item to adjust its color and finish. - -### Visiting and exporting - -To see what your future home will look like, drag the "person" icon in your blueprint view into a room. - -![Sweet Home 3D rendering][13] - -You can strike your own balance between realism and just getting a feel for space, but your imagination is your only limit. You can get additional assets to add to your home from the Sweet Home 3D [download page][4]. You can even create your own furniture and textures with the **Library Editor** applications, which are optional downloads from the project site. - -Sweet Home 3D can export your blueprint plan to SVG format for use in [Inkscape][14], and it can export your 3D model to OBJ format for use in [Blender][15]. To export your blueprint, go to the **Plan** menu and select **Export to SVG format**. To export a 3D model, go to the **3D View** menu and select **Export to OBJ format**. - -You can also take "snapshots" of your home so that you can refer to your ideas without opening Sweet Home 3D. To create a snapshot, go to the **3D View** menu and select **Create Photo**. The snapshot is rendered from the perspective of the person icon in the blueprint view, so adjust as required, then click the **Create** button in the **Create Photo** window. If you're happy with the photo, click **Save**. - -### Home sweet home - -There are many more features in Sweet Home 3D. You can add a sky and a lawn, position lights for your photos, set ceiling height, add another level to your house, and much more. Whether you're planning for a flat you're renting or a house you're buying—or a house that doesn't even exist (yet), Sweet Home 3D is an engaging and easy application that can entertain and help you make better purchasing choices when scurrying around for furniture, so you can finally stop eating breakfast at the kitchen counter and working while crouched on the floor. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/interior-design-sweet-home-3d - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_housing.png?itok=s7i6pQL1 (Several houses) -[2]: http://www.sweethome3d.com/ -[3]: https://opensource.com/resources/java -[4]: http://www.sweethome3d.com/download.jsp -[5]: https://opensource.com/article/17/7/how-unzip-targz-file -[6]: https://opensource.com/sites/default/files/uploads/sweethome3d-permissions.png (Sweet Home 3D permissions) -[7]: https://opensource.com/sites/default/files/images/life/sweethome3d-measure.jpg (Measure twice, execute once) -[8]: http://www.slackware.com/ -[9]: https://opensource.com/sites/default/files/uploads/sweethome3d-walls.jpg (Drawing walls in Sweet Home 3D) -[10]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms.jpg (Defining rooms in Sweet Home 3D) -[11]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms-modify.jpg (Modifying room floors, ceilings, etc. in Sweet Home 3D) -[12]: https://opensource.com/sites/default/files/uploads/sweethome3d-move.jpg (Moving a door in Sweet Home 3D) -[13]: https://opensource.com/sites/default/files/uploads/sweethome3d-view.jpg (Sweet Home 3D rendering) -[14]: http://inkscape.org -[15]: http://blender.org diff --git a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md b/translated/tech/20191016 Open source interior design with Sweet Home 3D.md new file mode 100644 index 0000000000..ebc4a3bc70 --- /dev/null +++ b/translated/tech/20191016 Open source interior design with Sweet Home 3D.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source interior design with Sweet Home 3D) +[#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + + Sweet Home 3D 开放源码室内设计 +====== +在你去真实世界购物前,在虚拟世界中尝试家具布局,配色方案等等。 +![Several houses][1] + +这里有关于如何装饰房间的三大流派: + + 1. 购买一堆家具,并把它们塞进房间。 + 2. 仔细测量每件家具,计算房间的理论容量,然后把它们全部塞进房间,忽略你在床上放置一个书架的事实。 + 3. 使用一台计算机进行预先可视化。 + + + +从历史观点上说,我实践了鲜为人知的第四条原则:没有家具。然而,自从我成为一个远程工作者,我发现家庭办公需要一些便利的设施,像一张桌子和一张椅子,一个用于存放参考书和技术手册的书架等等。因此,我一直在制定一个使用实际的家具来迁移我的生活和工作空间的计划,在 _计划_ 上强调由实木制作,而不是牛奶箱子(或胶水和锯末,或同样的东西)。我最不想做的一件事:从旧货市场淘到得宝贝带回家时,发现其进不了门,或者比另一件家具大很多。 + +是时候做专业人士该做的事了。是时候视觉预览了。 + +### 开放源码室内设计 + +[Sweet Home 3D][2] 是一个开放源码 (GPLv2) 室内设计应用程序,帮助你绘制你的住宅平面图,然后定义,重新调整大小以及安排家具。你可以使用精确的尺寸来完成这些,精确到一厘米以下,而不使用任何数学运算,仅使用简单的拖拽操作。当你完成后,你可以在 3D 中查看结果。如果你可以在一个 word 程序中创建一个基本的表格(不是家具类),你可以在 Sweet Home 3D 中规划你家的室内设计。 + +### 安装 + +Sweet Home 3D 是一个 [Java][3] 应用程序,因此它是通用的。它运行在任何可以运行 Java 的操作系统上,包括 Linux ,Windows ,MacOS 和 BSD 。不用理会你的操作系统,你可以从网站 [下载][4] 应用程序。 + + * 在 Linux 上,[untar][5] 存档文件。在 SweetHome3D 文件上右键单击,并选择**属性**。在**权限**选项卡中,授予文件可执行权限。 + * 在 MacOS 和 Windows 上,展开存档文件并启动应用程序。当系统提示时,你必需授予它权限来在你的系统上运行。 + +![Sweet Home 3D permissions][6] + +在 Linux 上,你也可以像一个 Snap 软件包一样安装 Sweet Home 3D ,前提是你已经安装并启用 **snapd** 。 + +### 成功的测量 + +首先:打开你的卷尺。为充分利用 Sweet Home 3D ,你必须知道你计划生活空间的实际尺寸。你可能需要测量到毫米或1/16英寸;你知道你自己对变化幅度的容忍度。但是你必需获得基本的尺寸,包括材料墙壁和门窗。 + +用你最好的判断力来判断常识。例如,当测量门时,包括门框; + +虽然从技术上讲它不是 _门_ 本身的一部分,它可能是你不想用家具覆盖的墙壁空间的一部分。 + +![Measure twice, execute once][7] + +CC-SA-BY opensource.com + +### 创建一间房间 + +当你第一次启动 Sweet Home 3D 时,它会以它的默认查看模式来打开一个空白的画布,蓝图视图在顶部面板中,3D 渲染在底部面板中。在我的 [Slackware][8] 桌面计算机上,这项工作非常友好,但是我的桌面计算机也是我的视频编辑和游戏计算机,所以它有一个极好的 3D 渲染显卡。在我的笔记本计算机上,这种视图模式是非常慢的。为了最好的性能(尤其是在一台计没有 3D 渲染的专用计算机上),转到窗口顶部的 **3D 视图** 菜单,并选择 **虚拟访问** 。这个视图模式基于虚拟访客的位置从地面视图渲染你的工作。这意味着你可以控制渲染的东西和时机。 + +不顾你计算机的功率来切换到这个视图的有意义的,因为地表以上的 3D 渲染不比蓝图平面图向你提供更多有用的详细信息。在你更改视图模式后,你可以开始设计。 + +第一步是定义你家的墙壁。使用**创建墙壁**工具完成,在顶部工具栏的右侧找到 **手** 图标。绘制墙壁很简单:单击你想要墙壁开始的位置,单击以锚定位置,不断单击锚定,直到你的房间完成。 + +![Drawing walls in Sweet Home 3D][9] + +在你闭合墙壁后,按**Esc**来退出工具。 + +#### 定义一间房间 + +Sweet Home 3D 在你如何创建墙壁的问题上是灵活的。你可以先绘制你房子的外部边界,然后再细分内部,或者你可以绘制每个房间作为结成一体的"容器",最终形成你房子所占的空间量。这种灵活性是能做到的,因为在现实生活中和在 Sweet Home 3D 中,墙壁并不总是定义一间房间。为定义一间房间,使用在顶部工具栏的**创建墙壁** 按钮右侧的 **创建房间** 按钮。 + +如果房间的地板空间是通过四面墙所定义,你们你需要做的全部的定义是像一间房间一样在四面墙壁内双击来圈占地方。Sweet Home 3D 将定义空间为一间房间,并根据你的喜好,以英尺或米为单位向你提供房间的面积。 + +对于不规则的房间,你必需使用每次单击来手动定义房间的每个墙角。根据房间形状的复杂性,你可能不得不进行试验来发现你是否需要从你的原点来顺时针或逆时针工作,以避免奇怪的莫比斯条形地板。不过,一般来说,定义一间房间的地板空间是简单的。 + +![Defining rooms in Sweet Home 3D][10] + +在你给定房间一层地板后,你可以更改到 **箭头** 工具,并在房间上双击来给予它一个名称。你也可以设置地板,墙壁,天花板和踢脚板的颜色及纹理。 + +![Modifying room floors, ceilings, etc. in Sweet Home 3D][11] + +默认情况下,这些都不会在蓝图视图中渲染。为启用在你蓝图面板中的房间渲染,转到 **文件** 菜单并选择 **首选项** 。在 **首选项** 面板中,设置 **平面图中房间渲染** 为 **地板颜色或纹理** 。 + +### 门和窗 + +在你完成基本的地板平面图后,你可以长期地切换到 **箭头** 工具。 + +你可以在 Sweet Home 3D 的左栏中的 **门和窗** 类别下找到门和窗。你有很多选择,所以选择最接近你家的东西。 + +![Moving a door in Sweet Home 3D][12] + +为放置一扇门或窗到你的平面图中,在你的蓝图平面图中的合适的墙壁上拖拽门或窗。为调整它的位置和大小,双击门或窗。 + +### 添加家具 + +随着基本计划完成,部分工作感觉像 _工作_ 结束了!从这点继续,你可以玩弄家具布置以及其它装饰。 + +你可以在左栏中找到家具,按每个计划的房间来组织。你可以拖拽任何项目到你的蓝图平面图中,当你的鼠标悬停在项目的区域上时,使用可视化工具控制方向和大小。在任何项目上双击双击来调整它的颜色和成品表面。 + +### 访问和导出 + +为了看看你未来的家将会看起来是什么样子,在你的蓝图视图中拖拽"人"图标到一个房间中。 + +![Sweet Home 3D rendering][13] + +你可以在现实主义和仅感受空间感之间找到自己的平衡,只要你的想象力是你唯一的限制。你可以从 Sweet Home 3D [下载页面][4] 获取附加的有用的资源来添加到你的家中。你甚至可以使用 **库编辑器** 应用程序创建你自己的家具和纹理,它们可以从项目网站有选择地下载。 + +Sweet Home 3D 可以导出你的蓝图平面图为 SVG 格式,以便在 [Inkscape][14] 中使用,并且它可以导出你的 3D 模型为 OBJ 格式,以便在 [Blender][15] 中使用。为导出你的蓝图,转到**平面图**菜单,并选择**导出为 SVG 格式**。为导出一个 3D 模型,转到 **3D 视图** 菜单并选择**导出为 OBJ 格式**。 + +你也可以拍摄你家的"快照,以便于不打开 Sweet Home 3D 而参考你的想法。为创建一个快照,转到 **3D视图** 菜单并选择 **创建照片**。快照是按照蓝图视图中的人的图标的角度展现的,因此按照需要调整,然后在 **创建照片** 窗口中单击 **创建** 按钮。 如果你对快照满意,单击 **保存** 。 + +### 甜蜜的家 + +在 Sweet Home 3D 中有更多的特色。你可以添加一片天空和一片草坪,为你的照片定位光线,设置天花板高度,给你房子添加另一楼层等等。不管你打算租一套公寓,还是买一套房子—或是(还)尚不存在的房子,Sweet Home 3D 是一款简单迷人的应用程序,当你匆忙购买家具时,它可以娱乐并帮助你做出更好的购买选择。因此,你终于可以停止在厨房的柜台上吃早餐以及蹲在地上工作。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/interior-design-sweet-home-3d + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_housing.png?itok=s7i6pQL1 (Several houses) +[2]: http://www.sweethome3d.com/ +[3]: https://opensource.com/resources/java +[4]: http://www.sweethome3d.com/download.jsp +[5]: https://opensource.com/article/17/7/how-unzip-targz-file +[6]: https://opensource.com/sites/default/files/uploads/sweethome3d-permissions.png (Sweet Home 3D permissions) +[7]: https://opensource.com/sites/default/files/images/life/sweethome3d-measure.jpg (Measure twice, execute once) +[8]: http://www.slackware.com/ +[9]: https://opensource.com/sites/default/files/uploads/sweethome3d-walls.jpg (Drawing walls in Sweet Home 3D) +[10]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms.jpg (Defining rooms in Sweet Home 3D) +[11]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms-modify.jpg (Modifying room floors, ceilings, etc. in Sweet Home 3D) +[12]: https://opensource.com/sites/default/files/uploads/sweethome3d-move.jpg (Moving a door in Sweet Home 3D) +[13]: https://opensource.com/sites/default/files/uploads/sweethome3d-view.jpg (Sweet Home 3D rendering) +[14]: http://inkscape.org +[15]: http://blender.org From 60eada912bb8adb854f5b4b5c4de497d6cef9ebd Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Thu, 9 Jan 2020 23:50:36 +0800 Subject: [PATCH 0170/3057] =?UTF-8?q?=E7=BF=BB=E8=AF=91done?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...181105 5 Minimal Web Browsers for Linux.md | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index e71e21ac1e..1a533e6557 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -27,7 +27,7 @@ GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览 Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: - * Simplicity简单性 - Feature bloat and user interface clutter are considered evil功能复杂和用户界面混乱都是不被允许的. + * 简单性 - 功能复杂和用户界面混乱都是不被允许的. * 规范性 - 任何非标准特性都不会引入到代码库中。 @@ -77,58 +77,59 @@ Figure 3: QupZilla 首选项工具. ### Otter Browser -Otter Browser is a free, open source attempt to recreate the closed-source offerings found in the Opera Browser. Otter Browser uses the WebKit rendering engine and has an interface that should be immediately familiar with any user. Although lightweight, Otter Browser does include full-blown features such as: +Otter 浏览器是一种免费开源的,旨在重建Opera 12.x的浏览器。它使用WebKit渲染引擎,并且有用户的熟悉界面。虽然它轻量,但它有丰富的功能: - * Passwords manager + * 密码管理 - * Add-on manager + * 插件管理 + + * 内容拦截 - * Content blocking + * 拼写检查 - * Spell checking + * 自定义界面 - * Customizable GUI + * 网址补全 - * URL completion + * 快速访问 (Figure 4) - * Speed dial (Figure 4) + * 书签和其他相关功能 - * Bookmarks and various related features + * 鼠标手势 - * Mouse gestures + * 用户样式表 - * User style sheets - - * Built-in Note tool + * 内建笔记功能 ![Otter][15] -Figure 4: The Otter Browser Speed Dial tab. +Figure 4: Otter 浏览器快起标签项. -[Used with permission][9] +[许可证书][9] -Otter Browser can be run on nearly any Linux distribution from an [AppImage][16], so there’s no installation required. Just download the AppImage file, give the file executable permissions (with the command chmod u+x otter-browser-*.AppImage), and then launch the app with the command ./otter-browser*.AppImage. +Otter浏览器可以在几乎所有Linux发行版上运行通过[AppImage][16]软件格式,因此无需安装。只需下载AppImage文件,授予文件可执行权限(使用命令 `chmod u+x otter-browser-.AppImage`),然后使用命令`./otter-browser.AppImage` 启动应用程序。 + +Otter浏览器在网站展示方面做得非常出色,可以轻松地用作你的微型浏览器。 -Otter Browser does an outstanding job of rendering websites and could function as your go-to minimal browser with ease. ### Lynx -Let’s get really minimal. When I first started using Linux, back in ‘97, one of the web browsers I often turned to was a text-only take on the app called [Lynx][17]. It should come as no surprise that Lynx is still around and available for installation from the standard repositories. As you might expect, Lynx works from the terminal window and doesn’t display pretty pictures or render much in the way of advanced features (Figure 5). In fact, Lynx is as bare-bones a browser as you will find available. Because of how bare-bones this web browser is, it’s not recommended for everyone. But if you happen to have a gui-less web server and you have a need to be able to read the occasional website, Lynx can be a real lifesaver. +让我们见识真正的微型浏览器。早在97年,当我使用Linux时,就经常使用的[Lynx][17]纯文本模式的网页浏览器。 +Lynx的存在并且可以从标准存储库中进行安装。正如您可能期望的那样,Lynx在终端窗口中工作,并且不会显示漂亮的图片和高级功能的渲染方式(图5)。事实上,Lynx是你能找到的最简单的浏览器。由于这个网页浏览器是如此简陋,所以不建议每个人都使用它。但如果你碰巧有一个没有界面的服务器,你需要能够偶尔访问的网站,Lynx是一个真正的救星。 ![Lynx][19] -Figure 5: The Lynx browser rendering the Linux.com page. +Figure 5: Lynx 浏览器展示 Linux.com 网址界面. -[Used with permission][9] +[许可证书][9] -I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). +我还发现Lynx是一个非常有用的工具,它可以帮助我解决网站某些方面的故障(或者如果网站上的某些功能阻止我在常规浏览器中查看内容)。使用Lynx的另一个重要原因是它可以让我们更加专注内容(而不是其他无关的元素)。 ### Plenty More Where This Came From 更多 -There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not.微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 +微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 -Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. 了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 -------------------------------------------------------------------------------- From 299f273a2f4c02ab8d84beeed762e9e106960e9e Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Thu, 9 Jan 2020 23:55:08 +0800 Subject: [PATCH 0171/3057] done --- ...181105 5 Minimal Web Browsers for Linux.md | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 translated/tech/20181105 5 Minimal Web Browsers for Linux.md diff --git a/translated/tech/20181105 5 Minimal Web Browsers for Linux.md b/translated/tech/20181105 5 Minimal Web Browsers for Linux.md new file mode 100644 index 0000000000..1a533e6557 --- /dev/null +++ b/translated/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: (MonkeyDEcho ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (5 Minimal Web Browsers for Linux) +[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) +[#]: url: ( ) + + +linux上的五种微型浏览器 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) + +有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 + +web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 + +但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 + +让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! + +### GNOME Web + +GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 + +Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: + + * 简单性 - 功能复杂和用户界面混乱都是不被允许的. + + * 规范性 - 任何非标准特性都不会引入到代码库中。 + + * 软件开源 - Epiphany始终遵守自由开源许可证。 + + * 人机交互 - Epiphany 始终遵守[GNOME的人机交互指南][6]。 + + * 最小首选项 - 经过慎重考虑才添加首选项。 + + * 受众群体 - 非技术用户是主要的受众目标,(有助于定义所包含功能的类型)。 + + + + +GNOME web浏览器就像看到的一样干净简洁 (Figure 1)。 + + +![GNOME Web][8] + +Figure 1: GNOME 浏览器为用户展示最少的首选项. + +[许可证书][9] + +GNOME Web 的声明如下: + +web 浏览器它不仅仅是一个应用程序,还是一种思维方式,一种看世界的方式。 Epiphany 的原则是简洁,标准和自由。 +### Netsurf + +[Netsurf][10] 浏览器是最小的浏览器,他的打开速度几乎和你松开鼠标一样。Netsurf 使用自己的布局和渲染引擎(完全从零开始设计的) 在渲染过程的设计中屡屡碰壁(Figure 2). + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) + +尽管你可能在特定的站点上发现 Netsurf的问题,但如果你了解Hubbub解析器的话,知道它正在兼容html5规范,是不是的会有一点问题。Netsurf对https的支持,网页缩略图,URL解析,缩放视图,书签,全屏模式,快捷键和GUI的工具包的功能;最后一点十分重要,当你桌面来回切换时,为了缓解渲染带来的问题。 + +对于那些对Netsurf 存在好奇的人来说,以现在的标准,他能在 16MB内存,30Mhz的ARM cpu的机器上运行,是让人惊奇的。 + +### QupZilla + +如果你找寻使用Qt Framework 和 the QtWebKit 渲染引擎的最小浏览器,QupZilla][11]是你最佳的选择。QupZilla 包含web浏览所有的标准功能,例如:书签,历史记录,侧边栏,选项卡,RSS,广告屏蔽,flash屏蔽,和CA证书管理。及时拥有这么多的功能,QupZilla 仍然是快速,轻量级的浏览器。另外还有其他的功能:快速启动,快速拨号主页,内置屏幕截图工具,浏览器主题等。 +吸引用户的一点是,与许多轻量级浏览器相比,QupZilla有更标准的首选项工具(图3)。所以,如果你很多功能,但你仍然想要更轻量,那么QupZilla就是你最好的选择。 + +![QupZilla][13] + +Figure 3: QupZilla 首选项工具. + +[许可证书][9] + +### Otter Browser + +Otter 浏览器是一种免费开源的,旨在重建Opera 12.x的浏览器。它使用WebKit渲染引擎,并且有用户的熟悉界面。虽然它轻量,但它有丰富的功能: + + * 密码管理 + + * 插件管理 + + * 内容拦截 + + * 拼写检查 + + * 自定义界面 + + * 网址补全 + + * 快速访问 (Figure 4) + + * 书签和其他相关功能 + + * 鼠标手势 + + * 用户样式表 + + * 内建笔记功能 + + +![Otter][15] + +Figure 4: Otter 浏览器快起标签项. + +[许可证书][9] + +Otter浏览器可以在几乎所有Linux发行版上运行通过[AppImage][16]软件格式,因此无需安装。只需下载AppImage文件,授予文件可执行权限(使用命令 `chmod u+x otter-browser-.AppImage`),然后使用命令`./otter-browser.AppImage` 启动应用程序。 + +Otter浏览器在网站展示方面做得非常出色,可以轻松地用作你的微型浏览器。 + + +### Lynx + +让我们见识真正的微型浏览器。早在97年,当我使用Linux时,就经常使用的[Lynx][17]纯文本模式的网页浏览器。 +Lynx的存在并且可以从标准存储库中进行安装。正如您可能期望的那样,Lynx在终端窗口中工作,并且不会显示漂亮的图片和高级功能的渲染方式(图5)。事实上,Lynx是你能找到的最简单的浏览器。由于这个网页浏览器是如此简陋,所以不建议每个人都使用它。但如果你碰巧有一个没有界面的服务器,你需要能够偶尔访问的网站,Lynx是一个真正的救星。 + +![Lynx][19] + +Figure 5: Lynx 浏览器展示 Linux.com 网址界面. + +[许可证书][9] + +我还发现Lynx是一个非常有用的工具,它可以帮助我解决网站某些方面的故障(或者如果网站上的某些功能阻止我在常规浏览器中查看内容)。使用Lynx的另一个重要原因是它可以让我们更加专注内容(而不是其他无关的元素)。 + +### Plenty More Where This Came From 更多 + +微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 + +了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[MonkeyDEcho](https://github.com/MonkeyDEcho) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.mozilla.org/en-US/firefox/new/ +[2]: https://www.chromium.org/ +[3]: https://vivaldi.com/ +[4]: https://www.google.com/chrome/ +[5]: https://www.merriam-webster.com/dictionary/epiphany +[6]: https://developer.gnome.org/hig/stable/ +[7]: /files/images/minimalbrowsers1jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) +[9]: /licenses/category/used-permission +[10]: https://www.netsurf-browser.org/ +[11]: https://qupzilla.com/ +[12]: /files/images/minimalbrowsers3jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) +[14]: /files/images/minimalbrowsers4jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) +[16]: https://sourceforge.net/projects/otter-browser/files/ +[17]: https://lynx.browser.org/ +[18]: /files/images/minimalbrowsers5jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) +[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 90ad890789888cfa40b34f020f22983b4399bd0b Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Thu, 9 Jan 2020 23:56:31 +0800 Subject: [PATCH 0172/3057] rm done --- ...181105 5 Minimal Web Browsers for Linux.md | 167 ------------------ 1 file changed, 167 deletions(-) delete mode 100644 sources/tech/20181105 5 Minimal Web Browsers for Linux.md diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md deleted file mode 100644 index 1a533e6557..0000000000 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ /dev/null @@ -1,167 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MonkeyDEcho ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (5 Minimal Web Browsers for Linux) -[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -[#]: url: ( ) - - -linux上的五种微型浏览器 -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) - -有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 - -web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 - -但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 - -让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! - -### GNOME Web - -GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 - -Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: - - * 简单性 - 功能复杂和用户界面混乱都是不被允许的. - - * 规范性 - 任何非标准特性都不会引入到代码库中。 - - * 软件开源 - Epiphany始终遵守自由开源许可证。 - - * 人机交互 - Epiphany 始终遵守[GNOME的人机交互指南][6]。 - - * 最小首选项 - 经过慎重考虑才添加首选项。 - - * 受众群体 - 非技术用户是主要的受众目标,(有助于定义所包含功能的类型)。 - - - - -GNOME web浏览器就像看到的一样干净简洁 (Figure 1)。 - - -![GNOME Web][8] - -Figure 1: GNOME 浏览器为用户展示最少的首选项. - -[许可证书][9] - -GNOME Web 的声明如下: - -web 浏览器它不仅仅是一个应用程序,还是一种思维方式,一种看世界的方式。 Epiphany 的原则是简洁,标准和自由。 -### Netsurf - -[Netsurf][10] 浏览器是最小的浏览器,他的打开速度几乎和你松开鼠标一样。Netsurf 使用自己的布局和渲染引擎(完全从零开始设计的) 在渲染过程的设计中屡屡碰壁(Figure 2). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) - -尽管你可能在特定的站点上发现 Netsurf的问题,但如果你了解Hubbub解析器的话,知道它正在兼容html5规范,是不是的会有一点问题。Netsurf对https的支持,网页缩略图,URL解析,缩放视图,书签,全屏模式,快捷键和GUI的工具包的功能;最后一点十分重要,当你桌面来回切换时,为了缓解渲染带来的问题。 - -对于那些对Netsurf 存在好奇的人来说,以现在的标准,他能在 16MB内存,30Mhz的ARM cpu的机器上运行,是让人惊奇的。 - -### QupZilla - -如果你找寻使用Qt Framework 和 the QtWebKit 渲染引擎的最小浏览器,QupZilla][11]是你最佳的选择。QupZilla 包含web浏览所有的标准功能,例如:书签,历史记录,侧边栏,选项卡,RSS,广告屏蔽,flash屏蔽,和CA证书管理。及时拥有这么多的功能,QupZilla 仍然是快速,轻量级的浏览器。另外还有其他的功能:快速启动,快速拨号主页,内置屏幕截图工具,浏览器主题等。 -吸引用户的一点是,与许多轻量级浏览器相比,QupZilla有更标准的首选项工具(图3)。所以,如果你很多功能,但你仍然想要更轻量,那么QupZilla就是你最好的选择。 - -![QupZilla][13] - -Figure 3: QupZilla 首选项工具. - -[许可证书][9] - -### Otter Browser - -Otter 浏览器是一种免费开源的,旨在重建Opera 12.x的浏览器。它使用WebKit渲染引擎,并且有用户的熟悉界面。虽然它轻量,但它有丰富的功能: - - * 密码管理 - - * 插件管理 - - * 内容拦截 - - * 拼写检查 - - * 自定义界面 - - * 网址补全 - - * 快速访问 (Figure 4) - - * 书签和其他相关功能 - - * 鼠标手势 - - * 用户样式表 - - * 内建笔记功能 - - -![Otter][15] - -Figure 4: Otter 浏览器快起标签项. - -[许可证书][9] - -Otter浏览器可以在几乎所有Linux发行版上运行通过[AppImage][16]软件格式,因此无需安装。只需下载AppImage文件,授予文件可执行权限(使用命令 `chmod u+x otter-browser-.AppImage`),然后使用命令`./otter-browser.AppImage` 启动应用程序。 - -Otter浏览器在网站展示方面做得非常出色,可以轻松地用作你的微型浏览器。 - - -### Lynx - -让我们见识真正的微型浏览器。早在97年,当我使用Linux时,就经常使用的[Lynx][17]纯文本模式的网页浏览器。 -Lynx的存在并且可以从标准存储库中进行安装。正如您可能期望的那样,Lynx在终端窗口中工作,并且不会显示漂亮的图片和高级功能的渲染方式(图5)。事实上,Lynx是你能找到的最简单的浏览器。由于这个网页浏览器是如此简陋,所以不建议每个人都使用它。但如果你碰巧有一个没有界面的服务器,你需要能够偶尔访问的网站,Lynx是一个真正的救星。 - -![Lynx][19] - -Figure 5: Lynx 浏览器展示 Linux.com 网址界面. - -[许可证书][9] - -我还发现Lynx是一个非常有用的工具,它可以帮助我解决网站某些方面的故障(或者如果网站上的某些功能阻止我在常规浏览器中查看内容)。使用Lynx的另一个重要原因是它可以让我们更加专注内容(而不是其他无关的元素)。 - -### Plenty More Where This Came From 更多 - -微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 - -了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[MonkeyDEcho](https://github.com/MonkeyDEcho) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.mozilla.org/en-US/firefox/new/ -[2]: https://www.chromium.org/ -[3]: https://vivaldi.com/ -[4]: https://www.google.com/chrome/ -[5]: https://www.merriam-webster.com/dictionary/epiphany -[6]: https://developer.gnome.org/hig/stable/ -[7]: /files/images/minimalbrowsers1jpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) -[9]: /licenses/category/used-permission -[10]: https://www.netsurf-browser.org/ -[11]: https://qupzilla.com/ -[12]: /files/images/minimalbrowsers3jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) -[14]: /files/images/minimalbrowsers4jpg -[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) -[16]: https://sourceforge.net/projects/otter-browser/files/ -[17]: https://lynx.browser.org/ -[18]: /files/images/minimalbrowsers5jpg -[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) -[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 5da985aef58c487b224082f6906c8ab9aba5dfc3 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Fri, 10 Jan 2020 00:08:33 +0800 Subject: [PATCH 0173/3057] Update 20180416 Cgo and Python.md --- sources/tech/20180416 Cgo and Python.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180416 Cgo and Python.md b/sources/tech/20180416 Cgo and Python.md index e5688d43c8..c78a820276 100644 --- a/sources/tech/20180416 Cgo and Python.md +++ b/sources/tech/20180416 Cgo and Python.md @@ -1,4 +1,5 @@ Cgo and Python +[#] MonkeyDEcho translating ============================================================ ![](https://datadog-prod.imgix.net/img/blog/engineering/cgo-and-python/cgo_python_hero.png?auto=format&w=1900&dpr=1) From 2cb066da2fc0d37f930cc94cf7a3cd54cd9d97a2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:52:36 +0800 Subject: [PATCH 0174/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200110=20Bash?= =?UTF-8?q?=20Script=20to=20Send=20eMail=20With=20a=20List=20of=20User=20A?= =?UTF-8?q?ccounts=20Expiring=20in=20=E2=80=9CX=E2=80=9D=20Days?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md --- ...t of User Accounts Expiring in -X- Days.md | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md diff --git a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md new file mode 100644 index 0000000000..1b3330a6e8 --- /dev/null +++ b/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days) +[#]: via: (https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days +====== + +The password enforcement policy is common to all operating systems and applications. + +If you want to **[implement a password enforcement policy on Linux][1]**, go to the following article. + +The password enforcement policy will be enforced by most companies by default, but the time period will be different depending on the company’s requirements. + +Usually everyone uses a 90-days password cycle. + +The user will only **[change the password][2]** on some of the servers they use, and they won’t change the password on the servers they don’t use often. + +In particular, most team forget to change the service account password, which can lead to breaking regular jobs even if they are configured to work with **[SSH key-based authentication][3]**. + +SSH key-based authentication and **[cronjobs][4]** will not work if the user account password expires. + +To avoid this situation, we have created a **[shell script][5]** that sends you a list of user accounts that expire within 10 days. + +There are two **[bash scripts][6]** included in this tutorial that will help you collect information about user expiration days on your system. + +### 1) Bash Script to Check List of User Accounts Expiring in 10 Days + +This script will help you to check the list of user accounts that expire in 10 days on your terminal. + +``` +# vi /opt/script/user-password-expiry.sh + +#!/bin/sh +/tmp/user-expiry-1.txt +/tmp/user-expiry.txt +echo "-------------------------------------------------" +echo "UserName The number of days the password expires" +echo "-------------------------------------------------" +for usern in u1 u2 u3 u4 +do +today=$(date +%s) +userexpdate=$(chage -l $usern | grep 'Password expires' |cut -d: -f2) +passexp=$(date -d "$userexpdate" "+%s") +exp=`expr \( $passexp - $today \)` +expday=`expr \( $exp / 86400 \)` +echo "$usern $expday" >> /tmp/user-expiry.txt +done +cat /tmp/user-expiry.txt | awk '$2 <= 10' > /tmp/user-expiry-1.txt +cat /tmp/user-expiry-1.txt | column -t +``` + +Set an executable Linux file permission to **“user-password-expiry.sh”** file. + +``` +# chmod +x /opt/script/user-password-expiry.sh +``` + +You will get an output like the one below. But the username and days may be different + +``` +# sh /opt/script/user-password-expiry.sh + +------------------------------------------------- +UserName The number of days the password expires +------------------------------------------------- +u1 -25 +u2 9 +u3 3 +u4 5 +``` + +### 2) Bash Script to Send eMail With a List of User Accounts Expiring in 10 Days + +This script will send a mail with a list of user accounts expiring in 10 days. + +``` +# vi /opt/script/user-password-expiry-mail.sh + +#!/bin/sh +SUBJECT="Information About User Password Expiration on "`date`"" +MESSAGE="/tmp/user-expiry.txt" +MESSAGE1="/tmp/user-expiry-1.txt" +TO="[email protected]" +echo "-------------------------------------------------" >> $MESSAGE1 +echo "UserName The number of days the password expires" >> $MESSAGE1 +echo "-------------------------------------------------" >> $MESSAGE1 +for usern in u1 u2 u3 u4 +do +today=$(date +%s) +userexpdate=$(chage -l $usern | grep 'Password expires' |cut -d: -f2) +passexp=$(date -d "$userexpdate" "+%s") +exp=`expr \( $passexp - $today \)` +expday=`expr \( $exp / 86400 \)` +echo "$usern $expday" >> $MESSAGE +done +cat $MESSAGE | awk '$2 <= 10' >> $MESSAGE1 +mail -s "$SUBJECT" "$TO" < $MESSAGE1 +rm $MESSAGE +rm $MESSAGE1 +``` + +Set an executable Linux file permission to **“user-password-expiry-mail.sh”** file. + +``` +# chmod +x /opt/script/user-password-expiry-mail.sh +``` + +Finally add a **[cronjob][4]** to automate this. It runs once in a day at 8AM. + +``` +# crontab -e +0 8 * * * /bin/bash /opt/script/user-password-expiry-mail.sh +``` + +You will receive a mail similar to the first shell script output. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ +[2]: https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-users-password-in-linux-using-shell-script/ +[3]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ +[4]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ +[5]: https://www.2daygeek.com/category/shell-script/ +[6]: https://www.2daygeek.com/category/bash-script/ From 874447fbc6fc18bac8b6dbb27ef9133e75a3742f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:55:49 +0800 Subject: [PATCH 0175/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20My?= =?UTF-8?q?=20favorite=20Bash=20hacks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200109 My favorite Bash hacks.md --- .../tech/20200109 My favorite Bash hacks.md | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 sources/tech/20200109 My favorite Bash hacks.md diff --git a/sources/tech/20200109 My favorite Bash hacks.md b/sources/tech/20200109 My favorite Bash hacks.md new file mode 100644 index 0000000000..857f10e160 --- /dev/null +++ b/sources/tech/20200109 My favorite Bash hacks.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My favorite Bash hacks) +[#]: via: (https://opensource.com/article/20/1/bash-scripts-aliases) +[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) + +My favorite Bash hacks +====== +Improve your productivity with aliases and other shortcuts for the +things you forget too often. +![bash logo on green background][1] + +When you work with computers all day, it's fantastic to find repeatable commands and tag them for easy use later on. They all sit there, tucked away in **~/.bashrc** (or ~/.zshrc for [Zsh users][2]), waiting to help improve your day! + +In this article, I share some of my favorite of these helper commands for things I forget a lot, in hopes that they will save you, too, some heartache over time. + +### Say when it's over + +When I'm using longer-running commands, I often multitask and then have to go back and check if the action has completed. But not anymore, with this helpful invocation of **say** (this is on MacOS; change for your local equivalent): + + +``` +function looooooooong { +    START=$(date +%s.%N) +    $* +    EXIT_CODE=$? +    END=$(date +%s.%N) +    DIFF=$(echo "$END - $START" | bc) +    RES=$(python -c "diff = $DIFF; min = int(diff / 60); print('%s min' % min)") +    result="$1 completed in $RES, exit code $EXIT_CODE." +    echo -e "\n⏰  $result" +    ( say -r 250 $result 2>&1 > /dev/null & ) +} +``` + +This command marks the start and end time of a command, calculates the minutes it takes, and speaks the command invoked, the time taken, and the exit code. I find this super helpful when a simple console bell just won't do. + +### Install helpers + +I started using Ubuntu back in the Lucid days, and one of the first things I needed to learn was how to install packages. And one of the first aliases I ever added was a helper for this (named based on the memes of the day): + + +``` +`alias canhas="sudo apt-get install -y"` +``` + +### GNU Privacy Guard (GPG) signing + +On the off chance I have to sign a [GPG][3] email without having an extension or application to do it for me, I drop down into the command line and use these terribly dorky aliases: + + +``` +alias gibson="gpg --encrypt --sign --armor" +alias ungibson="gpg --decrypt" +``` + +### Docker + +There are many Docker commands, but there are even more **docker compose** commands. I used to forget the **\--rm** flags, but not anymore with these useful aliases: + + +``` +alias dc="docker-compose" +alias dcr="docker-compose run --rm" +alias dcb="docker-compose run --rm --build" +``` + +### gcurl helper for Google Cloud + +This one is relatively new to me, but it's [heavily documented][4]. gcurl is an alias to ensure you get all the correct flags when using local curl commands with authentication headers when working with Google Cloud APIs.  + +### Git and ~/.gitignore + +I work a lot in Git, so I have a special section dedicated to Git helpers. + +One of my most useful helpers is one I use to clone GitHub repos. Instead of having to run: + + +``` +`git clone git@github.com:org/repo /Users/glasnt/git/org/repo` +``` + +I set up a clone function: + + +``` +clone(){ +    echo Cloning $1 to ~/git/$1 +    cd ~/git +    git clone [git@github.com][5]:$1 $1 +    cd $1 +} +``` + +Even though I always forget and giggle any time I'm diving into my **~/.bashrc** file, I also have my "refresh upstream" command: + + +``` +`alias yoink="git checkout master && git fetch upstream master && git merge upstream/master"` +``` + +Another helper for Git-ville is a global ignore file. In your **git config --global --list** you should see a **core.excludesfile**. If not, [create one][6], and fill it full of things that you always put into your individual **.gitignore** files. As a Python developer on MacOS, for me this is: + + +``` +.DS_Store     # macOS clutter +venv/         # I never want to commit my virtualenv +*.egg-info/*  # ... nor any locally compiled packages +__pycache__   # ... or source +*.swp         # ... nor any files open in vim +``` + +You can find other suggestions over on [Gitignore.io][7] or on the [Gitignore repo][8] on GitHub. + +### Your turn + +What are your favorite helper commands? Please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/bash-scripts-aliases + +作者:[Katie McLaughlin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/glasnt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/19/9/getting-started-zsh +[3]: https://gnupg.org/ +[4]: https://cloud.google.com/service-infrastructure/docs/service-control/getting-started +[5]: mailto:git@github.com +[6]: https://help.github.com/en/github/using-git/ignoring-files#create-a-global-gitignore +[7]: https://www.gitignore.io/ +[8]: https://github.com/github/gitignore From bc0fe0c7b43c19ad14d1e0cd619235f5fead93f4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:56:11 +0800 Subject: [PATCH 0176/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20Crea?= =?UTF-8?q?te=20demo=20project=20templates=20with=20one=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200109 Create demo project templates with one script.md --- ... demo project templates with one script.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20200109 Create demo project templates with one script.md diff --git a/sources/tech/20200109 Create demo project templates with one script.md b/sources/tech/20200109 Create demo project templates with one script.md new file mode 100644 index 0000000000..950ec0e85f --- /dev/null +++ b/sources/tech/20200109 Create demo project templates with one script.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create demo project templates with one script) +[#]: via: (https://opensource.com/article/20/1/initsh-script) +[#]: author: (Eric D. Schabell https://opensource.com/users/eschabell) + +Create demo project templates with one script +====== +This init.sh script makes it easier to create demos to convince your +customers, team, and boss that your project is exactly what they need. +![Person using a laptop][1] + +When you're standing on a stage or doing a live demo in an online session, getting your project into a perfect-looking state may appear easy. But a lot of work goes on behind the scenes to create working, easy to use, and repeatable demo projects. + +When you're doing a demo, the technology in a project must support your bigger story about the project without failing. My fellow JBoss technology evangelists and I often have to set up different technologies, so it became necessary for us to tune some sort of generic framework or template to put these demo projects into. + +Achieving this goal was guided by three principles: + + * KISS (keep it simple, stupid) + * Consistency + * Repeatability + + + +These stem from our aim to support anyone who wants to explore and get started with a JBoss technology. Note that while the order of these principles has some significance about what is most important, they all have to balance each other. + +If one must be weighed more heavily, when using technology, it is KISS. Therefore, you will find that this principle is followed almost religiously when deciding how to solve anything within the demo project template. + +### Simple + +The demos need to have a simple set up, taking almost no effort to get them started or, more realistically, the least amount of effort possible. + +Each project requires just three steps to get going: + + 1. Download and unzip the project. + 2. Add products to the project's **installs** directory. + 3. Run **init.sh** (for Unix) or **init.bat** (for Windows) to install the project. + + + +That's it; just watch the install's output to continue with the project as you see fit. + +This setup also relies on the very smallest or most basic set of dependencies that are physically possible for Unix- and Windows-based systems—Java and Maven, nothing more than that. + +A demo is all about learning what the project in front of you does, so it must be clear and offer the possibility to explore how the project is set up, configured, and runs. Based on users' feedback over the years, full automation is not desirable, as it takes the project out of the user's learning sphere. + +There is a balance offered when installing a project with autoconfiguration and setup, but there are still some steps that allow you to pause, consider, and explore what has been done. + +### Consistent + +The only way for people to be able to jump between our various technologies and products is to have some consistency in our demo projects. A customer, partner, or interested party needs to be able to recognize a simple and clear form of project setup. + +This is done with a simple and clear project template structure: + + * **docs/** contains project documentation and screenshots. + * **installs/** is where you place needed products. + * **projects/** contains sources for services, clients, or other project-based code. + * **support/** holds all other configuration, setup, or other necessary files and utilities. + * **init.{sh|bat}** stores installation scripts needed to set up the project. + + + +That's it; every single time it will look like this. + +### Repeatable + +Nothing is worse than spending a large amount of time to provide a demo project and only being able to run it one time. Often, there is some factor that rushes a project's completion so that you have little chance to bring some sort of order to it. + +Our template allows you to develop a demo project while saving its repeatability. Note that the entire setup is done in a new directory called **target**, where you can throw it all away and just set the project up again (with the initial **init** script). + +This is a golden rule: Every demo project should be repeatable in minutes, if not less. + +### Generic demo template project + +You want to create your own awesome demo to convince your friends, team, and boss that your project is exactly what the doctor ordered? This template will provide the tools to set up simple, consistent and easily repeatable demo projects. + +### Getting started with this template + + 1. [Download and unzip it][2]. + + + +Run **init.sh** to populate a project, and see the README files that are generated for how to use it: + + +``` +`$ ./init.sh PROJECTNAME` +``` + +#### + +![Setting up your project][3] + +#### Released versions + + * v2.0—Updated to generic template project creation + * v1.0—Image added and final touches + + + +  + +![Installing the template][4] + +![Installing the template][5] + +_This article is adapted from "How to create simple, consistent, repeatable demo projects" on [Eric D. Schabell's blog][6] and is reused with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/initsh-script + +作者:[Eric D. Schabell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/eschabell +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://github.com/jbossdemocentral/jboss-demo-template/archive/master.zip +[3]: https://opensource.com/sites/default/files/uploads/settingup_demotemplate.png (Setting up your project) +[4]: https://opensource.com/sites/default/files/uploads/install_eric_schabell.png (Installing the template) +[5]: https://opensource.com/sites/default/files/uploads/install-2_eric_schabell.png (Installing the template) +[6]: http://www.schabell.org/2015/02/jboss-evangelist-howto-create-demo-projects.html From 4a9fdf4bc73831fe8672886073243403ffeaef22 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:56:33 +0800 Subject: [PATCH 0177/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20What?= =?UTF-8?q?'s=20HTTPS=20for=20secure=20computing=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200109 What-s HTTPS for secure computing.md --- ...00109 What-s HTTPS for secure computing.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20200109 What-s HTTPS for secure computing.md diff --git a/sources/tech/20200109 What-s HTTPS for secure computing.md b/sources/tech/20200109 What-s HTTPS for secure computing.md new file mode 100644 index 0000000000..364ff39b13 --- /dev/null +++ b/sources/tech/20200109 What-s HTTPS for secure computing.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's HTTPS for secure computing?) +[#]: via: (https://opensource.com/article/20/1/confidential-computing) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +What's HTTPS for secure computing? +====== +Security by default hasn't arrived yet. +![Secure https browser][1] + +Over the past few years, it's become difficult to find a website that is just "http://…" This is because the industry has finally realised that security on the web is "a thing," and also because it has become easy for both servers and clients to set up and use HTTPS connections. A similar shift may be on its way in computing across cloud, edge, Internet of Things, blockchain, artificial intelligence, machine learning, and beyond. We've known for a long time that we should encrypt data at rest (in storage) and in transit (on the network), but encrypting it in use (while processing) has been difficult and expensive. Confidential computing—providing this type of protection for data and algorithms in use using hardware capabilities such as trusted execution environments (TEEs)—protects data on hosted systems or vulnerable environments. + +I've written several times about [TEEs][2] and, of course, the [Enarx project][3] of which I'm a co-founder with Nathaniel McCallum (see [_Enarx for everyone (a quest)_][4] and [_Enarx goes multi-platform_][5] for examples). Enarx uses TEEs and provides a platform- and language-independent deployment platform to allow you safely to deploy sensitive applications or components (such as microservices) onto hosts that you don't trust. Enarx is, of course, completely open source (we're using the Apache 2.0 licence, for those with an interest). Being able to run workloads on hosts that you don't trust is the promise of confidential computing, which extends normal practice for sensitive data at rest and in transit to data in use: + + * **Storage:** You encrypt your data at rest because you don't fully trust the underlying storage infrastructure. + * **Networking:** You encrypt your data in transit because you don't fully trust the underlying network infrastructure. + * **Compute:** You encrypt your data in use because you don't fully trust the underlying compute infrastructure. + + + +I've got a lot to say about trust, and the word "fully" in the statements above is important (I added it on re-reading what I'd written). In each case, you have to trust the underlying infrastructure to some degree, whether it's to deliver your packets or store your blocks, for instance. In the case of the compute infrastructure, you're going to have to trust the CPU and associated firmware, just because you can't really do computing without trusting them (there are techniques such as homomorphic encryption, which are beginning to offer some opportunities here, but they're limited and the technology still immature). + +Questions sometimes come up about whether you should fully trust CPUs, given some of the security problems that have been found with them, and also about whether they are fully secure against physical attacks on the host on which they reside. + +The answer to both questions is "no," but this is the best technology we currently have available at scale and at a price point to make it generally deployable. To address the second question, nobody is pretending that this (or any other technology) is fully secure: what we need to do is consider our [threat model][6] and decide whether TEEs (in this case) provide sufficient security for our specific requirements. In terms of the first question, the model that Enarx adopts is to allow decisions to be made at deployment time as to whether you trust a particular set of CPUs. So, for example, if vendor Q's generation R chips are found to contain a vulnerability, it will be easy to say "refuse to deploy my workloads to R-type CPUs from Q, but continue to deploy to S-type, T-type, and U-type chips from Q and any CPUs from vendors P, M, and N." + +I think there are three changes in the landscape that are leading to the interest and adoption of confidential computing right now: + + 1. **Hardware availability:** It is only over the past six to 12 months that hardware supporting TEEs has started to become widely available, with the key examples in the market at the moment being Intel's SGX and AMD's SEV. We can expect to see other examples of TEE-enabled hardware coming out in the fairly near future. + 2. **Industry readiness:** Just as cloud use is increasingly becoming accepted as a model for application deployment, regulators and legislators are increasing the requirements on organisations to protect the data they manage. Organisations are beginning to clamour for ways to run sensitive applications (or applications that handle sensitive data) on untrusted hosts—or, to be more accurate, on hosts that they cannot fully trust with that sensitive data. This should be no surprise: the chip vendors would not have invested so much money into this technology if they saw no likely market for it. Formation of the Linux Foundation's [Confidential Computing Consortium][7] (CCC) is another example of how the industry is interested in finding common models for the use of confidential computing and encouraging open source projects to employ these technologies.[1][8] + 3. **Open source:** Like blockchain, confidential computing is one of those technologies where it's an absolute no-brainer to use open source. If you are going to run sensitive applications, you need to trust what's doing the running for you. That's not just the CPU and firmware but also the framework that supports the execution of your workload within the TEE. It's all very well saying, "I don't trust the host machine and its software stack, so I'm going to use a TEE," but if you don't have visibility into the TEE software environment, then you're just swapping one type of software opacity for another. Open source support for TEEs allows you or the community—in fact, you _and_ the community—to check and audit what you're running in a way that is impossible for proprietary software. This is why the CCC sits within the Linux Foundation (which is committed to the open development model) and is encouraging TEE-related software projects to join and go open source (if they weren't already). + + + +I'd argue that this triad of hardware availability, industry readiness, and open source has become the driver for technology change over the past 15 to 20 years. Blockchain, AI, cloud computing, webscale computing, big data, and internet commerce are all examples of these three meeting at the same time and leading to extraordinary changes in our industry. + +Security by default is a promise that we've been hearing for decades now, and it hasn't arrived yet. Honestly, I'm not sure it ever will. But as new technologies become available, security ubiquity for particular use cases becomes more practical and more expected within the industry. It seems that confidential computing is ready to be the next big change—and you, dear reader, can join the revolution (it's open source, after all). + +* * * + + 1. Enarx, initiated by Red Hat, is a CCC project. + + + +* * * + +_This article was originally published on [Alice, Eve, and Bob][9] and is reprinted with the author's permission._ + +Get a sneak peek at Daniel Roesler's Texas Linux Fest talk, "If you're not using HTTPS, your... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/confidential-computing + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/secure_https_url_browser.jpg?itok=OaPuqBkG (Secure https browser) +[2]: https://aliceevebob.com/2019/02/26/oh-how-i-love-my-tee-or-do-i/ +[3]: https://enarx.io/ +[4]: https://aliceevebob.com/2019/08/20/enarx-for-everyone-a-quest/ +[5]: https://aliceevebob.com/2019/10/29/enarx-goes-multi-platform/ +[6]: https://aliceevebob.com/2018/02/20/there-are-no-absolutes-in-security/ +[7]: https://confidentialcomputing.io/ +[8]: tmp.VEZpFGxsLv#1 +[9]: https://aliceevebob.com/2019/12/03/confidential-computing-the-new-https/ From d4c144561acc823fa28e5ac6704ead91dfbdde89 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:57:29 +0800 Subject: [PATCH 0178/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20How?= =?UTF-8?q?=20to=20Deliver=20Affordable=20and=20Optimized=20Application=20?= =?UTF-8?q?Access=20Worldwide=20with=20SASE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md --- ... Application Access Worldwide with SASE.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md diff --git a/sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md b/sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md new file mode 100644 index 0000000000..9e217c7d24 --- /dev/null +++ b/sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Deliver Affordable and Optimized Application Access Worldwide with SASE) +[#]: via: (https://www.networkworld.com/article/3512640/how-to-deliver-affordable-and-optimized-application-access-worldwide-with-sase.html) +[#]: author: (Cato Networks https://www.networkworld.com/author/Matt-Conran/) + +How to Deliver Affordable and Optimized Application Access Worldwide with SASE +====== +Gartner tells you to use your MPLS renewal budget to transition into SASE, but not every SASE can replace MPLS. Here's what to look for. +Vit_Mar + +Global expansion is a common goal for many enterprises. In some verticals, like manufacturing, running production lines globally is an established practice. However, deploying international sales, service, and engineering teams is becoming the norm for many other sectors including high tech, finance, retail, and more. + +A global enterprise footprint creates a unique set of challenges that do not occur in regional businesses. Users in a remote office will need to securely access data-center applications, cloud applications, or both. Depending on the distance between the remote location and the application—and the sensitivity of the application to high latency, packet loss, and jitter—an expensive set of technologies and capabilities will be needed to optimize the user experience. + +[SD-WAN][1] focuses on affordable, high-performance site connectivity. Alone it cannot solve the broader networking and security challenges faced by global enterprises, which is why Gartner and other analysts are already recognizing the need to look beyond SD-WAN for a new class of enterprise solutions. Gartner has coined the term [secure access service edge (SASE, pronounced “sassy”)][2] for solutions that converge SD-WAN capabilities with enterprise security into a global, cloud-native platform. Let’s take a deeper look. + +#### **The Application Access Optimization Challenge** + +Across the enterprise, IT finds itself facing various challenges delivering network access to users and data everywhere. While those challenges will vary, their impact point remains the same—the user experience and IT budget. + +For data-center access, organizations traditionally relied on global MPLS providers. The predictability of MPLS ensured consistent latency and low packet loss and jitter needed to support critical applications like voice and ERP. The challenge with global MPLS was the cost per megabit that required organizations to spend heavily on limited bandwidth, creating a capacity constraint. The introduction of SD-WAN appliances and Internet-based connectivity does little to address the global connectivity challenge because SD-WAN appliances can't control the packet routing once the packet is placed on the Internet-leg of the SD-WAN. + +Another option to address global connectivity challenges was to shorten the distance between users and applications. Enterprises built regional data centers or hubs to get applications closer to end users. This is a very costly and complex endeavor that is most suitable for very large organizations with distributed IT staff who can optimize application performance and availability. + +#### **Global Cloud Access** + +The migration to cloud applications and cloud data centers created a new challenge for remote users. While MPLS was optimized for the organization’s on-premises data-center access, cloud data centers often reside in different geographic locations. Special connectivity solutions, such as [AWS DirectConnect and Azure ExpressRoute][3], are used to optimally connect physical enterprise locations to the cloud data centers. And while SD-WAN appliances claim cloud optimization, they require deploying a second appliance into the cloud — no easy task. + +Regardless of application location, none of the network solutions discussed are extensible to home offices and mobile users, where deploying edge appliances for SD-WAN or WAN optimization is not possible. This creates an application access challenge because the users must use the public internet to access the edge of the data center hosting their application. This access is subject to the unpredictable quality of the network from the user’s location to the destination. + +#### **SASE Delivers Optimized and Secured Application Access Anywhere** + +Global expansion, the migration from on-premises to cloud data centers, and the emergence of the mobile and telecommuting workforce are straining legacy network architectures. The network “patches” created to address this challenge, such as edge-SD-WAN, hybrid MPLS, Internet transports, and premium cloud connectivity, are costly and incomplete. + +To address this architectural challenge, a new architecture that connects and optimizes all edges—physical, virtual, cloud, mobile—anywhere in the world, must be created. That’s the story of [SASE][2]. SASE services converge networking and security into an identity-aware, cloud-native software stack. It’s the convergence that is key. Without the necessary network optimizations and capabilities, the SASE platform will not be able to meet performance expectations everywhere. + +#### **Cloud-Native: Built for and Delivered from the Cloud** + +A core characteristic of SASE is a cloud-native, as-a-service model. A cloud-native architecture leverages key cloud capabilities, including elasticity, adaptability, self-healing, and self-maintenance. + +SASE calls for the creation of a network of cloud points of presence (PoPs), which comprise the SASE Cloud. The PoPs run the provider software that delivers a wide range of networking and network security capabilities as a service. The PoPs should seamlessly scale to adapt to changes in traffic load via the addition of compute nodes. The PoPs software can be upgraded to deliver new features or bug fixes seamlessly and without IT involvement. The cloud architecture must include self-healing capabilities to automatically move processing away from failing compute nodes and PoPs and into healthy ones. + +These capabilities can't be achieved by spinning up virtual appliances in the cloud. Appliances are designed to serve a single customer (single tenant) and lack the overall cloud orchestration layer to ensure elasticity and self-healing. + +**Globally Distributed: Available Near All Edges** + +SASE Cloud is implemented as a globally distributed cloud platform. The SASE Cloud design guarantees that wherever your edges are, the full range of networking and security capabilities will be available to support them. SASE providers will have to strategically deploy PoPs to support business locations, cloud applications, and mobile users. As Gartner notes, SASE PoPs must extend beyond public cloud providers’ footprints (like AWS and Azure) to deliver a low-latency service to enterprise edges. + +Building a global cloud platform requires providers to hone their ability to rapidly deploy PoPs into cloud and physical data centers, ensure high capacity and redundant connectivity to support both WAN and cloud access, and apply security and optimization end-to-end across all edges. + +#### **Thin Edge: DC, Branch, Cloud, User** + +By placing processing and business logic in the cloud, SASE has minimal requirements for connecting various edges. This is a key challenge for SD-WAN edges especially in the context of NFV and uCPE. Running SD-WAN and network security side by side on the same appliance increases the likelihood of an overload, forcing the need to over-spec the underlying appliance.  This isn't a theoretical issue: An increase in branch throughput or rise in encrypted traffic volume can force an out-of-budget expansion. A Thin Edge approach has the following benefits:** ** + + * **Low cost:** By minimizing edge processing, low-cost appliances can achieve high throughput as most resource-intensive processing, such as deep packet inspection, is done using cloud resources that can scale better. + * **Low maintenance:** By keeping the over-functionality limited, it is possible to run a slower upgrade cycle to the edges, which has a higher potential for disruption vs. introducing new capabilities in the cloud. + * **Low impact:** Cloud integration is achieved with no edge appliances at all (agentless), while security and global network optimization remains intact. Mobile devices and new kinds of IoT devices no longer need significant processing resources to participate in the corporate network. They can automatically connect to the nearest SASE PoP with minimal battery impact. + + + +#### **End-to-End Optimization** + +Combining intelligent routing at the WAN edge with a software-defined global private backbone enables end-to-end traffic optimization. Last-mile optimizations focus on addressing last-mile issues, such as packet loss, by dynamically routing traffic over multiple ISPs. Middle-mile optimizations focus on optimizing routing globally and over multiple carriers comprising a diverse underlay. The middle-mile optimization extends to all edges—physical, virtual, and mobile—which is a unique benefit to a cloud-based, rather than an edge appliance-based, architecture. + +In short, SASE implements a new architecture that is built to support the modern global enterprise and address the various resources, requirements, and use cases in a holistic platform. Yes, SASE provides a fresh way to secure the network, but SASE also needs the “networking capabilities” of the network if companies are to deliver users everywhere an optimum user experience. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3512640/how-to-deliver-affordable-and-optimized-application-access-worldwide-with-sase.html + +作者:[Cato Networks][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.catonetworks.com/sd-wan?utm_source=idg +[2]: https://www.catonetworks.com/sase?utm_source=idg +[3]: https://www.catonetworks.com/cato-cloud#cloud-datacenter From ab89bd8d00f5d056bad82cef582c82835be90792 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 10 Jan 2020 08:51:05 +0800 Subject: [PATCH 0179/3057] translated --- ...erWM- tiled window management for GNOME.md | 71 ------------------- ...erWM- tiled window management for GNOME.md | 71 +++++++++++++++++++ 2 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 sources/tech/20200105 PaperWM- tiled window management for GNOME.md create mode 100644 translated/tech/20200105 PaperWM- tiled window management for GNOME.md diff --git a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md deleted file mode 100644 index fa99f6c352..0000000000 --- a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (PaperWM: tiled window management for GNOME) -[#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/) -[#]: author: (Julia Evans https://jvns.ca/) - -PaperWM: tiled window management for GNOME -====== - -When I started using Linux on my personal computer, one of the first things I got excited about was tiny lightweight window managers, largely because my laptop at the time had 32MB of RAM and anything else was unusable. - -Then I got into tiling window managers like [xmonad][1]! I could manage my windows with my keyboard! They were so fast! I could configure xmonad by writing a Haskell program! I could customize everything in all kinds of fun ways (like using [dmenu][2] as a launcher)! I used 3 or 4 different tiling window managers over the years and it was fun. - -About 6 years ago I decided configuring my tiling window manager wasn’t fun for me anymore and switched to using the Ubuntu stock desktop environment: Gnome. (which is much faster now that I have 500x more RAM in my laptop :) ) - -So I’ve been using Gnome for a long time, but I still kind of missed tiling window managers. Then 6 months ago a friend told me about [PaperWM][3], which lets you tile your windows in Gnome! I installed it immediately and I’ve been using it ever since. - -### PaperWM: tiling window management for Gnome - -The basic idea of [PaperWM][3] is: you want to keep using Gnome (because all kinds of things Just Work in Gnome) but you also kinda wish you were using a tiling window manager. - -It’s a Gnome extension (instead of being a standalone window manager) and it’s in Javascript. - -### “Paper” means all of your windows are in a line - -The main idea in PaperWM is it puts all your windows in a line, which is actually quite different from traditional tiling window managers where you can tile your windows any way you want. Here’s a gif of me moving between / resizing some windows while writing this blog post (there’s a browser and two terminal windows): - -![][4] - -PaperWM’s Github README links to this video: , which describes a similar system as a “linear window manager”. - -I’d never heard of this way of organizing windows before but I like the simplicity of it – if I’m looking for a specific window I just move left/right until I find it. - -### everything I do in PaperWM - -there are lots of other features but these are the only ones I use: - - * move left and right between windows (`Super + ,`, `Super + .`) - * move the window left/right in the ordering (`Super+Shift+,`, `Super+Shift+.`) - * full screen a window (`Super + f`) - * make a window smaller (`Super + r`) - - - -### I like tools that I don’t have to configure - -I’ve been using PaperWM for 6 months on a laptop and I really like it! I also really appreciate that even though it’s configurable (by writing a Javascript configuration file), it does the things I want out of the box without me having to research how to configure it. - -The [fish shell][5] is another delightful tool like that – I basically don’t configure fish at all (except to set environment variables etc) and I really like the default feature set. - --------------------------------------------------------------------------------- - -via: https://jvns.ca/blog/2020/01/05/paperwm/ - -作者:[Julia Evans][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://jvns.ca/ -[b]: https://github.com/lujun9972 -[1]: https://xmonad.org/ -[2]: https://wiki.archlinux.org/index.php/Dmenu -[3]: https://github.com/paperwm/PaperWM -[4]: https://jvns.ca/images/paperwm.gif -[5]: https://jvns.ca/blog/2017/04/23/the-fish-shell-is-awesome/ diff --git a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md new file mode 100644 index 0000000000..dab0726417 --- /dev/null +++ b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PaperWM: tiled window management for GNOME) +[#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/) +[#]: author: (Julia Evans https://jvns.ca/) + +PaperWM:GNOME 下的平铺窗口管理 +====== + +当我开始在个人计算机上使用 Linux 时,令我兴奋的第一件事就是轻巧的窗口管理器,这主要是因为当时我的笔记本电脑只有有 32MB 的内存,且没有其他可使用的内存。 + +接着我开始接触 [xmonad][1] 之类的平铺窗口管理器!我可以用键盘管理窗口了!它们太快了!我可以通过编写 Haskell 程序来配置 xmonad!我可以用各种有趣的方式自定义所有内容(例如使用 [dmenu][2] 作为启动器)!这些年来,我用过 3,4 个不同的平铺窗口管理器,它们很有趣。 + +大约 6 年前,我觉得配置平铺窗口管理器对我来说不再是一件有趣的事情,因此转而使用 Ubuntu 桌面环境 Gnome。 (现在,我的笔记本电脑中的内存增加了 500 倍,这要快得多 :) ) + +我使用 Gnome 已有很长时间了,但是我仍然有点想念平铺窗口管理器。六个月前,一个朋友告诉我有关 [PaperWM][3] 的消息,它使你可以在 Gnome中 平铺窗口!我立即安装了它,并从那时起我一直在使用它。 + +### PaperWM:Gnome 下的平铺窗口管理 + +[PaperWM][3] 的基本思想是:你想继续使用 Gnome(因为在 Gnome 中各种任务都能完成),但是你也希望使用平铺窗口管理器。 + +它是一个 Gnome 扩展程序(而不是一个独立的窗口管理器),并且使用 Javascript。 + +### “Paper” 表示你的所有窗户都在一行中 + +PaperWM 的主要思想是将所有窗口排成一行,这实际上与传统的平铺窗口管理器大不相同,在传统的平铺窗口管理器中,你可以按任意方式平铺窗口。这是我写这篇博客时在几个窗口之间切换/调整大小的 gif 图像(有一个浏览器和两个终端窗口): + +![][4] + +PaperWM 的 Github README 链接了此视频:,它描述为一个类似的”线性窗口管理器“。 + +我以前从未听说过这种组织窗口的方式,但是我喜欢它的简单性。如果要查找特定的窗口,只需向左/向右移动,直到找到它。 + +### 我在 PaperWM 中所做的一切 + +还有很多其他功能,但这是我使用的功能: + + * 在窗口之间左右移动(`Super + ,`, `Super + .`) +  * 按顺序向左/向右移动窗口(`Super+Shift+,`,`Super+Shift+.`) +  * 全屏显示窗口(`Super + f`) +  * 缩小窗口(`Super + r`) + + + +### 我喜欢不需要配置的工具 + +我在笔记本上使用 PaperWM 已经6个月了,我真的很喜欢它!即使它是可配置(通过编写 Javascript 配置文件),我也非常欣赏它,它自带我想要的功能,我无需研究如何去配置。 + +[fish shell][5] 是另一个类似的令人愉悦的工具,我基本上没有配置 fish(除了设置环境变量等),我真的很喜欢它的默认功能。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/01/05/paperwm/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://xmonad.org/ +[2]: https://wiki.archlinux.org/index.php/Dmenu +[3]: https://github.com/paperwm/PaperWM +[4]: https://jvns.ca/images/paperwm.gif +[5]: https://jvns.ca/blog/2017/04/23/the-fish-shell-is-awesome/ From fa31c8aab28d211786a5992d469b039891f2cd8a Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 10 Jan 2020 08:57:45 +0800 Subject: [PATCH 0180/3057] translating --- ...06 How to write a Python web API with Pyramid and Cornice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md index 2b10ef953a..eaab46c5bc 100644 --- a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md +++ b/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 357183cce76c020e080a7515e1c79e484db92910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 10 Jan 2020 09:17:48 +0800 Subject: [PATCH 0181/3057] Translated --- ...21 Simulate gravity in your Python game.md | 96 ++++++++++--------- 1 file changed, 49 insertions(+), 47 deletions(-) rename {sources => translated}/tech/20191121 Simulate gravity in your Python game.md (64%) diff --git a/sources/tech/20191121 Simulate gravity in your Python game.md b/translated/tech/20191121 Simulate gravity in your Python game.md similarity index 64% rename from sources/tech/20191121 Simulate gravity in your Python game.md rename to translated/tech/20191121 Simulate gravity in your Python game.md index 45e4b4ce50..fd02e851d6 100644 --- a/sources/tech/20191121 Simulate gravity in your Python game.md +++ b/translated/tech/20191121 Simulate gravity in your Python game.md @@ -7,29 +7,28 @@ [#]: via: (https://opensource.com/article/19/11/simulate-gravity-python) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Simulate gravity in your Python game +在你的 Python 游戏中模拟引力 ====== -Learn how to program video games with Python's Pygame module and start -manipulating gravity. +学习如何使用 Python 的 Pygame 模块编程电脑游戏,并开始操作引力。 ![Cosmic stars in outer space][1] -The real world is full of movement and life. The thing that makes the real world so busy and dynamic is physics. Physics is the way matter moves through space. Since a video game world has no matter, it also has no physics, so game programmers have to _simulate_ physics. +真实的世界充满了运动和生活。物理学使得真实的生活如此忙碌和动态。物理学是物质在空间中运动的方式。既然一个电脑游戏世界没有物质,它也就没有物理学规律,使用游戏程序员不得不 _模拟_ 物理学。 -In terms of most video games, there are basically only two aspects of physics that are important: gravity and collision. +从大多数电脑游戏来说,这里基本上仅有物理学的两个方向是重要的:引力和碰撞。 -You implemented some collision detection when you [added an enemy][2] to your game, but this article adds more because gravity requires collision detection. Think about why gravity might involve collisions. If you can't think of any reasons, don't worry—it'll become apparent as you work through the sample code. +当你[添加一个敌人][2]到你的游戏中时,你实现了一下碰撞检测,但是这篇文章添加更多的东西,因为引力需要碰撞检测。想想为什么引力可能涉及碰撞。如果你不能想到任何原因,不要担心—当你通过示例代码工作时,它将变得明显。 -Gravity in the real world is the tendency for objects with mass to be drawn toward one another. The larger the object, the more gravitational influence it exerts. In video game physics, you don't have to create objects with mass great enough to justify a gravitational pull; you can just program a tendency for objects to fall toward the presumed largest object in the video game world: the world itself. +引力在真实世界中的是有质量的物体来相互吸引的趋势。物体(质量)越大,它施加越大的引力作用。在电脑游戏物理学中,你不必创建质量足够大的物体来证明引力的正确;你可以在电脑游戏世界本身中仅编程一个物体落向假设的最大的对象的倾向。 -### Adding a gravity function +### 添加一个引力函数 -Remember that your player already has a property to determine motion. Use this property to pull the player sprite toward the bottom of the screen. +记住你的玩家已经有一个属性来决定动作。使用这个属性来将玩家精灵拉向屏幕底部。 -In Pygame, higher numbers are closer to the bottom edge of the screen. +在 Pygame 中,较高的数字更接近屏幕的底部边缘。 -In the real world, gravity affects everything. In platformers, however, gravity is selective—if you add gravity to your entire game world, all of your platforms would fall to the ground. Instead, you add gravity just to your player and enemy sprites. +在真实的世界中,引力影响一切。然而,在平台中,引力是有选择性的—如果你添加引力到你的整个游戏世界,你所有平台都将掉到地上。作为替换,你仅添加引力到你的玩家和敌人精灵中。 -First, add a **gravity** function in your **Player** class: +首先,在你的 **Player** 类中添加一个 **引力** 函数: ``` @@ -37,11 +36,11 @@ First, add a **gravity** function in your **Player** class:         self.movey += 3.2 # how fast player falls ``` -This is a simple function. First, you set your player in vertical motion, whether your player wants to be in motion or not. In other words, you have programmed your player to always be falling. That's basically gravity. +这是一个简单的函数。首先,不管你的玩家是否想运动,你设置你的玩家垂直运动。也就是说,你已经编程你的玩家总是在下降。这基本上就是引力。 -For the gravity function to have an effect, you must call it in your main loop. This way, Python applies the falling motion to your player once every clock tick. +为使引力函数生效,你必需在你的主循环中调用它。这样,当每一个时钟滴答作响时,Python 应用下落运动到你玩家。 -In this code, add the first line to your loop: +在这代码中,添加第一行到你的循环中: ``` @@ -49,49 +48,50 @@ In this code, add the first line to your loop:     player.update() ``` -Launch your game to see what happens. Look sharp, because it happens fast: your player falls out of the sky, right off your game screen. +启动你的游戏来看看会发生什么。注意,因为它快速地发生:你是玩家从天空上下落,恰好从你的游戏屏幕落下。 -Your gravity simulation is working, but maybe too well. +你的引力模拟是工作的,但是,也许太好了。 -As an experiment, try changing the rate at which your player falls. +作为一次试验,尝试更改你玩家下落的速度。 -### Adding a floor to gravity +### 添加一个地板到引力 -The problem with your character falling off the world is that there's no way for your game to detect it. In some games, if a player falls off the world, the sprite is deleted and respawned somewhere new. In other games, the player loses points or a life. Whatever you want to happen when a player falls off the world, you have to be able to detect when the player disappears offscreen. +你的游戏没有办法发现你的角色掉落出世界的问题。在一些游戏中,如果一个玩家掉落出世界,该精灵被删除,并在新的位置重生。在其它的游戏中,玩家丢失分数或一条生命。当一个玩家掉落出世界时,不管你想发生什么,你必需能够侦测出玩家何时消失在屏幕外。 -In Python, to check for a condition, you can use an **if** statement. +在 Python 中,要检查一个条件,你可以使用一个 **if** 语句。 -You must check to see **if** your player is falling and how far your player has fallen. If your player falls so far that it reaches the bottom of the screen, then you can do _something_. To keep things simple, set the position of the player sprite to 20 pixels above the bottom edge. +你必需查看你玩家**是否**正在掉落,以及你的玩家掉落到什么程度。如果你的玩家掉落到屏幕的底部,那么你可以做 _一些事情_ 。 为保持事情简单,设置玩家精灵的位置为底部边缘上方20像素。 -Make your **gravity** function look like this: +使你的 **引力** 函数看起来像这样: ```     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty ``` -Then launch your game. Your sprite still falls, but it stops at the bottom of the screen. You may not be able to _see_ your sprite behind the ground layer, though. An easy fix is to make your player sprite bounce higher by adding another **-ty** to its new Y position after it hits the bottom of the game world: +然后,启动你的游戏。你的精灵仍然下落,但是它停在屏幕的底部。不过,你也许不能 _看到_ 你在地面层下的精灵。一个简单的解决方法是,在精灵碰撞游戏世界的底部后,通过添加另一个 **-ty** 到它的新 Y 位置,从而使你的精灵弹跳更高: ```     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty-ty ``` -Now your player bounces at the bottom of the screen, just behind your ground sprites. +现在你的玩家在屏幕底部弹跳,恰好在你地面层精灵的后面。 -What your player really needs is a way to fight gravity. The problem with gravity is, you can't fight it unless you have something to push off of. So, in the next article, you'll add ground and platform collision and the ability to jump. In the meantime, try applying gravity to the enemy sprite. +你的玩家真正需要的是反抗引力的方法。引力问题是,你不能反抗它,除非你有一些东西来推开引力作用。因此,在接下来的文章中,你将添加地面和平台碰撞以及跳跃能力。在这期间,尝试应用引力到敌人精灵。 -Here's all the code so far: + +到目前为止,这里是全部的代码: ``` @@ -150,7 +150,7 @@ class Player(pygame.sprite.Sprite):     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty-ty         @@ -170,16 +170,16 @@ class Player(pygame.sprite.Sprite):         self.rect.y = self.rect.y + self.movey         # moving left -        if self.movex < 0: +        if self.movex < 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani]         # moving right -        if self.movex > 0: +        if self.movex > 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] @@ -215,9 +215,9 @@ class Enemy(pygame.sprite.Sprite):         distance = 80         speed = 8 -        if self.counter >= 0 and self.counter <= distance: +        if self.counter >= 0 and self.counter <= distance:             self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: +        elif self.counter >= distance and self.counter <= distance*2:             self.rect.x -= speed         else:             self.counter = 0 @@ -243,7 +243,7 @@ class Level():         ground_list = pygame.sprite.Group()         i=0         if lvl == 1: -            while i < len(gloc): +            while i < len(gloc):                 ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png')                 ground_list.add(ground)                 i=i+1 @@ -262,9 +262,9 @@ class Level():             ploc.append((300,worldy-ty-256,3))             ploc.append((500,worldy-ty-128,4)) -            while i < len(ploc): +            while i < len(ploc):                 j=0 -                while j <= ploc[i][2]: +                while j <= ploc[i][2]:                     plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png')                     plat_list.add(plat)                     j=j+1 @@ -311,7 +311,7 @@ tx = 64 #tile size ty = 64 #tile size i=0 -while i <= (worldx/tx)+tx: +while i <= (worldx/tx)+tx:     gloc.append(i*tx)     i=i+1 @@ -366,13 +366,14 @@ while main == True: * * * -This is part 6 in an ongoing series about creating video games in [Python 3][3] using the [Pygame][4] module. Previous articles are: +这是仍在进行中的关于使用 [Pygame][4] 模块来在 [Python 3][3] 在创建电脑游戏的第七部分。先前的文章是: - * [Learn how to program in Python by building a simple dice game][5] - * [Build a game framework with Python using the Pygame module][6] - * [How to add a player to your Python game][7] - * [Using Pygame to move your game character around][8] - * [What's a hero without a villain? How to add one to your Python game][2] + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][5] + * [使用 Python 和 Pygame 模块构建一个游戏框架][6] + * [如何在你的 Python 游戏中添加一个玩家][7] + * [用 Pygame 使你的游戏角色移动起来][8] + * [如何向你的 Python 游戏中添加一个敌人][2] + * [在 Pygame 游戏中放置平台][9] @@ -382,7 +383,7 @@ via: https://opensource.com/article/19/11/simulate-gravity-python 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[robsean](https://github.com/robsean) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -397,3 +398,4 @@ via: https://opensource.com/article/19/11/simulate-gravity-python [6]: https://opensource.com/article/17/12/game-framework-python [7]: https://opensource.com/article/17/12/game-python-add-a-player [8]: https://opensource.com/article/17/12/game-python-moving-player +[9]: https://opensource.com/article/18/7/put-platforms-python-game From 98e4b4bedc17c4c9995afc79595c695b5aa29608 Mon Sep 17 00:00:00 2001 From: cycoe Date: Fri, 10 Jan 2020 10:29:46 +0800 Subject: [PATCH 0182/3057] Translating by cycoe --- .../tech/20191205 Add jumping to your Python platformer game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191205 Add jumping to your Python platformer game.md b/sources/tech/20191205 Add jumping to your Python platformer game.md index 9d64001082..5c4ec0507e 100644 --- a/sources/tech/20191205 Add jumping to your Python platformer game.md +++ b/sources/tech/20191205 Add jumping to your Python platformer game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (cycoe) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2bc8a25f50d20410b4d452514ceec332b4e55f58 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 10 Jan 2020 10:36:40 +0800 Subject: [PATCH 0183/3057] PRF @geekpi --- ...et- Screen Recorder. Here-s How to Use it.md | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md index 84d72051eb..f8d1db0dd7 100644 --- a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md +++ b/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) [#]: via: (https://itsfoss.com/gnome-screen-recorder/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -GNOME 有一个“秘密”的屏幕录像机。下面是使用方法! +GNOME 有一个“隐藏”的屏幕录像机 ====== -[GNOME][1]是[最受欢迎的桌面环境][2]之一。它有现代的 UI,并且带有许多特定于 GNOME 的应用,这些应用与桌面整体外观完美融合。 +[GNOME][1] 是[最受欢迎的桌面环境][2]之一。它有现代的 UI,并且带有许多特定于 GNOME 的应用,这些应用与桌面整体外观完美融合。 你可以根据自己的喜好来[调整 GNOME][3],但我不在这里讨论。GNOME 桌面有一些你可能不知道的隐藏功能。 -这种不太明显的功能之一是内置的屏幕录像机。 +这种不太显眼的功能之一是内置的屏幕录像机。 是的,你没有看错。如果你使用的是 GNOME 桌面,那么不必安装其他的 [Linux 屏幕录像机][4]。你只需要知道正确的快捷键即可。 @@ -40,9 +40,9 @@ Ctrl + Alt + Shift + R gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300 ``` -在上面的命令中,我将录音的最大长度增加到 300 秒(即5分钟)。你可以将其更改为任何其他值,但应以秒为单位。 +在上面的命令中,我将录音的最大长度增加到 300 秒(即 5 分钟)。你可以将其更改为任何其它值,但应以秒为单位。 -如果你**不希望最长录音时间有任何限制,请将其设置为0**,之后它会在你手动停止或者磁盘空间不足才会停止。 +如果你**不希望最长录音时间有任何限制,请将其设置为 `0`**,之后它会在你手动停止或者磁盘空间不足才会停止。 #### 停止屏幕录制 @@ -54,29 +54,24 @@ gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length Ctrl + Alt + Shift + R ``` -你的录制内容将以 [webm][7 ]格式保存在家目录的 “Videos” 文件夹中。 +你的录制内容将以 [webm][7] 格式保存在家目录的 `Videos` 文件夹中。 #### 局限性 尽管使用这个小工具可以方便地快速录制桌面,但是与功能强大的 [Simple Screen Recorder][8] 这样的屏幕录制工具相比,它有一些局限性。 +* 录制开始之前没有时间延迟选项 +* 没有暂停和播放选项 +* 它录制整个屏幕。无法仅录制应用窗口、特定区域或特定屏幕(如果你有多个屏幕)。 +* 视频以 webm 格式保存在用户的 `Videos` 目录中。你无法更改。你必须使用 [HandBrake 之类的工具将视频转换为其他格式][9]。 - * 录制开始之前没有时间延迟选项 -  * 没有暂停和播放选项 -  * 它录制整个屏幕。无法仅录制应用窗口、特定区域或特定屏幕(如果你有多个屏幕)。 -  * 视频以 webm 格式保存在用户的 “Videos” 目录中。你无法更改。你必须使用 [HandBrake 之类的工具将视频转换为其他格式][9]。 - - - -如你所见,秘密的 GNOME 屏幕录像机与 [Kazam][10] 之类的工具或其他此类工具所提供的功能相差很远。 - -但是,它并不会尝试成为全功能的屏幕录像机。它只是为你提供录制屏幕的快速方法。 +如你所见,这个秘密的 GNOME 屏幕录像机与 [Kazam][10] 之类的工具或其他此类工具所提供的功能相差很远。但是,它并不会尝试成为全功能的屏幕录像机。它只是为你提供录制屏幕的快速方法。 GNOME 是一个多功能的现代桌面环境。你可以大量地[调整 GNOME][3]。[GNOME 扩展][11]为桌面自定义提供了另一个维度。 该屏幕录像机是 GNOME 的隐藏功能之一,就像你自己很难轻易找到的挂起选项。 -_你喜欢它吗?你是否还想与我们分享其他隐藏的 GNOME 功能?请在评论区留言。_ +你喜欢它吗?你是否还想与我们分享其他隐藏的 GNOME 功能?请在评论区留言。 -------------------------------------------------------------------------------- @@ -85,7 +80,7 @@ via: https://itsfoss.com/gnome-screen-recorder/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6924452c356a4ea7ded256846182ec79f2d1e709 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 10 Jan 2020 10:37:32 +0800 Subject: [PATCH 0184/3057] PUB @geekpi https://linux.cn/article-11766-1.html --- ...ME has a ‘Secret- Screen Recorder. Here-s How to Use it.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md (98%) diff --git a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md similarity index 98% rename from translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md rename to published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md index f8d1db0dd7..87e445c9b0 100644 --- a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md +++ b/published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11766-1.html) [#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) [#]: via: (https://itsfoss.com/gnome-screen-recorder/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 480defaa87da0c8e6d029aa4a573dc35c74ddf06 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 10 Jan 2020 10:42:14 +0800 Subject: [PATCH 0185/3057] =?UTF-8?q?Rename=2020200103=20GNOME=20has=20a?= =?UTF-8?q?=20=E2=80=98Secret-=20Screen=20Recorder.=20Here-s=20How=20to=20?= =?UTF-8?q?Use=20it.md=20to=2020200103=20GNOME=20has=20a=20Secret-=20Scree?= =?UTF-8?q?n=20Recorder.=20Here-s=20How=20to=20Use=20it.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...03 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename published/{20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md => 20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md} (100%) diff --git a/published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/published/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md similarity index 100% rename from published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md rename to published/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md From 0778586a45ccd97d95ea036c047d5945a1235c21 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 10 Jan 2020 11:16:17 +0800 Subject: [PATCH 0186/3057] Revert "Fiveweb done" --- ...181105 5 Minimal Web Browsers for Linux.md | 171 ++++++++++++++++++ ...181105 5 Minimal Web Browsers for Linux.md | 167 ----------------- 2 files changed, 171 insertions(+), 167 deletions(-) create mode 100644 sources/tech/20181105 5 Minimal Web Browsers for Linux.md delete mode 100644 translated/tech/20181105 5 Minimal Web Browsers for Linux.md diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md new file mode 100644 index 0000000000..34c0c1e18e --- /dev/null +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (MonkeyDEcho ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (5 Minimal Web Browsers for Linux) +[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) +[#]: url: ( ) + +5 Minimal Web Browsers for Linux +====== +linux上的五种微型浏览器 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) + +There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. +有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 + +The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. +web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 + +There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. +但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 + +Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. +让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! + +### GNOME Web + +GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. +GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 + +Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: + + * Simplicity - Feature bloat and user interface clutter are considered evil. + + * Standards compliance - No non-standard features will ever be introduced to the codebase. + + * Software freedom - Epiphany will always be released under a license that respects freedom. + + * Human interface - Epiphany follows the [GNOME Human Interface Guidelines][6]. + + * Minimal preferences - Preferences are only added when they make sense and after careful consideration. + + * Target audience - Non-technical users are the primary target audience (which helps to define the types of features that are included). + + + + +GNOME Web is as clean and simple a web browser as you’ll find (Figure 1). + +![GNOME Web][8] + +Figure 1: The GNOME Web browser displaying a minimal amount of preferences for the user. + +[Used with permission][9] + +The GNOME Web manifesto reads: + +A web browser is more than an application: it is a way of thinking, a way of seeing the world. Epiphany's principles are simplicity, standards compliance, and software freedom. + +### Netsurf + +The [Netsurf][10] minimal web browser opens almost faster than you can release the mouse button. Netsurf uses its own layout and rendering engine (designed completely from scratch), which is rather hit and miss in its rendering (Figure 2). + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) + +Although you might find Netsurf to suffer from rendering issues on certain sites, understand the Hubbub HTML parser is following the work-in-progress HTML5 specification, so there will be issues popup now and then. To ease those rendering headaches, Netsurf does include HTTPS support, web page thumbnailing, URL completion, scale view, bookmarks, full-screen mode, keyboard shorts, and no particular GUI toolkit requirements. That last bit is important, especially when you switch from one desktop to another. + +For those curious as to the requirements for Netsurf, the browser can run on a machine as slow as a 30Mhz ARM 6 computer with 16MB of RAM. That’s impressive, by today’s standard. + +### QupZilla + +If you’re looking for a minimal browser that uses the Qt Framework and the QtWebKit rendering engine, [QupZilla][11] might be exactly what you’re looking for. QupZilla does include all the standard features and functions you’d expect from a web browser, such as bookmarks, history, sidebar, tabs, RSS feeds, ad blocking, flash blocking, and CA Certificates management. Even with those features, QupZilla still manages to remain a very fast lightweight web browser. Other features include: Fast startup, speed dial homepage, built-in screenshot tool, browser themes, and more. +One feature that should appeal to average users is that QupZilla has a more standard preferences tools than found in many lightweight browsers (Figure 3). So, if going too far outside the lines isn’t your style, but you still want something lighter weight, QupZilla is the browser for you. + +![QupZilla][13] + +Figure 3: The QupZilla preferences tool. + +[Used with permission][9] + +### Otter Browser + +Otter Browser is a free, open source attempt to recreate the closed-source offerings found in the Opera Browser. Otter Browser uses the WebKit rendering engine and has an interface that should be immediately familiar with any user. Although lightweight, Otter Browser does include full-blown features such as: + + * Passwords manager + + * Add-on manager + + * Content blocking + + * Spell checking + + * Customizable GUI + + * URL completion + + * Speed dial (Figure 4) + + * Bookmarks and various related features + + * Mouse gestures + + * User style sheets + + * Built-in Note tool + + +![Otter][15] + +Figure 4: The Otter Browser Speed Dial tab. + +[Used with permission][9] + +Otter Browser can be run on nearly any Linux distribution from an [AppImage][16], so there’s no installation required. Just download the AppImage file, give the file executable permissions (with the command chmod u+x otter-browser-*.AppImage), and then launch the app with the command ./otter-browser*.AppImage. + +Otter Browser does an outstanding job of rendering websites and could function as your go-to minimal browser with ease. + +### Lynx + +Let’s get really minimal. When I first started using Linux, back in ‘97, one of the web browsers I often turned to was a text-only take on the app called [Lynx][17]. It should come as no surprise that Lynx is still around and available for installation from the standard repositories. As you might expect, Lynx works from the terminal window and doesn’t display pretty pictures or render much in the way of advanced features (Figure 5). In fact, Lynx is as bare-bones a browser as you will find available. Because of how bare-bones this web browser is, it’s not recommended for everyone. But if you happen to have a gui-less web server and you have a need to be able to read the occasional website, Lynx can be a real lifesaver. + +![Lynx][19] + +Figure 5: The Lynx browser rendering the Linux.com page. + +[Used with permission][9] + +I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). + +### Plenty More Where This Came From + +There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not. + +Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.mozilla.org/en-US/firefox/new/ +[2]: https://www.chromium.org/ +[3]: https://vivaldi.com/ +[4]: https://www.google.com/chrome/ +[5]: https://www.merriam-webster.com/dictionary/epiphany +[6]: https://developer.gnome.org/hig/stable/ +[7]: /files/images/minimalbrowsers1jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) +[9]: /licenses/category/used-permission +[10]: https://www.netsurf-browser.org/ +[11]: https://qupzilla.com/ +[12]: /files/images/minimalbrowsers3jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) +[14]: /files/images/minimalbrowsers4jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) +[16]: https://sourceforge.net/projects/otter-browser/files/ +[17]: https://lynx.browser.org/ +[18]: /files/images/minimalbrowsers5jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) +[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20181105 5 Minimal Web Browsers for Linux.md b/translated/tech/20181105 5 Minimal Web Browsers for Linux.md deleted file mode 100644 index 1a533e6557..0000000000 --- a/translated/tech/20181105 5 Minimal Web Browsers for Linux.md +++ /dev/null @@ -1,167 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MonkeyDEcho ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (5 Minimal Web Browsers for Linux) -[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -[#]: url: ( ) - - -linux上的五种微型浏览器 -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) - -有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 - -web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 - -但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 - -让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! - -### GNOME Web - -GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 - -Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: - - * 简单性 - 功能复杂和用户界面混乱都是不被允许的. - - * 规范性 - 任何非标准特性都不会引入到代码库中。 - - * 软件开源 - Epiphany始终遵守自由开源许可证。 - - * 人机交互 - Epiphany 始终遵守[GNOME的人机交互指南][6]。 - - * 最小首选项 - 经过慎重考虑才添加首选项。 - - * 受众群体 - 非技术用户是主要的受众目标,(有助于定义所包含功能的类型)。 - - - - -GNOME web浏览器就像看到的一样干净简洁 (Figure 1)。 - - -![GNOME Web][8] - -Figure 1: GNOME 浏览器为用户展示最少的首选项. - -[许可证书][9] - -GNOME Web 的声明如下: - -web 浏览器它不仅仅是一个应用程序,还是一种思维方式,一种看世界的方式。 Epiphany 的原则是简洁,标准和自由。 -### Netsurf - -[Netsurf][10] 浏览器是最小的浏览器,他的打开速度几乎和你松开鼠标一样。Netsurf 使用自己的布局和渲染引擎(完全从零开始设计的) 在渲染过程的设计中屡屡碰壁(Figure 2). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) - -尽管你可能在特定的站点上发现 Netsurf的问题,但如果你了解Hubbub解析器的话,知道它正在兼容html5规范,是不是的会有一点问题。Netsurf对https的支持,网页缩略图,URL解析,缩放视图,书签,全屏模式,快捷键和GUI的工具包的功能;最后一点十分重要,当你桌面来回切换时,为了缓解渲染带来的问题。 - -对于那些对Netsurf 存在好奇的人来说,以现在的标准,他能在 16MB内存,30Mhz的ARM cpu的机器上运行,是让人惊奇的。 - -### QupZilla - -如果你找寻使用Qt Framework 和 the QtWebKit 渲染引擎的最小浏览器,QupZilla][11]是你最佳的选择。QupZilla 包含web浏览所有的标准功能,例如:书签,历史记录,侧边栏,选项卡,RSS,广告屏蔽,flash屏蔽,和CA证书管理。及时拥有这么多的功能,QupZilla 仍然是快速,轻量级的浏览器。另外还有其他的功能:快速启动,快速拨号主页,内置屏幕截图工具,浏览器主题等。 -吸引用户的一点是,与许多轻量级浏览器相比,QupZilla有更标准的首选项工具(图3)。所以,如果你很多功能,但你仍然想要更轻量,那么QupZilla就是你最好的选择。 - -![QupZilla][13] - -Figure 3: QupZilla 首选项工具. - -[许可证书][9] - -### Otter Browser - -Otter 浏览器是一种免费开源的,旨在重建Opera 12.x的浏览器。它使用WebKit渲染引擎,并且有用户的熟悉界面。虽然它轻量,但它有丰富的功能: - - * 密码管理 - - * 插件管理 - - * 内容拦截 - - * 拼写检查 - - * 自定义界面 - - * 网址补全 - - * 快速访问 (Figure 4) - - * 书签和其他相关功能 - - * 鼠标手势 - - * 用户样式表 - - * 内建笔记功能 - - -![Otter][15] - -Figure 4: Otter 浏览器快起标签项. - -[许可证书][9] - -Otter浏览器可以在几乎所有Linux发行版上运行通过[AppImage][16]软件格式,因此无需安装。只需下载AppImage文件,授予文件可执行权限(使用命令 `chmod u+x otter-browser-.AppImage`),然后使用命令`./otter-browser.AppImage` 启动应用程序。 - -Otter浏览器在网站展示方面做得非常出色,可以轻松地用作你的微型浏览器。 - - -### Lynx - -让我们见识真正的微型浏览器。早在97年,当我使用Linux时,就经常使用的[Lynx][17]纯文本模式的网页浏览器。 -Lynx的存在并且可以从标准存储库中进行安装。正如您可能期望的那样,Lynx在终端窗口中工作,并且不会显示漂亮的图片和高级功能的渲染方式(图5)。事实上,Lynx是你能找到的最简单的浏览器。由于这个网页浏览器是如此简陋,所以不建议每个人都使用它。但如果你碰巧有一个没有界面的服务器,你需要能够偶尔访问的网站,Lynx是一个真正的救星。 - -![Lynx][19] - -Figure 5: Lynx 浏览器展示 Linux.com 网址界面. - -[许可证书][9] - -我还发现Lynx是一个非常有用的工具,它可以帮助我解决网站某些方面的故障(或者如果网站上的某些功能阻止我在常规浏览器中查看内容)。使用Lynx的另一个重要原因是它可以让我们更加专注内容(而不是其他无关的元素)。 - -### Plenty More Where This Came From 更多 - -微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 - -了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[MonkeyDEcho](https://github.com/MonkeyDEcho) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.mozilla.org/en-US/firefox/new/ -[2]: https://www.chromium.org/ -[3]: https://vivaldi.com/ -[4]: https://www.google.com/chrome/ -[5]: https://www.merriam-webster.com/dictionary/epiphany -[6]: https://developer.gnome.org/hig/stable/ -[7]: /files/images/minimalbrowsers1jpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) -[9]: /licenses/category/used-permission -[10]: https://www.netsurf-browser.org/ -[11]: https://qupzilla.com/ -[12]: /files/images/minimalbrowsers3jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) -[14]: /files/images/minimalbrowsers4jpg -[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) -[16]: https://sourceforge.net/projects/otter-browser/files/ -[17]: https://lynx.browser.org/ -[18]: /files/images/minimalbrowsers5jpg -[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) -[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From bfdde198d60206c3f109adfdcaf35d04f6bf0adb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 10 Jan 2020 11:39:24 +0800 Subject: [PATCH 0187/3057] PRF&PUB @wxy https://linux.cn/article-11768-1.html --- .../20190405 File sharing with Git.md | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) rename {translated/tech => published}/20190405 File sharing with Git.md (66%) diff --git a/translated/tech/20190405 File sharing with Git.md b/published/20190405 File sharing with Git.md similarity index 66% rename from translated/tech/20190405 File sharing with Git.md rename to published/20190405 File sharing with Git.md index a1ad1bc228..57d89c14c8 100644 --- a/translated/tech/20190405 File sharing with Git.md +++ b/published/20190405 File sharing with Git.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11768-1.html) [#]: subject: (File sharing with Git) [#]: via: (https://opensource.com/article/19/4/file-sharing-git) [#]: author: (Seth Kenlon) -用 Git 共享文件 +用 Git 来共享文件 ====== -> SparkleShare 是一个开源的基于 Git、Dropbox 风格的文件共享应用程序。在我们的系列文章中了解有关 Git 鲜为人知的用法。 +> SparkleShare 是一个开源的基于 Git 的 Dropbox 风格的文件共享应用程序。在我们的系列文章中了解有关 Git 鲜为人知的用法。 -![][1] +![](https://img.linux.net.cn/data/attachment/album/202001/10/113645qb2ufvuu2ttimugv.png) [Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 @@ -22,13 +22,13 @@ Git 的优点之一是它具有固有的分发能力。它可用来建立共享。即使你只是与自己网络上的其他计算机共享资源库,Git 也会为从共享位置获取文件的行为带来透明性。 -随着其界面的发展,Git 变得非常简单。虽然因用户而异,他们坐下来完成一些工作时的共同点仅仅是 `git pull` 或稍微复杂一点的 `git pull && git checkout -b my-branch`。但是,对于某些人来说,将*命令输入*到他们的计算机中的做法完全是令人困惑或烦恼的。计算机旨在使生活变得轻松,计算机擅长重复性工作,因此有更简便的方法可以与 Git 共享文件。 +随着其界面的发展,Git 变得非常简单。虽然因用户而异,他们坐下来完成一些工作时的共同点仅仅是 `git pull` 或稍微复杂一点的 `git pull && git checkout -b my-branch`。但是,对于某些人来说,将*命令输入*到他们的计算机中的做法完全是令人困惑或烦恼的。计算机旨在使生活变得轻松,它擅长于重复性工作,因此有更简便的方法可以与 Git 共享文件。 ### SparkleShare -[SparkleShare][3] 项目是一个基于 Git 的跨平台的开源的 Dropbox 式的文件共享应用程序。它通过将文件拖放到专门指定的 SparkleShare 目录中的简单操作,自动执行所有 Git 命令,触发添加、提交、推送和拉取过程。因为它基于 Git,所以你可以获得基于差异(diff)的快速推送和拉取,并且继承了 Git 版本控制和后端基础设施(如 Git 挂钩)的所有优点。它可以完全自托管,也可以将其与 [GitLab][4]、GitHub、Bitbucket 等 Git 托管服务一起使用。此外,由于它基本上只是一个 Git 的前端,因此你可以在可能没有 SparkleShare 客户端但有 Git 客户端的设备上访问 SparkleShare 中的文件。 +[SparkleShare][3] 项目是一个基于 Git 的跨平台的、开源的 Dropbox 式的文件共享应用程序。它通过将文件拖放到专门指定的 SparkleShare 目录中的简单操作,自动执行所有 Git 命令,触发添加、提交、推送和拉取过程。因为它基于 Git,所以你可以获得基于差异(diff)的快速推送和拉取,并且继承了 Git 版本控制和后端基础设施(如 Git 挂钩)的所有优点。它可以完全自托管,也可以将其与 [GitLab][4]、GitHub、Bitbucket 等 Git 托管服务一起使用。此外,由于它基本上只是一个 Git 的前端,因此你可以在可能没有 SparkleShare 客户端但有 Git 客户端的设备上访问 SparkleShare 中的文件。 -正如你获得 Git 的所有好处一样,你也会受到所有常见的 Git 限制:使用 SparkleShare 存储数百张照片、音乐和视频是不切实际的,因为 Git 是为文本而设计和优化的。Git 当然可以存储二进制文件的大文件,但是因为它可以跟踪历史记录,因此一旦将文件添加到其中,几乎就不可能完全删除它。这在某种程度上限制了 SparkleShare 对某些人的实用性,但使其非常适合许多工作流程,包括 [日程安排][5]。 +正如你获得 Git 的所有好处一样,你也会受到所有常见的 Git 限制:使用 SparkleShare 存储数百张照片、音乐和视频是不切实际的,因为 Git 是为文本而设计和优化的。Git 当然可以存储二进制文件的大文件,但是因为它可以跟踪历史记录,因此一旦将文件添加到其中,几乎就不可能完全删除它。这在某种程度上限制了 SparkleShare 对某些人的实用性,但使其非常适合许多工作流程,包括[日程安排][5]。 #### 安装 SparkleShare @@ -41,17 +41,17 @@ $ sudo flatpak install flathub org.sparkleshare.SparkleShare ### 创建一个 Git 存储库 -SparkleShare 并不是软件即服务(SaaS)。你在计算机上运行 SparkleShare 以与 Git 存储库进行通信,而 SparkleShare 并不存储你的数据。如果你还没有与文件夹同步的 Git 存储库,则必须在启动 SparkleShare 之前创建一个文件夹。你有三个选择:托管的 Git、自托管 Git 或自托管 SparkleShare。 +SparkleShare 并不是软件即服务(SaaS)。你在计算机上运行 SparkleShare 与 Git 存储库进行通信,而 SparkleShare 并不存储你的数据。如果你还没有与文件夹同步的 Git 存储库,则必须在启动 SparkleShare 之前创建一个文件夹。你有三个选择:托管的 Git、自托管 Git 或自托管 SparkleShare。 -#### 托管的 Git +#### 托管的 Git -SparkleShare 可以使用你可以访问的任何 Git 存储库进行存储,因此,如果你拥有(或可在其中创建的)GitLab 或任何其他托管服务的帐户,则它可以成为 SparkleShare 的后端。例如,开源 [Notabug.org][8] 服务是一个类似于 GitHub 和 GitLab 的 Git 托管服务,但其独特性足以证明 SparkleShare 的灵活性。根据用户界面的不同,不同的托管服务创建新存储库的方法也有所不同,但是所有主要存储库都遵循相同的通用模型。 +SparkleShare 可以使用你能访问的任何 Git 存储库进行存储,因此,如果你拥有 GitLab 或任何其他托管服务的帐户(或创建一个),则它可以成为 SparkleShare 的后端。例如,开源 [Notabug.org][8] 服务是一个类似于 GitHub 和 GitLab 的 Git 托管服务,但其独特性足以证明 SparkleShare 的灵活性。根据用户界面的不同,不同的托管服务创建新存储库的方法也有所不同,但是所有主要存储库都遵循相同的通用模型。 -首先,在托管服务中找到创建一个新项目或存储库的按钮,单击它以开始。然后逐步完成存储库的创建过程,为存储库提供名称、隐私级别(存储库通常默认为公共),以及是否使用 `README` 文件初始化存储库。无论你是否需要个 `README` 文件,请初始化建立一个。使用一个文件创立存储库不是绝对必要的,但是它会强制 Git 主机实例化存储库中的 `master` 分支,这有助于确保前端应用程序(例如 SparkleShare)具有要提交并推送的分支。即使文件几乎是空的 `README` 文件,也可以用来查看该文件以确认你已连接成功。 +首先,在托管服务中找到创建新项目或存储库的按钮,单击它以开始。然后逐步完成存储库的创建过程,为存储库提供名称、隐私级别(存储库通常默认为公共),以及是否使用 `README` 文件初始化存储库。无论你是否需要个 `README` 文件,请初始化建立一个。使用一个文件来创建存储库不是绝对必要的,但是它会强制 Git 主机实例化存储库中的 `master` 分支,这有助于确保前端应用程序(例如 SparkleShare)具有要提交并推送的分支。即使文件是几乎空的 `README` 文件,也可以用来查看该文件以确认你已连接成功。 ![Creating a Git repository][9] -创建存储库后,获取其用于 SSH 克隆的 URL。你可以像获取任何人从 Git 项目获得其 URL 一样获得此 URL:导航至存储库页面并查找 “Clone” 按钮或字段。 +创建存储库后,获取其用于 SSH 克隆的 URL。就像从 Git 项目获得其 URL 一样,你也可以获取此 URL:导航至存储库页面并查找 “Clone” 按钮或字段。 ![Cloning a URL on GitHub][10] @@ -63,7 +63,6 @@ SparkleShare 可以使用你可以访问的任何 Git 存储库进行存储, 这是 SparkleShare 用于获取数据的地址,因此请记下它。你的 Git 存储库现已配置好。 - #### 自托管的 Git 你可以使用 SparkleShare 访问你有权访问的任何计算机上的 Git 存储库。除了一个 Git 裸存储库外,无需任何特殊设置。但是,如果你想将对 Git 存储库的访问权授予其他任何人,则应运行 [Gitolite][12] 之类的 Git 管理器或 SparkleShare 自己的 Dazzle 服务器来帮助你管理 SSH 密钥和帐户。至少,创建一个特定于 Git 的用户,以便有权访问你的 Git 存储库的用户不会自动获得对服务器其余部分的访问权限。 @@ -99,21 +98,21 @@ $ dazzle create sparkly ### 配置 SparkleShare -首次启动 SparkleShare 时,系统会提示你配置要让 SparkleShare 用于存储的服务器。这个过程可能看起来像一个首次运行的安装向导,但实际上是在 SparkleShare 中设置新共享位置的通常过程。与许多共享驱动器应用程序不同,使用 SparkleShare 可以一次配置多个位置。你配置的第一个共享位置并不比你以后可以设置的任何共享位置重要,并且你也没有注册 SparkleShare 或任何其他服务。你只是将 SparkleShare 指向 Git 存储库,以便它知道如何使第一个 SparkleShare 文件夹保持同步。 +首次启动 SparkleShare 时,系统会提示你配置 SparkleShare 用于存储的服务器。这个过程可能看起来像一个首次运行的安装向导,但实际上是在 SparkleShare 中设置新共享位置的通常过程。与许多共享驱动器应用程序不同,使用 SparkleShare 可以一次配置多个位置。你配置的第一个共享位置并不比你以后可以配置的任何共享位置更重要,并且你也不用注册 SparkleShare 或任何其他服务。你只是将 SparkleShare 指向 Git 存储库,以便它知道如何使第一个 SparkleShare 文件夹保持同步。 -在第一个屏幕上,给出一个身份,SparkleShare 将在代表你进行的 Git 提交记录中使用这些信息。你可以使用任何内容,甚至可以不代表任何意义的伪造信息。它仅用于提交消息,如果你对审查 Git 后端进程没有兴趣,你可能甚至看不到它们。 +在第一个屏幕上,给出一个身份信息,SparkleShare 将在代表你进行的 Git 提交记录中使用这些信息。你可以使用任何内容,甚至可以使用不代表任何意义的伪造信息。它仅用于提交消息,如果你对审查 Git 后端进程没有兴趣,你可能甚至看不到它们。 下一个屏幕提示你选择主机类型。如果你使用的是 GitLab、GitHub、Planio 或 Bitbucket,则可以选择一个适当的。否则,请选择“自己的服务器”。 ![Choosing a Sparkleshare host][14] -在此屏幕底部,您必须输入 SSH 的克隆 URL。如果你是自托管的 Git,则地址类似于 ``,而远程路径是为此目的而创建的 Git 存储库的绝对路径。 +在此屏幕底部,你必须输入 SSH 的克隆 URL。如果你是自托管的 Git,则地址类似于 ``,而远程路径是为此目的而创建的 Git 存储库的绝对路径。 -根据上面的自托管示例,我虚构的服务器的地址为 `ssh://git@example.com:22122`(`:22122` 表示非标准的 SSH 端口),远程路径为 `/home/git/sparkly.git`。 +根据上面的自托管示例,我虚构的服务器的地址为 `ssh://git@example.com:22122`(`:22122` 表示一个非标准的 SSH 端口),远程路径为 `/home/git/sparkly.git`。 如果我改用 Notabug.org 帐户,则上例中的地址为 `ssh://git@notabug.org`,路径为 `seth/sparkly.git`。 -SparkleShare 首次尝试连接到主机时将失败,因为你尚未将 SparkleShare 客户端 ID(特定于 SparkleShare 应用程序的 SSH 密钥)复制到 Git 主机。这是预料之中的,所以不要取消该过程。将 SparkleShare 设置窗口保持打开状态,并从系统任务栏中的 SparkleShare 图标处获取客户端 ID。然后将客户端 ID 复制到剪贴板,以便可以将其添加到 Git 主机。 +SparkleShare 首次尝试连接到主机时会失败,因为你尚未将 SparkleShare 客户端 ID(特定于 SparkleShare 应用程序的 SSH 密钥)复制到 Git 主机。这是预料之中的,所以不要取消该过程。将 SparkleShare 设置窗口保持打开状态,并从系统任务栏中的 SparkleShare 图标处获取客户端 ID。然后将客户端 ID 复制到剪贴板,以便可以将其添加到 Git 主机。 ![Getting the client ID from Sparkleshare][16] @@ -127,7 +126,7 @@ SparkleShare 首次尝试连接到主机时将失败,因为你尚未将 Sparkl #### 将你的客户端 ID 添加到自托管的 Git 帐户 -SparkleShare 客户端 ID 只是一个 SSH 密钥,因此将其复制并粘贴到 Git 用户的 `~/.ssh/authorized_keys`文件中。 +SparkleShare 客户端 ID 只是一个 SSH 密钥,因此将其复制并粘贴到 Git 用户的 `~/.ssh/authorized_keys` 文件中。 #### 使用 Dazzle 添加你的客户 ID @@ -153,7 +152,7 @@ $ dazzle link #### 排除某些文件 -由于 Git 从设计上就是要记住*一切*,因此你可能希望从记录中排除特定的文件类型。排除一些文件是有原因的。通过定义摆脱 SparkleShare 限制的文件,可以避免意外复制大文件。你还可以为自己设计一种方案,使你可以将存储在一个目录中的逻辑上属于同一文件(例如,MIDI 文件及其 .flac 导出文件),但是可以自己手动备份大文件,而同时让 SparkleShare 备份基于文本的文件。 +由于 Git 从设计上就是要记住*一切*,因此你可能希望从记录中排除特定的文件类型。排除一些文件是有原因的。通过定义摆脱 SparkleShare 管理的文件,可以避免意外复制大文件。你还可以为自己设计一种方案,使你可以将存储在一个目录中的逻辑上属于同一个文件(例如,MIDI 文件及其 .flac 导出文件),但是可以自己手动备份大文件,而同时让 SparkleShare 备份基于文本的文件。 如果在系统的文件管理器中看不到隐藏的文件,请显示它们。导航到你的 SparkleShare 文件夹,然后到代表你的存储库的目录,找到一个名为 `.gitignore` 的文件,然后在文本编辑器中将其打开。你可以在 `.gitignore` 中输入文件扩展名或文件名(每行一个),任何与你列出的文件匹配的文件都会被忽略(如文件名所示)。 @@ -186,13 +185,13 @@ $RECYCLE.BIN/ *.cbz ``` -你知道最经常遇到哪些文件类型,因此请集中精力处理最有可能潜入你的 SparkleShare 目录的文件。如果您想稍微矫枉过正一些,可以在 Notabug.org 以及整个网上找到 `.gitignore` 文件的好集合。 +你知道最经常遇到哪些文件类型,因此请集中精力处理最有可能潜入你的 SparkleShare 目录的文件。如果你想稍微矫枉过正一些,可以在 Notabug.org 以及整个网上找到 `.gitignore` 文件的好集合。 -通过将这些条目保存在 `.gitignore` 文件中,你可以将不需要发送到 Git 主机的大文件放在 SparkleShare 目录中,SparkleShare 将完全忽略它们。当然,这意味着您需要确保它们可以备份或通过其他方式分发给你的 SparkleShare 合作者。 +通过将这些条目保存在 `.gitignore` 文件中,你可以将不需要发送到 Git 主机的大文件放在 SparkleShare 目录中,SparkleShare 将完全忽略它们。当然,这意味着你需要确保它们可以备份或通过其他方式分发给你的 SparkleShare 协作者。 ### 自动化 -[自动化][20] 是我们与计算机达成的默契之一:计算机执行重复的、无聊的工作,而我们人类要么不擅长做这些,要么不擅长记忆这些。SparkleShare 是一种很好的、简单的自动执行例行数据分发的方法。无论如何,这并不适合每个 Git 存储库。它没有用于高级 Git 功能的接口,它没有暂停按钮或手动管理的操作。没关系,因为它的范围是有意限制的。SparkleShare 可以完成 SparkleShare 计划要做的事情,它做得很好,而且它是你无需关心的一个 Git 存储库。 +[自动化][20] 是我们与计算机达成的默契之一:计算机执行重复的、无聊的工作,而我们人类要么不擅长做这些,要么不擅长记忆这些。SparkleShare 是一种很好的、简单的自动执行例行数据分发的方法。但不管怎么说,这并不适合每个 Git 存储库。它没有用于高级 Git 功能的接口,它没有暂停按钮或手动管理的操作。没关系,因为它的使用范围是有意限制的。SparkleShare 可以完成它计划要做的事情,它做得很好,而且它是你无需关心的一个 Git 存储库。 如果你想使用这种稳定的、看不见的自动化,请尝试一下 SparkleShare。 @@ -203,7 +202,7 @@ via: https://opensource.com/article/19/4/file-sharing-git 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0eb14f0a7e4df77df754a01b62fa34094fe0d546 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Fri, 10 Jan 2020 14:35:51 +0800 Subject: [PATCH 0188/3057] Update 20200102 Put some loot in your Python platformer game.md --- .../20200102 Put some loot in your Python platformer game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200102 Put some loot in your Python platformer game.md b/sources/tech/20200102 Put some loot in your Python platformer game.md index 678fb69516..296739c2b9 100644 --- a/sources/tech/20200102 Put some loot in your Python platformer game.md +++ b/sources/tech/20200102 Put some loot in your Python platformer game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -514,7 +514,7 @@ via: https://opensource.com/article/20/1/loot-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9ab354cdb30e23b5a7644e4ddd88ca6f9698716d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 10 Jan 2020 16:16:37 +0800 Subject: [PATCH 0189/3057] Translating --- sources/tech/20200103 Add scorekeeping to your Python game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200103 Add scorekeeping to your Python game.md b/sources/tech/20200103 Add scorekeeping to your Python game.md index d2055cc067..0bcfe955c7 100644 --- a/sources/tech/20200103 Add scorekeeping to your Python game.md +++ b/sources/tech/20200103 Add scorekeeping to your Python game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 740bbe6981c5350dc71e39edf31ea16d005417f5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 10 Jan 2020 22:00:54 +0800 Subject: [PATCH 0190/3057] PRF @robsean --- ...n Source Disk Partitioning Tool GParted.md | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md index 6fa07d80a3..6721773f69 100644 --- a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md +++ b/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -1,94 +1,96 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) [#]: via: (https://itsfoss.com/gparted/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -应用程序推荐:开源磁盘分区工具 GParted +应用推荐:开源磁盘分区工具 GParted ====== -_**摘要:GParted 是一个非常流行的自由的可用于 Linux 发行版的分区编辑器。在这里,我们简单地看看它提供了什么。**_ +![](https://img.linux.net.cn/data/attachment/album/202001/10/220015lp58jjjt22xfppjj.jpg) -### GParted:一个基于自由和开放源码的图形化分区管理器 +> GParted 是一个可用于 Linux 发行版的非常受欢迎且免费的分区编辑器。在这里,我们简要地介绍一下它提供的功能。 + +### GParted:一个自由开源的图形化分区管理器 ![][1] -GParted 无疑是[在 Linux 下的最好的分区管理器][2]之一。用户界面非常简单,可用完成任务。 +GParted 无疑是 [Linux 下的最好的分区管理器][2]之一。用户界面非常简单而可以完成任务。 -在一些情况下,你最终也需要使用 [GParted][3] 来修复或格式化你的 USB 驱动器。我有一个[我不能在 Ubuntu 中格式化的 USB 磁盘][4],使用该“磁盘”应用程序 – 这里是 GParted 用来救援的地方。 +在某些情况下,你最终还是会使用 [GParted][3] 来修复或格式化你的 USB 驱动器。我有一个[在 Ubuntu 中使用“磁盘”应用程序不能格式化的 USB 磁盘][4],而这是 GParted 用来救援的地方。 -所以,它是非常有用的工具,有很多好的特色。让我为你们推荐一下。 +所以,它是一个非常有用的工具,有很多出色的功能。让我为你们重点介绍一下。 -警告! +> 警告! +> +> 进行磁盘分区是一件危险的工作。除非绝对必要,否则不要做。否则,你可能最终擦除了整个磁盘。 -玩弄磁盘分区是一件危险的工作。除非绝对必要,否则不要做。否则,你可能最终会擦除整个磁盘。 +### GParted 的功能 -### GParted 的特色 - -你可以使用 GParted 做很多事,排列一下简单地格式化任务到重要的分区任务。我将使用一些屏幕截图推荐关键特色,以帮助你在安装它前了解更多信息。 +从简单地格式化任务到重要的分区任务,你可以使用 GParted 做很多事。我将使用一些屏幕截图突出关键功能,以帮助你在安装它前进一步了解它。 #### 创建分区表 -你可以为你的新的磁盘创建一个新的分区表,或者擦除你现存的磁盘内容来修改分区表。 +你可以为新磁盘创建一个新的分区表,也可以擦除你现存的磁盘内容来修改分区表。 ![][5] -你将能够选择 msdos ,gpt ,atari ,以及更多类型的分区表。 +你能够选择 msdos、gpt、atari,以及更多类型的分区表。 -#### 创建,移动,标记,删除和修改分区表 +#### 创建、移动、标记、删除和修改分区表 -你可以使用 GParted 中一系列可用的选项来简单地创建,标记,删除或修改分区表。 +你可以使用 GParted 中一系列选项来轻松地创建、标记、删除或修改分区表。 ![][6] -当然,你将不得不小心你想做什么。 +当然,你必须要谨慎你要做的事情。 -好的一些东西是,GParted 确保你不能直接应用任何更改 – 在你点击应用更改之前,它将排队你选择的操作/任务,并询问另外一处最后的确认。 +好的是,GParted 可以确保你不能直接应用任何更改 —— 在你点击应用更改之前,它将排队你选择的操作/任务,并在你执行前最后再要求确认一次。 -在顶部的对号标记符号 ✓ 允许你来确认更改,只有你更改时开始生效。 +顶部的对号标记符号 `✓` 可以让你确认更改,然后你的更改才会生效。 -这样有另一个你可用的分区选项的屏幕截图: +这是分区可用选项的另一个屏幕截图: ![][7] #### 尝试数据救援 -除了编辑分区,你也可以尝试使用“**尝试数据救援**”特色以[在Linux 中恢复你丢失的数据][8],像下面的屏幕截图所示。 +除了编辑分区以外,你也可以试着使用“尝试数据救援”功能以[在 Linux 中恢复丢失的数据][8],如下面的屏幕截图所示。 ![][9] -值得注意的是,默认情况下你没有安装这个功能 – 你仅能看到可见的选项。所以,对于数据恢复特色作业来说,你必需使用下面的命令来单独地安装 gpart (在基于 Ubuntu/Debian 的发行版上): +值得注意的是,默认情况下你没有安装此功能 —— 你只是能看到这个选项。因此,要使这个数据恢复功能可以正常工作,你必须使用下面的命令来单独地安装 gpart (在基于 Ubuntu/Debian 的发行版上): ``` sudo apt install gpart ``` -除了所有关键的特色外,它支持大量的存储设备和文件系统。在它们的官方网站上,你可以从[特色列表][10]中学到很多。 +除了所有这些关键功能以外,它支持各种存储设备和文件系统。你可以从其官方网站的[功能列表][10]中了解到更多信息。 ### 在 Ubuntu 和其它 Linux 发行版上安装 GParted -你可能已经预先安装 GParted 。所以,务必核实一下。如果你没有安装它,你可以前往进入软件中心安装它。 +你可能已经预安装了 GParted 。所以,务必核实一下。如果你尚未安装它,则可以进入软件中心安装它。 -以备你想使用终端,简单地键入下面的命令: +如果你想使用终端,简单地键入下面的命令: ``` sudo apt install gparted ``` -像我如上所述,如果你想要数据恢复选项,除了 gparted 软件包外,你应该安装 gpart 软件包。 +如上所述,如果你想要使用数据恢复选项,除了安装 gparted 软件包外,还应该安装 gpart 软件包。 -如果你正在使用一些其它 Linux 发行版,你可以在各自的软件管理器中找到它,或者简单地查看[官方下载操作指南][11]。 +如果你使用的是其它 Linux 发行版,你可以在各自的软件管理器中找到它,或者直接查看[官方下载操作说明][11]。 -[下载 GParted][11] +- [下载 GParted][11] -**总结** +### 总结 -当涉及处理磁盘管理和分区时,GParted 是一个非常有用和重要的工具。但是,因为显而易见的原因,当你使用它时,你将不得不小心。 +当涉及处理磁盘管理和分区时,GParted 是一个非常有用且重要的工具。但是,因为显而易见的原因,当你使用它时,你必须要小心。 -你尝试过 GParted 吗?你在 Linux 上使用的其它分区工具是什么?请在下面的评论中分享你的体验。 +你尝试过 GParted 吗?你在 Linux 上使用的其它哪个分区工具?请在下面的评论中分享你的经验。 -------------------------------------------------------------------------------- @@ -97,7 +99,7 @@ via: https://itsfoss.com/gparted/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a39d5cbd63dcb84d3ebfd6452319226c0e727a49 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 11 Jan 2020 00:57:45 +0800 Subject: [PATCH 0191/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200111=20Don?= =?UTF-8?q?=E2=80=99t=20Use=20ZFS=20on=20Linux:=20Linus=20Torvalds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md --- ... Don-t Use ZFS on Linux- Linus Torvalds.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md diff --git a/sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md b/sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md new file mode 100644 index 0000000000..7323b77a8e --- /dev/null +++ b/sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Don’t Use ZFS on Linux: Linus Torvalds) +[#]: via: (https://itsfoss.com/linus-torvalds-zfs/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Don’t Use ZFS on Linux: Linus Torvalds +====== + +_“Don’t use ZFS. It’s that simple. It was always more of a buzzword than anything else, I feel, and the licensing issues just make it a non-starter for me.”_ + +This is what Linus Torvalds [said in a mailing list][1] to once again express his disliking for [ZFS filesystem][2] specially over its licensing. + +To avoid unnecessary confusion, this is more intended for Linux distributions, kernel developers and maintainers rather than individual Linux users. + +### What’s the licensing issue with ZFS and Linux kernel? + +![][3] + +ZFS was open sourced around 2003. This would have meant that Linux distributions start supporting ZFS. But that didn’t really happen because of the complexity of [open source licenses][4]. + +ZFS is open source under [Common Development and Distribution License][5] (CDDL) 1.0 whereas Linux kernel is licensed under the GNU General Public License (GPL) 2.0. + +These two open source licenses are not fully compatible with each other. As noted by [PCWorld][6], if ZFS with this license is included in the Linux kernel, this would mean that kernel+ZFS is a derivative work of the (original ZFS-less) Linux kernel. + +### Torvalds doesn’t trust Oracle + +![][7] + +While the whole derivative thing is a matter of debate for legal and licensing experts, Torvalds is skeptical of Oracle. Oracle has a history of suing enterprises for using its code. Remember [Oracle vs Android lawsuit over the use of Java][8]? + +> Other people think it can be ok to merge ZFS code into the kernel and that the module interface makes it ok, and that’s their decision. But considering Oracle’s litigious nature, and the questions over licensing, there’s no way I can feel safe in ever doing so. +> +> And I’m not at all interested in some “ZFS shim layer” thing either that some people seem to think would isolate the two projects. That adds no value to our side, and given Oracle’s interface copyright suits (see Java), I don’t think it’s any real licensing win either. + +Torvalds doesn’t want Linux kernel to get into legal troubles with Oracle in future and hence he refuses to include ZFS in mainline kernel until Orcale provides a signed letter that a kernel with ZFS will be under GPL license. + +> And honestly, there is no way I can merge any of the ZFS efforts until I get an official letter from Oracle that is signed by their main legal counsel or preferably by Larry Ellison himself that says that yes, it’s ok to do so and treat the end result as GPL’d. + +He is not stopping other (distributions) from using ZFS. But they are on their own. + +> If somebody adds a kernel module like ZFS, they are on their own. I can’t maintain it, and I can not be bound by other peoples kernel changes. + +Canonical, Ubuntu’s parent company, has been too keen on ZFS. Their [legal department thinks that including ZFS in kernel doesn’t make it a derivative work][9]. So they took their chances and now they provide an option to [use ZFS on root from Ubuntu 19.10][10]. + +### Torvalds is also not impressed with ZFS in general + +![][11] + +While some people drool over ZFS, Linus Torvalds is not that impressed with ZFS. He doesn’t think it’s using ZFS is a good idea specially when it is not actively maintained by Oracle (after they open sourced it) + +> The benchmarks I’ve seen do not make ZFS look all that great. And as far as I can tell, it has no real maintenance behind it either any more, so from a long-term stability standpoint, why would you ever want to use it in the first place? + +I am no legal expert but if there is even a slightest doubt, I would prefer staying away from ZFS. What do you think of the whole ZFS debate? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linus-torvalds-zfs/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.realworldtech.com/forum/?threadid=189711&curpostid=189841 +[2]: https://itsfoss.com/what-is-zfs/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/dont_use_zfs_torvalds.jpg?ssl=1 +[4]: https://itsfoss.com/open-source-licenses-explained/ +[5]: https://opensource.org/licenses/CDDL-1.0 +[6]: https://www.pcworld.com/article/3061924/ubuntu-1604s-support-for-the-zfs-file-system-may-violate-the-general-public-license.html +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/linus-torvalds-zfs-quotes-1.jpg?ssl=1 +[8]: https://itsfoss.com/oracle-google-dispute/ +[9]: https://ubuntu.com/blog/zfs-licensing-and-linux +[10]: https://itsfoss.com/zfs-ubuntu/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/linus-torvalds-zfs-quotes-2.jpg?ssl=1 From ec111ac4a5dd9faeece3a98ec010a2aac5bde9f7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 11 Jan 2020 00:58:26 +0800 Subject: [PATCH 0192/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200110=205=20?= =?UTF-8?q?ops=20hacks=20for=20sysadmins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200110 5 ops hacks for sysadmins.md --- .../20200110 5 ops hacks for sysadmins.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20200110 5 ops hacks for sysadmins.md diff --git a/sources/tech/20200110 5 ops hacks for sysadmins.md b/sources/tech/20200110 5 ops hacks for sysadmins.md new file mode 100644 index 0000000000..409d5a0716 --- /dev/null +++ b/sources/tech/20200110 5 ops hacks for sysadmins.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ops hacks for sysadmins) +[#]: via: (https://opensource.com/article/20/1/ops-hacks-sysadmins) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +5 ops hacks for sysadmins +====== +Five tools to help you find the source of your users' IT problems when +you don't know where to start. +![Wratchet set tools][1] + +As a sysadmin, every day I am faced with problems I need to solve quickly because there are users and managers who expect things to run smoothly. In a large environment like the one I manage, it's nearly impossible to know all of the systems and products from end to end, so I have to use creative techniques to find the source of the problems and (hopefully) come up with solutions. + +This has been my daily experience for well over 20 years, and I love it! Coming to work each day, I never quite know what will happen. So, I have a few quick and dirty tricks that I default to when a problem lands on my lap, but I don't know where to start. + +_BUT WAIT!_ Before you jump straight onto the command line, spend some time talking to your users. Yes, it can be tedious, but they will have some good information for you. Keep in mind that users probably don't have as much experience as you have, and you will need to do some interpreting of whatever they say. Try to get a clear picture of what _is_ happening and what _should be_ happening, then describe the fault to yourself in technical language. Be aware that most users don't read what is on the screen in front of them; it's sad but true. Make sure you and the user are reading all of the text to gather as much information as possible. Once you have that together, jump onto the command line with these five tools. + +### Telnet + +I am starting with a classic. [Telnet][2] was the predecessor to SSH, and, in the olden days, it was used on Unix systems to connect to a remote terminal just like SSH does, but it was not encrypted. Telnet has a very neat and invaluable trick for diagnosing network connectivity issues: you can Telnet into TCP ports that are not reserved for it. To do so, use Telnet like you normally would, but add the TCP port onto the end (**telnet localhost 80,** for instance) to connect to a web server. This enables you to check a server to see if a service is running or if a firewall is blocking it. So, without having the application client or even a login for the application, you can check if the TCP port is responding. If you know how, sometimes you can elicit a response from the server by manually typing into the Telnet prompt and checking the response. Web servers and mail servers are two examples where you can do this. + +![Getting a response from a webserver with Telnet][3] + +### Tcpdump + +The [tcpdump][4] tool lets you inspect what data is being transmitted on the network. Most network protocols are fairly simple and, if you combine tcpdump with a tool like [Wireshark][5], you will have a nice, easy way to browse the traffic that you have captured. In the example below, I am inspecting packets in the bottom window and connecting to TCP port 3260 in the top. + +![Inspecting packets in real time with tcpdump][6] + +This screenshot shows a real-world use of Wireshark to look at the iSCSI protocol; in this case, I was able to identify that there was a problem with the way our QNAP network-attached storage was configured. + +![Using Wireshark to inspect a TCP session][7] + +### find + +The [find][8] command is simply the best tool if you don't know where to start. In its most simple form, you can use it to "find" files. For example, if I wanted to do a recursive search through all directories and get a list of the conf files, I could enter: + + +``` +`find . -name '*.conf'.` +``` + +![find command output][9] + +But one of find's hidden gems is that you can use it to execute a command against each item it finds. For example, if I wanted to get a long list of each file, I could enter: + + +``` +`find . -name '*.conf' -exec ls -las {} \;` +``` + +![find command output][10] + +Once you know this technique, you can use it in all sorts of creative ways to find, search, and execute programs in specific ways. + +### strace + +I was introduced to the concept of [strace][11] on Solaris, where it is called truss. It is still as useful today as it was all those years ago. strace allows you to inspect what a process is doing as it runs in real time. Using it is simple; just use the command **ps -ef** and find the process ID that you are interested in. Start strace with **strace -p <pid>**; this will start printing out a whole lot of stuff, which at first looks like junk. But if you look closer, you will see text that you recognize, such as words like **OPEN** and **CLOSE** and filenames. This can lead you in the right direction if you are trying to figure out why a program is not working. + +### grep + +Leaving the best for last: [grep][12]. This tool is so useful and powerful that I have trouble coming up with a succinct way to describe it. Put simply, it's a search tool, but the way it searches is what makes it so powerful. In problem analysis, I typically grep over a bunch of logs to search for something. A companion command called zgrep does the same thing with zipped files. In the following example, I used **zgrep /var/log/* bancroft** to grep across all the log files to see what I have been up to on the system. I used zgrep because there are zipped files in the directory. + +![grep command output][13] + +Another great way to use grep is for piping the output of other tools into it; this way, it can be used as a filter of sorts. In the following example, I listed the auth file and grepped for my login to see what I have been doing by using **cat auth.log |grep bancroft**. This can also be written as **grep bancroft auth.log**, but I used the pipe (**|**) to demonstrate the point. + +![grep command output][14] + +### Other tools to consider + +You can do a lot more with these tools, but I hope this brief introduction gives you a window into how to use them to solve the nasty problems that come your way. Another tool worth your attention is [Nmap][15], which I did not include because it is so comprehensive that it needs an entire article (or more) to explain it. Finally, I recommend learning some white hat and hacking techniques; they can be very beneficial when trying to get to the bottom of a problem because they can help you collect information that can be crucial in decision making. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/ops-hacks-sysadmins + +作者:[Stephen Bancroft][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stevereaver +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4 (Wratchet set tools) +[2]: https://en.wikipedia.org/wiki/Telnet +[3]: https://opensource.com/sites/default/files/uploads/telnet_1.png (Getting a response from a webserver with Telnet) +[4]: https://www.tcpdump.org/ +[5]: https://www.wireshark.org/ +[6]: https://opensource.com/sites/default/files/uploads/tcpdump_1.png (Inspecting packets in real time with tcpdump) +[7]: https://opensource.com/sites/default/files/uploads/tcpdump_2.png (Using Wireshark to inspect a TCP session) +[8]: https://en.wikipedia.org/wiki/Find_%28Unix%29 +[9]: https://opensource.com/sites/default/files/uploads/find_1_0.png (find command output) +[10]: https://opensource.com/sites/default/files/uploads/find_2.png (find command output) +[11]: https://strace.io/ +[12]: https://en.wikipedia.org/wiki/Grep +[13]: https://opensource.com/sites/default/files/uploads/grep_1.png (grep command output) +[14]: https://opensource.com/sites/default/files/uploads/grep_2.png (grep command output) +[15]: https://nmap.org/ From f56bef9e248961cdb05a8f0631cac035fe6a78bf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 11 Jan 2020 00:59:27 +0800 Subject: [PATCH 0193/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200110=20How?= =?UTF-8?q?=20I=20upgraded=20my=20CuBox=20open=20source=20music=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200110 How I upgraded my CuBox open source music server.md --- ...raded my CuBox open source music server.md | 237 ++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 sources/tech/20200110 How I upgraded my CuBox open source music server.md diff --git a/sources/tech/20200110 How I upgraded my CuBox open source music server.md b/sources/tech/20200110 How I upgraded my CuBox open source music server.md new file mode 100644 index 0000000000..b4651d48c4 --- /dev/null +++ b/sources/tech/20200110 How I upgraded my CuBox open source music server.md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I upgraded my CuBox open source music server) +[#]: via: (https://opensource.com/article/20/1/upgrade-cubox-open-source-music-server) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +How I upgraded my CuBox open source music server +====== +Our resident audiophile explains how he updated his CuBox music server +after more than five years of excellent use. +![open source music with piano keys background][1] + +Back in early 2014, I purchased my first [ARM-based computer][2], a [SolidRun CuBox-i4][3]. My goal for the CuBox was to have a headless device (e.g., no display) that takes up minimal space in the audio equipment shelf, makes minimal noise, and serves music files to my digital-to-analog converter (DAC) and thus to the rest of the stereo. On paper, the CuBox was a perfect fit. It is fanless, works with various Linux distros, provides a separate [eSATA interface][4] for a locally mounted hard drive and therefore leaves the USB ports free for other stuff, provides a [TOSLINK port][5] for digital audio, uses a [MicroSD card][6] (by default, anyway) for the system installation and boot drive, and comes with 2GB of RAM and a reasonably fast [i.MX6q quad-core processor][7], all in an unobtrusive 5x5x5cm black plastic box. + +And as luck would (sometimes) have it, those promises have mostly been kept. The box still runs and provides my family with a great deal of musical enjoyment. The attached hard drive contains about 275GB of music files—a bit over 7,500 FLAC files with some 300 or so MP3 files thrown in. + +As our home music server, the CuBox runs a barebones Linux server distro with Music Player Daemon ([MPD][8]) as the music-serving software, sending digital data to the DAC via the [ALSA][9] with no software mixing, up- or down-sampling, or volume control on the server. Lately, I've found it convenient to run [lighttpd][10], a lightweight, simple-to-configure HTTP server, to provide cover images to the various MPD clients that we run in the house. (But now MPD provides that capability, so that convenience may soon go away.) For the user interfaces to play music, we use [Cantata][11] on the desktop and [MPD Remote][12] (caution: it may not be open source) on our Android phones to browse, select, and play music. + +In 2017, I wrote about [my experiences using the CuBox][13]. I had tried [Voyage Linux][14], [Volumio][15], and [Archphile Linux][16], and had just moved to [Armbian][17], which at that time was based on Ubuntu 16.04 LTS (long term support). This fall, I decided it was time to upgrade the server, get the latest version of MPD, and deal with a few other bothersome details along the way. + +### The upgrade + +Given my generally great experience with Armbian, I decided to go there again for upgrade materials. There are two supported options: a Debian Buster-based server configuration and an Ubuntu 18.04 desktop configuration. Bearing in mind my desire to keep the system display-free and minimalist, I selected the Debian version. + +![Armbian versions][18] + +The download was trouble-free, and I soon had an install image in my Downloads folder. As before, I was impressed with the quality and "to the point" nature of the [Armbian documentation][19], which notes: + +> Images shall only be written with Etcher on all platforms since, unlike other tools, Etcher validates burning results **saving you from corrupted SD card contents**. + +This was my first experience using [Etcher][20], and I was duly impressed with its usability (yet another wonderful reason to use open source software). I inserted the resulting MicroSD card into the CuBox, connected the Ethernet cable, DAC, and eSATA drive, and powered it on. Soon, I could SSH into the CuBox to configure it. Talk about a painless experience! Here's what I see when I log into that machine using SSH: + +![CuBox login][21] + +In terms of configuration, I had the following objectives: + + * Finish the initial configuration + * Configure static IP addressing for the wired networking connection + * Get the installed system up to date + * Disable the wireless + * Install and configure MPD + * Install and configure lighttpd + * Listen to some music! + + + +I used the excellent [Armbian Config program][22] to carry out a bunch of these initial configuration tasks. + +![Armbian-Config screen][23] + +Choosing System presents this menu: + +![Armbian-Config settings][24] + +I used this to disable root login over SSH and enable password and public key authentication. + +In the Network subsystem, I set static IP addressing (to conform to my home router settings), and in the Personal subsystem, I changed the time zone and hostname. I probably could have used the Software subsystem to run the initial update, but I chose to exit to the shell and use apt to finish up this initial configuration with: + + +``` +sudo apt update +sudo apt upgrade +``` + +I also used apt to install MPD and lighttpd with: + + +``` +`sudo apt install mpd lighttpd` +``` + +I had my previous MPD configuration file (**/etc/mpd.conf**); generally, I prefer to use these types of older files as guides to configure a new one, rather than just plunking the old one on top of the new. In the end, there weren't many changes to make; here are the differences between the old and new files: + + +``` +clh@stereo:/etc$ diff mpd.conf.orig mpd.conf +85c85,86 +< bind_to_address               "localhost" +\--- +> #bind_to_address              "localhost" +> bind_to_address               "192.168.1.21" +241c242,249 +<       name            "My ALSA Device" +\--- +>       name            "Drop Airist R2R" +>       device          "hw:CARD=U20,DEV=0" +>       mixer_type      "none" +>       replay_gain_handler      "none" +> #     name            "Schit Bifrost 4490" +> #     device          "hw:CARD=S2,DEV=0" +> #     mixer_type      "none" +> #     replay_gain_handler      "none" +clh@stereo:/etc$ +``` + +You can see that I have two DACs (just because), and the second is commented out (and not connected). Also, I had to change **bind_to_address** so that MPD will listen over the local area network. + +As for lighttpd, I only had to change the **document-root**: + + +``` +clh@stereo:/etc/lighttpd$ diff lighttpd.conf.orig lighttpd.conf +8c8,13 +< server.document-root        = "/var/www/html" +\--- +> # Used this config documentation +> # +> # which wasn't good - wrong user name, didn't need to add +> # the mime config +> # in the end just changed the document root. +> +> server.document-root        = "/var/lib/mpd/music/" +clh@stereo:/etc/lighttpd$ +``` + +To get to the music files, I added the following line to **/etc/fstab**: + + +``` +`/dev/sda1 /mnt/eSATA ext4 rw 0 0` +``` + +and created the mount point with: + + +``` +`sudo mkdir /mnt/eSATA` +``` + +At this point, I mounted the external hard drive with: + + +``` +`sudo mount /dev/sda1` +``` + +Finally, I linked MPD's configuration directory to the music with: + + +``` +sudo rmdir /var/lib/mpd/music +sudo ln -s /mnt/eSATA/Music /var/lib/mpd/music +``` + +I used this approach because I'd rather not futz around with MPD's configuration more than I have to. + +It's a good idea to check that the music files are owned by the correct MPD user ID. Do this with: + + +``` +clh@stereo:~$ ls -ld /var/lib/mpd/music/* | head +drwxrwxrwx   5 mpd audio  4096 Jan 22  2017 /var/lib/mpd/music/Academy of St. Martin-in-the-Fields +drwxrwxrwx   3 mpd audio  4096 Jan 22  2017 /var/lib/mpd/music/Acantus +drwxrwxrwx   3 mpd audio  4096 Dec 13  2014 /var/lib/mpd/music/Afrikan_Sciences +drwxrwxrwx   5 mpd audio  4096 Sep 25  2016 /var/lib/mpd/music/Afro Celt Sound System +drwxrwxrwx   3 mpd audio  4096 Mar 11  2014 /var/lib/mpd/music/Agnes Obel +drwxrwxrwx   3 mpd audio  4096 Oct  9  2013 /var/lib/mpd/music/Alexander Malter, Dietmar Schwalke, Vladimir Spiakov, Sergej Bezrodny +drwxrwxrwx   3 mpd audio  4096 Oct  8  2013 /var/lib/mpd/music/Ali Farka Toure & Toumani Diabate +drwxrwxrwx   3 mpd audio  4096 Oct  8  2013 /var/lib/mpd/music/Ali Farka Touré with Ry Cooder +drwxrwxrwx   5 mpd audio  4096 Jan  1  2018 /var/lib/mpd/music/Amadou et Mariam +drwxrwxrwx   3 mpd audio  4096 Jul 11  2017 /var/lib/mpd/music/American Authors +clh@stereo:~$ +``` + +This looks fine (user ID **mpd**, group ID **audio**). + +Finally, to disable the wireless, I entered: + + +``` +`sudo nmcli radio wifi off` +``` + +And I'm done! Time for a reboot: + + +``` +`sudo systemctl reboot` +``` + +Once it rebooted, I used Cantata to force MPD to refresh its database. Here's what it looks like when that's done, and I'm listening to [Frameworks' latest album, _Imagine Gold_][25]: + +![Frameworks "Imagine Gold" in Cantata][26] + +Just to the left of the track listings, you can see the cover images that lighttpd serves. + +### And speaking of music + +I really do like Frameworks' latest album. It's quite similar to his previous work, and he always has the greatest hooks with very dance-able stuff and just that great bit of "yearning." It's nice to buy his stuff on Bandcamp, as usual (see link above, where you can also listen). + +Lately, I've also been buying stuff in that other great open source format, vinyl records. In particular, two fine recent albums from the [Erased Tapes][27] label, [Anne Müller's _Heliopause_][28], which is a beautiful record of her own solo cello and supporting instruments and sounds, "focusing on novel approaches to classical instrumentation," and [Penguin Cafe's _Handfuls of Night_][29], which "began life after Greenpeace commissioned [Arthur] Jeffes [of Penguin Cafe] to write four pieces of music corresponding to four breeds of penguins to help raise awareness for the endangered Antarctic seas." How could a Linux user not have music about penguins by Penguin Cafe? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/upgrade-cubox-open-source-music-server + +作者:[Chris Hermansen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_LIFE_music_520x292_0411_ma.png?itok=v_ARy1ZT (open source music with piano keys background) +[2]: https://en.wikipedia.org/wiki/ARM_architecture +[3]: https://www.solid-run.com/nxp-family/cubox-i/ +[4]: https://en.wikipedia.org/wiki/Serial_ATA +[5]: https://en.wikipedia.org/wiki/TOSLINK +[6]: https://www.makeuseof.com/tag/5-mistakes-avoid-buying-next-microsd-card/ +[7]: https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/i.mx-applications-processors/i.mx-6-processors/i.mx-6quad-processors-high-performance-3d-graphics-hd-video-arm-cortex-a9-core:i.MX6Q?&cid=ps_PRG100148_CAM262037_EETECH&gclid=CjwKCAiA27LvBRB0EiwAPc8XWfLpyKIpi4OPNrPLdmXpSynIaDP0FG2jQ9PPZ1q49ENp1CbQU2fKxxoCKtMQAvD_BwE +[8]: https://www.musicpd.org/ +[9]: https://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture +[10]: https://www.lighttpd.net/ +[11]: https://opensource.com/article/17/8/cantata-music-linux +[12]: https://play.google.com/store/apps/details?id=net.prezz.mpr&hl=en_CA +[13]: https://opensource.com/article/17/6/armbian-cubox-i4pro +[14]: https://wiki.debian.org/Derivatives/Census/VoyageLinux +[15]: https://volumio.org/ +[16]: https://archphile.org/ +[17]: https://www.armbian.com/ +[18]: https://opensource.com/sites/default/files/uploads/armbianversions.png (Armbian versions) +[19]: https://docs.armbian.com/ +[20]: https://www.etcher.io/ +[21]: https://opensource.com/sites/default/files/uploads/cuboxlogin.png (CuBox login) +[22]: https://docs.armbian.com/User-Guide_Armbian-Config/ +[23]: https://opensource.com/sites/default/files/uploads/armbian-config.png (Armbian-config screen) +[24]: https://opensource.com/sites/default/files/uploads/armbian-config_settings.png (Armbian-config settings) +[25]: https://frameworksuk.bandcamp.com/album/imagine-gold +[26]: https://opensource.com/sites/default/files/uploads/frameworks-imaginegold.png (Frameworks "Imagine Gold" in Cantata) +[27]: https://www.erasedtapes.com/ +[28]: https://www.erasedtapes.com/release/eratp128-anne-mueller-heliopause +[29]: https://www.erasedtapes.com/release/eratp127-penguin-cafe-handfuls-of-night From a3fcdcbbc510200eb296b88038513dbbadde86e6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 08:40:59 +0800 Subject: [PATCH 0194/3057] PUB @robsean https://linux.cn/article-11770-1.html --- ...p Highlight- Open Source Disk Partitioning Tool GParted.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md (98%) diff --git a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/published/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md similarity index 98% rename from translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md rename to published/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md index 6721773f69..088b578c82 100644 --- a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md +++ b/published/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11770-1.html) [#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) [#]: via: (https://itsfoss.com/gparted/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 18e314b9e43f2f2b83de1ca60b78f147df21a4d5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 11 Jan 2020 08:46:22 +0800 Subject: [PATCH 0195/3057] Rename sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md to sources/talk/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md --- .../20200111 Don-t Use ZFS on Linux- Linus Torvalds.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md (100%) diff --git a/sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md b/sources/talk/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md similarity index 100% rename from sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md rename to sources/talk/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md From b6f217100ff0ecadaa85b5903bfcc515abc89dea Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 09:20:28 +0800 Subject: [PATCH 0196/3057] PRF @geekpi --- ...y Pi retrospective- 6 projects and more.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md index 2e3d16258d..001d8cd841 100644 --- a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md +++ b/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -7,26 +7,28 @@ [#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) [#]: author: (Anderson Silva https://opensource.com/users/ansilva) -我的树莓派回顾:不止 6 个项目 +我的树莓派项目回顾 ====== -看看我在有趣的、有教育意义和有用的树莓派上做了什么。 -![Raspberry Pi 4 board, posterized filter][1] -从历史和理论上讲,十年、一个世纪或一千年从十进制一那年的 1 月 1 日物业开始。例如,20 世纪始于 1901 年 1 月 1 日,而不是 1900 年 1 月 1 日。原因很简单:现代日历中没有 0 年,因此这些时间段始于 1 年(使用公历)。但这不是我们在口语上和文化上指代时间段的方式。例如,当我们提到 80 年代的音乐或电影时,我们所说的是 1980 年至 1989 年。 +> 看看我在好玩、能学习、有用处的树莓派上做了些什么。 -我可以说,最近过去的 21 世纪 10 年代是云计算、社交媒体、移动技术和物联网 (IoT) 的十年,这其中包括[树莓派][2]。最近,《时代》杂志将树莓派称为[过去十年中 10 个最佳小玩意][3]之一。我非常同意这点。 +![](https://img.linux.net.cn/data/attachment/album/202001/11/091748wekfv77t5ux5zzv2.jpg) -最初的树莓派于 2012 年推出,我过了几年才使用上了它。但是从那以后,我在家中做了许多有趣的教育项目,甚至在 Opensource.com 中记录了一些。 +无论是从历史上,还是从理论上讲,当时钟走到一个十年份第一年的 1 月 1 日的午夜 0 点时,就开始了一个十年或一个世纪或一个千年纪元。例如,20 世纪始于 1901 年 1 月 1 日,而不是 1900 年 1 月 1 日。原因很简单:现代日历中没有 0 年,因此这些时间段始于 1 年(使用公历)。但这不是我们在口语上和文化上指代时间段的方式。例如,当我们提到 80 年代的音乐或电影时,我们所说的是 1980 年至 1989 年。 + +我可以说,最近过去的 21 世纪 10 年代是云计算、社交媒体、移动技术和物联网(IoT)的十年,这其中就包括[树莓派][2]。最近,《时代》杂志将树莓派称为[过去十年中 10 个最佳小玩意][3]之一。我非常同意这点。 + +树莓派最初的于 2012 年推出,我过了几年才使用上了它。不过从那以后,我在家中做了许多有趣的教育项目,还在 Opensource.com 中记录了一些。 ### 圣诞灯三部曲 -三年来,我写了三篇探讨如何使用树莓派和开源项目 LightShowPi 控制圣诞灯的文章。第一篇文章[_用树莓派创建你自己的音乐灯光秀_][4],是基础电子开发介绍和灯光秀的结合。第二篇文章,[_ 使用树莓派 SSH 进入你的圣诞树_][5],更深入地介绍了通过远程管理和电子按钮控制灯光的方法。三部曲的最后一章[_用树莓派设置假期心情_][6],回顾了上一年 LightShowPi 项目中引入的更改。 +三年来,我写了三篇探讨如何使用树莓派和开源项目 LightShowPi 控制圣诞灯的文章。第一篇文章《[用树莓派创建你自己的音乐灯光秀][4]》,非常基础地介绍了电子开发介绍和灯光秀的结合。第二篇文章,《[使用树莓派 SSH 进入你的圣诞树][5]》,稍微深入地介绍了通过远程管理和电子按钮控制灯光的方法。三部曲的最后一章《[用树莓派设置假期心情][6]》,回顾了上一年 LightShowPi 项目中引入的更改。 ### DIY 项目 -多年来,我已经将树莓派变成了几种有用的设备。有一次,我将树莓派变成了[带有 Pi MusicBox 的音乐播放设备][7],它可以让你在 Web 界面中导入你喜欢的音乐流并在房间中播放。 +多年来,我已经将树莓派变成了几种有用的设备。有一次,我将树莓派变成了 [Pi MusicBox 音乐播放设备][7],它可以让你在 Web 界面中导入你喜欢的音乐流并在房间中播放。 -将树莓派做成[移动视频录制设备][8]是另一个 DIY 项目。它需要一些额外的硬件,例如触摸屏、Pi 摄像头和电池组,但是可以使用。这个设备的最大缺点之一是当时树莓派的可用内存很小。我认为如果我将它重新配置在具有 4GB 内存的树莓派 4 上,那么这款便携式摄像机的功能可能会更好。这可能是一个会在 2020 年重新做项目。 +将树莓派做成[移动视频录制设备][8]是另一个 DIY 项目。它需要一些额外的硬件,例如触摸屏、树莓派摄像头和电池组,但是它工作的很好。这个设备的最大缺点之一是当时树莓派的可用内存很小。我认为如果我将它重新配置在具有 4GB 内存的树莓派 4 上,那么这款便携式摄像机的功能可能会更好。这可能是一个会在 2020 年重新打造的项目。 我做的另一个小项目[客厅的数字时钟][9]使用了 Adafruit PiTFT 小屏幕。尽管这个项目很简单,但它可能是我使用时间最长的项目。那个时钟在我的电视机上呆了一年多,一天 24 小时不间断运行,直到屏幕烧坏为止。 @@ -36,7 +38,7 @@ ### 走向未来 -我在树莓派基金会中不认识任何人,因此我不了解任何它的路线图和未来计划。我可以(但我不会)推测品牌及其设备的未来,它们让世界各地这么多不同社会地位的人扩展他们对计算机科学、电子和开源开发的知识。我希望基金会的管理层能够忠于其愿景和使命,并继续为世界各地的人们提供价格合理的技术。 +我不认识树莓派基金会中的任何人,因此我不了解它的任何路线图和未来计划。我可以(但我不会)推测品牌及其设备的未来,它们让世界各地这么多不同社会地位的人扩展他们对计算机科学、电子和开源开发的知识。我希望基金会的管理层能够忠于其愿景和使命,并继续为世界各地的人们提供价格合理的技术。 21 世纪 10 年代过去了,那是多么甜蜜的十年。对我来说,它闻起来就像树莓派馅饼。 @@ -47,7 +49,7 @@ via: https://opensource.com/article/20/1/raspberry-pi-best 作者:[Anderson Silva][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f08f47ea1e16aaea73e208503b3aed5771c07ab3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 09:21:10 +0800 Subject: [PATCH 0197/3057] PUB @geekpi https://linux.cn/article-11771-1.html --- ...03 My Raspberry Pi retrospective- 6 projects and more.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200103 My Raspberry Pi retrospective- 6 projects and more.md (98%) diff --git a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/published/20200103 My Raspberry Pi retrospective- 6 projects and more.md similarity index 98% rename from translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md rename to published/20200103 My Raspberry Pi retrospective- 6 projects and more.md index 001d8cd841..ad2ff90485 100644 --- a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md +++ b/published/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11771-1.html) [#]: subject: (My Raspberry Pi retrospective: 6 projects and more) [#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) [#]: author: (Anderson Silva https://opensource.com/users/ansilva) From d6cc786096a61d066f3a18be662e62a44808ccc1 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Sat, 11 Jan 2020 09:46:16 +0800 Subject: [PATCH 0198/3057] Update 20200102 Put some loot in your Python platformer game.md --- ...ome loot in your Python platformer game.md | 84 ++++++++----------- 1 file changed, 37 insertions(+), 47 deletions(-) diff --git a/sources/tech/20200102 Put some loot in your Python platformer game.md b/sources/tech/20200102 Put some loot in your Python platformer game.md index 296739c2b9..998b7da88d 100644 --- a/sources/tech/20200102 Put some loot in your Python platformer game.md +++ b/sources/tech/20200102 Put some loot in your Python platformer game.md @@ -8,40 +8,36 @@ [#]: author: (Seth Kenlon https://opensource.com/users/seth) Put some loot in your Python platformer game +在你的 Python 平台类游戏中放一些奖励 ====== -Give your players some treasures to collect and boost their score in -this installment on programming video games with Python's Pygame module. + +这部分是关于在使用 Python Pygame 模块开发视频游戏给你的玩家提供收集的宝物和经验值的内容。 ![Hearts, stars, and dollar signs][1] -This is part 9 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: +这是正在进行的关于使用 [Python 3][2]的[Pygame][3]模块创建视频游戏的系列文章的第9部分。以前的文章有: - * [Learn how to program in Python by building a simple dice game][4] - * [Build a game framework with Python using the Pygame module][5] - * [How to add a player to your Python game][6] - * [Using Pygame to move your game character around][7] - * [What's a hero without a villain? How to add one to your Python game][8] - * [Simulate gravity in your Python game][9] - * [Add jumping to your Python platformer game][10] - * [Enable your Python game player to run forward and backward][11] + * [通过构建一个简单的骰子游戏学习如何用 Python 编程][4] + * [使用 Pygame 模块用 Python 构建游戏框架][5] + * [如何在 Python 游戏中添加玩家][6] + * [使用 Pygame 移动你的游戏角色][7] + * [没有恶棍的哪里来的英雄?如何在您的 Python 游戏中添加一个][8] + * [在你的 Python 游戏中模拟重力][9] + * [将跳跃添加到您的 Python 平台游戏中][10] + * [使你的 Python 游戏玩家能够向前和向后跑][11] +如果你已经阅读了本系列的前几篇文章,那么你已经了解了编写游戏的所有基础知识。现在你可以在这些基础上,创造一个全功能的游戏。当你第一次学习时,遵循像本系列代码示例,这样的“用例”是有帮助的,但是,用例也会约束你。现在是时候运用你学到的知识,以新的方式应用它们了。 +如果说,说起来容易做起来难,这篇文章展示了一个如何将你已经了解的内容用于新目的的例子中。具体来说,就是它涵盖了如何使用你以前的课程中已经了解到的来实现奖励系统。 -If you've followed along with the previous articles in this series, then you know all the basics of programming video game mechanics. You can build upon these basics to create a fully functional video game all your own. Following a "recipe" like the code samples in this series is helpful when you're first learning, but eventually, the recipe becomes a constraint. It's time to use the principles you've learned and apply them in new ways. +在大多数电子游戏中,你有机会在游戏世界中获得“奖励”或收集到宝物和其他物品。奖励通常会增加你的分数或者你的健康指数,或者为你的下一次任务提供信息。 -If that sounds easier said than done, this article demonstrates an example of how to leverage what you already know for new purposes. Specifically, it covers how to implement a looting system +游戏中包含的奖励类似于编程平台。像平台一样,奖励没有用户控制,随着游戏世界的滚动,并且必须检查与玩家的碰撞。 -using what you have already learned about platforms from previous lessons. +### 创建奖励函数 -In most video games, you have the opportunity to "loot," or collect treasures and other items within the game world. Loot usually increases your score or your health or provides information leading to your next quest. - -Including loot in your game is similar to programming platforms. Like platforms, loot has no user controls, scrolls with the game world, and must check for collisions with the player sprite. - -### Creating the loot function - -Loot is so similar to platforms that you don't even need a Loot class. You can just reuse the **Platform** class and call the results loot. - -Since loot type and placement probably differ from level to level, create a new function called **loot** in your **Level** class, if you don't already have one. Since loot items are not platforms, you must also create a new **loot_list** group and then add loot objects to it. As with platforms, ground, and enemies, this group is used when checking for collisions: +奖励和平台非常相似,你甚至不需要奖励类。您可以重用 **Platform** 类,并将结果称为奖励。 +由于奖励类型和位置可能因级别不同而不同,如果你还没有一个新的功能,请在你的 **Level** 中创建一个名为 **Level** 的新功能。因为奖励物品不是平台,你也必须创建一个新的 **loot_list** 组,然后添加奖励物品。与平台、地面和敌人一样,该组用于检查冲突: ```     def loot(lvl,lloc): @@ -56,10 +52,9 @@ Since loot type and placement probably differ from level to level, create a new         return loot_list ``` -You can add as many loot objects as you like; just remember to add each one to your loot list. The arguments for the **Platform** class are the X position, the Y position, the width and height of the loot sprite (it's usually easiest to keep your loot sprite the same size as all other tiles), and the image you want to use as loot. Placement of loot can be just as complex as mapping platforms, so use the level design document you created when creating the level. - -Call your new loot function in the **Setup** section of your script. In the following code, the first three lines are for context, so just add the fourth: +你可以随意添加任意数量的奖励对象;记住把每一个都加到你的奖励清单上。***Platform** 类的参数是奖励图标的X位置、Y位置、宽度和高度(通常最容易让你的奖励图标保持和所有其他方块一样的大小),以及你想要用作的奖励图标。奖励的放置可以和贴图平台一样复杂,所以使用创建关卡时需要创建关卡设计文档。 +在脚本的 **Setup** 部分调用新的奖励函数。在下面的代码中,前三行是上下文,所以只需添加第四行: ``` enemy_list = Level.bad( 1, eloc ) @@ -68,8 +63,7 @@ plat_list = Level.platform( 1,tx,ty ) loot_list = Level.loot(1,tx,ty) ``` -As you know by now, the loot won't get drawn to the screen unless you include it in your main loop. Add the final line from the following code sample to your loop: - +正如你现在所知道的,除非你把它包含在你的主循环中,否则奖励不会被显示到屏幕上。将下面代码示例的最后一行添加到循环中: ```     enemy_list.draw(world) @@ -78,16 +72,16 @@ As you know by now, the loot won't get drawn to the screen unless you include it     loot_list.draw(world) ``` -Launch your game to see what happens. +启动你的游戏看看会发生什么。 ![Loot in Python platformer][12] -Your loot objects are spawned, but they don't do anything when your player runs into them, nor do they scroll when your player runs past them. Fix these issues next. +你的奖励会产生,但是当你的玩家碰到它们时,它们不会做任何事情,当你的玩家经过它们时,它们也不会滚动。接下来解决这些问题。 -### Scrolling loot +### 滚动奖励 Like platforms, loot has to scroll when the player moves through the game world. The logic is identical to platform scrolling. To scroll the loot forward, add the last two lines: - +像平台一样,当玩家在游戏世界中移动时,奖励必须滚动。逻辑与平台滚动相同。要向前滚动战利品,添加最后两行: ```         for e in enemy_list: @@ -96,7 +90,7 @@ Like platforms, loot has to scroll when the player moves through the game world.             l.rect.x -= scroll ``` -To scroll it backward, add the last two lines: +要向后滚动,请添加最后两行: ``` @@ -106,16 +100,15 @@ To scroll it backward, add the last two lines:             l.rect.x += scroll ``` -Launch your game again to see that your loot objects now act like they're _in_ the game world instead of just painted on top of it. +再次启动你的游戏,看看你的奖励物品现在表现得像在游戏世界里一样,而不是仅仅画在上面。 -### Detecting collisions +### 检测碰撞 -As with platforms and enemies, you can check for collisions between loot and your player. The logic is the same as other collisions, except that a hit doesn't (necessarily) affect gravity or health. Instead, a hit causes the loot to disappear and increment the player's score. +就像平台和敌人一样,你可以检查奖励物品和玩家之间的碰撞。逻辑与其他碰撞相同,除了撞击不会(必然)影响重力或健康。取而代之的是,命中会导致奖励物品会消失并增加玩家的分数。 -When your player touches a loot object, you can remove that object from the **loot_list**. This means that when your main loop redraws all loot items in **loot_list**, it won't redraw that particular object, so it will look like the player has grabbed the loot. - -Add the following code above the platform collision detection in the **update** function of your **Player** class (the last line is just for context): +当你的玩家触摸到一个奖励对象时,你可以从 **奖励列表** 中移除该对象。这意味着当你的主循环在 **loot_list** 中重绘所有奖励物品时,它不会重绘那个特定的对象,所以看起来玩家已经获得了奖励物品。 +在 **Player** 类的 **update** 函数中的平台碰撞检测之上添加以下代码(最后一行仅用于上下文): ```                 loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) @@ -127,8 +120,7 @@ Add the following code above the platform collision detection in the **update**         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) ``` -Not only do you remove the loot object from its group when a collision happens, but you also award your player a bump in score. You haven't created a score variable yet, so add that to your player's properties, created in the **__init__** function of the **Player** class. In the following code, the first two lines are for context, so just add the score variable: - +当碰撞发生时,你不仅要把奖励从它的组中移除,还要给你的玩家一个分数提升。你还没有创建分数变量,所以请将它添加到你的玩家属性中,该属性是在***Player** 类的**__init__**函数中创建的。在下面的代码中,前两行是上下文,所以只需添加分数变量: ```         self.frame = 0 @@ -136,20 +128,18 @@ Not only do you remove the loot object from its group when a collision happens,         self.score = 0 ``` -When calling the **update** function in your main loop, include the **loot_list**: - +当在主循环中调用**update**函数时,需要包括**loot_list**: ```         player.gravity()         player.update() ``` -As you can see, you've got all the basics. All you have to do now is use what you know in new ways. +如你所见,你已经掌握了所有的基本知识。你现在要做的就是用新的方式使用你所知道的。 -There are a few more tips in the next article, but in the meantime, use what you've learned to make a few simple, single-level games. Limiting the scope of what you are trying to create is important so that you don't overwhelm yourself. It also makes it easier to end up with a finished product that looks and feels finished. - -Here's all the code you've written for this Python platformer so far: +在下一篇文章中还有一些提示,但是与此同时,用你学到的知识来制作一些简单的单层游戏。限制你试图创造的东西的范围是很重要的,这样你就不会埋没自己。这也使得最终的成品看起来和感觉上更容易完成。 +以下是迄今为止你为这个 Python 平台编写的所有代码: ``` #!/usr/bin/env python3 From b74afa0013d3aa652767befc7bc5686330967f90 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Sat, 11 Jan 2020 10:52:36 +0800 Subject: [PATCH 0199/3057] heguangzhi translated --- ...ut some loot in your Python platformer game.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) rename {sources => translated}/tech/20200102 Put some loot in your Python platformer game.md (94%) diff --git a/sources/tech/20200102 Put some loot in your Python platformer game.md b/translated/tech/20200102 Put some loot in your Python platformer game.md similarity index 94% rename from sources/tech/20200102 Put some loot in your Python platformer game.md rename to translated/tech/20200102 Put some loot in your Python platformer game.md index 998b7da88d..14d2715438 100644 --- a/sources/tech/20200102 Put some loot in your Python platformer game.md +++ b/translated/tech/20200102 Put some loot in your Python platformer game.md @@ -11,7 +11,7 @@ Put some loot in your Python platformer game 在你的 Python 平台类游戏中放一些奖励 ====== -这部分是关于在使用 Python Pygame 模块开发视频游戏给你的玩家提供收集的宝物和经验值的内容。 +这部分是关于在使用 Python 的 Pygame 模块开发视频游戏给你的玩家提供收集的宝物和经验值的内容。 ![Hearts, stars, and dollar signs][1] 这是正在进行的关于使用 [Python 3][2]的[Pygame][3]模块创建视频游戏的系列文章的第9部分。以前的文章有: @@ -25,19 +25,19 @@ Put some loot in your Python platformer game * [将跳跃添加到您的 Python 平台游戏中][10] * [使你的 Python 游戏玩家能够向前和向后跑][11] -如果你已经阅读了本系列的前几篇文章,那么你已经了解了编写游戏的所有基础知识。现在你可以在这些基础上,创造一个全功能的游戏。当你第一次学习时,遵循像本系列代码示例,这样的“用例”是有帮助的,但是,用例也会约束你。现在是时候运用你学到的知识,以新的方式应用它们了。 +如果你已经阅读了本系列的前几篇文章,那么你已经了解了编写游戏的所有基础知识。现在你可以在这些基础上,创造一个全功能的游戏。当你第一次学习时,遵循本系列代码示例,这样的“用例”是有帮助的,但是,用例也会约束你。现在是时候运用你学到的知识,以新的方式应用它们了。 如果说,说起来容易做起来难,这篇文章展示了一个如何将你已经了解的内容用于新目的的例子中。具体来说,就是它涵盖了如何使用你以前的课程中已经了解到的来实现奖励系统。 在大多数电子游戏中,你有机会在游戏世界中获得“奖励”或收集到宝物和其他物品。奖励通常会增加你的分数或者你的健康指数,或者为你的下一次任务提供信息。 -游戏中包含的奖励类似于编程平台。像平台一样,奖励没有用户控制,随着游戏世界的滚动,并且必须检查与玩家的碰撞。 +游戏中包含的奖励类似于编程平台。像平台一样,奖励没有用户控制,随着游戏世界的滚动进行,并且必须检查与玩家的碰撞。 ### 创建奖励函数 奖励和平台非常相似,你甚至不需要奖励类。您可以重用 **Platform** 类,并将结果称为奖励。 -由于奖励类型和位置可能因级别不同而不同,如果你还没有一个新的功能,请在你的 **Level** 中创建一个名为 **Level** 的新功能。因为奖励物品不是平台,你也必须创建一个新的 **loot_list** 组,然后添加奖励物品。与平台、地面和敌人一样,该组用于检查冲突: +由于奖励类型和位置可能因关卡不同而不同,如果你还没有一个新的功能,请在你的 **Level** 中创建一个名为 **Level** 的新功能。因为奖励物品不是平台,你也必须创建一个新的 **loot_list** 组,然后添加奖励物品。与平台、地面和敌人一样,该组用于检查玩家碰撞: ```     def loot(lvl,lloc): @@ -76,12 +76,11 @@ loot_list = Level.loot(1,tx,ty) ![Loot in Python platformer][12] -你的奖励会产生,但是当你的玩家碰到它们时,它们不会做任何事情,当你的玩家经过它们时,它们也不会滚动。接下来解决这些问题。 +你的奖励将会显示出来,但是当你的玩家碰到它们时,它们不会做任何事情,当你的玩家经过它们时,它们也不会滚动。接下来解决这些问题。 ### 滚动奖励 -Like platforms, loot has to scroll when the player moves through the game world. The logic is identical to platform scrolling. To scroll the loot forward, add the last two lines: -像平台一样,当玩家在游戏世界中移动时,奖励必须滚动。逻辑与平台滚动相同。要向前滚动战利品,添加最后两行: +像平台一样,当玩家在游戏世界中移动时,奖励必须滚动。逻辑与平台滚动相同。要向前滚动奖励物品,添加最后两行: ```         for e in enemy_list: @@ -100,7 +99,7 @@ Like platforms, loot has to scroll when the player moves through the game world.             l.rect.x += scroll ``` -再次启动你的游戏,看看你的奖励物品现在表现得像在游戏世界里一样,而不是仅仅画在上面。 +再次启动你的游戏,看看你的奖励物品现在表现得像在游戏世界里一样了,而不是仅仅画在上面。 ### 检测碰撞 From 74d6c1c6f61dac8a069b4f035608ee99eed748d1 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Sat, 11 Jan 2020 14:20:38 +0800 Subject: [PATCH 0200/3057] Update 20200107 How piwheels will save Raspberry Pi users time in 2020.md --- ... How piwheels will save Raspberry Pi users time in 2020.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md index aa43d04f90..9a05b56b50 100644 --- a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md +++ b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -90,7 +90,7 @@ via: https://opensource.com/article/20/1/piwheels 作者:[Ben Nuttall][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From df7d6ab3e32d36eeb84f0265b96b8a6ce93b5aba Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 14:25:49 +0800 Subject: [PATCH 0201/3057] PRF @MjSeven --- ...w to write a Python web API with Django.md | 126 +++++++++--------- 1 file changed, 64 insertions(+), 62 deletions(-) diff --git a/translated/tech/20191129 How to write a Python web API with Django.md b/translated/tech/20191129 How to write a Python web API with Django.md index aaf4acefb8..5ba1650a1f 100644 --- a/translated/tech/20191129 How to write a Python web API with Django.md +++ b/translated/tech/20191129 How to write a Python web API with Django.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to write a Python web API with Django) @@ -9,12 +9,14 @@ 如何借助 Django 来编写一个 Python Web API ====== -Django 是 Python API 开发中最流行的框架之一,在这个教程中,我们来学习如何使用它。 -![拿起 Python 书来学习吧][1] + +> Django 是 Python API 开发中最流行的框架之一,在这个教程中,我们来学习如何使用它。 + +![](https://img.linux.net.cn/data/attachment/album/202001/11/142503aio2325mk5weiozz.jpg) [Django][2] 所有 Web 框架中最全面的,也是最受欢迎的一个。自 2005 年以来,其流行度大幅上升。 -Django 是由 Django 软件基金会维护,并且获得了社区的大力支持,在全球拥有超过 11,600 名会员。在 Stack Overflow 上,Django 约有 191,000 个带标签的问题。Spotify、YouTube 和 Instagram 等都使用 Django 来构建应用程序和数据管理。 +Django 是由 Django 软件基金会维护,并且获得了社区的大力支持,在全球拥有超过 11,600 名成员。在 Stack Overflow 上,约有 191,000 个带 Django 标签的问题。Spotify、YouTube 和 Instagram 等都使用 Django 来构建应用程序和数据管理。 本文演示了一个简单的 API,通过它可以使用 HTTP 协议的 GET 方法来从服务器获取数据。 @@ -34,11 +36,11 @@ $ python3 -m venv env $ source env/bin/activate ``` -在 Windows 上,使用命令 **env\Scripts\activate** 来激活虚拟环境: +在 Windows 上,使用命令 `env\Scripts\activate` 来激活虚拟环境。 ### 安装 Django 和 Django REST framework -然后,安装 Django 和 Django REST: +然后,安装 Django 和 Django REST 模块: ``` $ pip3 install django @@ -47,7 +49,7 @@ $ pip3 install djangorestframework ### 实例化一个新的 Django 项目 -现在你的应用程序已经有了一个工作环境,你必须实例化一个新的 Django 项目。与 [Flask][3] 这样微框架不同的是,Django 有专门的命令来创建(注意第一条命令后的 **.** 字符)。 +现在你的应用程序已经有了一个工作环境,你必须实例化一个新的 Django 项目。与 [Flask][3] 这样微框架不同的是,Django 有专门的命令来创建(注意第一条命令后的 `.` 字符)。 ``` $ django-admin startproject tutorial . @@ -55,68 +57,68 @@ $ cd tutorial $ django-admin startapp quickstart ``` -Django 使用数据库来管理后端,所以你应该在开始开发之前同步数据库,数据库可以通过 **manage.py** 脚本管理,它是在你运行 **django-admin** 命令时创建的。因为你现在在 **tutorial** 目录,所以使用 **../** 符号来运行脚本,它位于上一层目录: +Django 使用数据库来管理后端,所以你应该在开始开发之前同步数据库,数据库可以通过 `manage.py` 脚本管理,它是在你运行 `django-admin` 命令时创建的。因为你现在在 `tutorial` 目录,所以使用 `../` 符号来运行脚本,它位于上一层目录: ``` $ python3 ../manage.py makemigrations No changes detected $ python4 ../manage.py migrate Operations to perform: -  Apply all migrations: admin, auth, contenttypes, sessions + Apply all migrations: admin, auth, contenttypes, sessions Running migrations: -  Applying contenttypes.0001_initial... OK -  Applying auth.0001_initial... OK -  Applying admin.0001_initial... OK -  Applying admin.0002_logentry_remove_auto_add... OK -  Applying admin.0003_logentry_add_action_flag_choices... OK -  Applying contenttypes.0002_remove_content_type_name... OK -  Applying auth.0002_alter_permission_name_max_length... OK -  Applying auth.0003_alter_user_email_max_length... OK -  Applying auth.0004_alter_user_username_opts... OK -  Applying auth.0005_alter_user_last_login_null... OK -  Applying auth.0006_require_contenttypes_0002... OK -  Applying auth.0007_alter_validators_add_error_messages... OK -  Applying auth.0008_alter_user_username_max_length... OK -  Applying auth.0009_alter_user_last_name_max_length... OK -  Applying auth.0010_alter_group_name_max_length... OK -  Applying auth.0011_update_proxy_permissions... OK -  Applying sessions.0001_initial... OK + Applying contenttypes.0001_initial... OK + Applying auth.0001_initial... OK + Applying admin.0001_initial... OK + Applying admin.0002_logentry_remove_auto_add... OK + Applying admin.0003_logentry_add_action_flag_choices... OK + Applying contenttypes.0002_remove_content_type_name... OK + Applying auth.0002_alter_permission_name_max_length... OK + Applying auth.0003_alter_user_email_max_length... OK + Applying auth.0004_alter_user_username_opts... OK + Applying auth.0005_alter_user_last_login_null... OK + Applying auth.0006_require_contenttypes_0002... OK + Applying auth.0007_alter_validators_add_error_messages... OK + Applying auth.0008_alter_user_username_max_length... OK + Applying auth.0009_alter_user_last_name_max_length... OK + Applying auth.0010_alter_group_name_max_length... OK + Applying auth.0011_update_proxy_permissions... OK + Applying sessions.0001_initial... OK ``` ### 在 Django 中创建用户 -创建一个名为 **admin**,密码为 **password123** 的初始用户: +创建一个名为 `admin`,示例密码为 `password123` 的初始用户: ``` $ python3 ../manage.py createsuperuser \ -  --email [admin@example.com][4] \ -  --username admin + --email admin@example.com \ + --username admin ``` 在提示时创建密码。 ### 在 Django 中实现序列化和视图 -为了使 Django 能够将信息传递给 HTTP GET 请求,必须将信息对象转化为有效的响应数据。Django 为此实现了“序列化类”。 +为了使 Django 能够将信息传递给 HTTP GET 请求,必须将信息对象转化为有效的响应数据。Django 为此实现了“序列化类” `serializers`。 -在你的项目中,创建一个名为 **quickstart/serializers.py** 的新模块,使用它来定义一些序列化器,模块将用于数据展示: +在你的项目中,创建一个名为 `quickstart/serializers.py` 的新模块,使用它来定义一些序列化器,模块将用于数据展示: ``` from django.contrib.auth.models import User, Group from rest_framework import serializers class UserSerializer(serializers.HyperlinkedModelSerializer): -    class Meta: -        model = User -        fields = ['url', 'username', 'email', 'groups'] + class Meta: + model = User + fields = ['url', 'username', 'email', 'groups'] class GroupSerializer(serializers.HyperlinkedModelSerializer): -    class Meta: -        model = Group -        fields = ['url', 'name'] + class Meta: + model = Group + fields = ['url', 'name'] ``` -Django 中的 [view][5] 是一个接受 Web 请求并返回 Web 响应的函数。响应可以是 HTML、HTTP 重定向、HTTP 错误、JSON 或 XML 文档、图像或 TAR 文件,或者可以是从 Internet 获得的任何其他内容。要创建视图,打开 **quickstart/views.py** 并输入以下代码。该文件已经存在,并且其中包含一些示例文本,保留这些文本并将以下代码添加到文件中: +Django 中的[视图][5]是一个接受 Web 请求并返回 Web 响应的函数。响应可以是 HTML、HTTP 重定向、HTTP 错误、JSON 或 XML 文档、图像或 TAR 文件,或者可以是从 Internet 获得的任何其他内容。要创建视图,打开 `quickstart/views.py` 并输入以下代码。该文件已经存在,并且其中包含一些示例文本,保留这些文本并将以下代码添加到文件中: ``` from django.contrib.auth.models import User, Group @@ -124,23 +126,23 @@ from rest_framework import viewsets from tutorial.quickstart.serializers import UserSerializer, GroupSerializer class UserViewSet(viewsets.ModelViewSet): -    """ -    API 允许查看或编辑用户 -    """ -    queryset = User.objects.all().order_by('-date_joined') -    serializer_class = UserSerializer + """ + API 允许查看或编辑用户 + """ + queryset = User.objects.all().order_by('-date_joined') + serializer_class = UserSerializer class GroupViewSet(viewsets.ModelViewSet): -    """ -    API 允许查看或编辑组 -    """ -    queryset = Group.objects.all() -    serializer_class = GroupSerializer + """ + API 允许查看或编辑组 + """ + queryset = Group.objects.all() + serializer_class = GroupSerializer ``` ### 使用 Django 生成 URL -现在,你可以生成 URL 以便人们可以访问你刚起步的 API。在文本编辑器中打开 urls.py 并将默认示例代码替换为以下代码: +现在,你可以生成 URL 以便人们可以访问你刚起步的 API。在文本编辑器中打开 `urls.py` 并将默认示例代码替换为以下代码: ``` from django.urls import include, path @@ -154,19 +156,19 @@ router.register(r'groups', views.GroupViewSet) # 使用自动路由 URL # 还有登录 URL urlpatterns = [ -    path('', include(router.urls)), -    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) + path('', include(router.urls)), + path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] ``` ### 调整你的 Django 项目设置 -这个示例项目的设置模块存储在 **tutorial/settings.py** 中,因此在文本编辑器中将其打开,然后在 **INSTALLED_APPS** 列表的末尾添加 **rest_framework**: +这个示例项目的设置模块存储在 `tutorial/settings.py` 中,因此在文本编辑器中将其打开,然后在 `INSTALLED_APPS` 列表的末尾添加 `rest_framework`: ``` INSTALLED_APPS = [ -    ... -    'rest_framework', + ... + 'rest_framework', ] ``` @@ -175,17 +177,17 @@ INSTALLED_APPS = [ 现在,你可以测试构建的 API。首先,从命令行启动内置服务器: ``` -`$ python3 manage.py runserver` +$ python3 manage.py runserver ``` -你可以通过使用 **curl** 导航至 URL **** 来访问 API: +你可以通过使用 `curl` 导航至 URL `http://localhost:8000/users` 来访问 API: ``` -$ curl --get -[{"url":" +$ curl --get http://localhost:8000/users/?format=json +[{"url":"http://localhost:8000/users/1/?format=json","username":"admin","email":"admin@example.com","groups":[]}] ``` -使用 Firefox 或[开源浏览器][6]: +使用 Firefox 或你选择的[开源浏览器][6]: ![一个简单的 Django API][7] @@ -197,10 +199,10 @@ Django 的主要优点: 1. Django 社区的规模正在不断扩大,因此即使你做一个复杂项目,也会有大量的指导资源。 2. 默认包含模板、路由、表单、身份验证和管理工具等功能,你不必寻找外部工具,也不必担心第三方工具会引入兼容性问题。 - 3. 用户,循环和条件的简单结构使你可以专注于编写代码。 + 3. 用户、循环和条件的简单结构使你可以专注于编写代码。 4. 这是一个成熟且经过优化的框架,它非常快速且可靠。 -Django 的主要缺点是: +Django 的主要缺点: 1. Django 很复杂!从开发人员视角的角度来看,它可能比简单的框架更难学。 2. Django 有一个很大的生态系统。一旦你熟悉它,这会很棒,但是当你深入学习时,它可能会令人感到无所适从。 @@ -214,7 +216,7 @@ via: https://opensource.com/article/19/11/python-web-api-django 作者:[Rachel Waston][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5cab9d11e26dab1ec1f0627644a30246e36028f3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 14:26:27 +0800 Subject: [PATCH 0202/3057] PUB @MjSeven https://linux.cn/article-11773-1.html --- .../20191129 How to write a Python web API with Django.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20191129 How to write a Python web API with Django.md (100%) diff --git a/translated/tech/20191129 How to write a Python web API with Django.md b/published/20191129 How to write a Python web API with Django.md similarity index 100% rename from translated/tech/20191129 How to write a Python web API with Django.md rename to published/20191129 How to write a Python web API with Django.md From ae7bb0737328a4f038ff5bfd7cfbed0263e5827f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 14:33:21 +0800 Subject: [PATCH 0203/3057] APL --- sources/tech/20190406 Run a server with Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190406 Run a server with Git.md b/sources/tech/20190406 Run a server with Git.md index 2d7749a465..7387669ac0 100644 --- a/sources/tech/20190406 Run a server with Git.md +++ b/sources/tech/20190406 Run a server with Git.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 904d29fbcc86e71876530e2cdc110d1dc074e79d Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Sat, 11 Jan 2020 15:45:33 +0800 Subject: [PATCH 0204/3057] heguangzhi translated --- ...ll save Raspberry Pi users time in 2020.md | 127 ----------------- ...ll save Raspberry Pi users time in 2020.md | 128 ++++++++++++++++++ 2 files changed, 128 insertions(+), 127 deletions(-) delete mode 100644 sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md create mode 100644 translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md diff --git a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md deleted file mode 100644 index 9a05b56b50..0000000000 --- a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md +++ /dev/null @@ -1,127 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (heguangzhi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How piwheels will save Raspberry Pi users time in 2020) -[#]: via: (https://opensource.com/article/20/1/piwheels) -[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) - -How piwheels will save Raspberry Pi users time in 2020 -====== -By making pre-compiled Python packages for Raspberry Pi available, the -piwheels project saves users significant time and effort. -![rainbow colors on pinwheels in the sun][1] - -Piwheels automates building Python wheels (pre-compiled Python packages) for all of the projects on [PyPI][2], the Python Package Index, using Raspberry Pi hardware to ensure compatibility. This means that when a Raspberry Pi user wants to install a Python library using **pip**, they get a ready-made compiled version that's guaranteed to work on the Raspberry Pi. This makes it much easier for Raspberry Pi users to dive in and get started with their projects. - -![Piwheels logo][3] - -When I wrote [_piwheels: Speedy Python package installation for the Raspberry Pi_][4] in October 2018, the piwheels project was in its first year and already proving its purpose of saving Raspberry Pi users considerable time and effort. But the project, which makes pre-compiled Python packages available for Raspberry Pi, has come a long way in its second year. - -![Raspberry Pi 4][5] - -### How it works - -[Raspbian][6], the primary OS for Raspberry Pi, comes pre-configured to use piwheels, so users don't need to do anything special to get access to the wheels. - -The configuration file (at **/etc/pip.conf**) tells pip to use [piwheels.org][7] as an _additional index_, so pip looks at PyPI first, then piwheels. The Piwheels website is hosted on a Raspberry Pi 3, and all the wheels built by the project are hosted on that Pi. It serves over 1 million packages per month—not bad for a $35 computer! - -In addition to the main Raspberry Pi that serves the website, the piwheels project uses seven other Pis to build the packages. Some run Raspbian Jessie, building wheels for Python 3.4, some run Raspbian Stretch for Python 3.5, and some run Raspbian Buster for Python 3.7. The project doesn't generally support other Python versions. There's also a "proper server"—a virtual machine running the Postgres database. Since the Pi 3 has just 1GB of RAM, the (very large) database doesn't run well on it, so we moved it to a VM. The Pi 4 with 4GB RAM would probably be suitable, so we may move to this in the future. - -The Pis are all on an IPv6-only network in a "Pi Cloud"—a brilliant service provided by Cambridge-based hosting company [Mythic Beasts][8]. - -![Mythic Beasts hosting service][9] - -### Downloads and trends - -Every time a wheel file is downloaded, it is logged in the database. This provides insight into what packages are most popular and what Python versions and operating systems people are using. We don't have much information from the user agent, but because the architecture of Pi 1/Zero shows as "armv6" and Pi 2/3/4 show as "armv7," we can tell them apart. - -As of mid-December 2019, over 14 million packages have been downloaded from piwheels, with nearly 9 million in 2019 alone. - -The 10 most popular packages since the project's inception are: - - 1. [pycparser][10] (821,060 downloads) - 2. [PyYAML][11] (366,979) - 3. [numpy][12] (354,531) - 4. [cffi][13] (336,982) - 5. [MarkupSafe][14] (318,878) - 6. [future][15] (282,349) - 7. [aiohttp][16] (277,046) - 8. [cryptography][17] (276,167) - 9. [home-assistant-frontend][18] (266,667) - 10. [multidict][19] (256,185) - - - -Note that many pure-Python packages, such as [urllib3][20], are provided as wheels on PyPI; because these are compatible across platforms, they're not usually downloaded from piwheels because PyPI takes precedence. - -We also see trends in things like which Python versions are used over time. This shows the quick takeover of Python 3.7 from 3.5 when Raspbian Buster was released: - -![Data from piwheels on Python versions used over time][21] - -You can see more trends in our [stats blog posts][22]. - -### Time saved - -Every package build is logged in the database, and every download is also stored. Cross-referencing downloads with build duration shows how much time has been saved. One example is numpy—the latest version took about 11 minutes to build. - -So far, piwheels has saved users a total of over 165 years of build time. At the current usage rate, piwheels saves _over 200 days per day_. - -As well as saving build time, having pre-compiled wheels also means people don't have to install various development tools to build packages. Some packages require other apt packages for them to access shared libraries. Figuring out which ones you need can be a pain, so we made that step easier, too. First, we figured out the process and [documented it on our blog][23]. Then we added this logic to the build process so that when a wheel is built, its dependencies are automatically calculated and added to the package's project page: - -![numpy dependencies][24] - -### What next for piwheels? - -We launched project pages (e.g., [numpy][25]) this year, which are a really useful way to let people look up information about a project in a human-readable way. They also make it easier for people to report issues, such as if a project is missing from piwheels or they have an issue with a package they've downloaded. - -In early 2020, we're planning to roll out some upgrades to piwheels that will enable a new JSON API, so you can automatically check which versions are available, look up dependencies for a project, and lots more. - -The next Debian/Raspbian upgrade won't happen until mid-2021, so we won't start building wheels for any new Python versions until then. - -You can read more about piwheels on the project's [blog][26], where I'll be publishing a 2019 roundup early in 2020. You can also follow [@piwheels][27] on Twitter, where you'll see daily and monthly stats along with any milestones reached. - -Of course, piwheels is an open source project, and you can see the entire project [source code on GitHub][28]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/piwheels - -作者:[Ben Nuttall][a] -选题:[lujun9972][b] -译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bennuttall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rainbow-pinwheel-piwheel-diversity-inclusion.png?itok=di41Wd3V (rainbow colors on pinwheels in the sun) -[2]: https://pypi.org/ -[3]: https://opensource.com/sites/default/files/uploads/piwheels.png (Piwheels logo) -[4]: https://opensource.com/article/18/10/piwheels-python-raspberrypi -[5]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4_0.jpg (Raspberry Pi 4) -[6]: https://www.raspberrypi.org/downloads/raspbian/ -[7]: http://piwheels.org -[8]: https://www.mythic-beasts.com/order/rpi -[9]: https://opensource.com/sites/default/files/uploads/pi-cloud.png (Mythic Beasts hosting service) -[10]: https://www.piwheels.org/project/pycparser -[11]: https://www.piwheels.org/project/PyYAML -[12]: https://www.piwheels.org/project/numpy -[13]: https://www.piwheels.org/project/cffi -[14]: https://www.piwheels.org/project/MarkupSafe -[15]: https://www.piwheels.org/project/future -[16]: https://www.piwheels.org/project/aiohttp -[17]: https://www.piwheels.org/project/cryptography -[18]: https://www.piwheels.org/project/home-assistant-frontend -[19]: https://www.piwheels.org/project/multidict -[20]: https://piwheels.org/project/urllib3/ -[21]: https://opensource.com/sites/default/files/uploads/pyvers2019.png (Data from piwheels on Python versions used over time) -[22]: https://blog.piwheels.org/piwheels-stats-for-2019/ -[23]: https://blog.piwheels.org/how-to-work-out-the-missing-dependencies-for-a-python-package/ -[24]: https://opensource.com/sites/default/files/uploads/numpy-deps.png (numpy dependencies) -[25]: https://www.piwheels.org/project/numpy/ -[26]: https://blog.piwheels.org/ -[27]: https://twitter.com/piwheels -[28]: https://github.com/piwheels/ diff --git a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md new file mode 100644 index 0000000000..3b7ec879eb --- /dev/null +++ b/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How piwheels will save Raspberry Pi users time in 2020) +[#]: via: (https://opensource.com/article/20/1/piwheels) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + + +piwheels 是如何在2020年节省树莓派用户的时间的 +====== +通过为树莓派提供预编译的 Python 包,piwheels 项目为用户节省了大量的时间和精力。![rainbow colors on pinwheels in the sun][1] + +piwheels 自动为[PiPi][2]上的所有项目构建 Python wheels( 预编译的 Python包 ),即 Python 包索引,使用树莓派硬件确保其兼容性。这意味着,当树莓派用户想要使用 **pip**,安装一个Python库时,他们会得到一个现成的编译版本,并保证可以在树莓派上良好的工作。这使得树莓派用户更容易进入和开始他们的项目。 + +![Piwheels logo][3] + +当我在2018年10月写[piwheels:为树莓派提供快速 Python 包安装][4]时,piwheels 项目已经进入第一年,并且已经证明了其为树莓派用户节省大量时间和精力。但是这个项目已经进入第二年,它为树莓派提供了预编译的 Python 包走了更长的路。 + +![Raspberry Pi 4][5] + +### 它是怎么工作的 + +[Raspbian][6],树莓派的主要操作系统,预配置使用 piwheels,所以用户不需要做任何特殊的事情就可以使用piwheels。 + +配置文件(在 **/etc/pip.conf**)告诉 pip 使用[piwheels.org][7]作为 _附加索引_,因此 pip 首先查看PyPI,然后查看 piwheels。piwheels 网站位于树莓派 3的 hosts中,该项目建造的所有 wheels 都位于该派上。它每月提供100多万套服务——对于一台35美元的电脑来说还不错! + +网站除了主要服务于树莓派以外,piwheels 项目还对使用其他七个派系统并构建软件包。有人运行 Raspbian Jessie,为 Python 3.4 建造 wheels,有人运行 Raspbian Stretch 为 Python 3.5,有人运行 Raspbian Buster 为 Python 3.7。该项目通常不支持其他 Python 版本。还有一个“合适的服务器”——运行 Postgres 数据库的虚拟机。由于 派3 只有1GB的内存,所以(非常大的)数据库不能在其上很好地运行,所以我们把它移到了虚拟机上。带 4GB 内存的 派4 可能是合适的,所以我们将来可能会用到它。 + +派都在“派云”中的 IPv6 网络上——这是一项由总部位于剑桥的托管公司[Mythic Beasts][8]提供的卓越的服务。 +![Mythic Beasts hosting service][9] + +### 下载和统计趋势 + +每次下载 piwheels 文件时,它都会记录在数据库中。这提供了对什么包最受欢迎以及人们使用什么 Python 版本和操作系统的统计。我们没有太多来自用户代理的信息,但是因为 派1/Zero 的架构显示为 “armv6”,派2/3/4显示为“armv7”,所以我们可以将它们区分开来。 + +截至2019年12月中旬,从派风车下载的软件包超过1,400万个,仅2019年就有近900万个。 + +自项目开始以来最受欢迎的10个软件包是: + + 1. [pycparser][10] (821,060 downloads) + 2. [PyYAML][11] (366,979) + 3. [numpy][12] (354,531) + 4. [cffi][13] (336,982) + 5. [MarkupSafe][14] (318,878) + 6. [future][15] (282,349) + 7. [aiohttp][16] (277,046) + 8. [cryptography][17] (276,167) + 9. [home-assistant-frontend][18] (266,667) + 10. [multidict][19] (256,185) + + + +请注意,许多纯 Python 包,如[urllib3][20],都是作为 PyPI 上的 wheels 提供的;因为这些是跨平台兼容的,所以通常不会从 piwheels 下载,因为PyPI优先。 + +随着时间的推移,我们也看到了使用哪些 Python 版本的趋势。这里显示了 Raspbian Buster 发布时从3.5版快速升级到了Python 3.7: + +![Data from piwheels on Python versions used over time][21] + + +你可以看到更多的统计趋势在[stats blog posts][22]。 + +### 节省时间 + + +每个包构建都被记录在数据库中,并且每个下载也被存储。带有构建持续时间的交叉引用下载显示了节省了多少时间。一个例子是 numpy ——最新版本大约需要11分钟来构建。 + +迄今为止,piwheels 项目已经为用户节省了总计超过165年的构建时间。按照目前的使用率,piwheels 项目每天节省200多天。 + + +除了节省构建时间,拥有预编译的 wheels 也意味着人们不必安装各种开发工具来构建包。一些包需要其他apt包来访问共享库。弄清楚你需要哪一个可能会很痛苦,所以我们也让这一步变得容易了。首先,我们找到了这个过程,[在博客上记录了这个过程][23]。然后,我们将这个逻辑添加到构建过程中,这样当构建一个 wheels 时,它的依赖关系会被自动计算并添加到包的项目页面中: + +![numpy dependencies][24] + +### 派风车的下一步是什么? + +今年,我们推出了项目页面(例如,[numpy][25),这是一种非常有用的方式,可以让人们以人类可读的方式查找项目信息。它们还使人们更容易报告问题,例如 piwheels 中缺少一个项目,或者他们下载的包有问题。 + +2020年初,我们计划对 piwheels 项目进行一些升级,以启用新的JSON应用编程接口,这样你就可以自动检查哪些版本可用,查找项目的依赖关系,等等。 + +下一次 Debian/Raspbian 升级要到2021年年中才会发生,所以在那之前我们不会开始为任何新的 Python 版本 制造 wheels。 + +你可以在这个项目的[博客][26]上读到更多关于 piwheels 的信息,我将在2020年初在那里发表一篇2019年的综述。你也可以在推特上关注[@piwheels][27],在那里你可以看到每日和每月的统计数据以及任何达到的里程碑。 + +当然,piwheels 是一个开源项目,你可以在[GitHub][28]上看到整个项目源代码。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/piwheels + +作者:[Ben Nuttall][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rainbow-pinwheel-piwheel-diversity-inclusion.png?itok=di41Wd3V (rainbow colors on pinwheels in the sun) +[2]: https://pypi.org/ +[3]: https://opensource.com/sites/default/files/uploads/piwheels.png (Piwheels logo) +[4]: https://opensource.com/article/18/10/piwheels-python-raspberrypi +[5]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4_0.jpg (Raspberry Pi 4) +[6]: https://www.raspberrypi.org/downloads/raspbian/ +[7]: http://piwheels.org +[8]: https://www.mythic-beasts.com/order/rpi +[9]: https://opensource.com/sites/default/files/uploads/pi-cloud.png (Mythic Beasts hosting service) +[10]: https://www.piwheels.org/project/pycparser +[11]: https://www.piwheels.org/project/PyYAML +[12]: https://www.piwheels.org/project/numpy +[13]: https://www.piwheels.org/project/cffi +[14]: https://www.piwheels.org/project/MarkupSafe +[15]: https://www.piwheels.org/project/future +[16]: https://www.piwheels.org/project/aiohttp +[17]: https://www.piwheels.org/project/cryptography +[18]: https://www.piwheels.org/project/home-assistant-frontend +[19]: https://www.piwheels.org/project/multidict +[20]: https://piwheels.org/project/urllib3/ +[21]: https://opensource.com/sites/default/files/uploads/pyvers2019.png (Data from piwheels on Python versions used over time) +[22]: https://blog.piwheels.org/piwheels-stats-for-2019/ +[23]: https://blog.piwheels.org/how-to-work-out-the-missing-dependencies-for-a-python-package/ +[24]: https://opensource.com/sites/default/files/uploads/numpy-deps.png (numpy dependencies) +[25]: https://www.piwheels.org/project/numpy/ +[26]: https://blog.piwheels.org/ +[27]: https://twitter.com/piwheels +[28]: https://github.com/piwheels/ From 41b815b26883c112122b6b1b7065933445a0d4f8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 22:17:31 +0800 Subject: [PATCH 0205/3057] TSL --- .../tech/20190406 Run a server with Git.md | 240 ------------------ .../tech/20190406 Run a server with Git.md | 226 +++++++++++++++++ 2 files changed, 226 insertions(+), 240 deletions(-) delete mode 100644 sources/tech/20190406 Run a server with Git.md create mode 100644 translated/tech/20190406 Run a server with Git.md diff --git a/sources/tech/20190406 Run a server with Git.md b/sources/tech/20190406 Run a server with Git.md deleted file mode 100644 index 7387669ac0..0000000000 --- a/sources/tech/20190406 Run a server with Git.md +++ /dev/null @@ -1,240 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Run a server with Git) -[#]: via: (https://opensource.com/article/19/4/server-administration-git) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/seth) - -Run a server with Git -====== -Thanks to Gitolite, you can manage a Git server with Git. Learn how in -our series about little-known Git uses. -![computer servers processing data][1] - -As I've tried to demonstrate in this series leading up to Git's 14th anniversary on April 7, [Git][2] can do a wide range of things beyond tracking source code. Believe it or not, Git can even manage your Git server, so you can, more or less, run a Git server with Git itself. - -Of course, this involves a lot of components beyond everyday Git, not the least of which is [Gitolite][3], the backend application managing the fiddly bits that you configure using Git. The great thing about Gitolite is that, because it uses Git as its frontend interface, it's easy to integrate Git server administration within the rest of your Git-based workflow. Gitolite provides precise control over who can access specific repositories on your server and what permissions they have. You can manage that sort of thing yourself with the usual Linux system tools, but it takes a lot of work if you have more than just one or two repos across a half-dozen users. - -Gitolite's developers have done the hard work to make it easy for you to provide many users with access to your Git server without giving them access to your entire environment—and you can do it all with Git. - -What Gitolite is _not_ is a GUI admin and user panel. That sort of experience is available with the excellent [Gitea][4] project, but this article focuses on the simple elegance and comforting familiarity of Gitolite. - -### Install Gitolite - -Assuming your Git server runs Linux, you can install Gitolite with your package manager ( **yum** on CentOS and RHEL, **apt** on Debian and Ubuntu, **zypper** on OpenSUSE, and so on). For example, on RHEL: - - -``` -`$ sudo yum install gitolite3` -``` - -Many repositories still have older versions of Gitolite for legacy support, but the current version is version 3. - -You must have passwordless SSH access to your server. You can use a password to log in if you prefer, but Gitolite relies on SSH keys, so you must configure the option to log in with keys. If you don't know how to configure a server for passwordless SSH access, go learn how to do that first (the [Setting up SSH key authentication][5] section of Steve Ovens's Ansible article explains it well). It's an essential part of secure server administration—as well as of running Gitolite. - -### Configure a Git user - -Without Gitolite, if a person requests access to a Git repository you host on a server, you have to provide that person with a user account. Git provides a special shell, the **git-shell** , which is an ultra-specific shell that performs only Git tasks. This lets you have users who can access your server only through the filter of a very limited shell environment. - -That solution works, but it usually means a user gains access to all repositories on your server unless you have a very good schema for group permissions and maintain those permissions strictly whenever a new repository is created. It also requires a lot of manual configuration at the system level, an area usually reserved for a specific tier of sysadmins and not necessarily the person usually in charge of Git repositories. - -Gitolite sidesteps this issue entirely by designating one username for every person who needs access to any repository. By default, the username is **git** , and because Gitolite's documentation assumes that's what is used, it's a good default to keep when you're learning the tool. It's also a well-known convention for anyone who's ever used GitLab or GitHub or any other Git hosting service. - -Gitolite calls this user the _hosting user_. Create an account on your server to act as the hosting user (I'll stick with **git** because that's the convention): - - -``` -` $ sudo adduser --create-home git` -``` - -For you to control the **git** user account, it must have a valid public SSH key that belongs to you. You should already have this set up, so **cp** your public key ( _not your private key_ ) to the **git** user's home directory: - - -``` -$ sudo cp ~/.ssh/id_ed25519.pub /home/git/ -$ sudo chown git:git /home/git/id_ed25519.pub -``` - -If your public key doesn't end with the extension **.pub** , Gitolite will not use it, so rename the file accordingly. Change to that user account to run Gitolite's setup: - - -``` -$ sudo su - git -$ gitolite setup --pubkey id_ed25519.pub -``` - -After the setup script runs, the **git** home's user directory will have a **repositories** directory, which (for now) contains the files **git-admin.git** and **testing.git**. That's all the setup the server requires, so log out. - -### Use Gitolite - -Managing Gitolite is a matter of editing text files in a Git repository, specifically **gitolite-admin.git**. You won't SSH into your server for Git administration, and Gitolite encourages you not to try. The repositories you and your users store on the Gitolite server are _bare_ repositories, so it's best to stay out of them. - - -``` -$ git clone [git@example.com][6]:gitolite-admin.git gitolite-admin.git -$ cd gitolite-admin.git -$ ls -1 -conf -keydir -``` - -The **conf** directory in this repository contains a file called **gitolite.conf**. Open it in a text editor or use **cat** to view its contents: - - -``` -repo gitolite-admin -RW+ = id_ed22519 - -repo testing -RW+ = @all -``` - -You may have an idea of what this configuration file does: **gitolite-admin** represents this repository, and the owner of the **id_ed25519** key has read, write, and Git administrative privileges. In other words, rather than mapping users to normal local Unix users (because all your users log in using the **git** hosting user identity), Gitolite maps users to SSH keys listed in the **keydir** directory. - -The **testing.git** repository gives full permissions to everyone with access to the server using special group notation. - -#### Add users - -If you want to add a user called **alice** to your Git server, the person Alice must send you her public SSH key. Gitolite uses whatever is to the left of the **.pub** extension as the identifier for your Git users. Rather than using the default key name values, give keys a name indicative of the key owner. If a user has more than one key (e.g., one for her laptop, one for her desktop), you can use subdirectories to avoid file name collisions. For instance, the key Alice uses from her laptop might come to you as the default **id_rsa.pub** , so rename it **alice.pub** or similar (or let the users name the key according to their local user accounts on their computers), and place it into the **gitolite-admin.git/keydir/work/laptop/** directory. If she sends you another key from her desktop, name it **alice.pub** (the same as the previous one) and add it to **keydir/work/desktop/**. Another key might go into **keydir/home/desktop/** , and so on. Gitolite recursively searches **keydir** for a **.pub** file matching a repository "user" and treats any match as the same identity. - -When you add keys to the **keydir** directory, you must commit them back to your server. This is such an easy thing to forget that there's a real argument here for using an automated Git application like [**Sparkleshare**][7] so any change is committed back to your Gitolite admin immediately. The first time you forget to commit and push—and waste three hours of your time and your user's time troubleshooting—you'll see that Gitolite is the perfect justification for using Sparkleshare. - - -``` -$ git add keydir -$ git commit -m 'added alice-laptop-0.pub' -$ git push origin HEAD -``` - -Alice, by default, gains access to the **testing.git** directory so she can test connectivity and functionality with that. - -#### Set permissions - -As with users, directory permissions and groups are abstracted away from the normal Unix tools you might be used to (or find information about online). Permissions to projects are granted in the **gitolite.conf** file in **gitolite-admin.git/conf** directory. There are four levels of permissions: - - * **R** allows read-only. A user with **R** permissions on a repository may clone it, and that's all. - * **RW** allows a user to perform a fast-forward push of a branch, create new branches, and create new tags. More or less, this one feels like a "normal" Git repository to most users. - * **RW+** allows Git actions that are potentially destructive. A user can perform normal fast-forward pushes, as well as rewind pushes, do rebases, and delete branches and tags. This may or may not be something you want to grant to all contributors on a project. - * **-** explicitly denies access to a repository. This is essentially the same as a user not being listed in the repository's configuration. - - - -Create a new repository or modify an existing repository's permissions by adjusting **gitolite.conf**. For instance, to give Alice permissions to administrate a new repository called **widgets.git** : - - -``` -repo gitolite-admin -RW+ = id_ed22519 - -repo testing -RW+ = @all - -repo widgets -RW+ = alice -``` - -Now Alice—and Alice alone—can clone the repo: - - -``` -[alice]$ git clone [git@example.com][6]:widgets.git -Cloning into 'widgets'... -warning: You appear to have cloned an empty repository. -``` - -On her initial push, Alice must use the **-u** option to send her branch to the empty repository (as she would have to do with any Git host). - -To make user management easier, you can define groups of repositories: - - -``` -@qtrepo = widgets -@qtrepo = games - -repo gitolite-admin -RW+ = id_ed22519 - -repo testing -RW+ = @all - -repo @qtrepo -RW+ = alice -``` - -Just as you can create group repositories, you can group users. One user group exists by default: **@all**. As you might expect, it includes all users, without exception. You can create your own: - - -``` -@qtrepo = widgets -@qtrepo = games - -@developers = alice bob - -repo gitolite-admin -RW+ = id_ed22519 - -repo testing -RW+ = @all - -repo @qtrepo -RW+ = @developers -``` - -As with adding or modifying key files, any change to the **gitolite.conf** file must be committed and pushed to take effect. - -### Create a repository - -By default, Gitolite assumes repository creation happens from the top down. For instance, a project manager with access to the Git server creates a project repository and, through the Gitolite administration repo, adds developers. - -In practice, you might prefer to grant users permission to create repositories. Gitolite calls these "wild repos" (I'm not sure whether that's commentary on how the repos come into being or a reference to the wildcard characters required by the configuration file to let it happen). Here's an example: - - -``` -@managers = alice bob - -repo foo/CREATOR/[a-z]..* -C = @managers -RW+ = CREATOR -RW = WRITERS -R = READERS -``` - -The first line defines a group of users: the group is called **@managers** and contains users **alice** and **bob**. The next line sets up a wildcard allowing repositories that do not yet exist to be created in a directory called **foo** followed by a subdirectory named for the user creating the repo. For example: - - -``` -[alice]$ git clone [git@example.com][6]:foo/alice/cool-app.git -Cloning into cool-app'... -Initialized empty Git repository in /home/git/repositories/foo/alice/cool-app.git -warning: You appear to have cloned an empty repository. -``` - -There are some mechanisms for the creator of a wild repo to define who can read and write to their repository, but they're limited in scope. For the most part, Gitolite assumes that a specific set of users governs project permission. One solution is to grant all users access to **gitolite-admin** using a Git hook to require manager approval to merge changes into the master branch. - -### Learn more - -Gitolite has many more features than what this introductory article covers, so try it out. The [documentation][8] is excellent, and once you read through it, you can customize your Gitolite server to provide your users whatever level of control you are comfortable with. Gitolite is a low-maintenance, simple system that you can install, set up, and then more or less forget about. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/server-administration-git - -作者:[Seth Kenlon (Red Hat, Community Moderator)][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/server_data_system_admin.png?itok=q6HCfNQ8 (computer servers processing data) -[2]: https://git-scm.com/ -[3]: http://gitolite.com -[4]: http://gitea.io -[5]: Setting%20up%20SSH%20key%20authentication -[6]: mailto:git@example.com -[7]: https://opensource.com/article/19/4/file-sharing-git -[8]: http://gitolite.com/gitolite/quick_install.html diff --git a/translated/tech/20190406 Run a server with Git.md b/translated/tech/20190406 Run a server with Git.md new file mode 100644 index 0000000000..c52295591e --- /dev/null +++ b/translated/tech/20190406 Run a server with Git.md @@ -0,0 +1,226 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run a server with Git) +[#]: via: (https://opensource.com/article/19/4/server-administration-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/seth) + +使用 Git 来管理 Git 服务器 +====== + +> 借助 Gitolite,你可以使用 Git 来管理 Git 服务器。在我们的系列中了解这些鲜为人知的 Git 用途。 + +![computer servers processing data][1] + +正如我在系列文章中演示的那样,[Git][2] 除了跟踪源代码外,还可以做很多事情。信不信由你,Git 甚至可以管理你的 Git 服务器,因此你可以或多或少地使用 Git 本身运行 Git 服务器。 + +当然,这涉及除日常使用 Git 之外的许多组件,其中最重要的是 [Gitolite][3],该后端应用程序可以管理你使用 Git 的每个细小的配置。Gitolite 的优点在于,由于它使用 Git 作为其前端接口,因此很容易将 Git 服务器管理集成到其他基于 Git 的工作流中。Gitolite 可以精确控制谁可以访问你服务器上的特定存储库以及他们具有哪些权限。你可以使用常规的 Linux 系统工具自行管理此类事务,但是如果在六个用户中只有一个或两个以上的仓库,则需要大量的工作。 + +Gitolite 的开发人员做了艰苦的工作,使你可以轻松地为许多用户提供对你的 Git 服务器的访问权,而又不让他们访问你的整个环境 —— 而这一切,你可以使用 Git 来完成全部工作。 + +Gitolite 并`不是` 图形化的管理员和用户面板。优秀的 [Gitea][4] 项目可提供这种经验,但是本文重点介绍 Gitolite 的简单优雅和令人舒适的熟悉感。 + +### 安装 Gitolite + +假设你的 Git 服务器运行 Linux,则可以使用包管理器安装 Gitolite(在 CentOS 和 RHEL 上为 `yum`,在 Debian 和 Ubuntu 上为 `apt`,在 OpenSUSE 上为 `zypper` 等)。例如,在 RHEL 上: + +``` +$ sudo yum install gitolite3 +``` + +许多发行版的存储库仍提供的是旧版本的 Gitolite,但当前版本为版本 3。 + +你必须具有对服务器的无密码 SSH 访问权限。如果愿意,你可以使用密码登录服务器,但是 Gitolite 依赖于 SSH 密钥,因此必须配置使用密钥登录的选项。如果你不知道如何配置服务器以进行无密码 SSH 访问,请首先学习如何进行操作(Steve Ovens 的 Ansible 文章的[设置 SSH 密钥身份验证][5]部分对此进行了很好的说明)。这是加强服务器管理的安全以及运行 Gitolite 的重要组成部分。 + +### 配置 Git 用户 + +如果没有 Gitolite,则如果某人请求访问你在服务器上托管的 Git 存储库,则必须向该人提供用户帐户。Git 提供了一个特殊的外壳,即 `git-shell`,这是一个仅执行 Git 任务的特别特定的 shell。这可以让你有个只能通过非常受限的 Shell 环境的过滤器来访问服务器的用户。 + +该解决方案可行,但通常意味着用户可以访问服务器上的所有存储库,除非你具有用于组权限的良好模式,并在创建新存储库时严格保持这些权限。这种方式还需要在系统级别进行大量手动配置,这通常是为特定级别的系统管理员保留的区域,而不一定是通常负责 Git 存储库的人员。 + +Gitolite 通过为需要访问任何存储库的每个人指定一个用户名来完全回避此问题。 默认情况下,用户名是 `git`,并且由于 Gitolite 的文档假定使用的是它,因此在学习该工具时保留它是一个很好的默认设置。对于曾经使用过 GitLab 或 GitHub 或任何其他 Git 托管服务的人来说,这也是一个众所周知的约定。 + +Gitolite 将此用户称为**托管用户**。在服务器上创建一个帐户以充当托管用户(我习惯使用 `git`,因为这是惯例): + +``` +$ sudo adduser --create-home git +``` + +为了控制该 `git` 用户帐户,该帐户必须具有属于你的有效 SSH 公钥。你应该已经进行了设置,因此复制你的公钥(**不是你的私钥**)添加到 `git` 用户的家目录中: + +``` +$ sudo cp ~/.ssh/id_ed25519.pub /home/git/ +$ sudo chown git:git /home/git/id_ed25519.pub +``` + +如果你的公钥不以扩展名 `.pub` 结尾,则 Gitolite 不会使用它,因此请相应地重命名该文件。切换为该用户帐户以运行 Gitolite 的安装程序: + +``` +$ sudo su - git +$ gitolite setup --pubkey id_ed25519.pub +``` + +安装脚本运行后,`git` 的家用户目录将有一个 `repository` 目录,该目录(目前)包含文件 `git-admin.git` 和 `testing.git`。这就是该服务器所需的全部设置,现在请登出 `git` 用户。 + +### 使用 Gitolite + +管理 Gitolite 就是编辑 Git 存储库中的文本文件,尤其是 `gitolite-admin.git`。你不会通过 SSH 进入服务器来进行 Git 管理,并且 Gitolite 也建议你不要这样尝试。你和你的用户存储在 Gitolite 服务器上的存储库是个**裸**存储库,因此最好不要使用它们。 + +``` +$ git clone git@example.com:gitolite-admin.git gitolite-admin.git +$ cd gitolite-admin.git +$ ls -1 +conf +keydir +``` + +该存储库中的 `conf` 目录包含一个名为 `gitolite.conf` 的文件。在文本编辑器中打开它,或使用`cat`查看其内容: + +``` +repo gitolite-admin + RW+ = id_ed22519 + +repo testing + RW+ = @all +``` + +你可能对该配置文件的功能有所了解:`gitolite-admin` 代表此存储库,并且 `id_ed25519` 密钥的所有者具有读取、写入和 Git 管理权限。换句话说,不是将用户映射到普通的本地 Unix 用户(因为所有用户都使用 `git` 用户托管用户身份),而是将用户映射到 `keydir` 目录中列出的 SSH 密钥。 + +`testing.git` 存储库使用特殊组符号为访问服务器的每个人提供了全部权限。 + +#### 添加用户 + +如果要向 Git 服务器添加一个名为 `alice` 的用户,Alice 必须向你发送她的 SSH 公钥。Gitolite 使用 `.pub` 扩展名左边的任何内容作为该 Git 用户的标识符。不要使用默认的密钥名称值,而是给密钥指定一个指示密钥所有者的名称。如果用户有多个密钥(例如,一个用于笔记本电脑,一个用于台式机),则可以使用子目录来避免文件名冲突。例如,Alice 在笔记本电脑上使用的密钥可能是默认的 `id_rsa.pub`,因此将其重命名为`alice.pub` 或类似名称(或让用户根据其计算机上的本地用户帐户来命名密钥),然后将其放入 `gitolite-admin.git/keydir/work/laptop/` 目录中。如果她从她的桌面发送了另一个密钥,命名为 `alice.pub`(与上一个相同),然后将其添加到 `keydir/home/desktop/` 中。另一个密钥可能放到 `keydir/home/desktop/` 中,依此类推。Gitolite 递归地在 `keydir` 中搜索与存储库“用户”匹配的 `.pub` 文件,并将所有匹配项视为相同的身份。 + +当你将密钥添加到 `keydir` 目录时,必须将它们提交回服务器。这是一件很容易忘记的事情,这里有一个使用自动化的 Git 应用程序(例如 [Sparkleshare] [7])的真正的理由,因此任何更改都将立即提交给你的 Gitolite 管理员。第一次忘记提交和推送,在浪费了三个小时的时间以及用户的故障排除时间之后,你会发现 Gitolite 是使用 Sparkleshare 的完美理由。 + +``` +$ git add keydir +$ git commit -m 'added alice-laptop-0.pub' +$ git push origin HEAD +``` + +默认情况下,Alice 可以访问 `testing.git` 目录,因此她可以使用该目录测试连接性和功能。 + +#### 设置权限 + +与用户一样,目录权限和组也是从你可能习惯的的常规 Unix 工具中抽象出来的(或可从在线信息查找)。在`gitolite-admin.git/conf` 目录中的 `gitolite.conf` 文件中授予对项目的权限。权限分为四个级别: + +* `R` 允许只读。在存储库上具有 `R` 权限的用户可以克隆它,仅此而已。 +* `RW` 允许用户执行分支的快进推送、创建新分支和创建新标签。对于大多数用户来说,这个或多或少感觉就像一个“普通”的 Git 存储库。 +* `RW+` 允许可能具有破坏性的 Git 动作。用户可以执行常规的快进推送、回滚推送、变基以及删除分支和标签。你可能想要或不希望将其授予项目中的所有贡献者。 +* `-` 明确拒绝访问存储库。这与未在存储库的配置中列出的用户相同。 + +通过调整 `gitolite.conf` 来创建一个新的存储库或修改现有存储库的权限。例如,授予 Alice 权限来管理一个名为 `widgets.git` 的新存储库: + +``` +repo gitolite-admin + RW+ = id_ed22519 + +repo testing + RW+ = @all + +repo widgets + RW+ = alice +``` + +现在,Alice(也仅 Alice 一个人)就可以克隆该存储库: + +``` +[alice]$ git clone git@example.com:widgets.git +Cloning into 'widgets'... +warning: You appear to have cloned an empty repository. +``` + +在第一次推送时,Alice 必须使用 `-u` 选项将其分支发送到空存储库(如同她在任何 Git 主机上做的一样)。 + +为了简化用户管理,你可以定义存储库组: + +``` +@qtrepo = widgets +@qtrepo = games + +repo gitolite-admin + RW+ = id_ed22519 + +repo testing + RW+ = @all + +repo @qtrepo + RW+ = alice +``` + +正如你可以创建组存储库一样,你也可以对用户进行分组。默认情况下存在一个用户组:`@all`。如你所料,它包括所有用户,无一例外。你也可以创建自己的组: + +``` +@qtrepo = widgets +@qtrepo = games + +@developers = alice bob + +repo gitolite-admin + RW+ = id_ed22519 + +repo testing + RW+ = @all + +repo @qtrepo + RW+ = @developers +``` + +与添加或修改密钥文件一样,对 `gitolite.conf` 文件的任何更改都必须提交并推送以生效。 + +### 创建存储库 + +默认情况下,Gitolite 假设存储库的创建是从上至下进行。例如,有权访问 Git 服务器的项目经理创建了一个项目存储库,并通过 Gitolite 管理仓库添加了开发人员。 + +实际上,你可能更愿意向用户授予创建存储库的权限。Gitolite 称这些为“野生仓库(通配仓库)wild repos”(我不确定这是关于仓库的形成方式的描述,还是指配置文件所需的通配符)。这是一个例子: + +``` +@managers = alice bob + +repo foo/CREATOR/[a-z]..* + C = @managers + RW+ = CREATOR + RW = WRITERS + R = READERS +``` + +第一行定义了一组用户:该组称为 `@managers`,其中包含用户 `alice` 和 `bob`。下一行设置了通配符允许创建尚不存在的存储库,放在名为 `foo` 的目录下的创建存储库的用户名的子目录中。例如: + +``` +[alice]$ git clone git@example.com:foo/alice/cool-app.git +Cloning into cool-app'... +Initialized empty Git repository in /home/git/repositories/foo/alice/cool-app.git +warning: You appear to have cloned an empty repository. +``` + +野生仓库的创建者可以使用一些机制来定义谁可以读取和写入其存储库,但是他们是被限定范围的。在大多数情况下,Gitolite 假定由一组特定的用户来管理项目权限。一种解决方案是使用 Git 挂钩授予所有用户对 `gitolite-admin` 的访问权限,以要求管理者批准将更改合并到 master 分支中。 + +### 了解更多 + +Gitolite 具有比此介绍性文章涵盖的更多功能,因此请尝试一下。其[文档][8]非常出色,一旦你通读了它,就可以自定义 Gitolite 服务器,以向用户提供你喜欢的任何级别的控制。Gitolite 是一种维护成本低、简单的系统,你可以安装、设置它,然后基本上就可以将其忘却。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/server-administration-git + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/server_data_system_admin.png?itok=q6HCfNQ8 (computer servers processing data) +[2]: https://git-scm.com/ +[3]: http://gitolite.com +[4]: http://gitea.io +[5]: Setting%20up%20SSH%20key%20authentication +[6]: mailto:git@example.com +[7]: https://opensource.com/article/19/4/file-sharing-git +[8]: http://gitolite.com/gitolite/quick_install.html From 8088857543ccc50aa24430c9481f64c85ae6d9ea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 12 Jan 2020 00:57:21 +0800 Subject: [PATCH 0206/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200111=20Sync?= =?UTF-8?q?=20files=20across=20multiple=20devices=20with=20Syncthing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200111 Sync files across multiple devices with Syncthing.md --- ... across multiple devices with Syncthing.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20200111 Sync files across multiple devices with Syncthing.md diff --git a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md new file mode 100644 index 0000000000..75c6161189 --- /dev/null +++ b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sync files across multiple devices with Syncthing) +[#]: via: (https://opensource.com/article/20/1/sync-files-syncthing) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Sync files across multiple devices with Syncthing +====== +Learn how to sync files between devices with Syncthing in the first +article in our series on 20 ways to be more productive with open source +in 2020. +![Files in a folder][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Syncing files with Synthing + +Setting up a new machine is a pain. We all have our "standard setups" that we copy from machine to machine. And over the years, I've used a lot of ways to keep them in sync between machines. In the old days (and this will tell you how old I am), it was with floppy disks, then Zip disks, USB sticks, SCP, Rsync, Dropbox, ownCloud—you name it. And they never seemed to work right for me. + +Then I stumbled upon [Syncthing][2]. + +![syncthing console][3] + +Syncthing is a lightweight, peer-to-peer file-synchronization system. You don't need to pay for a service, you don't need a third-party server, and it's fast. Much faster, in my experience, than many of the "big names" in file synchronization. + +Syncthing is available for Linux, MacOS, Windows, and several flavors of BSD. There is also an Android app (but nothing official for iOS yet). There are even handy graphical frontends for all of the above (although I'm not going to cover those here). On Linux, there are packages available for most distributions, so installation is very straightforward. + +![Installing Syncthing on Ubuntu][4] + +When you start Syncthing the first time, it launches a web browser to configure the daemon. There's not much to do on the first machine, but it is a good chance to poke around the user interface (UI) a little bit. The most important thing to see is System ID under the **Actions** menu in the top-right. + +![Machine ID][5] + +Once the first machine is set up, repeat the installation on the second machine. In the UI, there will be a button on the lower-right labeled **Add Remote Device**. Click the button, and you will be presented with a box to enter a **Device ID and a Name**. Copy and paste the **Device ID** from the first machine and click **Save**. + +You should see a pop-up on the first node asking to add the second. Once you accept it, the new machine will show up on the lower-right of the first one. Share the default directory with the second machine. Click on **Default Folder** and then click the **Edit** button. There are four links at the top of the pop-up. Click on **Sharing** and then select the second machine. Click **Save** and look at the second machine. You should get a prompt to accept the shared directory. Once you accept that, it will start synchronizing files between the two machines. + +![Sharing a directory in Syncthing][6] + +Test it out by copying a file to the default directory (**/your/home/Share**) on one of the machines. It should show up on the other one very quickly. + +You can add as many directories as you want or need to the sharing, which is pretty handy. As you can see in the first image, I have one for **myconfigs**—that's where I keep my configuration files. When I get a new machine, I just install Syncthing, and if I tune a configuration on one, I don't have to update all of them—it happens automatically. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-files-syncthing + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://syncthing.net/ +[3]: https://opensource.com/sites/default/files/uploads/productivity_1-1.png (syncthing console) +[4]: https://opensource.com/sites/default/files/uploads/productivity_1-2.png (Installing Syncthing on Ubuntu) +[5]: https://opensource.com/sites/default/files/uploads/productivity_1-3.png (Machine ID) +[6]: https://opensource.com/sites/default/files/uploads/productivity_1-4.png (Sharing a directory in Syncthing) From fce1ce02e1e0a3d85dee495e6bfc2cdf4001d3df Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 12 Jan 2020 09:27:05 +0800 Subject: [PATCH 0207/3057] PRF @robsean --- ...urce interior design with Sweet Home 3D.md | 78 +++++++++---------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md b/translated/tech/20191016 Open source interior design with Sweet Home 3D.md index ebc4a3bc70..bfabda6d1e 100644 --- a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md +++ b/translated/tech/20191016 Open source interior design with Sweet Home 3D.md @@ -1,115 +1,111 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Open source interior design with Sweet Home 3D) [#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) [#]: author: (Seth Kenlon https://opensource.com/users/seth) - Sweet Home 3D 开放源码室内设计 +Sweet Home 3D 开放源码室内设计 ====== -在你去真实世界购物前,在虚拟世界中尝试家具布局,配色方案等等。 -![Several houses][1] + +> 在你去真实世界购物前,在虚拟世界中尝试家具布局、配色方案等等。 + +![](https://img.linux.net.cn/data/attachment/album/202001/12/092633eyc3c9f7u3gfgj4e.jpg) 这里有关于如何装饰房间的三大流派: - 1. 购买一堆家具,并把它们塞进房间。 - 2. 仔细测量每件家具,计算房间的理论容量,然后把它们全部塞进房间,忽略你在床上放置一个书架的事实。 - 3. 使用一台计算机进行预先可视化。 +1. 购买一堆家具,并把它们塞进房间。 +2. 仔细测量每件家具,计算房间的理论容量,然后把它们全部塞进房间,忽略你在床上放置一个书架的事实。 +3. 使用一台计算机进行预先可视化。 +之前,我还实践了鲜为人知的第四个方式:不要家具。然而,自从我成为一个远程工作者,我发现家庭办公需要一些便利的设施,像一张桌子和一张椅子,一个用于存放参考书和技术手册的书架等等。因此,我一直在制定一个使用实际的家具来迁移我的生活和工作空间的计划,在该*计划*上强调由实木制作,而不是牛奶箱子(或胶水和锯末板之类的东西)。我最不想做的一件事:从旧货市场淘到得宝贝带回家时,发现其进不了门,或者比另一件家具大很多。 - -从历史观点上说,我实践了鲜为人知的第四条原则:没有家具。然而,自从我成为一个远程工作者,我发现家庭办公需要一些便利的设施,像一张桌子和一张椅子,一个用于存放参考书和技术手册的书架等等。因此,我一直在制定一个使用实际的家具来迁移我的生活和工作空间的计划,在 _计划_ 上强调由实木制作,而不是牛奶箱子(或胶水和锯末,或同样的东西)。我最不想做的一件事:从旧货市场淘到得宝贝带回家时,发现其进不了门,或者比另一件家具大很多。 - -是时候做专业人士该做的事了。是时候视觉预览了。 +是时候做专业人士该做的事了,是时候做视觉预览了。 ### 开放源码室内设计 -[Sweet Home 3D][2] 是一个开放源码 (GPLv2) 室内设计应用程序,帮助你绘制你的住宅平面图,然后定义,重新调整大小以及安排家具。你可以使用精确的尺寸来完成这些,精确到一厘米以下,而不使用任何数学运算,仅使用简单的拖拽操作。当你完成后,你可以在 3D 中查看结果。如果你可以在一个 word 程序中创建一个基本的表格(不是家具类),你可以在 Sweet Home 3D 中规划你家的室内设计。 +[Sweet Home 3D][2] 是一个开源的(GPLv2)室内设计应用程序,可以帮助你绘制你的住宅平面图,然后定义、重新调整大小以及安排家具。你可以使用精确的尺寸来完成这些,精确到一厘米以下,而不使用任何数学运算,仅使用简单的拖拽操作就行。当你完成后,你可以以 3D 方式查看结果。在 Sweet Home 3D 中规划你家的室内设计,就和在 Word 程序中创建基本的表格一样简单。 ### 安装 -Sweet Home 3D 是一个 [Java][3] 应用程序,因此它是通用的。它运行在任何可以运行 Java 的操作系统上,包括 Linux ,Windows ,MacOS 和 BSD 。不用理会你的操作系统,你可以从网站 [下载][4] 应用程序。 +Sweet Home 3D 是一个 [Java][3] 应用程序,因此它是平台通用的。它运行在任何可以运行 Java 的操作系统上,包括 Linux、Windows、MacOS 和 BSD 。不用理会你的操作系统,你可以从网站[下载][4]该应用程序。 - * 在 Linux 上,[untar][5] 存档文件。在 SweetHome3D 文件上右键单击,并选择**属性**。在**权限**选项卡中,授予文件可执行权限。 - * 在 MacOS 和 Windows 上,展开存档文件并启动应用程序。当系统提示时,你必需授予它权限来在你的系统上运行。 +* 在 Linux 上,[untar][5] 存档文件。在 `SweetHome3D` 文件上右键单击,并选择**属性**。在**权限**选项卡中,授予文件可执行权限。 +* 在 MacOS 和 Windows 上,展开存档文件并启动应用程序。当系统提示时,你必需授予它权限来在你的系统上运行。 ![Sweet Home 3D permissions][6] -在 Linux 上,你也可以像一个 Snap 软件包一样安装 Sweet Home 3D ,前提是你已经安装并启用 **snapd** 。 +在 Linux 上,你也可以像一个 Snap 软件包一样安装 Sweet Home 3D ,前提是你已经安装并启用 **snapd**。 ### 成功的测量 -首先:打开你的卷尺。为充分利用 Sweet Home 3D ,你必须知道你计划生活空间的实际尺寸。你可能需要测量到毫米或1/16英寸;你知道你自己对变化幅度的容忍度。但是你必需获得基本的尺寸,包括材料墙壁和门窗。 +首先:打开你的卷尺。为充分利用 Sweet Home 3D,你必须知道你所计划的生活空间的实际尺寸。你可能需要测量精度到毫米或 1/16 英寸;你可以自己把握对偏差幅度的容忍度。但是你必需获得基本的尺寸,包括测量墙壁和门窗。 -用你最好的判断力来判断常识。例如,当测量门时,包括门框; - -虽然从技术上讲它不是 _门_ 本身的一部分,它可能是你不想用家具覆盖的墙壁空间的一部分。 +用你最好的判断力来判断常识。例如,当测量门时,包括门框;虽然从技术上讲它不是*门*本身的一部分,但它可能是你不想用家具遮挡的一部分墙壁空间。 ![Measure twice, execute once][7] -CC-SA-BY opensource.com - ### 创建一间房间 -当你第一次启动 Sweet Home 3D 时,它会以它的默认查看模式来打开一个空白的画布,蓝图视图在顶部面板中,3D 渲染在底部面板中。在我的 [Slackware][8] 桌面计算机上,这项工作非常友好,但是我的桌面计算机也是我的视频编辑和游戏计算机,所以它有一个极好的 3D 渲染显卡。在我的笔记本计算机上,这种视图模式是非常慢的。为了最好的性能(尤其是在一台计没有 3D 渲染的专用计算机上),转到窗口顶部的 **3D 视图** 菜单,并选择 **虚拟访问** 。这个视图模式基于虚拟访客的位置从地面视图渲染你的工作。这意味着你可以控制渲染的东西和时机。 +当你第一次启动 Sweet Home 3D 时,它会以其默认查看模式来打开一个空白的画布,蓝图视图在顶部面板中,3D 渲染在底部面板中。在我的 [Slackware][8] 桌面计算机上,它可以很好地工作,不过我的桌面计算机也是我的视频编辑和游戏计算机,所以它有一个极好的 3D 渲染显卡。在我的笔记本计算机上,这种视图模式是非常慢的。为了最好的性能(尤其是在一台计没有 3D 渲染的专用计算机上),转到窗口顶部的 **3D 视图** 菜单,并选择 **虚拟访问** 。这个视图模式基于虚拟访客的位置从地面视图渲染你的工作。这意味着你可以控制渲染的内容和时机。 -不顾你计算机的功率来切换到这个视图的有意义的,因为地表以上的 3D 渲染不比蓝图平面图向你提供更多有用的详细信息。在你更改视图模式后,你可以开始设计。 +不管你计算机是否强力,切换到这个视图的有意义的,因为地表以上的 3D 渲染不比蓝图平面图向你提供更多有用的详细信息。在你更改视图模式后,你可以开始设计。 -第一步是定义你家的墙壁。使用**创建墙壁**工具完成,在顶部工具栏的右侧找到 **手** 图标。绘制墙壁很简单:单击你想要墙壁开始的位置,单击以锚定位置,不断单击锚定,直到你的房间完成。 +第一步是定义你家的墙壁。使用**创建墙壁**工具完成,可以在顶部工具栏的**手形**图标右侧找到。绘制墙壁很简单:单击你想要墙壁开始的位置,单击以锚定位置,不断单击锚定,直到你的房间完成。 ![Drawing walls in Sweet Home 3D][9] -在你闭合墙壁后,按**Esc**来退出工具。 +在你闭合墙壁后,按 `Esc` 来退出工具。 #### 定义一间房间 -Sweet Home 3D 在你如何创建墙壁的问题上是灵活的。你可以先绘制你房子的外部边界,然后再细分内部,或者你可以绘制每个房间作为结成一体的"容器",最终形成你房子所占的空间量。这种灵活性是能做到的,因为在现实生活中和在 Sweet Home 3D 中,墙壁并不总是定义一间房间。为定义一间房间,使用在顶部工具栏的**创建墙壁** 按钮右侧的 **创建房间** 按钮。 +Sweet Home 3D 在你如何创建墙壁的问题上是灵活的。你可以先绘制你房子的外部边界,然后再细分内部,或者你可以绘制每个房间作为结成一体的“容器”,最终形成你房子所占的空间量。这种灵活性是能做到的,因为在现实生活中和在 Sweet Home 3D 中,墙壁并不总是用来定义一间房间。为定义一间房间,使用在顶部工具栏的**创建墙壁**按钮右侧的**创建房间**按钮。 -如果房间的地板空间是通过四面墙所定义,你们你需要做的全部的定义是像一间房间一样在四面墙壁内双击来圈占地方。Sweet Home 3D 将定义空间为一间房间,并根据你的喜好,以英尺或米为单位向你提供房间的面积。 +如果房间的地板空间是通过四面墙所定义,你需要做的全部的定义是像一间房间一样在四面墙壁内双击来圈占地方。Sweet Home 3D 将定义该空间为一间房间,并根据你的喜好,以英尺或米为单位向你提供房间的面积。 对于不规则的房间,你必需使用每次单击来手动定义房间的每个墙角。根据房间形状的复杂性,你可能不得不进行试验来发现你是否需要从你的原点来顺时针或逆时针工作,以避免奇怪的莫比斯条形地板。不过,一般来说,定义一间房间的地板空间是简单的。 ![Defining rooms in Sweet Home 3D][10] -在你给定房间一层地板后,你可以更改到 **箭头** 工具,并在房间上双击来给予它一个名称。你也可以设置地板,墙壁,天花板和踢脚板的颜色及纹理。 +在你给定房间一层地板后,你可以更改到**箭头**工具,并在房间上双击来给予它一个名称。你也可以设置地板、墙壁、天花板和踢脚线的颜色及纹理。 ![Modifying room floors, ceilings, etc. in Sweet Home 3D][11] -默认情况下,这些都不会在蓝图视图中渲染。为启用在你蓝图面板中的房间渲染,转到 **文件** 菜单并选择 **首选项** 。在 **首选项** 面板中,设置 **平面图中房间渲染** 为 **地板颜色或纹理** 。 +默认情况下,这些都不会在蓝图视图中渲染。为启用在你蓝图面板中的房间渲染,转到**文件**菜单并选择**首选项**。在**首选项**面板中,设置**平面图中房间渲染**为**地板颜色或纹理**。 ### 门和窗 -在你完成基本的地板平面图后,你可以长期地切换到 **箭头** 工具。 +在你完成基本的地板平面图后,你可以长期地切换到**箭头**工具。 -你可以在 Sweet Home 3D 的左栏中的 **门和窗** 类别下找到门和窗。你有很多选择,所以选择最接近你家的东西。 +你可以在 Sweet Home 3D 的左栏中的**门和窗**类别下找到门和窗。你有很多选择,所以选择最接近你家的东西。 ![Moving a door in Sweet Home 3D][12] -为放置一扇门或窗到你的平面图中,在你的蓝图平面图中的合适的墙壁上拖拽门或窗。为调整它的位置和大小,双击门或窗。 +为放置一扇门或窗到你的平面图中,在你的蓝图平面图中的合适的墙壁上拖拽门或窗。要调整它的位置和大小,请双击门或窗。 ### 添加家具 -随着基本计划完成,部分工作感觉像 _工作_ 结束了!从这点继续,你可以玩弄家具布置以及其它装饰。 +随着基本平面图完成,这部分工作感觉像是结束了!从这点继续,你可以摆弄家具布置以及其它装饰。 -你可以在左栏中找到家具,按每个计划的房间来组织。你可以拖拽任何项目到你的蓝图平面图中,当你的鼠标悬停在项目的区域上时,使用可视化工具控制方向和大小。在任何项目上双击双击来调整它的颜色和成品表面。 +你可以在左栏中找到家具,按预期的方式来组织每个房间。你可以拖拽任何项目到你的蓝图平面图中,当你的鼠标悬停在项目的区域上时,使用可视化工具控制方向和大小。在任何项目上双击双击来调整它的颜色和成品表面。 -### 访问和导出 +### 查看和导出 -为了看看你未来的家将会看起来是什么样子,在你的蓝图视图中拖拽"人"图标到一个房间中。 +为了看看你未来的家将会看起来是什么样子,在你的蓝图视图中拖拽“人”图标到一个房间中。 ![Sweet Home 3D rendering][13] -你可以在现实主义和仅感受空间感之间找到自己的平衡,只要你的想象力是你唯一的限制。你可以从 Sweet Home 3D [下载页面][4] 获取附加的有用的资源来添加到你的家中。你甚至可以使用 **库编辑器** 应用程序创建你自己的家具和纹理,它们可以从项目网站有选择地下载。 +你可以在现实和空间感受之间找到自己的平衡,你的想象力是你唯一的限制。你可以从 Sweet Home 3D [下载页面][4]获取附加的有用的资源来添加到你的家中。你甚至可以使用**库编辑器**应用程序创建你自己的家具和纹理,它可以从该项目的网站下载。 Sweet Home 3D 可以导出你的蓝图平面图为 SVG 格式,以便在 [Inkscape][14] 中使用,并且它可以导出你的 3D 模型为 OBJ 格式,以便在 [Blender][15] 中使用。为导出你的蓝图,转到**平面图**菜单,并选择**导出为 SVG 格式**。为导出一个 3D 模型,转到 **3D 视图** 菜单并选择**导出为 OBJ 格式**。 -你也可以拍摄你家的"快照,以便于不打开 Sweet Home 3D 而参考你的想法。为创建一个快照,转到 **3D视图** 菜单并选择 **创建照片**。快照是按照蓝图视图中的人的图标的角度展现的,因此按照需要调整,然后在 **创建照片** 窗口中单击 **创建** 按钮。 如果你对快照满意,单击 **保存** 。 +你也可以拍摄你家的"快照,以便于不打开 Sweet Home 3D 而回顾你的想法。为创建一个快照,转到 **3D 视图**菜单并选择**创建照片**。快照是按照蓝图视图中的人的图标的角度展现的,因此按照需要调整,然后在**创建照片**窗口中单击**创建**按钮。如果你对快照满意,单击**保存**。 ### 甜蜜的家 -在 Sweet Home 3D 中有更多的特色。你可以添加一片天空和一片草坪,为你的照片定位光线,设置天花板高度,给你房子添加另一楼层等等。不管你打算租一套公寓,还是买一套房子—或是(还)尚不存在的房子,Sweet Home 3D 是一款简单迷人的应用程序,当你匆忙购买家具时,它可以娱乐并帮助你做出更好的购买选择。因此,你终于可以停止在厨房的柜台上吃早餐以及蹲在地上工作。 +在 Sweet Home 3D 中有更多的特色。你可以添加一片天空和一片草坪,为你的照片定位光线,设置天花板高度,给你房子添加另一楼层等等。不管你是打算租一套公寓,还是买一套房子,或是(尚)不存在的房子,Sweet Home 3D 是一款简单迷人的应用程序,当你匆忙购买家具时,它可以帮助你快乐地做出更好的购买选择。因此,你终于可以停止在厨房的柜台上吃早餐以及蹲在地上工作了。 -------------------------------------------------------------------------------- @@ -118,7 +114,7 @@ via: https://opensource.com/article/19/10/interior-design-sweet-home-3d 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9cbad661076712210ebe606cdbb80d3dcf7a2839 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 12 Jan 2020 09:29:37 +0800 Subject: [PATCH 0208/3057] PUB @robsean https://linux.cn/article-11774-1.html --- ...20191016 Open source interior design with Sweet Home 3D.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191016 Open source interior design with Sweet Home 3D.md (99%) diff --git a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md b/published/20191016 Open source interior design with Sweet Home 3D.md similarity index 99% rename from translated/tech/20191016 Open source interior design with Sweet Home 3D.md rename to published/20191016 Open source interior design with Sweet Home 3D.md index bfabda6d1e..814f0bdb23 100644 --- a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md +++ b/published/20191016 Open source interior design with Sweet Home 3D.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11774-1.html) [#]: subject: (Open source interior design with Sweet Home 3D) [#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 5a3a8442208994562e3494b29e5d5b5bc948624c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 13 Jan 2020 00:52:44 +0800 Subject: [PATCH 0209/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200112=20What?= =?UTF-8?q?=20I=20learned=20going=20from=20prison=20to=20Python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200112 What I learned going from prison to Python.md --- ...t I learned going from prison to Python.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20200112 What I learned going from prison to Python.md diff --git a/sources/tech/20200112 What I learned going from prison to Python.md b/sources/tech/20200112 What I learned going from prison to Python.md new file mode 100644 index 0000000000..84dfa73ecb --- /dev/null +++ b/sources/tech/20200112 What I learned going from prison to Python.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What I learned going from prison to Python) +[#]: via: (https://opensource.com/article/20/1/prison-to-python) +[#]: author: (Shadeed "Sha" Wallace-Stepter https://opensource.com/users/shastepter) + +What I learned going from prison to Python +====== +How open source programming can offer opportunities after incarceration. +![Programming books on a shelf][1] + +Less than a year ago, I was in San Quentin State Prison serving a life sentence. + +In my junior year in high school, I shot a man while robbing him. Now, it took a while for me to see or even admit that what I did was wrong, but after going through a jury trial and seeing the devastating consequences of my actions, I knew that I needed to make a change, and I did. And although it was a great thing that I had changed, I had still shot a man and nearly killed him. And there are consequences to doing something like that, and rightfully so. So at the age of 18, I was sentenced to life in prison. + +Now prison is a terrible place; I do not recommend it. But I had to go and so I went. I’ll spare you the details, but you can rest assured it’s a place where there isn’t much incentive to change, and many people pick up more bad habits than they went in with. + +I’m one of the lucky ones. While I was in prison, something different happened. I started to imagine a future for myself beyond the prison bars where, up until that point, I had spent all of my adult life. + +Now YOU think about this: I’m black, with nothing more than a high school education. I had no work history, and if I ever were to leave prison, I would be a convicted felon upon my release. And I think I’m being fair when I say that the first thought for an employer who sees this profile is not "I need to hire this person." + +My options weren’t clear, but my mind was made up. I needed to do something to survive that wouldn’t look anything like my life before prison. + +### A path to Python + +Eventually, I wound up in San Quentin State Prison, and I had no idea how lucky I was to be there. San Quentin offered several self-help and education programs. These [rehabilitation opportunities][2] ensured prisoners had skills that helped them avoid being repeat offenders upon release. + +As part of one of these programs, I met [Jessica McKellar][3] in 2017 through her work with the San Quentin Media Program. Jessica is an enthusiast of the programming language [Python][4], and she started to sell me on how great Python is and how it’s the perfect language to learn for someone just starting out. And this is where the story becomes stranger than fiction. + +  + +> Thanks [@northbaypython][5] for letting [@ShaStepter][6] and me reprise our [@pycon][7] keynotes to get them recorded. I'm honored to share: +> +> From Prison to Python: +> +> Mass Decarceration: If We Don't Hire People With Felony Convictions, Who Will? [pic.twitter.com/Kpjo8d3ul6][8] +> +> — Jessica McKellar (@jessicamckellar) [November 5, 2019][9] + +  + +Jessica told me about these Python video tutorials that she did for a company called [O’Reilly Media][10], that they were online, and how great it would be if I could get access to them. Unfortunately, internet access in prison isn’t a thing. But, I had met this guy named Tim O’Reilly, who had recently come to San Quentin. It turns out that, after his visit, Tim had donated a ton of content from his company, O’Reilly Media, to the prison’s programming class. I wound up getting my hands on a tablet that had Jessica’s Python tutorials on it and learned how to code using those Python tutorials. + +It was incredible. Total strangers with a very different background and life from my own had connected the dots in a way that led to me learning to code. + +### The love of the Python community + +After this point, I started meeting with Jessica pretty frequently, and she began to tell me about the open source community. What I learned is that, on a fundamental level, open source is about fellowship and collaboration. It works so well because no one is excluded. + +And for me, someone who struggled to see where they fit, what I saw was a very basic form of love—love by way of collaboration and acceptance, love by way of access, love by way of inclusion. And my spirit yearned to be a part of it. So I continued my education with Python, and, unfortunately, I wasn’t able to get more tutorials, but I was able to draw from the vast wealth of written knowledge that has been compiled by the open source community. I read anything that even mentioned Python, from paperback books to obscure magazine articles, and I used the tablet that I had to solve the Python problems that I read about. + +My passion for Python and programming wasn’t something that many of my peers shared. Aside from the very small group of people who were in the prison’s programming class, no one else that I knew had ever mentioned programming; it’s just not on the average prisoner’s radar. I believe that this is due to the perception that programming isn’t accessible to people who have experienced incarceration, especially if you are a person of color. + +### Life with Python outside of prison + +Then, on August 17, 2018, I got the surprise of my life. Then-Governor Jerry Brown commuted my 27-years-to-life sentence, and I was released from prison after serving almost 19 years. + +But here’s the reality of my situation and why I believe that programming and the open source community are so valuable. I am a 37-year-old, black, convicted felon, with no work history, who just served 18 years in prison. There aren’t many professions that exist that would prevent me from being at the mercy of the stigmas and biases that inevitably accompany my criminal past. But one of the few exceptions is programming. + +The people who are now returning back to society after incarceration are in desperate need of inclusion, but when the conversation turns to diversity in the workplace and how much it’s needed, you really don’t hear this group being mentioned or included. + +  + +> What else: +> +> 1\. Background checks: ask how they are used at your company. +> +> 2\. Entry-level roles: remove fake, unnecessary prerequisites that will exclude qualified people with records. +> +> 3\. Active outreach: partner with local re-entry programs to create hiring pipelines. [pic.twitter.com/WnzdEUTuxr][11] +> +> — Jessica McKellar (@jessicamckellar) [May 12, 2019][12] + +  + +So with that, I want to humbly challenge all of the programmers and members of the open source community to expand your thinking around inclusion and diversity. I proudly stand before you today as the representative of a demographic that most people don’t think about—formerly incarcerated people. But we exist, and we are eager to prove our value, and, above all else, we are looking to be accepted. Many challenges await us upon our reentry back into society, and I ask that you allow us to have the opportunity to demonstrate our worth. Welcome us, accept us, and, more than anything else, include us. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/prison-to-python + +作者:[Shadeed "Sha" Wallace-Stepter][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shastepter +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_programming_languages.jpg?itok=KJcdnXM2 (Programming books on a shelf) +[2]: https://www.dailycal.org/2019/02/27/san-quentin-rehabilitation-programs-offer-inmates-education-a-voice/ +[3]: https://twitter.com/jessicamckellar?lang=en +[4]: https://www.python.org/ +[5]: https://twitter.com/northbaypython?ref_src=twsrc%5Etfw +[6]: https://twitter.com/ShaStepter?ref_src=twsrc%5Etfw +[7]: https://twitter.com/pycon?ref_src=twsrc%5Etfw +[8]: https://t.co/Kpjo8d3ul6 +[9]: https://twitter.com/jessicamckellar/status/1191601209917837312?ref_src=twsrc%5Etfw +[10]: http://shop.oreilly.com/product/110000448.do +[11]: https://t.co/WnzdEUTuxr +[12]: https://twitter.com/jessicamckellar/status/1127640222504636416?ref_src=twsrc%5Etfw From 47cae5389da7cf4d305b6ca36f25dfb8bb0bd097 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 13 Jan 2020 00:53:18 +0800 Subject: [PATCH 0210/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200112=20Use?= =?UTF-8?q?=20Stow=20for=20configuration=20management=20of=20multiple=20ma?= =?UTF-8?q?chines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200112 Use Stow for configuration management of multiple machines.md --- ...uration management of multiple machines.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20200112 Use Stow for configuration management of multiple machines.md diff --git a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md new file mode 100644 index 0000000000..68a1eb0ebc --- /dev/null +++ b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Stow for configuration management of multiple machines) +[#]: via: (https://opensource.com/article/20/1/configuration-management-stow) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use Stow for configuration management of multiple machines +====== +Learn how to use Stow to manage configurations across machines in the +second article in our series on 20 ways to be more productive with open +source in 2020. +![A person programming][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Manage symlinks with Stow + +Yesterday, I explained how I keep my files in sync across multiple machines with [Syncthing][2]. But that's only one of the tools I use to keep my configurations consistent. The other is a seemingly simple tool called [Stow][3]. + +![Stow help screen][4] + +Stow manages symlinks. By default, it makes symlinks from the directory it is in to the directory below it. There are also options to set a source and target directory, but I don't usually use them. + +As I mentioned in the Syncthing [article][5], I use Syncthing to keep a directory called **myconfigs** consistent across all of my machines. The **myconfigs** directory has several subdirectories underneath it. Each subdirectory contains the configuration files for one of the applications I use regularly. + +![myconfigs directory][6] + +On each machine, I change to the **myconfigs** directory and run **stow -S <directory name>** to symlink the files inside the directory to my home directory. For example, under the **vim** directory, I have my **.vimrc** and **.vim** directories. On each machine, I run **stow -S vim** to create the symlinks **~/.vimrc** and **~/.vim**. When I make a change to my Vim configuration on one machine, it applies to ALL of my machines. + +Sometimes, though, I need something machine-specific, which is why I have directories like **msmtp-personal** and **msmtp-elastic** (my employer). Since my **msmtp** SMTP client needs to know what email server to relay through, and each one has different setups and credentials, I can use Stow to swap between the two by "unstowing" one with the **-D** flag and then putting the other in place. + +![Unstow one, stow the other][7] + +Sometimes I find myself adding files to a configuration. For that, there is the "restow" option with **-R**. For example, I like to use a specific font when I use Vim as a graphical application and not a console. The **.gvimrc** file lets me set options that apply only to the graphical version, in addition to the standard **.vimrc** file. When I first set this up, I moved **~/.gvimrc** to **~/myconfigs/vim** and then ran **stow -R vim**, which unlinks and relinks everything in that directory. + +Stow lets me switch between several configurations with a simple command line and, in combination with Syncthing, I can be sure that I have the setup I like for the tools I use ready to go, no matter where I am or where I make changes. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/configuration-management-stow + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://syncthing.net/ +[3]: https://www.gnu.org/software/stow/ +[4]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png (Stow help screen) +[5]: https://opensource.com/article/20/1/20-productivity-tools-syncthing +[6]: https://opensource.com/sites/default/files/uploads/productivity_2-2.png (myconfigs directory) +[7]: https://opensource.com/sites/default/files/uploads/productivity_2-3.png (Unstow one, stow the other) From 773790f4d732b098da0a4de7b1de6cc4dd2a2d18 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 13 Jan 2020 09:00:41 +0800 Subject: [PATCH 0211/3057] translating --- ...ic sequences with the Linux seq command.md | 165 ------------------ ...ic sequences with the Linux seq command.md | 153 ++++++++++++++++ 2 files changed, 153 insertions(+), 165 deletions(-) delete mode 100644 sources/tech/20200107 Generating numeric sequences with the Linux seq command.md create mode 100644 translated/tech/20200107 Generating numeric sequences with the Linux seq command.md diff --git a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md deleted file mode 100644 index 7ae48a2785..0000000000 --- a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md +++ /dev/null @@ -1,165 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Generating numeric sequences with the Linux seq command) -[#]: via: (https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Generating numeric sequences with the Linux seq command -====== -The Linux seq command can generate lists of numbers and at lightning speed. It's easy to use and flexible, too. -[Jamie][1] [(CC BY 2.0)][2] - -One of the easiest ways to generate a list of numbers in Linux is to use the **seq** (sequence) command. In its simplest form, **seq** will take a single number and then list all the numbers from 1 to that number. For example: - -``` -$ seq 5 -1 -2 -3 -4 -5 -``` - -Unless directed otherwise, **seq** always starts with 1. You can start a sequence with a different number by inserting it before the final number. - -``` -$ seq 3 5 -3 -4 -5 -``` - -### Specifying an increment - -You can also specify an increment. Say you want to list multiples of 3. Specify your starting point (first 3 in this example), increment (second 3) and end point (18). - -[][3] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][3] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -``` -$ seq 3 3 18 -3 -6 -9 -12 -15 -18 -``` - -You can elect to go from larger to smaller numbers by using a negative increment (i.e., a decrement). - -``` -$ seq 18 -3 3 -18 -15 -12 -9 -6 -3 -``` - -The **seq** command is also very fast. You can probably generate a list of a million numbers in under 10 seconds. - -Advertisement - -``` -$ time seq 1000000 -1 -2 -3 -… -… -999998 -999999 -1000000 - -real 0m9.290s <== 9+ seconds -user 0m0.020s -sys 0m0.899s -``` - -## Using a separator - -Another very useful option is to use a separator. Instead of listing a single number on each line, you can insert commas, colons or some other characters. The -s option followed by the character you wish to use. - -``` -$ seq -s: 3 3 18 -3:6:9:12:15:18 -``` - -In fact, if you simply want your numbers to be listed on a single line, you can use a blank as your separator in place of the default linefeed. - -**[ Also see [Invaluable tips and tricks for troubleshooting Linux][4]. ]** - -``` -$ seq -s' ' 3 3 18 -3 6 9 12 15 18 -``` - -### Getting to the math - -It may seem like a big leap to go from generating a sequence of numbers to doing math, but given the right separators, **seq** can easily prepare calculations that you can pass to **bc**. For example: - -``` -$ seq -s* 5 | bc -120 -``` - -What is going on in this command? Let’s take a look. First, **seq** is generating a list of numbers and using * as the separator. - -``` -$ seq -s* 5 -1*2*3*4*5 -``` - -It’s then passing the string to the calculator (**bc**) which promptly multiplies the numbers. And you can do a fairly extensive calculation in a fraction of a second. - -``` -$ time seq -s* 117 | bc -39699371608087208954019596294986306477904063601683223011297484643104\ -22041758630649341780708631240196854767624444057168110272995649603642\ -560353748940315749184568295424000000000000000000000000000 - -real 0m0.003s -user 0m0.004s -sys 0m0.000s -``` - -### Limitations - -You only get to choose one separator, so your calculations will be very limited. Use **bc** by itself for more complicated math. In addition, **seq** only works with numbers. To generate a sequence of single letters, use a command like this instead: - -``` -$ echo {a..g} -a b c d e f g -``` - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://creativecommons.org/licenses/by/2.0/ -[2]: https://creativecommons.org/licenses/by/2.0/legalcode -[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[4]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md b/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md new file mode 100644 index 0000000000..0b12dfb508 --- /dev/null +++ b/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Generating numeric sequences with the Linux seq command) +[#]: via: (https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 Linux seq 命令生成数字序列 +====== +Linux seq 命令可以以闪电般的速度生成数字列表。它易于使用而且灵活。 +[Jamie][1] [(CC BY 2.0)][2] + +在 Linux 中生成数字列表的最简单方法之一是使用 **seq**(sequence)命令。最简单的形式是,**seq** 接收一个数字,并输出从 1 到该数字的列表。例如: + +``` +$ seq 5 +1 +2 +3 +4 +5 +``` + +除非另有指定,否则 **seq** 始终以 1 开头。你可以在最终数字前面插上不同数字开始。 + +``` +$ seq 3 5 +3 +4 +5 +``` + +### 指定增量 + +你还可以指定增量。假设你要列出 3 的倍数。指定起点(在此示例中为第一个 3 ),增量(第二个 3)和终点(18)。 + +``` +$ seq 3 3 18 +3 +6 +9 +12 +15 +18 +``` + +你可以选择使用负增量(即减量)将数字从大变小。 + +``` +$ seq 18 -3 3 +18 +15 +12 +9 +6 +3 +``` + +**seq** 命令也非常快。你或许可以在 10 秒内生成一百万个数字的列表。 + +Advertisement + +``` +$ time seq 1000000 +1 +2 +3 +… +… +999998 +999999 +1000000 + +real 0m9.290s <== 9+ seconds +user 0m0.020s +sys 0m0.899s +``` + +## 使用分隔符 + +另一个非常有用的选项是使用分隔符。你可以插入逗号,冒号或其他一些字符,而不是在每行上列出单个数字。-s 选项后跟要使用的字符。 + +``` +$ seq -s: 3 3 18 +3:6:9:12:15:18 +``` + +实际上,如果只是希望将数字列在一行上,那么可以使用空格代替默认的换行符。 + +``` +$ seq -s' ' 3 3 18 +3 6 9 12 15 18 +``` + +### 开始数学运算 + +从生成数字序列到进行数学运算似乎是一个巨大的飞跃,但是有了正确的分隔符,**seq** 可以轻松地传递给 **bc** 进行计算。例如: + +``` +$ seq -s* 5 | bc +120 +``` + +该命令中发生了什么?让我们来看看。首先,**seq** 生成一个数字列表,并使用 \* 作为分隔符。 + +``` +$ seq -s* 5 +1*2*3*4*5 +``` + +然后,它将字符串传递给计算器 (**bc**),计算器立即将数字相乘。你可以在不到一秒的时间内进行相当广泛的计算。 + +``` +$ time seq -s* 117 | bc +39699371608087208954019596294986306477904063601683223011297484643104\ +22041758630649341780708631240196854767624444057168110272995649603642\ +560353748940315749184568295424000000000000000000000000000 + +real 0m0.003s +user 0m0.004s +sys 0m0.000s +``` + +### 局限性 + +你只能选择一个分隔符,因此计算将非常有限。单独使用 **bc** 可进行更复杂的数学运算。此外,**seq** 仅适用于数字。要生成单个字母序列,请改用如下命令: + +``` +$ echo {a..g} +a b c d e f g +``` + +加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://creativecommons.org/licenses/by/2.0/ +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 0bd08ea3ea61f05e9c26a8a5d88480ebb7dae16a Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 13 Jan 2020 09:05:58 +0800 Subject: [PATCH 0212/3057] translating --- ...0200111 Sync files across multiple devices with Syncthing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md index 75c6161189..d662fc1a78 100644 --- a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md +++ b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 753e745388fb59dcf9ef49365286c9f9987b132a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 09:06:51 +0800 Subject: [PATCH 0213/3057] PRF @geekpi --- ...VLC More Awesome With These Simple Tips.md | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md index 7363cb7992..350fa16604 100644 --- a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md +++ b/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Make VLC More Awesome With These Simple Tips) @@ -10,20 +10,19 @@ 这些简单的技巧使 VLC 更加出色 ====== -如果 [VLC][1] 不是最好的播放器,那它是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。 +如果 [VLC][1] 不是最好的播放器,那它也是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。 你可以进行许多复杂的任务,如直播视频、捕捉设备等。只需打开菜单,你就可以看到它有多少选项。 -它的 FOSS 页面有一个详细的教程,讨论一些[专业的 VLC 技巧][3],但这些对于普通用户太复杂。 +我们有一个详细的教程,讨论一些[专业的 VLC 技巧][3],但这些对于普通用户太复杂。 -这就是为什么我写另一篇文章的原因,来向你展示一些可以在 VLC 中使用的简单技巧。 +这就是为什么我要写另一篇文章的原因,来向你展示一些可以在 VLC 中使用的简单技巧。 ### 使用这些简单技巧让 VLC 做更多事 -Let’s see what can you do with VLC other than just playing a video file. 让我们看看除了播放视频文件之外,你还可以使用 VLC 做什么。 -#### 1\. 使用 VLC 观看 YouTube 视频 +#### 1、使用 VLC 观看 YouTube 视频 ![][4] @@ -31,65 +30,60 @@ Let’s see what can you do with VLC other than just playing a video file. 是的,在 VLC 上流式传输 YouTube 视频是非常容易的。 -只需启动 VLC 播放器,前往媒体设置,然后单击 ”**Open Network Stream**“ 或使用快捷方式 **CTRL + N**。 +只需启动 VLC 播放器,前往媒体设置,然后单击 ”Open Network Stream“ 或使用快捷方式 `CTRL + N`。 ![][6] -接下来,你只需要粘贴要观看的视频的 URL。有一些选项可以调整,但通常你无需担心这些。如果你好奇,你可以点击 ”**Advanced options**“ 来探索。 +接下来,你只需要粘贴要观看的视频的 URL。有一些选项可以调整,但通常你无需担心这些。如果你好奇,你可以点击 ”Advanced options“ 来探索。 你还可以通过这种方式向 YouTube 视频添加字幕。然而,[一个更简单的带字幕观看 Youtube 视频的办法是使用 Penguin 字幕播放器][7]。 -#### 2\. 将视频转换为不同格式 +#### 2、将视频转换为不同格式 ![][8] 你可以[在 Linux 命令行使用 ffmpeg 转换视频][9]。你还可以使用图形工具,如 [HandBrake 转换视频格式][10]。 -但是,如果你不想用一个单独的应用转码视频,你可以使用 VLC 播放器来完成该工作。 +但是,如果你不想用一个单独的应用来转码视频,你可以使用 VLC 播放器来完成该工作。 -为此,只需点击 VLC 上的媒体选项,然后单击 **Convert/Save**,或者在 VLC 播放器处于活动状态时按下快捷键 CTRL + R。 +为此,只需点击 VLC 上的媒体选项,然后单击 “Convert/Save”,或者在 VLC 播放器处于活动状态时按下快捷键 `CTRL + R`。接下来,你需要从计算机/硬盘或者 URL 导入你想保存/转换的的视频。 -接下来,你需要从计算机/硬盘或者 URL 导入你想保存/转换的的视频。 - -不管什么来源,只需选择文件后点击 ”**Convert/Save**“ 按钮 - -你现在会看到另外一个窗口给你更改 ”**Profile**“ 设置。点击并选择你想转换的格式(并保存)。 +不管是什么来源,只需选择文件后点击 “Convert/Save” 按钮。你现在会看到另外一个窗口可以更改 “Profile” 设置。点击并选择你想转换的格式(并保存)。 你还可以在转换之前通过在屏幕底部设置目标文件夹来更改转换文件的存储路径。 -#### 3\. 从源录制音频/视频 +#### 3、从源录制音频/视频 ![Vlc Advanced Controls][11] 你是否想在 VLC 播放器中录制正在播放的音频/视频? -如果是的话,有一个简单的解决方案。只需**通过 View,然后点击 ”Advanced Controls“**。 +如果是的话,有一个简单的解决方案。只需通过 “View”,然后点击 “Advanced Controls”。 完成后,你会看到一个新按钮(包括 VLC 播放器中的红色录制按钮)。 -#### 4\. 自动下载字幕 +#### 4、自动下载字幕 ![][12] -是的,你可以[使用 VLC 自动下载字幕][13]。你甚至不必在单独的网站上查找字幕。你只需点击 **View->VLSub**。 +是的,你可以[使用 VLC 自动下载字幕][13]。你甚至不必在单独的网站上查找字幕。你只需点击 +“View”->“VLSub”。 默认情况下,它是禁用的,因此当你单击该选项时,它会被激活,并允许你搜索/下载想要的字幕。 [VLC 还能让你使用简单的键盘快捷键同步字幕][14] -#### 5\. 截图 +#### 5、截图 ![][15] -你可以在观看视频时使用 VLC 获取一些视频的截图/图像。 - -你只需在视频播放/暂停时右击播放器,你会看到一组选项,点击 **Video->Take Snapshot**。 +你可以在观看视频时使用 VLC 获取一些视频的截图/图像。你只需在视频播放/暂停时右击播放器,你会看到一组选项,点击 “Video”->“Take Snapshot”。 如果安装了旧版本,你可能在右键时看到截图选项。 #### 额外技巧:给视频添加音频/视频效果 -在菜单中,进入 ”**Tools**“ 选项。单击 ”**Effects and Filters**“,或者在 VLC 播放器窗口中按 **CTRL + E** 打开选项。 +在菜单中,进入 “Tools” 选项。单击 “Effects and Filters”,或者在 VLC 播放器窗口中按 `CTRL + E` 打开选项。 好了,你可以观察你给视频添加的音频和视频效果了。你也许无法实时看到效果,因此你需要调整并保存来看发生了什么。 @@ -108,7 +102,7 @@ via: https://itsfoss.com/simple-vlc-tips/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ad881c80d06f0bf4e17d7e676e08359696bede69 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 09:08:08 +0800 Subject: [PATCH 0214/3057] PUB @geekpi https://linux.cn/article-11776-1.html --- ...20191214 Make VLC More Awesome With These Simple Tips.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191214 Make VLC More Awesome With These Simple Tips.md (97%) diff --git a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/published/20191214 Make VLC More Awesome With These Simple Tips.md similarity index 97% rename from translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md rename to published/20191214 Make VLC More Awesome With These Simple Tips.md index 350fa16604..3bb170df03 100644 --- a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md +++ b/published/20191214 Make VLC More Awesome With These Simple Tips.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11776-1.html) [#]: subject: (Make VLC More Awesome With These Simple Tips) [#]: via: (https://itsfoss.com/simple-vlc-tips/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) @@ -10,6 +10,8 @@ 这些简单的技巧使 VLC 更加出色 ====== +![](https://img.linux.net.cn/data/attachment/album/202001/13/090635eu9va9999rr4ue92.jpeg) + 如果 [VLC][1] 不是最好的播放器,那它也是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。 你可以进行许多复杂的任务,如直播视频、捕捉设备等。只需打开菜单,你就可以看到它有多少选项。 From 622d09bde11060169652ebba0b1ae948989a7ab1 Mon Sep 17 00:00:00 2001 From: qianmingtian <40565099+qianmingtian@users.noreply.github.com> Date: Mon, 13 Jan 2020 13:10:30 +0800 Subject: [PATCH 0215/3057] Translating by qianmingtian --- ...d eMail With a List of User Accounts Expiring in -X- Days.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index 1b3330a6e8..efc52e33f9 100644 --- a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qianmingtian) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c36faf34d18c4363c7011a8bb6e9bcb7cbe86c24 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 15:13:06 +0800 Subject: [PATCH 0216/3057] PRF @lxbwolf --- ... Lessons learned from programming in Go.md | 116 +++++++++--------- 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/translated/tech/20191210 Lessons learned from programming in Go.md b/translated/tech/20191210 Lessons learned from programming in Go.md index 0c17e142a8..aeef69681e 100644 --- a/translated/tech/20191210 Lessons learned from programming in Go.md +++ b/translated/tech/20191210 Lessons learned from programming in Go.md @@ -1,63 +1,65 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Lessons learned from programming in Go) [#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) [#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) -Go 编程中的经验教训 +Go 并发编程中的经验教训 ====== -通过学习如何定位并发处理的陷阱来避免未来处理这些问题时的困境。 -![Goland gopher illustration][1] -在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。[Mode.net][2] 公司系统每天要处理实时、快速和灵活的以毫秒为单位动态路由数据包的全球专用网络和数据,需要高度并发的系统。这个动态路由是基于网络状态的,而这个过程需要考虑众多因素,我们只考虑关系链的监控。在我们的环境中,调用关系链监控可以是任何跟网络调用关系链有关的状态和当前属性(如链接延迟)。 +> 通过学习如何定位并发处理的陷阱来避免未来处理这些问题时的困境。 + +![](https://img.linux.net.cn/data/attachment/album/202001/13/150539n217ak1vcf717uzx.jpg) + +在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。在 [Mode.net][2] 公司,我们每天都要和实时、快速和灵活的软件打交道。而没有一个高度并发的系统,就不可能构建一个毫秒级的动态地路由数据包的全球专用网络。这个动态路由是基于网络状态的,尽管这个过程需要考虑众多因素,但我们的重点是链路指标。在我们的环境中,链路指标可以是任何跟网络链接的状态和当前属性(如链接延迟)有关的任何内容。 ### 并发探测链接监控 -[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing,译注:逐跳自适应链路状态最佳路由),我们的动态路由算法部分依赖于链路度量来计算路由表。 这些指标由位于每个PoP(译注:存活节点)上的独立组件收集。PoP是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有不止一个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探针。 +我们的动态路由算法 [H.A.L.O.][4](逐跳自适应链路状态最佳路由Hop-by-Hop Adaptive Link-State Optimal Routing)部分依赖于链路指标来计算路由表。这些指标由位于每个 PoP(存活节点Point of Presence)上的独立组件收集。PoP 是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有不止一个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探测。 ![latency computation graph][6] -### 序列号和重置:一个记录场景 +### 序列号和重置:一个重新排列场景 -我们的探测组件互相发送和接收数据包并依靠序列号进行数据包处理。旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号 0 来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们只考虑了始终从 0 开始递增的序列号。组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,直到排到重置之前用到的值之前,它后面的包都会被忽略掉。 +我们的探测组件互相发送和接收数据包,并依靠序列号进行数据包处理。这旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号 0 来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们考虑了递增的序列号总是从 0 开始。在该组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,后继的包都会被忽略掉,直到排到重置之前用到的序列值。 ### UDP 握手和有限状态机 -这里的问题是重启前后的序列号是否一致。有几种方法可以解决这个问题,经过讨论,我们选择了实现一个带有清晰状态定义的三向交握协议。这个握手过程在初始化时通过链接建立 session。这样可以确保节点通过同一个 session 进行通信且使用了适当的序列号。 +这里的问题是该组件重启前后的序列号是否一致。有几种方法可以解决这个问题,经过讨论,我们选择了实现一个带有清晰状态定义的三步握手协议。这个握手过程在初始化时通过链接建立会话。这样可以确保节点通过同一个会话进行通信且使用了适当的序列号。 为了正确实现这个过程,我们必须定义一个有清晰状态和过渡的有限状态机。这样我们就可以正确管理握手过程中的所有极端情况。 ![finite state machine diagram][7] -session ID 由握手的初始化程序生成。一个完整的交换顺序如下: +会话 ID 由握手的初始化程序生成。一个完整的交换顺序如下: - 1. sender 发送一个 **SYN (ID)** 数据包。 - 2. receiver 存储接收到的 **ID** 并发送一个 **SYN-ACK (ID)**. - 3. sender 接收到 **SYN-ACK (ID)** _并发送一个 **ACK (ID)**_。它还发送一个从序列号 0 开始的数据包。 - 4. receiver 检查最后接收到的 **ID**,如果 ID 匹配,_则接受 **ACK (ID)**_。它还开始接受序列号为 0 的数据包。 +1. 发送者发送一个 `SYN(ID)` 数据包。 +2. 接收者存储接收到的 `ID` 并发送一个 `SYN-ACK(ID)`。 +3. 发送者接收到 `SYN-ACK(ID)` 并发送一个 `ACK(ID)`。它还发送一个从序列号 0 开始的数据包。 +4. 接收者检查最后接收到的 `ID`,如果 ID 匹配,则接受 `ACK(ID)`。它还开始接受序列号为 0 的数据包。 ### 处理状态超时 基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 - * 链接事件包括连接和断开,连接时会初始化一个链接 session,断开时会断开一个已建立的 seesion。 - * 数据包事件是控制数据包 **(SYN/SYN-ACK/ACK)** 或只是探测响应。 - * 超时事件在当前 session 状态的预定超时时间到期后触发。 +* 链接事件包括网络连接或网络断开的变化,相应的初始化一个链接会话或断开一个已建立的会话。 +* 数据包事件是控制数据包(`SYN`/`SYN-ACK`/`ACK`)或只是探测响应。 +* 超时事件在当前会话状态的预定超时时间到期后触发。 -这里面临的最主要的问题是如何处理并发超时到期和其他事件。这里很容易陷入死锁和资源竞争的陷阱。 +这里面临的最主要的问题是如何处理并发的超时到期和其他事件。这里很容易陷入死锁和资源竞争的陷阱。 ### 第一种方法 -本项目使用的语言是 [Golang][8]. 它确实提供了原生的同步机制,如自带的 channel 和锁,并且能够使用轻量级线程来进行并发处理。 +本项目使用的语言是 [Golang][8]。它确实提供了原生的同步机制,如自带的通道和锁,并且能够使用轻量级线程来进行并发处理。 ![gophers hacking together][9] -gopher 们聚众狂欢 +*gopher 们聚众狂欢* -首先,你可以设计两个分别表示我们的 **Session** 和 **Timeout Handlers** 的结构体。 +首先,你可以设计两个分别表示我们的会话和超时处理程序的结构体。 ```go type Session struct {   @@ -74,14 +76,14 @@ type TimeoutHandler struct {   } ``` -**Session** 标识连接 session,内有表示 session ID、临近的连接点的 IP 和当前 session 状态的字段。 +`Session` 标识连接会话,内有表示会话 ID、临近的连接点的 IP 和当前会话状态的字段。 -**TimeoutHandler** 包含回调函数、对应的 session、持续时间和指向调度计时器的 timer 指针。 +`TimeoutHandler` 包含回调函数、对应的会话、持续时间和指向调度计时器的指针。 -每一个临近连接点的 session 都包含一个保存调度 `TimeoutHandler` 的全局 map。 +每一个临近连接点的会话都包含一个保存调度 `TimeoutHandler` 的全局映射。 ``` -`SessionTimeout map[Session]*TimeoutHandler` +SessionTimeout map[Session]*TimeoutHandler ``` 下面方法注册和取消超时: @@ -118,7 +120,7 @@ func CreateTimeoutHandler(callback func(Session), session Session, duration int) } ``` -超时 handler 创建后,会在经过了设置的 _duration_ 时间(秒)后执行回调函数。然而,有些事件会使你重新调度一个超时 handler(与 **SYN** 状态时的处理一样 — 每 3 秒一次)。 +超时处理程序创建后,会在经过了设置的 `duration` 时间(秒)后执行回调函数。然而,有些事件会使你重新调度一个超时处理程序(与 `SYN` 状态时的处理一样,每 3 秒一次)。 为此,你可以让回调函数重新调度一次超时: @@ -134,25 +136,25 @@ func synCallback(session Session) {   } ``` -这次回调在新的超时 handler 中重新调度自己,并更新全局 map **sessionTimeout**。 +这次回调在新的超时处理程序中重新调度自己,并更新全局映射 `sessionTimeout`。 ### 数据竞争和引用 -你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,在 *duration* 时间内 sleep,然后检查是否执行了回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 +你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,休眠 `duration` 秒,然后检查是否执行了回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 -令人惊讶的是,这个简单的测试发现了这个解决方案中的一个 bug。使用 cancel 方法来取消超时并没有正确处理。以下顺序的事件会导致数据资源竞争: +令人惊讶的是,这个简单的测试发现了这个解决方案中的一个问题。使用 `cancel` 方法来取消超时并没有正确处理。以下顺序的事件会导致数据资源竞争: - 1. 你有一个已调度的超时 handler。 - 2. 线程 1: -a)你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个 session 状态(如 发送 **SYN** 后接收到一个 **SYN-ACK**) -b)你调用了 **timeout.Cancel()**,这个函数调用了 **timer.Stop()**。(请注意,Golang 计时器的 stop 不会终止一个已过期的计时器。) - 3. 线程 2: -a)在调用 cancel 之前,计时器已过期,回调即将执行。 -b)执行回调,它调度一次新的超时并更新全局 map。 - 4. 线程 1: -a)切换到新的 session 状态并注册新的超时,更新全局 map。 +1. 你有一个已调度的超时处理程序。 +2. 线程 1: + 1. 你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个会话状态(如发送 `SYN` 后接收到一个 `SYN-ACK`) + 2. 你调用了 `timeout.Cancel()`,这个函数调用了 `timer.Stop()`。(请注意,Golang 计时器的停止不会终止一个已过期的计时器。) +3. 线程 2: + 1. 在取消调用之前,计时器已过期,回调即将执行。 + 2. 执行回调,它调度一次新的超时并更新全局映射。 +4. 线程 1: + 1. 切换到新的会话状态并注册新的超时,更新全局映射。 -两个线程同时更新超时 map。最终结果是你无法取消注册的超时,然后你也会丢失对线程 2 重新调度的超时的引用。这导致 handler 在一段时间内持续执行和重新调度,出现非预期行为。 +两个线程并发地更新超时映射。最终结果是你无法取消注册的超时,然后你也会丢失对线程 2 重新调度的超时的引用。这导致处理程序在一段时间内持续执行和重新调度,出现非预期行为。 ### 锁也解决不了问题 @@ -169,15 +171,15 @@ func (timeout* TimeoutHandler) Register() {   } ``` -现在的区别就是全局 map 的更新是同步的,但是这还是不能阻止在你调用 **timeout.Cancel() ** 后回调的执行 — 这种情况出现在调度计时器过期了但是还没有拿到锁的时候。你还是会丢失一个已注册的超时的引用。 +现在的区别就是全局映射的更新是同步的,但是这还是不能阻止在你调用 `timeout.Cancel()` 后回调的执行 —— 这种情况出现在调度计时器过期了但是还没有拿到锁的时候。你还是会丢失一个已注册的超时的引用。 -### 使用取消 channel +### 使用取消通道 -你可以使用取消 channel,而不必依赖不能阻止到期的计时器执行的 golang 函数 **timer.Stop()**。 +你可以使用取消通道,而不必依赖不能阻止到期的计时器执行的 golang 函数 `timer.Stop()`。 这是一个略有不同的方法。现在你可以不用再通过回调进行递归地重新调度;而是注册一个死循环,这个循环接收到取消信号或超时事件时终止。 -新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用方一个取消 channel,用来控制循环的终止。 +新的 `Register()` 产生一个新的 go 线程,这个线程在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用方一个取消通道,用来控制循环的终止。 ```go func (timeout *TimeoutHandler) Register() chan struct{} {   @@ -208,9 +210,9 @@ func (timeout* TimeoutHandler) Cancel() {   } ``` -这个方法提供了你注册的所有超时的取消 channel。对 cancel 的一次调用向 channel 发送一个空结构体并触发取消操作。然而,这并不能解决前面的问题;可能在你通过 channel 调用 cancel 超时线程还没有拿到锁之前,超时时间就已经到了。 +这个方法给你注册的所有超时提供了取消通道。一个取消调用向通道发送一个空结构体并触发取消操作。然而,这并不能解决前面的问题;可能在你通过通道取消之前以及超时线程拿到锁之前,超时时间就已经到了。 -这里的解决方案是,在拿到锁之后,检查一下超时范围内的取消 channel。 +这里的解决方案是,在拿到锁**之后**,检查一下超时范围内的取消通道。 ```go   case _ = <- time.AfterFunc(time.Duration(timeout.duration) * time.Second):   @@ -236,15 +238,15 @@ func (timeout* TimeoutHandler) Cancel() {   请阅读上面的代码,试着自己找到它。考虑下描述的所有函数的并发调用。 -这里的问题在取消 channel 本身。我们创建的是无缓冲 channel,即发送是阻塞调用。当你在一个超时 handler 中调用取消函数时,只有在该 handler 被取消后才能继续处理。问题出现在,当你有多个调用请求到同一个取消 channel 时,这时一个取消请求只被处理一次。当多个事件同时取消同一个超时 handler 时,如链接断开或控制包事件,很容易出现这种情况。这会导致死锁,可能会使应用程序 halt。 +这里的问题在取消通道本身。我们创建的是无缓冲通道,即发送的是阻塞调用。当你在一个超时处理程序中调用取消函数时,只有在该处理程序被取消后才能继续处理。问题出现在,当你有多个调用请求到同一个取消通道时,这时一个取消请求只被处理一次。当多个事件同时取消同一个超时处理程序时,如连接断开或控制包事件,很容易出现这种情况。这会导致死锁,可能会使应用程序停机。 ![gophers on a wire, talking][11] -有人在听吗? +*有人在听吗?* -已获得 Trevor Forrey 授权。 +(已获得 Trevor Forrey 授权。) -这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会阻塞后续的取消调用。 +这里的解决方案是创建通道时指定缓存大小至少为 1,这样向通道发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会阻塞后续的取消调用。 ```go func (timeout* TimeoutHandler) Cancel() {   @@ -266,27 +268,27 @@ func (timeout* TimeoutHandler) Cancel() {   #### 在非同步的情况下更新共享数据 -这似乎是个很明显的问题,但如果并发更新发生在不同的位置,就很难发现。结果就是数据竞争,由于一个更新会覆盖另一个,因此对同一数据的多次更新中会有某些更新丢失。在我们的案例中,我们是在同时更新同一个共享 map 里的调度超时引用。有趣的是,(如果 Go 检测到在同一个 map 对象上的并发读写,会抛出 fatal 错误 — 你可以尝试下运行 Go 的[数据竞争检测器](https://golang.org/doc/articles/race_detector.html))。这最终会导致丢失超时引用,且无法取消给定的超时。当有必要时,永远不要忘记使用锁。 +这似乎是个很明显的问题,但如果并发更新发生在不同的位置,就很难发现。结果就是数据竞争,由于一个更新会覆盖另一个,因此对同一数据的多次更新中会有某些更新丢失。在我们的案例中,我们是在同时更新同一个共享映射里的调度超时引用。(有趣的是,如果 Go 检测到在同一个映射对象上的并发读写,会抛出致命错误 — 你可以尝试下运行 Go 的[数据竞争检测器](https://golang.org/doc/articles/race_detector.html))。这最终会导致丢失超时引用,且无法取消给定的超时。当有必要时,永远不要忘记使用锁。 ![gopher assembly line][13] -不要忘记同步 gopher 们的工作 +*不要忘记同步 gopher 们的工作* #### 缺少条件检查 -在不能仅依赖锁的独占性的情况下,就需要进行条件检查。我们遇到的场景稍微有点不一样,但是核心思想跟[条件变量][14]是一样的。假设有个经典的一个生产者和多个消费者使用一个共享队列的场景,生产者可以将一个元素添加到队列并唤醒所有消费者。这个唤醒调用意味着队列中的数据是可访问的,并且由于队列是共享的,消费者必须通过锁来进行同步访问。每个消费者都可能拿到锁;然而,你仍然需要检查队列中是否有元素。因为在你拿到锁的瞬间并不知道队列的状态,所以还是需要进行条件检查。 +在不能仅依赖锁的独占性的情况下,就需要进行条件检查。我们遇到的场景稍微有点不一样,但是核心思想跟[条件变量][14]是一样的。假设有个一个生产者和多个消费者使用一个共享队列的经典场景,生产者可以将一个元素添加到队列并唤醒所有消费者。这个唤醒调用意味着队列中的数据是可访问的,并且由于队列是共享的,消费者必须通过锁来进行同步访问。每个消费者都可能拿到锁;然而,你仍然需要检查队列中是否有元素。因为在你拿到锁的瞬间并不知道队列的状态,所以还是需要进行条件检查。 -在我们的例子中,超时 handler 收到了计时器到期时发出的「唤醒」调用,但是它仍需要检查是否已向其发送了取消信号,然后才能继续执行回调。 +在我们的例子中,超时处理程序收到了计时器到期时发出的“唤醒”调用,但是它仍需要检查是否已向其发送了取消信号,然后才能继续执行回调。 ![gopher boot camp][15] -如果你要唤醒多个 gopher,可能就需要进行条件检查 +*如果你要唤醒多个 gopher,可能就需要进行条件检查* #### 死锁 -当一个线程被卡住,无限期地等待一个唤醒信号,但是这个信号永远不会到达时,就会发生这种情况。死锁可以通过让你的整个程序 halt 来彻底杀死你的应用。 +当一个线程被卡住,无限期地等待一个唤醒信号,但是这个信号永远不会到达时,就会发生这种情况。死锁可以通过让你的整个程序停机来彻底杀死你的应用。 -在我们的案例中,这种情况的发生是由于多次发送请求到一个非缓冲且阻塞的 channel。这意味着向 channel 发送数据只有在从这个 channel 接收完数据后才能 return。我们的超时线程循环迅速从取消 channel 接收信号;然而,在接收到第一个信号后,它将跳出循环,并且再也不会从这个 channel 读取数据。其他的调用会一直被卡住。为避免这种情况,你需要仔细检查代码,谨慎处理阻塞调用,并确保不会发生线程饥饿。我们例子中的解决方法是使取消调用成为非阻塞调用 — 我们不需要阻塞调用。 +在我们的案例中,这种情况的发生是由于多次发送请求到一个非缓冲且阻塞的通道。这意味着向通道发送数据只有在从这个通道接收完数据后才能返回。我们的超时线程循环迅速从取消通道接收信号;然而,在接收到第一个信号后,它将跳出循环,并且再也不会从这个通道读取数据。其他的调用会一直被卡住。为避免这种情况,你需要仔细检查代码,谨慎处理阻塞调用,并确保不会发生线程饥饿。我们例子中的解决方法是使取消调用成为非阻塞调用 — 我们不需要阻塞调用。 -------------------------------------------------------------------------------- @@ -295,7 +297,7 @@ via: https://opensource.com/article/19/12/go-common-pitfalls 作者:[Eduardo Ferreira][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0bec37da27bfe29e70dd019bc8ee083f94fe8ac1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 15:15:06 +0800 Subject: [PATCH 0217/3057] PUB @lxbwolf https://linux.cn/article-11778-1.html --- .../20191210 Lessons learned from programming in Go.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191210 Lessons learned from programming in Go.md (99%) diff --git a/translated/tech/20191210 Lessons learned from programming in Go.md b/published/20191210 Lessons learned from programming in Go.md similarity index 99% rename from translated/tech/20191210 Lessons learned from programming in Go.md rename to published/20191210 Lessons learned from programming in Go.md index aeef69681e..3c5e495b89 100644 --- a/translated/tech/20191210 Lessons learned from programming in Go.md +++ b/published/20191210 Lessons learned from programming in Go.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11778-1.html) [#]: subject: (Lessons learned from programming in Go) [#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) [#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) From 35320cdc6d9098c684ddde01089a3435a7f67114 Mon Sep 17 00:00:00 2001 From: qianmingtian Date: Mon, 13 Jan 2020 21:06:23 +0800 Subject: [PATCH 0218/3057] Translated by qianmingtian --- ...t of User Accounts Expiring in -X- Days.md | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) rename {sources => translated}/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md (62%) diff --git a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md similarity index 62% rename from sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md rename to translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index efc52e33f9..77fcbeed2b 100644 --- a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -7,30 +7,30 @@ [#]: via: (https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days +使用Bash 脚本发送包含 “X” 天内到期的用户账号列表的电子邮件 ====== -The password enforcement policy is common to all operating systems and applications. +密码强制策略对所有操作系统和应用程序都是通用的。 -If you want to **[implement a password enforcement policy on Linux][1]**, go to the following article. +如果要 **[在Linux上实现密码强制策略][1]** ,请参阅以下文章。 -The password enforcement policy will be enforced by most companies by default, but the time period will be different depending on the company’s requirements. +默认情况下,大多数公司都会强制执行密码强制策略,但根据公司的要求,密码的时间周期会有所不同。 -Usually everyone uses a 90-days password cycle. +通常每个人都使用 90 天的密码周期。 -The user will only **[change the password][2]** on some of the servers they use, and they won’t change the password on the servers they don’t use often. +用户只会在他们使用的一些服务器上 **[更改密码][2]**,而不会在他们不经常使用的服务器上更改密码。 -In particular, most team forget to change the service account password, which can lead to breaking regular jobs even if they are configured to work with **[SSH key-based authentication][3]**. +特别地,大多数团队忘记更改服务帐户密码,这可能导致日常工作的中断,即使他们配置有 **[SSH基于密钥的身份验证][3]** 。 -SSH key-based authentication and **[cronjobs][4]** will not work if the user account password expires. +如果用户帐户密码过期,基于SSH密钥的身份验证和 **[cronjobs][4]** 将不起作用。 -To avoid this situation, we have created a **[shell script][5]** that sends you a list of user accounts that expire within 10 days. +为了避免这种情况,我们创建了一个 **[shell脚本][5]** 来向您发送 10 天内到期的用户帐户列表。 -There are two **[bash scripts][6]** included in this tutorial that will help you collect information about user expiration days on your system. +本教程中包含两个 **[bash脚本][6]** 可以帮助您收集系统中用户到期日的信息。 -### 1) Bash Script to Check List of User Accounts Expiring in 10 Days +### 1) 检查10天后到期的用户帐户列表 -This script will help you to check the list of user accounts that expire in 10 days on your terminal. +此脚本将帮助您检查终端上 10 天内到期的用户帐户列表。 ``` # vi /opt/script/user-password-expiry.sh @@ -54,13 +54,13 @@ cat /tmp/user-expiry.txt | awk '$2 <= 10' > /tmp/user-expiry-1.txt cat /tmp/user-expiry-1.txt | column -t ``` -Set an executable Linux file permission to **“user-password-expiry.sh”** file. +将文件 **“user password expiry.sh”** 设置为 Linux 可执行文件权限。 ``` # chmod +x /opt/script/user-password-expiry.sh ``` -You will get an output like the one below. But the username and days may be different +你将得到如下输出,但用户与天数可能不同。 ``` # sh /opt/script/user-password-expiry.sh @@ -73,10 +73,9 @@ u2 9 u3 3 u4 5 ``` +### 2) 发送包含 10 天内到期的用户帐户列表的电子邮件 -### 2) Bash Script to Send eMail With a List of User Accounts Expiring in 10 Days - -This script will send a mail with a list of user accounts expiring in 10 days. +此脚本将发送一封包含 10 天内到期的用户帐户列表的邮件。 ``` # vi /opt/script/user-password-expiry-mail.sh @@ -104,20 +103,20 @@ rm $MESSAGE rm $MESSAGE1 ``` -Set an executable Linux file permission to **“user-password-expiry-mail.sh”** file. +将文件 **“user-password-expiry-mail.sh”** 设置为 Linux 可执行文件权限。 ``` # chmod +x /opt/script/user-password-expiry-mail.sh ``` -Finally add a **[cronjob][4]** to automate this. It runs once in a day at 8AM. +最后,添加一个 **[cronjob][4]** 去自动执行脚本。每天早上 8 点运行一次。 ``` # crontab -e 0 8 * * * /bin/bash /opt/script/user-password-expiry-mail.sh ``` -You will receive a mail similar to the first shell script output. +你将收到一封与第一个脚本输出类似的电子邮件。 -------------------------------------------------------------------------------- @@ -125,13 +124,14 @@ via: https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qianmingtian][c] 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 +[c]: https://github.com/qianmingtian [1]: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ [2]: https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-users-password-in-linux-using-shell-script/ [3]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ From f468498a3ba5289890df1293056eaa8dc924bcec Mon Sep 17 00:00:00 2001 From: cycoe Date: Mon, 13 Jan 2020 21:07:47 +0800 Subject: [PATCH 0219/3057] Translating by cycoe --- ... jumping to your Python platformer game.md | 161 +++++++++--------- 1 file changed, 80 insertions(+), 81 deletions(-) rename {sources => translated}/tech/20191205 Add jumping to your Python platformer game.md (52%) diff --git a/sources/tech/20191205 Add jumping to your Python platformer game.md b/translated/tech/20191205 Add jumping to your Python platformer game.md similarity index 52% rename from sources/tech/20191205 Add jumping to your Python platformer game.md rename to translated/tech/20191205 Add jumping to your Python platformer game.md index 5c4ec0507e..0487cc1491 100644 --- a/sources/tech/20191205 Add jumping to your Python platformer game.md +++ b/translated/tech/20191205 Add jumping to your Python platformer game.md @@ -7,28 +7,27 @@ [#]: via: (https://opensource.com/article/19/12/jumping-python-platformer-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Add jumping to your Python platformer game +为你的 Python 平台类游戏添加跳跃功能 ====== -Learn how to fight gravity with jumping in this installment on -programming video games with Python's Pygame module. -![Arcade games][1] +在本期使用 Python Pygame 模块编写视频游戏中,学会如何使用跳跃来对抗重力。 +![游戏厅中的游戏][1] -In the [previous article][2] in this series, you simulated gravity, but now you need to give your player a way to fight against gravity by jumping. +在本系列的 [前一篇文章][2] 中,你已经模拟了重力。但现在,你需要赋予你的角色跳跃的能力来对抗重力。 -A jump is a temporary reprieve from gravity. For a few moments, you jump _up_ instead of falling down, the way gravity is pulling you. But once you hit the peak of your jump, gravity kicks in again and pulls you back down to earth. +跳跃是对重力作用的暂时延缓。在这一小段时间里,你是向_上_跳,而不是被重力拉着向下落。但你一旦到达了跳跃的最高点,重力就会重新发挥作用,将你拉回地面。 -In code, this translates to variables. First, you must establish variables for the player sprite so that Python can track whether or not the sprite is jumping. Once the player sprite is jumping, then gravity is applied to the player sprite again, pulling it back down to the nearest object. +在代码中,跳跃被表示为变量。首先,你需要为玩家对象建立一个变量,使得 Python 能够跟踪对象是否正在跳跃中。一旦玩家对象开始跳跃,他就会再次受到重力的作用,并被拉回最近的物体。 -### Setting jump state variables +### 设置跳跃状态变量 -You must add two new variables to your Player class: +你需要为你的 Player 类添加两个新变量: - * One to track whether your player is jumping or not, determined by whether or not your player sprite is standing on solid ground - * One to bring the player back down to the ground + * 一个是为了跟踪你的角色是否正在跳跃中,可通过你的玩家对象是否站在坚实的地面来确定 + * 一个是为了将玩家带回地面 -Add these variables to your **Player** class. In the following code, the lines above the comment are for context, so just add the final two lines: +将如下两个变量添加到你的 **Player** 类中。在下方的代码中,注释前的部分用于提示上下文,因此只需要添加最后两行: ``` @@ -36,20 +35,20 @@ Add these variables to your **Player** class. In the following code, the lines a                 self.movey = 0                 self.frame = 0                 self.health = 10 -                # gravity variables here +                # 此处是重力相关变量                 self.collide_delta = 0                 self.jump_delta = 6 ``` -The first variable (**collide_delta**) is set to 0 because, in its natural state, the player sprite is not in a mid-jump. The other variable (**jump_delta**) is set to 6 to prevent the sprite from bouncing (actually, jumping) when it first lands in the game world. When you've finished this article's examples, try setting it to 0 to see what happens. +第一个变量 **collide_delta** 被设为 0 是因为在正常状态下,玩家对象没有处在跳跃中的状态。另一个变量 **jump_delta** 被设为 6,是为了防止对象在第一次进入游戏世界时就发生反弹(实际上就是跳跃)。当你完成了本篇文章的示例,尝试把该变量设为 0 看看会发生什么。 -### Colliding mid-jump +### 跳跃中的碰撞 -If you jump on a trampoline, your jumps are pretty impressive. But what would happen if you jumped into a wall? (Don't try it to find out!) Your jump, no matter how impressively it started, would end very quickly when you collide with something much larger and much more solid than you. +如果你是跳到一个蹦床上,那你的跳跃一定非常优美。但是如果你是跳向一面墙会发生什么呢?(千万不要去尝试!)不管你的起跳多么令人印象深刻,当你撞到比你更大更硬的物体时,你都会立马停下。(译注:原理参考动量守恒定律) -To mimic this in your video game, you must set the **self.collide_delta** variable to 0 whenever your player sprite collides with something, like the ground. If **self.collide_delta** is anything other than 0, then your player is jumping, and your player can't jump when it hits a wall or the ground. +为了在你的视频游戏中模拟这一点,你需要在你的玩家对象与地面等东西发生碰撞时,将 **self.collide_delta** 变量设为 0。如果你的 **self.collide_delta** 不是 0 而是其它的什么值,那么你的玩家就会发生跳跃,并且当你的玩家与墙或者地面发生碰撞时无法跳跃。 -In the **update** function of your **Player** class, modify the ground collision block to look like this: +在你的 **Player** 类的 **update** 方法中,将地面碰撞相关代码块修改为如下所示: ``` @@ -57,54 +56,54 @@ In the **update** function of your **Player** class, modify the ground collision         for g in ground_hit_list:             self.movey = 0             self.rect.y = worldy-ty-ty -            self.collide_delta = 0 # stop jumping +            self.collide_delta = 0 # 停止跳跃             if self.rect.y > g.rect.y:                 self.health -=1                 print(self.health) ``` -This code block checks for collisions happening between the ground sprites and the player sprite. In the event of a collision, it sets the Y-position of the player to a value equal to the height of the game window (**worldy**) minus the height of a tile minus the height of another tile (so that the player sprite appears to be standing on top of the ground and not in the middle of it). It also sets **self.collide_delta** to 0 so that the program is aware that the player is not in mid-jump. Additionally, it sets **self.movey** to 0 so that the program is aware that the player is not being pulled by gravity (it's a quirk of game physics that you don't need to continue to pull your player toward earth once the player has been grounded). +这段代码块检查了地面对象和玩家对象之间发生的碰撞。当发生碰撞时,它会将玩家 Y 方向的坐标值设置为游戏窗口的高度减去一个瓷贴的高度再减去另一个瓷贴的高度。以此保证了玩家对象是站在地面**上**,而不是嵌在地面里。同时它也将 **self.collide_delta** 设为 0,使得程序能够知道玩家未处在跳跃中。除此之外,它将 **self.movey** 设为 0,使得程序能够知道玩家当前未受到重力的牵引作用(这是游戏物理引擎的奇怪之处,一旦玩家落地,也就没有必要继续将玩家拉向地面)。 -The **if** statement detects whether the player has descended _below_ the level of the ground; if so, it deducts health points as a penalty. This assumes that you want your player to lose health points for falling off the world. That's not strictly necessary; it's just a common convention in platformers. More than likely, you want this event to trigger something, though, or else your real-world player will be stuck playing a game with a sprite that's fallen off the screen. An easy recovery is to set **self.rect.y** to 0 again so that when the player sprite falls off the world, it respawns at the top of the world and falls back onto solid ground. +此处 **if** 语句用来检测玩家是否已经落到地面之_下_,如果是,那就扣除一点生命值作为惩罚。此处假定了你希望当你的玩家落到地图之外时失去生命值。这个设定不是必需的,它只是平台类游戏的一种惯例。更有可能的是,你希望这个事件能够触发另一些事件,或者说是一种能够让你的现实世界玩家沉迷于让对象掉到屏幕之外的东西。一种简单的恢复方式是在玩家对象掉落到地图之外时,将 **self.rect.y** 重新设置为 0,这样它就会在地图上方重新生成,并落到坚实的地面上。 -### Hitting the ground +### 撞向地面 -Your simulated gravity wants your player's Y-axis movement to be 0 or more. To create a jump, write code that sends your player sprite off solid ground and into the air. +模拟的重力使你玩家的 Y 坐标不断增大(译注:此处原文中为 0,但在 Pygame 中越靠下方 Y 坐标应越大)。要实现跳跃,完成如下代码使你的玩家对象离开地面,飞向空中。 -In the **update** function of your **Player** class, add a temporary reprieve from gravity: +在你的 **Player** 类的 **update** 方法中,添加如下代码来暂时延缓重力的作用: ```         if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2 -            self.movey -= 33  # how high to jump +            self.movey -= 33  # 跳跃的高度             self.collide_delta += 6             self.jump_delta    += 6 ``` -According to this code, a jump sends the player sprite 33 pixels into the air. It's _negative_ 33 because a lower number in Pygame means it's closer to the top of the screen. +根据此代码所示,跳跃使玩家对象向空中移动了 33 个像素。此处是_负_ 33 是因为在 Pygame 中,越小的数代表距离屏幕顶端越近。 -This event is conditional, though. It only happens if **self.collide_delta** is less than 6 (its default value established in the **init** function of your **Player** sprite) and if **self.jump_delta** is less than 6. This condition prevents the player from triggering another jump until it collides with a platform. In other words, it prevents mid-air jumps. +不过此事件视条件而定,只有当 **self.collide_delta** 小于 6(缺省值定义在你 **Player** 类的 **init** 方法中)并且 **self.jump_delta** 也于 6 的时候才会发生。此条件能够保证直到玩家碰到一个平台,才能触发另一次跳跃。换言之,它能够阻止空中二段跳。 -You don't have to prevent mid-air jumps, or you can allow for mid-air jumps under special conditions; for instance, if a player obtains a special loot item, then you could grant it the ability to perform mid-air jumps until the next time it is hit by an enemy. +在某些特殊条件下,你可能不想阻止空中二段跳,或者说你允许玩家进行空中二段跳。举个栗子,如果玩家获得了某个战利品,那么在他被敌人攻击到之前,都能够拥有空中二段跳的能力。 -When you've finished this article's examples, try setting **self.collide_delta** and **self.jump_delta** to 0 for a 100% chance to jump in mid-air. +当你完成本篇文章中的示例,尝试将 **self.collide_delta** 和 **self.jump_delta** 设置为 0,从而获得百分之百的几率触发空中二段跳。 -### Landing on a platform +### 在平台上着陆 -So far, you've defined an anti-gravity condition for when the player sprite hits the ground, but the game code keeps platforms and the ground in separate lists. (As with so many choices made in this article, that's not strictly necessary, and you can experiment with treating the ground as just another platform.) To enable a player sprite to stand on top of a platform, you must detect a collision between the player sprite and a platform sprite and then perform the same actions as you did for a ground collision. Place this code into your **update** function: +目前你已经定义了再玩家对象摔落地面时的抵抗重力条件,但此时你的游戏代码仍保持平台与地面置于不同的列表中(就像本文中做的很多其他选择一样,这个设定并不是必需的,你可以尝试将地面作为另一种平台)。为了允许玩家对象站在平台之上,你必须像检测地面碰撞一样,检测玩家对象与平台对象之间的碰撞。将如下代码放于你的 **update** 方法中: ```         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False)         for p in plat_hit_list: -            self.collide_delta = 0 # stop jumping +            self.collide_delta = 0 # 跳跃结束             self.movey = 0 ``` -There's one additional concern, though: platforms hang in the air, meaning the player can interact with them by approaching them from either the top or the bottom. +但此处还有一点需要考虑:平台悬在空中,也就意味着玩家可以通过从上面或者从下面接触平台来与之互动。 -It's up to you how you want the platforms to react to your player. It's not uncommon to block a player from accessing a platform from below. Add this code to the above code block to treat platforms as a sort of ceiling or pergola, such that the player sprite can jump onto a platform as long as it jumps higher than the platform's topside, but obstructs the player when it tries to jump from beneath: +确定平台如何与玩家互动取决于你,阻止玩家从下方到达平台也并不稀奇。将如下代码加到上方的代码块中,使得平台表现得像天花板或者说是藤架。只有在玩家对象跳得比平台上沿更高时才能跳到平台上,但会阻止玩家从平台下方跳上来: ``` @@ -114,17 +113,17 @@ It's up to you how you want the platforms to react to your player. It's not unco                 self.rect.y = p.rect.y-ty ``` -The first clause of this **if** statement blocks the player from accessing a platform when the player sprite is directly under the platform. It does this by detecting that the player sprite's position is greater (in Pygame, that means lower on the screen, from top to bottom), and then sets the player sprite's new Y position to its current Y position plus the height of a tile, effectively keeping the player one tile's height away from ever passing through a platform from beneath it. +此处 **if** 语句代码块的第一个子句阻止玩家对象从平台正下方跳到平台上。如果它检测到玩家对象的坐标比平台更大(在 Pygame 中,坐标更大意味着在屏幕的更下方),那么将玩家对象新的 Y 坐标设置为当前平台的 Y 坐标加上一个瓷贴的高度。实际效果就是保证玩家对象距离平台一个瓷贴的高度,防止其从下方穿过平台。 -The **else** clause does the opposite. If the program is running this code, then the player sprite's Y position is _not_ greater than the platforms, meaning that the player sprite is falling from the sky (either because it has been freshly spawned there or because the player has jumped). In this event, the player sprite's position is set to the position of the platform minus one tile's height (because, remember, in Pygame, lower numbers mean something is higher up on the screen). This keeps the player on top of the platform unless it jumps or walks off of it. +**else** 子句做了相反的事情。当程序运行到此处时,如果玩家对象的 Y 坐标_不_比平台的更大,意味着玩家对象是从空中落下(不论是由于玩家刚刚从此处生成,或者是玩家执行了跳跃)。在这种情况下,玩家对象的 Y 坐标被设为平台的 Y 坐标减去一个瓷贴的高度(切记,在 Pygame 中更小的 Y 坐标代表在屏幕上的更高处)。这样就能保证玩家在平台_上_,除非他从平台上跳下来或者走下来。 -You can experiment with other ways of dealing with sprite and platform interaction. For instance, maybe the player is assumed to be "in front" of the platforms and can seamlessly jump through them to stand on top of one. Or a platform could slow a player's leap but not block it entirely. You can even mix and match by grouping platforms into different lists. +你也可以尝试其他的方式来处理玩家与平台之间的互动。举个栗子,也许玩家对象被设定为处在平台的“前面”,他能够无障碍地跳跃穿过平台并站在上面。或者你可以设计一种平台会减缓而又不完全阻止玩家的跳跃过程。甚至你可以通过将不同平台分到不同列表中来混合搭配使用。 -### Triggering a jump +### 触发一次跳跃 -Your code now simulates all the necessary jump conditions, but it still lacks a jump trigger. Your player sprite's **self.jump_delta** is set to 6 initially, and the jump update code is triggered only when it's less than 6. +目前为此,你的代码已经模拟了所有必需的跳跃条件,但仍缺少一个跳跃触发器。你的玩家对象的 **self.jump_delta** 初始值被设置为 6,只有当它比 6 小时才会触发更新跳跃的代码。 -To trigger a new setting for the jumping variable, create a **jump** function in your **Player** class that sets the **self.jump_delta** to less than 6, causing gravity to be temporarily reprieved by sending your player sprite 33 pixels into the air: +为跳跃变量设置一个新的设置方法,在你的 **Player** 类中创建一个 **jump** 方法,并将 **self.jump_delta** 设为小于 6 的值。通过使玩家对象向空中移动 33 个像素,来暂时减缓重力的作用。 ``` @@ -132,17 +131,17 @@ To trigger a new setting for the jumping variable, create a **jump** function in         self.jump_delta = 0 ``` -That's all the **jump** function requires, believe it or not. The rest happens in the **update** function, and you've already written that code. +不管你相信与否,这就是 **jump** 方法的全部。剩余的部分在 **update** 方法中,你已经在前面实现了相关代码。 -There's one last thing to do before jumping is functional in your game. If you can't think of what it is, try playing your game to see how jumping works for you. +要使你游戏中的跳跃功能生效,还有最后一件事情要做。如果你想不起来是什么,运行游戏并观察跳跃是如何生效的。 -The problem is that nothing in your main loop is calling the **jump** function. You made a placeholder keypress for it early on, but right now, all the jump key does is print **jump** to the terminal. +问题就在于你的主循环中没有调用 **jump** 方法。先前你已经为该方法创建了一个按键占位符,现在,跳跃键所做的就是将 **jump** 打印到终端。 -### Calling the jump function +### 调用 jump 方法 -In your main loop, change the result of the Up arrow from printing a debug statement to calling the **jump** function. +在你的主循环中,将_上_方向键的效果从打印一条调试语句,改为调用 **jump** 方法。 -Notice that the **jump** function, like the **update** function, needs to know about collisions, so you have to tell it which **plat_list** to use. +注意此处,与 **update** 方法类似,**jump** 方法也需要检测碰撞,因此你需要告诉它使用哪个 **plat_list**。 ``` @@ -150,13 +149,13 @@ Notice that the **jump** function, like the **update** function, needs to know a                 player.jump(plat_list) ``` -If you would rather use the Spacebar for jumping, set the key to **pygame.K_SPACE** instead of **pygame.K_UP**. Alternately, you can use both (as separate **if** statements) so that the player has a choice. +如果你倾向于使用空格键作为跳跃键,使用 **pygame.K_SPACE** 替代 **pygame.K_UP** 作为按键。另一种选择,你可以同时使用两种方式(使用单独的 **if** 语句),给玩家多一种选择。 -Try your game now. In the next article, you'll make your world scroll. +现在来尝试你的游戏吧!在下一篇文章中,你将让你的游戏卷动起来。 -![Pygame platformer][3] +![Pygame 平台类游戏][3] -Here's all the code so far: +以下是目前为止的所有代码: ``` @@ -184,7 +183,7 @@ Objects ''' class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     + # x 坐标,y 坐标,图像宽度,图像高度,图像文件     def __init__(self,xloc,yloc,imgw,imgh,img):         pygame.sprite.Sprite.__init__(self)         self.image = pygame.image.load(os.path.join('images',img)).convert() @@ -195,7 +194,7 @@ class Platform(pygame.sprite.Sprite): class Player(pygame.sprite.Sprite):     ''' -    Spawn a player +    生成一个玩家     '''     def __init__(self):         pygame.sprite.Sprite.__init__(self) @@ -227,34 +226,34 @@ class Player(pygame.sprite.Sprite):             def control(self,x,y):         ''' -        control player movement +        控制玩家移动         '''         self.movex += x         self.movey += y             def update(self):         ''' -        Update sprite position +        更新对象位置         '''                 self.rect.x = self.rect.x + self.movex         self.rect.y = self.rect.y + self.movey -        # moving left +        # 向左移动         if self.movex < 0:             self.frame += 1             if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani] -        # moving right +        # 向右移动         if self.movex > 0:             self.frame += 1             if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] -        # collisions +        # 碰撞         enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False)         for enemy in enemy_hit_list:             self.health -= 1 @@ -286,7 +285,7 @@ class Player(pygame.sprite.Sprite):             class Enemy(pygame.sprite.Sprite):     ''' -    Spawn an enemy +    生成一个敌人     '''     def __init__(self,x,y,img):         pygame.sprite.Sprite.__init__(self) @@ -302,7 +301,7 @@ class Enemy(pygame.sprite.Sprite):                     def move(self):         ''' -        enemy movement +        敌人移动         '''         distance = 80         speed = 8 @@ -337,9 +336,9 @@ class Enemy(pygame.sprite.Sprite): class Level():     def bad(lvl,eloc):         if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # 生成敌人 +            enemy_list = pygame.sprite.Group() # 创建敌人组 +            enemy_list.add(enemy)              # 将敌人添加到敌人组                     if lvl == 2:             print("Level " + str(lvl) ) @@ -392,8 +391,8 @@ Setup worldx = 960 worldy = 720 -fps = 40 # frame rate -ani = 4  # animation cycles +fps = 40 # 帧率 +ani = 4  # 动画循环 clock = pygame.time.Clock() pygame.init() main = True @@ -406,7 +405,7 @@ ALPHA = (0,255,0) world = pygame.display.set_mode([worldx,worldy]) backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() backdropbox = world.get_rect() -player = Player() # spawn player +player = Player() # 生成玩家 player.rect.x = 0 player.rect.y = 0 player_list = pygame.sprite.Group() @@ -418,8 +417,8 @@ eloc = [] eloc = [200,20] gloc = [] #gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] -tx = 64 #tile size -ty = 64 #tile size +tx = 64 # 瓷贴尺寸 +ty = 64 # 瓷贴尺寸 i=0 while i <= (worldx/tx)+tx: @@ -431,7 +430,7 @@ ground_list = Level.ground( 1,gloc,tx,ty ) plat_list = Level.platform( 1,tx,ty ) ''' -Main loop +主循环 ''' while main == True:     for event in pygame.event.get(): @@ -464,26 +463,26 @@ while main == True: #    world.fill(BLACK)     world.blit(backdrop, backdropbox) -    player.gravity() # check gravity +    player.gravity() # 检查重力     player.update() -    player_list.draw(world) #refresh player position -    enemy_list.draw(world)  # refresh enemies -    ground_list.draw(world)  # refresh enemies -    plat_list.draw(world)   # refresh platforms +    player_list.draw(world) # 刷新玩家位置 +    enemy_list.draw(world)  # 刷新敌人 +    ground_list.draw(world)  # 刷新地面 +    plat_list.draw(world)   # 刷新平台     for e in enemy_list:         e.move()     pygame.display.flip()     clock.tick(fps) ``` -This is the 7th installment in an ongoing series about creating video games in [Python 3][4] using the [Pygame][5] module. Previous articles are: +本期是使用 [Pygame][5] 模块在 [Python 3][4] 中创建视频游戏连载系列的第 7 期。往期文章为: - * [Learn how to program in Python by building a simple dice game][6] - * [Build a game framework with Python using the Pygame module][7] - * [How to add a player to your Python game][8] - * [Using Pygame to move your game character around][9] - * [What's a hero without a villain? How to add one to your Python game][10] - * [Simulate gravity in your Python game][2] + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][6] + * [使用 Python 和 Pygame 模块构建一个游戏框架][7] + * [如何在你的 Python 游戏中添加一个玩家][8] + * [用 Pygame 使你的游戏角色移动起来][9] + * [如何向你的 Python 游戏中添加一个敌人][10] + * [在你的 Python 游戏中模拟重力][2] @@ -493,7 +492,7 @@ via: https://opensource.com/article/19/12/jumping-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[cycoe](https://github.com/cycoe) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fe1ad6440223a95d0726e563c47b1ef1b29d178a Mon Sep 17 00:00:00 2001 From: cycoe Date: Mon, 13 Jan 2020 21:10:23 +0800 Subject: [PATCH 0220/3057] Translated by cycoe --- ... jumping to your Python platformer game.md | 161 +++++++++--------- 1 file changed, 80 insertions(+), 81 deletions(-) rename {sources => translated}/tech/20191205 Add jumping to your Python platformer game.md (52%) diff --git a/sources/tech/20191205 Add jumping to your Python platformer game.md b/translated/tech/20191205 Add jumping to your Python platformer game.md similarity index 52% rename from sources/tech/20191205 Add jumping to your Python platformer game.md rename to translated/tech/20191205 Add jumping to your Python platformer game.md index 5c4ec0507e..0487cc1491 100644 --- a/sources/tech/20191205 Add jumping to your Python platformer game.md +++ b/translated/tech/20191205 Add jumping to your Python platformer game.md @@ -7,28 +7,27 @@ [#]: via: (https://opensource.com/article/19/12/jumping-python-platformer-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Add jumping to your Python platformer game +为你的 Python 平台类游戏添加跳跃功能 ====== -Learn how to fight gravity with jumping in this installment on -programming video games with Python's Pygame module. -![Arcade games][1] +在本期使用 Python Pygame 模块编写视频游戏中,学会如何使用跳跃来对抗重力。 +![游戏厅中的游戏][1] -In the [previous article][2] in this series, you simulated gravity, but now you need to give your player a way to fight against gravity by jumping. +在本系列的 [前一篇文章][2] 中,你已经模拟了重力。但现在,你需要赋予你的角色跳跃的能力来对抗重力。 -A jump is a temporary reprieve from gravity. For a few moments, you jump _up_ instead of falling down, the way gravity is pulling you. But once you hit the peak of your jump, gravity kicks in again and pulls you back down to earth. +跳跃是对重力作用的暂时延缓。在这一小段时间里,你是向_上_跳,而不是被重力拉着向下落。但你一旦到达了跳跃的最高点,重力就会重新发挥作用,将你拉回地面。 -In code, this translates to variables. First, you must establish variables for the player sprite so that Python can track whether or not the sprite is jumping. Once the player sprite is jumping, then gravity is applied to the player sprite again, pulling it back down to the nearest object. +在代码中,跳跃被表示为变量。首先,你需要为玩家对象建立一个变量,使得 Python 能够跟踪对象是否正在跳跃中。一旦玩家对象开始跳跃,他就会再次受到重力的作用,并被拉回最近的物体。 -### Setting jump state variables +### 设置跳跃状态变量 -You must add two new variables to your Player class: +你需要为你的 Player 类添加两个新变量: - * One to track whether your player is jumping or not, determined by whether or not your player sprite is standing on solid ground - * One to bring the player back down to the ground + * 一个是为了跟踪你的角色是否正在跳跃中,可通过你的玩家对象是否站在坚实的地面来确定 + * 一个是为了将玩家带回地面 -Add these variables to your **Player** class. In the following code, the lines above the comment are for context, so just add the final two lines: +将如下两个变量添加到你的 **Player** 类中。在下方的代码中,注释前的部分用于提示上下文,因此只需要添加最后两行: ``` @@ -36,20 +35,20 @@ Add these variables to your **Player** class. In the following code, the lines a                 self.movey = 0                 self.frame = 0                 self.health = 10 -                # gravity variables here +                # 此处是重力相关变量                 self.collide_delta = 0                 self.jump_delta = 6 ``` -The first variable (**collide_delta**) is set to 0 because, in its natural state, the player sprite is not in a mid-jump. The other variable (**jump_delta**) is set to 6 to prevent the sprite from bouncing (actually, jumping) when it first lands in the game world. When you've finished this article's examples, try setting it to 0 to see what happens. +第一个变量 **collide_delta** 被设为 0 是因为在正常状态下,玩家对象没有处在跳跃中的状态。另一个变量 **jump_delta** 被设为 6,是为了防止对象在第一次进入游戏世界时就发生反弹(实际上就是跳跃)。当你完成了本篇文章的示例,尝试把该变量设为 0 看看会发生什么。 -### Colliding mid-jump +### 跳跃中的碰撞 -If you jump on a trampoline, your jumps are pretty impressive. But what would happen if you jumped into a wall? (Don't try it to find out!) Your jump, no matter how impressively it started, would end very quickly when you collide with something much larger and much more solid than you. +如果你是跳到一个蹦床上,那你的跳跃一定非常优美。但是如果你是跳向一面墙会发生什么呢?(千万不要去尝试!)不管你的起跳多么令人印象深刻,当你撞到比你更大更硬的物体时,你都会立马停下。(译注:原理参考动量守恒定律) -To mimic this in your video game, you must set the **self.collide_delta** variable to 0 whenever your player sprite collides with something, like the ground. If **self.collide_delta** is anything other than 0, then your player is jumping, and your player can't jump when it hits a wall or the ground. +为了在你的视频游戏中模拟这一点,你需要在你的玩家对象与地面等东西发生碰撞时,将 **self.collide_delta** 变量设为 0。如果你的 **self.collide_delta** 不是 0 而是其它的什么值,那么你的玩家就会发生跳跃,并且当你的玩家与墙或者地面发生碰撞时无法跳跃。 -In the **update** function of your **Player** class, modify the ground collision block to look like this: +在你的 **Player** 类的 **update** 方法中,将地面碰撞相关代码块修改为如下所示: ``` @@ -57,54 +56,54 @@ In the **update** function of your **Player** class, modify the ground collision         for g in ground_hit_list:             self.movey = 0             self.rect.y = worldy-ty-ty -            self.collide_delta = 0 # stop jumping +            self.collide_delta = 0 # 停止跳跃             if self.rect.y > g.rect.y:                 self.health -=1                 print(self.health) ``` -This code block checks for collisions happening between the ground sprites and the player sprite. In the event of a collision, it sets the Y-position of the player to a value equal to the height of the game window (**worldy**) minus the height of a tile minus the height of another tile (so that the player sprite appears to be standing on top of the ground and not in the middle of it). It also sets **self.collide_delta** to 0 so that the program is aware that the player is not in mid-jump. Additionally, it sets **self.movey** to 0 so that the program is aware that the player is not being pulled by gravity (it's a quirk of game physics that you don't need to continue to pull your player toward earth once the player has been grounded). +这段代码块检查了地面对象和玩家对象之间发生的碰撞。当发生碰撞时,它会将玩家 Y 方向的坐标值设置为游戏窗口的高度减去一个瓷贴的高度再减去另一个瓷贴的高度。以此保证了玩家对象是站在地面**上**,而不是嵌在地面里。同时它也将 **self.collide_delta** 设为 0,使得程序能够知道玩家未处在跳跃中。除此之外,它将 **self.movey** 设为 0,使得程序能够知道玩家当前未受到重力的牵引作用(这是游戏物理引擎的奇怪之处,一旦玩家落地,也就没有必要继续将玩家拉向地面)。 -The **if** statement detects whether the player has descended _below_ the level of the ground; if so, it deducts health points as a penalty. This assumes that you want your player to lose health points for falling off the world. That's not strictly necessary; it's just a common convention in platformers. More than likely, you want this event to trigger something, though, or else your real-world player will be stuck playing a game with a sprite that's fallen off the screen. An easy recovery is to set **self.rect.y** to 0 again so that when the player sprite falls off the world, it respawns at the top of the world and falls back onto solid ground. +此处 **if** 语句用来检测玩家是否已经落到地面之_下_,如果是,那就扣除一点生命值作为惩罚。此处假定了你希望当你的玩家落到地图之外时失去生命值。这个设定不是必需的,它只是平台类游戏的一种惯例。更有可能的是,你希望这个事件能够触发另一些事件,或者说是一种能够让你的现实世界玩家沉迷于让对象掉到屏幕之外的东西。一种简单的恢复方式是在玩家对象掉落到地图之外时,将 **self.rect.y** 重新设置为 0,这样它就会在地图上方重新生成,并落到坚实的地面上。 -### Hitting the ground +### 撞向地面 -Your simulated gravity wants your player's Y-axis movement to be 0 or more. To create a jump, write code that sends your player sprite off solid ground and into the air. +模拟的重力使你玩家的 Y 坐标不断增大(译注:此处原文中为 0,但在 Pygame 中越靠下方 Y 坐标应越大)。要实现跳跃,完成如下代码使你的玩家对象离开地面,飞向空中。 -In the **update** function of your **Player** class, add a temporary reprieve from gravity: +在你的 **Player** 类的 **update** 方法中,添加如下代码来暂时延缓重力的作用: ```         if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2 -            self.movey -= 33  # how high to jump +            self.movey -= 33  # 跳跃的高度             self.collide_delta += 6             self.jump_delta    += 6 ``` -According to this code, a jump sends the player sprite 33 pixels into the air. It's _negative_ 33 because a lower number in Pygame means it's closer to the top of the screen. +根据此代码所示,跳跃使玩家对象向空中移动了 33 个像素。此处是_负_ 33 是因为在 Pygame 中,越小的数代表距离屏幕顶端越近。 -This event is conditional, though. It only happens if **self.collide_delta** is less than 6 (its default value established in the **init** function of your **Player** sprite) and if **self.jump_delta** is less than 6. This condition prevents the player from triggering another jump until it collides with a platform. In other words, it prevents mid-air jumps. +不过此事件视条件而定,只有当 **self.collide_delta** 小于 6(缺省值定义在你 **Player** 类的 **init** 方法中)并且 **self.jump_delta** 也于 6 的时候才会发生。此条件能够保证直到玩家碰到一个平台,才能触发另一次跳跃。换言之,它能够阻止空中二段跳。 -You don't have to prevent mid-air jumps, or you can allow for mid-air jumps under special conditions; for instance, if a player obtains a special loot item, then you could grant it the ability to perform mid-air jumps until the next time it is hit by an enemy. +在某些特殊条件下,你可能不想阻止空中二段跳,或者说你允许玩家进行空中二段跳。举个栗子,如果玩家获得了某个战利品,那么在他被敌人攻击到之前,都能够拥有空中二段跳的能力。 -When you've finished this article's examples, try setting **self.collide_delta** and **self.jump_delta** to 0 for a 100% chance to jump in mid-air. +当你完成本篇文章中的示例,尝试将 **self.collide_delta** 和 **self.jump_delta** 设置为 0,从而获得百分之百的几率触发空中二段跳。 -### Landing on a platform +### 在平台上着陆 -So far, you've defined an anti-gravity condition for when the player sprite hits the ground, but the game code keeps platforms and the ground in separate lists. (As with so many choices made in this article, that's not strictly necessary, and you can experiment with treating the ground as just another platform.) To enable a player sprite to stand on top of a platform, you must detect a collision between the player sprite and a platform sprite and then perform the same actions as you did for a ground collision. Place this code into your **update** function: +目前你已经定义了再玩家对象摔落地面时的抵抗重力条件,但此时你的游戏代码仍保持平台与地面置于不同的列表中(就像本文中做的很多其他选择一样,这个设定并不是必需的,你可以尝试将地面作为另一种平台)。为了允许玩家对象站在平台之上,你必须像检测地面碰撞一样,检测玩家对象与平台对象之间的碰撞。将如下代码放于你的 **update** 方法中: ```         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False)         for p in plat_hit_list: -            self.collide_delta = 0 # stop jumping +            self.collide_delta = 0 # 跳跃结束             self.movey = 0 ``` -There's one additional concern, though: platforms hang in the air, meaning the player can interact with them by approaching them from either the top or the bottom. +但此处还有一点需要考虑:平台悬在空中,也就意味着玩家可以通过从上面或者从下面接触平台来与之互动。 -It's up to you how you want the platforms to react to your player. It's not uncommon to block a player from accessing a platform from below. Add this code to the above code block to treat platforms as a sort of ceiling or pergola, such that the player sprite can jump onto a platform as long as it jumps higher than the platform's topside, but obstructs the player when it tries to jump from beneath: +确定平台如何与玩家互动取决于你,阻止玩家从下方到达平台也并不稀奇。将如下代码加到上方的代码块中,使得平台表现得像天花板或者说是藤架。只有在玩家对象跳得比平台上沿更高时才能跳到平台上,但会阻止玩家从平台下方跳上来: ``` @@ -114,17 +113,17 @@ It's up to you how you want the platforms to react to your player. It's not unco                 self.rect.y = p.rect.y-ty ``` -The first clause of this **if** statement blocks the player from accessing a platform when the player sprite is directly under the platform. It does this by detecting that the player sprite's position is greater (in Pygame, that means lower on the screen, from top to bottom), and then sets the player sprite's new Y position to its current Y position plus the height of a tile, effectively keeping the player one tile's height away from ever passing through a platform from beneath it. +此处 **if** 语句代码块的第一个子句阻止玩家对象从平台正下方跳到平台上。如果它检测到玩家对象的坐标比平台更大(在 Pygame 中,坐标更大意味着在屏幕的更下方),那么将玩家对象新的 Y 坐标设置为当前平台的 Y 坐标加上一个瓷贴的高度。实际效果就是保证玩家对象距离平台一个瓷贴的高度,防止其从下方穿过平台。 -The **else** clause does the opposite. If the program is running this code, then the player sprite's Y position is _not_ greater than the platforms, meaning that the player sprite is falling from the sky (either because it has been freshly spawned there or because the player has jumped). In this event, the player sprite's position is set to the position of the platform minus one tile's height (because, remember, in Pygame, lower numbers mean something is higher up on the screen). This keeps the player on top of the platform unless it jumps or walks off of it. +**else** 子句做了相反的事情。当程序运行到此处时,如果玩家对象的 Y 坐标_不_比平台的更大,意味着玩家对象是从空中落下(不论是由于玩家刚刚从此处生成,或者是玩家执行了跳跃)。在这种情况下,玩家对象的 Y 坐标被设为平台的 Y 坐标减去一个瓷贴的高度(切记,在 Pygame 中更小的 Y 坐标代表在屏幕上的更高处)。这样就能保证玩家在平台_上_,除非他从平台上跳下来或者走下来。 -You can experiment with other ways of dealing with sprite and platform interaction. For instance, maybe the player is assumed to be "in front" of the platforms and can seamlessly jump through them to stand on top of one. Or a platform could slow a player's leap but not block it entirely. You can even mix and match by grouping platforms into different lists. +你也可以尝试其他的方式来处理玩家与平台之间的互动。举个栗子,也许玩家对象被设定为处在平台的“前面”,他能够无障碍地跳跃穿过平台并站在上面。或者你可以设计一种平台会减缓而又不完全阻止玩家的跳跃过程。甚至你可以通过将不同平台分到不同列表中来混合搭配使用。 -### Triggering a jump +### 触发一次跳跃 -Your code now simulates all the necessary jump conditions, but it still lacks a jump trigger. Your player sprite's **self.jump_delta** is set to 6 initially, and the jump update code is triggered only when it's less than 6. +目前为此,你的代码已经模拟了所有必需的跳跃条件,但仍缺少一个跳跃触发器。你的玩家对象的 **self.jump_delta** 初始值被设置为 6,只有当它比 6 小时才会触发更新跳跃的代码。 -To trigger a new setting for the jumping variable, create a **jump** function in your **Player** class that sets the **self.jump_delta** to less than 6, causing gravity to be temporarily reprieved by sending your player sprite 33 pixels into the air: +为跳跃变量设置一个新的设置方法,在你的 **Player** 类中创建一个 **jump** 方法,并将 **self.jump_delta** 设为小于 6 的值。通过使玩家对象向空中移动 33 个像素,来暂时减缓重力的作用。 ``` @@ -132,17 +131,17 @@ To trigger a new setting for the jumping variable, create a **jump** function in         self.jump_delta = 0 ``` -That's all the **jump** function requires, believe it or not. The rest happens in the **update** function, and you've already written that code. +不管你相信与否,这就是 **jump** 方法的全部。剩余的部分在 **update** 方法中,你已经在前面实现了相关代码。 -There's one last thing to do before jumping is functional in your game. If you can't think of what it is, try playing your game to see how jumping works for you. +要使你游戏中的跳跃功能生效,还有最后一件事情要做。如果你想不起来是什么,运行游戏并观察跳跃是如何生效的。 -The problem is that nothing in your main loop is calling the **jump** function. You made a placeholder keypress for it early on, but right now, all the jump key does is print **jump** to the terminal. +问题就在于你的主循环中没有调用 **jump** 方法。先前你已经为该方法创建了一个按键占位符,现在,跳跃键所做的就是将 **jump** 打印到终端。 -### Calling the jump function +### 调用 jump 方法 -In your main loop, change the result of the Up arrow from printing a debug statement to calling the **jump** function. +在你的主循环中,将_上_方向键的效果从打印一条调试语句,改为调用 **jump** 方法。 -Notice that the **jump** function, like the **update** function, needs to know about collisions, so you have to tell it which **plat_list** to use. +注意此处,与 **update** 方法类似,**jump** 方法也需要检测碰撞,因此你需要告诉它使用哪个 **plat_list**。 ``` @@ -150,13 +149,13 @@ Notice that the **jump** function, like the **update** function, needs to know a                 player.jump(plat_list) ``` -If you would rather use the Spacebar for jumping, set the key to **pygame.K_SPACE** instead of **pygame.K_UP**. Alternately, you can use both (as separate **if** statements) so that the player has a choice. +如果你倾向于使用空格键作为跳跃键,使用 **pygame.K_SPACE** 替代 **pygame.K_UP** 作为按键。另一种选择,你可以同时使用两种方式(使用单独的 **if** 语句),给玩家多一种选择。 -Try your game now. In the next article, you'll make your world scroll. +现在来尝试你的游戏吧!在下一篇文章中,你将让你的游戏卷动起来。 -![Pygame platformer][3] +![Pygame 平台类游戏][3] -Here's all the code so far: +以下是目前为止的所有代码: ``` @@ -184,7 +183,7 @@ Objects ''' class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     + # x 坐标,y 坐标,图像宽度,图像高度,图像文件     def __init__(self,xloc,yloc,imgw,imgh,img):         pygame.sprite.Sprite.__init__(self)         self.image = pygame.image.load(os.path.join('images',img)).convert() @@ -195,7 +194,7 @@ class Platform(pygame.sprite.Sprite): class Player(pygame.sprite.Sprite):     ''' -    Spawn a player +    生成一个玩家     '''     def __init__(self):         pygame.sprite.Sprite.__init__(self) @@ -227,34 +226,34 @@ class Player(pygame.sprite.Sprite):             def control(self,x,y):         ''' -        control player movement +        控制玩家移动         '''         self.movex += x         self.movey += y             def update(self):         ''' -        Update sprite position +        更新对象位置         '''                 self.rect.x = self.rect.x + self.movex         self.rect.y = self.rect.y + self.movey -        # moving left +        # 向左移动         if self.movex < 0:             self.frame += 1             if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani] -        # moving right +        # 向右移动         if self.movex > 0:             self.frame += 1             if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] -        # collisions +        # 碰撞         enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False)         for enemy in enemy_hit_list:             self.health -= 1 @@ -286,7 +285,7 @@ class Player(pygame.sprite.Sprite):             class Enemy(pygame.sprite.Sprite):     ''' -    Spawn an enemy +    生成一个敌人     '''     def __init__(self,x,y,img):         pygame.sprite.Sprite.__init__(self) @@ -302,7 +301,7 @@ class Enemy(pygame.sprite.Sprite):                     def move(self):         ''' -        enemy movement +        敌人移动         '''         distance = 80         speed = 8 @@ -337,9 +336,9 @@ class Enemy(pygame.sprite.Sprite): class Level():     def bad(lvl,eloc):         if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # 生成敌人 +            enemy_list = pygame.sprite.Group() # 创建敌人组 +            enemy_list.add(enemy)              # 将敌人添加到敌人组                     if lvl == 2:             print("Level " + str(lvl) ) @@ -392,8 +391,8 @@ Setup worldx = 960 worldy = 720 -fps = 40 # frame rate -ani = 4  # animation cycles +fps = 40 # 帧率 +ani = 4  # 动画循环 clock = pygame.time.Clock() pygame.init() main = True @@ -406,7 +405,7 @@ ALPHA = (0,255,0) world = pygame.display.set_mode([worldx,worldy]) backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() backdropbox = world.get_rect() -player = Player() # spawn player +player = Player() # 生成玩家 player.rect.x = 0 player.rect.y = 0 player_list = pygame.sprite.Group() @@ -418,8 +417,8 @@ eloc = [] eloc = [200,20] gloc = [] #gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] -tx = 64 #tile size -ty = 64 #tile size +tx = 64 # 瓷贴尺寸 +ty = 64 # 瓷贴尺寸 i=0 while i <= (worldx/tx)+tx: @@ -431,7 +430,7 @@ ground_list = Level.ground( 1,gloc,tx,ty ) plat_list = Level.platform( 1,tx,ty ) ''' -Main loop +主循环 ''' while main == True:     for event in pygame.event.get(): @@ -464,26 +463,26 @@ while main == True: #    world.fill(BLACK)     world.blit(backdrop, backdropbox) -    player.gravity() # check gravity +    player.gravity() # 检查重力     player.update() -    player_list.draw(world) #refresh player position -    enemy_list.draw(world)  # refresh enemies -    ground_list.draw(world)  # refresh enemies -    plat_list.draw(world)   # refresh platforms +    player_list.draw(world) # 刷新玩家位置 +    enemy_list.draw(world)  # 刷新敌人 +    ground_list.draw(world)  # 刷新地面 +    plat_list.draw(world)   # 刷新平台     for e in enemy_list:         e.move()     pygame.display.flip()     clock.tick(fps) ``` -This is the 7th installment in an ongoing series about creating video games in [Python 3][4] using the [Pygame][5] module. Previous articles are: +本期是使用 [Pygame][5] 模块在 [Python 3][4] 中创建视频游戏连载系列的第 7 期。往期文章为: - * [Learn how to program in Python by building a simple dice game][6] - * [Build a game framework with Python using the Pygame module][7] - * [How to add a player to your Python game][8] - * [Using Pygame to move your game character around][9] - * [What's a hero without a villain? How to add one to your Python game][10] - * [Simulate gravity in your Python game][2] + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][6] + * [使用 Python 和 Pygame 模块构建一个游戏框架][7] + * [如何在你的 Python 游戏中添加一个玩家][8] + * [用 Pygame 使你的游戏角色移动起来][9] + * [如何向你的 Python 游戏中添加一个敌人][10] + * [在你的 Python 游戏中模拟重力][2] @@ -493,7 +492,7 @@ via: https://opensource.com/article/19/12/jumping-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[cycoe](https://github.com/cycoe) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b01f40ea8d95136e54416029b39237baecc1ce0a Mon Sep 17 00:00:00 2001 From: qianmingtian <40565099+qianmingtian@users.noreply.github.com> Date: Mon, 13 Jan 2020 21:12:03 +0800 Subject: [PATCH 0221/3057] Translated and fixed a space by qianmingtian --- ...d eMail With a List of User Accounts Expiring in -X- Days.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index 77fcbeed2b..1e073e3051 100644 --- a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -28,7 +28,7 @@ 本教程中包含两个 **[bash脚本][6]** 可以帮助您收集系统中用户到期日的信息。 -### 1) 检查10天后到期的用户帐户列表 +### 1) 检查 10 天后到期的用户帐户列表 此脚本将帮助您检查终端上 10 天内到期的用户帐户列表。 From 759e2c8180270e8a9e3ca80f4818b74eb9333b0a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 21:17:58 +0800 Subject: [PATCH 0222/3057] APL --- .../tech/20200105 PaperWM- tiled window management for GNOME.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md index dab0726417..a110310251 100644 --- a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md +++ b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (PaperWM: tiled window management for GNOME) From 3309887a712ae7253bbdad911d99dff64ced4599 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 21:30:43 +0800 Subject: [PATCH 0223/3057] PRF @geekpi --- ...erWM- tiled window management for GNOME.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md index a110310251..7693b5446a 100644 --- a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md +++ b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -10,13 +10,15 @@ PaperWM:GNOME 下的平铺窗口管理 ====== -当我开始在个人计算机上使用 Linux 时,令我兴奋的第一件事就是轻巧的窗口管理器,这主要是因为当时我的笔记本电脑只有有 32MB 的内存,且没有其他可使用的内存。 +![](https://img.linux.net.cn/data/attachment/album/202001/13/212936hsk572f4jrsj2jsh.jpg) -接着我开始接触 [xmonad][1] 之类的平铺窗口管理器!我可以用键盘管理窗口了!它们太快了!我可以通过编写 Haskell 程序来配置 xmonad!我可以用各种有趣的方式自定义所有内容(例如使用 [dmenu][2] 作为启动器)!这些年来,我用过 3,4 个不同的平铺窗口管理器,它们很有趣。 +当我开始在个人计算机上使用 Linux 时,首先令我兴奋的就是轻巧的窗口管理器,这主要是因为当时我的笔记本电脑只有有 32MB 的内存,其它的都运行不了了。 -大约 6 年前,我觉得配置平铺窗口管理器对我来说不再是一件有趣的事情,因此转而使用 Ubuntu 桌面环境 Gnome。 (现在,我的笔记本电脑中的内存增加了 500 倍,这要快得多 :) ) +接着我开始接触 [xmonad][1] 之类的平铺窗口管理器!我可以用键盘管理窗口了!它们是如此之快!我可以通过编写 Haskell 程序来配置 xmonad!我可以用各种有趣的方式自定义所有内容(例如使用 [dmenu][2] 作为启动器)!这些年来,我用过 3、4 个不同的平铺窗口管理器,它们都很有趣。 -我使用 Gnome 已有很长时间了,但是我仍然有点想念平铺窗口管理器。六个月前,一个朋友告诉我有关 [PaperWM][3] 的消息,它使你可以在 Gnome中 平铺窗口!我立即安装了它,并从那时起我一直在使用它。 +大约 6 年前,我觉得配置平铺窗口管理器对我来说不再是一件有趣的事情,因此转而使用 Ubuntu 桌面环境 Gnome。(现在,我的笔记本电脑中的内存增加了 500 倍,这要快得多 :) ) + +我使用 Gnome 已有很长时间了,但是我仍然有点想念平铺窗口管理器。六个月前,一个朋友告诉我有关 [PaperWM][3] 的消息,它使你可以在 Gnome 中平铺窗口!我立即安装了它,并从那时起我一直在使用它。 ### PaperWM:Gnome 下的平铺窗口管理 @@ -26,7 +28,7 @@ PaperWM:GNOME 下的平铺窗口管理 ### “Paper” 表示你的所有窗户都在一行中 -PaperWM 的主要思想是将所有窗口排成一行,这实际上与传统的平铺窗口管理器大不相同,在传统的平铺窗口管理器中,你可以按任意方式平铺窗口。这是我写这篇博客时在几个窗口之间切换/调整大小的 gif 图像(有一个浏览器和两个终端窗口): +PaperWM 的主要想法是将所有窗口排成一行,这实际上与传统的平铺窗口管理器大不相同,在传统的平铺窗口管理器中,你可以按任意方式平铺窗口。这是我写这篇博客时在几个窗口之间切换/调整大小的 gif 图像(有一个浏览器和两个终端窗口): ![][4] @@ -38,16 +40,14 @@ PaperWM 的 Github README 链接了此视频:,它 还有很多其他功能,但这是我使用的功能: - * 在窗口之间左右移动(`Super + ,`, `Super + .`) -  * 按顺序向左/向右移动窗口(`Super+Shift+,`,`Super+Shift+.`) -  * 全屏显示窗口(`Super + f`) -  * 缩小窗口(`Super + r`) - - +* 在窗口之间左右移动(`Super + ,`、`Super + .`) +* 按顺序向左/向右移动窗口(`Super+Shift+,`、`Super+Shift+.`) +* 全屏显示窗口(`Super + f`) +* 缩小窗口(`Super + r`) ### 我喜欢不需要配置的工具 -我在笔记本上使用 PaperWM 已经6个月了,我真的很喜欢它!即使它是可配置(通过编写 Javascript 配置文件),我也非常欣赏它,它自带我想要的功能,我无需研究如何去配置。 +我在笔记本上使用 PaperWM 已经 6 个月了,我真的很喜欢它!即使它是可配置(通过编写 Javascript 配置文件),我也非常欣赏它,它自带我想要的功能,我无需研究如何去配置。 [fish shell][5] 是另一个类似的令人愉悦的工具,我基本上没有配置 fish(除了设置环境变量等),我真的很喜欢它的默认功能。 @@ -58,7 +58,7 @@ via: https://jvns.ca/blog/2020/01/05/paperwm/ 作者:[Julia Evans][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3218e4aa8b7e9e4871dd2c2ce3b9606c0d005408 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 21:38:16 +0800 Subject: [PATCH 0224/3057] PUB @geekpi https://linux.cn/article-11779-1.html --- .../20200105 PaperWM- tiled window management for GNOME.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200105 PaperWM- tiled window management for GNOME.md (98%) diff --git a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md b/published/20200105 PaperWM- tiled window management for GNOME.md similarity index 98% rename from translated/tech/20200105 PaperWM- tiled window management for GNOME.md rename to published/20200105 PaperWM- tiled window management for GNOME.md index 7693b5446a..ea412dae95 100644 --- a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md +++ b/published/20200105 PaperWM- tiled window management for GNOME.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11779-1.html) [#]: subject: (PaperWM: tiled window management for GNOME) [#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/) [#]: author: (Julia Evans https://jvns.ca/) From 6608f4dfc7bb89c4df675a9a77578f5d0e6a7287 Mon Sep 17 00:00:00 2001 From: qianmingtian <40565099+qianmingtian@users.noreply.github.com> Date: Mon, 13 Jan 2020 22:09:24 +0800 Subject: [PATCH 0225/3057] Translating by qianmingtian --- ...09 Huawei-s Linux Distribution openEuler is Available Now.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md index 93c4330b52..6f762fd0a2 100644 --- a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md +++ b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qianmingtian) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 21922e846dd44a124f1c9b409dd626f66356dda1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 22:39:55 +0800 Subject: [PATCH 0226/3057] PRF @robsean --- ...21 Simulate gravity in your Python game.md | 416 +++++++++--------- 1 file changed, 205 insertions(+), 211 deletions(-) diff --git a/translated/tech/20191121 Simulate gravity in your Python game.md b/translated/tech/20191121 Simulate gravity in your Python game.md index fd02e851d6..e220aca3ff 100644 --- a/translated/tech/20191121 Simulate gravity in your Python game.md +++ b/translated/tech/20191121 Simulate gravity in your Python game.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Simulate gravity in your Python game) @@ -9,91 +9,87 @@ 在你的 Python 游戏中模拟引力 ====== -学习如何使用 Python 的 Pygame 模块编程电脑游戏,并开始操作引力。 -![Cosmic stars in outer space][1] -真实的世界充满了运动和生活。物理学使得真实的生活如此忙碌和动态。物理学是物质在空间中运动的方式。既然一个电脑游戏世界没有物质,它也就没有物理学规律,使用游戏程序员不得不 _模拟_ 物理学。 +> 学习如何使用 Python 的 Pygame 模块编程电脑游戏,并开始操作引力。 -从大多数电脑游戏来说,这里基本上仅有物理学的两个方向是重要的:引力和碰撞。 +![](https://img.linux.net.cn/data/attachment/album/202001/13/223923k6t4zmvvmo6tfmmg.png) -当你[添加一个敌人][2]到你的游戏中时,你实现了一下碰撞检测,但是这篇文章添加更多的东西,因为引力需要碰撞检测。想想为什么引力可能涉及碰撞。如果你不能想到任何原因,不要担心—当你通过示例代码工作时,它将变得明显。 +真实的世界充满了运动和生活。物理学使得真实的生活如此忙碌和动态。物理学是物质在空间中运动的方式。既然一个电脑游戏世界没有物质,它也就没有物理学规律,使用游戏程序员不得不*模拟*物理学。 -引力在真实世界中的是有质量的物体来相互吸引的趋势。物体(质量)越大,它施加越大的引力作用。在电脑游戏物理学中,你不必创建质量足够大的物体来证明引力的正确;你可以在电脑游戏世界本身中仅编程一个物体落向假设的最大的对象的倾向。 +从大多数电脑游戏来说,这里基本上仅有两个方面的物理学是重要的:引力和碰撞。 + +当你[添加一个敌人][2]到你的游戏中时,你实现了一些碰撞检测,但是这篇文章要添加更多的东西,因为引力需要碰撞检测。想想为什么引力可能涉及碰撞。如果你不能想到任何原因,不要担心 —— 它会随着你开发示例代码工作而且显然。 + +在真实世界中的引力是有质量的物体来相互吸引的倾向性。物体(质量)越大,它施加越大的引力作用。在电脑游戏物理学中,你不必创建质量足够大的物体来证明引力的正确;你可以在电脑游戏世界本身中仅编程一个物体落向假设的最大的对象的倾向。 ### 添加一个引力函数 -记住你的玩家已经有一个属性来决定动作。使用这个属性来将玩家精灵拉向屏幕底部。 +记住你的玩家已经有了一个决定动作的属性。使用这个属性来将玩家精灵拉向屏幕底部。 在 Pygame 中,较高的数字更接近屏幕的底部边缘。 -在真实的世界中,引力影响一切。然而,在平台中,引力是有选择性的—如果你添加引力到你的整个游戏世界,你所有平台都将掉到地上。作为替换,你仅添加引力到你的玩家和敌人精灵中。 - -首先,在你的 **Player** 类中添加一个 **引力** 函数: +在真实的世界中,引力影响一切。然而,在平台游戏中,引力是有选择性的 —— 如果你添加引力到你的整个游戏世界,你的所有平台都将掉到地上。反之,你可以仅添加引力到你的玩家和敌人精灵中。 +首先,在你的 `Player` 类中添加一个 `gravity` 函数: ```     def gravity(self): -        self.movey += 3.2 # how fast player falls +        self.movey += 3.2 # 玩家掉落的多快 ``` 这是一个简单的函数。首先,不管你的玩家是否想运动,你设置你的玩家垂直运动。也就是说,你已经编程你的玩家总是在下降。这基本上就是引力。 -为使引力函数生效,你必需在你的主循环中调用它。这样,当每一个时钟滴答作响时,Python 应用下落运动到你玩家。 +为使引力函数生效,你必须在你的主循环中调用它。这样,当每一个处理循环时,Python 都应用下落运动到你的玩家。 在这代码中,添加第一行到你的循环中: - ``` -    player.gravity() # check gravity +    player.gravity() # 检查引力     player.update() ``` -启动你的游戏来看看会发生什么。注意,因为它快速地发生:你是玩家从天空上下落,恰好从你的游戏屏幕落下。 +启动你的游戏来看看会发生什么。要注意,因为它发生的很快:你是玩家从天空上下落,马上掉出了你的游戏屏幕。 你的引力模拟是工作的,但是,也许太好了。 作为一次试验,尝试更改你玩家下落的速度。 -### 添加一个地板到引力 +### 给引力添加一个地板 -你的游戏没有办法发现你的角色掉落出世界的问题。在一些游戏中,如果一个玩家掉落出世界,该精灵被删除,并在新的位置重生。在其它的游戏中,玩家丢失分数或一条生命。当一个玩家掉落出世界时,不管你想发生什么,你必需能够侦测出玩家何时消失在屏幕外。 +你的游戏没有办法发现你的角色掉落出世界的问题。在一些游戏中,如果一个玩家掉落出世界,该精灵被删除,并在某个新的位置重生。在另一些游戏中,玩家会丢失分数或一条生命。当一个玩家掉落出世界时,不管你想发生什么,你必须能够侦测出玩家何时消失在屏幕外。 -在 Python 中,要检查一个条件,你可以使用一个 **if** 语句。 +在 Python 中,要检查一个条件,你可以使用一个 `if` 语句。 -你必需查看你玩家**是否**正在掉落,以及你的玩家掉落到什么程度。如果你的玩家掉落到屏幕的底部,那么你可以做 _一些事情_ 。 为保持事情简单,设置玩家精灵的位置为底部边缘上方20像素。 - -使你的 **引力** 函数看起来像这样: +你必需查看你玩家**是否**正在掉落,以及你的玩家掉落的程度。如果你的玩家掉落到屏幕的底部,那么你可以做*一些事情*。简化一下,设置玩家精灵的位置为底部边缘上方 20 像素。 +使你的 `gravity` 函数看起来像这样: ```     def gravity(self): -        self.movey += 3.2 # how fast player falls +        self.movey += 3.2 # 玩家掉落的多快                 if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty ``` -然后,启动你的游戏。你的精灵仍然下落,但是它停在屏幕的底部。不过,你也许不能 _看到_ 你在地面层下的精灵。一个简单的解决方法是,在精灵碰撞游戏世界的底部后,通过添加另一个 **-ty** 到它的新 Y 位置,从而使你的精灵弹跳更高: - +然后,启动你的游戏。你的精灵仍然下落,但是它停在屏幕的底部。不过,你也许不能*看到*你在地面层之上的精灵。一个简单的解决方法是,在精灵碰撞游戏世界的底部后,通过添加另一个 `-ty` 到它的新 Y 位置,从而使你的精灵弹跳到更高处: ```     def gravity(self): -        self.movey += 3.2 # how fast player falls +        self.movey += 3.2 # 玩家掉落的多快                 if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty-ty ``` -现在你的玩家在屏幕底部弹跳,恰好在你地面层精灵的后面。 +现在你的玩家在屏幕底部弹跳,恰好在你地面精灵上面。 你的玩家真正需要的是反抗引力的方法。引力问题是,你不能反抗它,除非你有一些东西来推开引力作用。因此,在接下来的文章中,你将添加地面和平台碰撞以及跳跃能力。在这期间,尝试应用引力到敌人精灵。 - 到目前为止,这里是全部的代码: - ``` #!/usr/bin/env python3 # draw a world @@ -106,7 +102,7 @@ # GNU All-Permissive License # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved.  This file is offered as-is, +# notice and this notice are preserved. This file is offered as-is, # without any warranty. import pygame @@ -118,163 +114,163 @@ Objects ''' class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     -    def __init__(self,xloc,yloc,imgw,imgh,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)).convert() -        self.image.convert_alpha() -        self.rect = self.image.get_rect() -        self.rect.y = yloc -        self.rect.x = xloc + # x location, y location, img width, img height, img file + def __init__(self,xloc,yloc,imgw,imgh,img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)).convert() + self.image.convert_alpha() + self.rect = self.image.get_rect() + self.rect.y = yloc + self.rect.x = xloc class Player(pygame.sprite.Sprite): -    ''' -    Spawn a player -    ''' -    def __init__(self): -        pygame.sprite.Sprite.__init__(self) -        self.movex = 0 -        self.movey = 0 -        self.frame = 0 -        self.health = 10 -        self.score = 1 -        self.images = [] -        for i in range(1,9): -            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() -            img.convert_alpha() -            img.set_colorkey(ALPHA) -            self.images.append(img) -            self.image = self.images[0] -            self.rect  = self.image.get_rect() + ''' + Spawn a player + ''' + def __init__(self): + pygame.sprite.Sprite.__init__(self) + self.movex = 0 + self.movey = 0 + self.frame = 0 + self.health = 10 + self.score = 1 + self.images = [] + for i in range(1,9): + img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() + img.convert_alpha() + img.set_colorkey(ALPHA) + self.images.append(img) + self.image = self.images[0] + self.rect = self.image.get_rect() -    def gravity(self): -        self.movey += 3.2 # how fast player falls -        -        if self.rect.y > worldy and self.movey >= 0: -            self.movey = 0 -            self.rect.y = worldy-ty-ty -        -    def control(self,x,y): -        ''' -        control player movement -        ''' -        self.movex += x -        self.movey += y -        -    def update(self): -        ''' -        Update sprite position -        ''' + def gravity(self): + self.movey += 3.2 # how fast player falls + + if self.rect.y > worldy and self.movey >= 0: + self.movey = 0 + self.rect.y = worldy-ty-ty + + def control(self,x,y): + ''' + control player movement + ''' + self.movex += x + self.movey += y + + def update(self): + ''' + Update sprite position + ''' -        self.rect.x = self.rect.x + self.movex -        self.rect.y = self.rect.y + self.movey + self.rect.x = self.rect.x + self.movex + self.rect.y = self.rect.y + self.movey -        # moving left -        if self.movex < 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[self.frame//ani] + # moving left + if self.movex < 0: + self.frame += 1 + if self.frame > ani*3: + self.frame = 0 + self.image = self.images[self.frame//ani] -        # moving right -        if self.movex > 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[(self.frame//ani)+4] + # moving right + if self.movex > 0: + self.frame += 1 + if self.frame > ani*3: + self.frame = 0 + self.image = self.images[(self.frame//ani)+4] -        # collisions -        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) -        for enemy in enemy_hit_list: -            self.health -= 1 -            print(self.health) + # collisions + enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) + for enemy in enemy_hit_list: + self.health -= 1 + print(self.health) -        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) -        for g in ground_hit_list: -            self.health -= 1 -            print(self.health) + ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) + for g in ground_hit_list: + self.health -= 1 + print(self.health) class Enemy(pygame.sprite.Sprite): -    ''' -    Spawn an enemy -    ''' -    def __init__(self,x,y,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)) -        #self.image.convert_alpha() -        #self.image.set_colorkey(ALPHA) -        self.rect = self.image.get_rect() -        self.rect.x = x -        self.rect.y = y -        self.counter = 0 -        -    def move(self): -        ''' -        enemy movement -        ''' -        distance = 80 -        speed = 8 + ''' + Spawn an enemy + ''' + def __init__(self,x,y,img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)) + #self.image.convert_alpha() + #self.image.set_colorkey(ALPHA) + self.rect = self.image.get_rect() + self.rect.x = x + self.rect.y = y + self.counter = 0 + + def move(self): + ''' + enemy movement + ''' + distance = 80 + speed = 8 -        if self.counter >= 0 and self.counter <= distance: -            self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: -            self.rect.x -= speed -        else: -            self.counter = 0 + if self.counter >= 0 and self.counter <= distance: + self.rect.x += speed + elif self.counter >= distance and self.counter <= distance*2: + self.rect.x -= speed + else: + self.counter = 0 -        self.counter += 1 + self.counter += 1 class Level(): -    def bad(lvl,eloc): -        if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group -            -        if lvl == 2: -            print("Level " + str(lvl) ) + def bad(lvl,eloc): + if lvl == 1: + enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy + enemy_list = pygame.sprite.Group() # create enemy group + enemy_list.add(enemy) # add enemy to group + + if lvl == 2: + print("Level " + str(lvl) ) -        return enemy_list + return enemy_list -    def loot(lvl,lloc): -        print(lvl) + def loot(lvl,lloc): + print(lvl) -    def ground(lvl,gloc,tx,ty): -        ground_list = pygame.sprite.Group() -        i=0 -        if lvl == 1: -            while i < len(gloc): -                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') -                ground_list.add(ground) -                i=i+1 + def ground(lvl,gloc,tx,ty): + ground_list = pygame.sprite.Group() + i=0 + if lvl == 1: + while i < len(gloc): + ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') + ground_list.add(ground) + i=i+1 -        if lvl == 2: -            print("Level " + str(lvl) ) + if lvl == 2: + print("Level " + str(lvl) ) -        return ground_list + return ground_list -    def platform(lvl,tx,ty): -        plat_list = pygame.sprite.Group() -        ploc = [] -        i=0 -        if lvl == 1: -            ploc.append((0,worldy-ty-128,3)) -            ploc.append((300,worldy-ty-256,3)) -            ploc.append((500,worldy-ty-128,4)) + def platform(lvl,tx,ty): + plat_list = pygame.sprite.Group() + ploc = [] + i=0 + if lvl == 1: + ploc.append((0,worldy-ty-128,3)) + ploc.append((300,worldy-ty-256,3)) + ploc.append((500,worldy-ty-128,4)) -            while i < len(ploc): -                j=0 -                while j <= ploc[i][2]: -                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') -                    plat_list.add(plat) -                    j=j+1 -                print('run' + str(i) + str(ploc[i])) -                i=i+1 + while i < len(ploc): + j=0 + while j <= ploc[i][2]: + plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') + plat_list.add(plat) + j=j+1 + print('run' + str(i) + str(ploc[i])) + i=i+1 -        if lvl == 2: -            print("Level " + str(lvl) ) + if lvl == 2: + print("Level " + str(lvl) ) -        return plat_list + return plat_list ''' Setup @@ -283,12 +279,12 @@ worldx = 960 worldy = 720 fps = 40 # frame rate -ani = 4  # animation cycles +ani = 4 # animation cycles clock = pygame.time.Clock() pygame.init() main = True -BLUE  = (25,25,200) +BLUE = (25,25,200) BLACK = (23,23,23 ) WHITE = (254,254,254) ALPHA = (0,255,0) @@ -312,8 +308,8 @@ ty = 64 #tile size i=0 while i <= (worldx/tx)+tx: -    gloc.append(i*tx) -    i=i+1 + gloc.append(i*tx) + i=i+1 enemy_list = Level.bad( 1, eloc ) ground_list = Level.ground( 1,gloc,tx,ty ) @@ -323,45 +319,45 @@ plat_list = Level.platform( 1,tx,ty ) Main loop ''' while main == True: -    for event in pygame.event.get(): -        if event.type == pygame.QUIT: -            pygame.quit(); sys.exit() -            main = False + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit(); sys.exit() + main = False -        if event.type == pygame.KEYDOWN: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                print("LEFT") -                player.control(-steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                print("RIGHT") -                player.control(steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                print('jump') + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_LEFT or event.key == ord('a'): + print("LEFT") + player.control(-steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + print("RIGHT") + player.control(steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + print('jump') -        if event.type == pygame.KEYUP: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                player.control(steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                player.control(-steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                print('jump') + if event.type == pygame.KEYUP: + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(-steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + print('jump') -            if event.key == ord('q'): -                pygame.quit() -                sys.exit() -                main = False + if event.key == ord('q'): + pygame.quit() + sys.exit() + main = False -    world.blit(backdrop, backdropbox) -    player.gravity() # check gravity -    player.update() -    player_list.draw(world) -    enemy_list.draw(world) -    ground_list.draw(world) -    plat_list.draw(world) -    for e in enemy_list: -        e.move() -    pygame.display.flip() -    clock.tick(fps) + world.blit(backdrop, backdropbox) + player.gravity() # check gravity + player.update() + player_list.draw(world) + enemy_list.draw(world) + ground_list.draw(world) + plat_list.draw(world) + for e in enemy_list: + e.move() + pygame.display.flip() + clock.tick(fps) ``` * * * @@ -375,8 +371,6 @@ while main == True: * [如何向你的 Python 游戏中添加一个敌人][2] * [在 Pygame 游戏中放置平台][9] - - -------------------------------------------------------------------------------- via: https://opensource.com/article/19/11/simulate-gravity-python @@ -384,7 +378,7 @@ via: https://opensource.com/article/19/11/simulate-gravity-python 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -394,8 +388,8 @@ via: https://opensource.com/article/19/11/simulate-gravity-python [2]: https://opensource.com/article/18/5/pygame-enemy [3]: https://www.python.org/ [4]: https://www.pygame.org -[5]: https://opensource.com/article/17/10/python-101 -[6]: https://opensource.com/article/17/12/game-framework-python -[7]: https://opensource.com/article/17/12/game-python-add-a-player -[8]: https://opensource.com/article/17/12/game-python-moving-player -[9]: https://opensource.com/article/18/7/put-platforms-python-game +[5]: https://linux.cn/article-9071-1.html +[6]: https://linux.cn/article-10850-1.html +[7]: https://linux.cn/article-10858-1.html +[8]: https://linux.cn/article-10874-1.html +[9]: https://linux.cn/article-10883-1.html From 5cb14926d2c1d394bf9da7746c85d586a9cb8345 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 22:40:22 +0800 Subject: [PATCH 0227/3057] PUB @robsean https://linux.cn/article-11780-1.html --- .../20191121 Simulate gravity in your Python game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191121 Simulate gravity in your Python game.md (99%) diff --git a/translated/tech/20191121 Simulate gravity in your Python game.md b/published/20191121 Simulate gravity in your Python game.md similarity index 99% rename from translated/tech/20191121 Simulate gravity in your Python game.md rename to published/20191121 Simulate gravity in your Python game.md index e220aca3ff..e69c8a86ce 100644 --- a/translated/tech/20191121 Simulate gravity in your Python game.md +++ b/published/20191121 Simulate gravity in your Python game.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11780-1.html) [#]: subject: (Simulate gravity in your Python game) [#]: via: (https://opensource.com/article/19/11/simulate-gravity-python) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 26e965e2c3dd8d416ed59f1613f00500471152bf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 22:48:46 +0800 Subject: [PATCH 0228/3057] PRF --- published/20191121 Simulate gravity in your Python game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20191121 Simulate gravity in your Python game.md b/published/20191121 Simulate gravity in your Python game.md index e69c8a86ce..309dbf2091 100644 --- a/published/20191121 Simulate gravity in your Python game.md +++ b/published/20191121 Simulate gravity in your Python game.md @@ -385,11 +385,11 @@ via: https://opensource.com/article/19/11/simulate-gravity-python [a]: https://opensource.com/users/seth [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmic.jpg?itok=bE94WtN- (Cosmic stars in outer space) -[2]: https://opensource.com/article/18/5/pygame-enemy +[2]: https://linux.cn/article-10883-1.html [3]: https://www.python.org/ [4]: https://www.pygame.org [5]: https://linux.cn/article-9071-1.html [6]: https://linux.cn/article-10850-1.html [7]: https://linux.cn/article-10858-1.html [8]: https://linux.cn/article-10874-1.html -[9]: https://linux.cn/article-10883-1.html +[9]: https://linux.cn/article-10902-1.html From 0e93ba1e8549748664271e32ef44dc4e6cf96496 Mon Sep 17 00:00:00 2001 From: qianmingtian Date: Mon, 13 Jan 2020 23:21:50 +0800 Subject: [PATCH 0229/3057] Translated by qianmingtian --- ...Distribution openEuler is Available Now.md | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md index 93c4330b52..ea6b5d24a5 100644 --- a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md +++ b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qianmingtian) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,58 +7,59 @@ [#]: via: (https://itsfoss.com/openeuler/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Huawei’s Linux Distribution openEuler is Available Now! +华为的linux发行版 openEuler 可以使用了! ====== -Huawei offers a CentOS based enterprise Linux distribution called EulerOS. Recently, Huawei has released a community edition of EulerOS called [openEuler][1]. +华为提供了一个基于 CentOS 的企业 Linux 发行版 EulerOS 。最近,华为发布了一个名为 [openEuler][1] 的 EulerOS 社区版。 -The source code of openEuler is released as well. You won’t find it on Microsoft owned GitHub – the source code is available at [Gitee][2], a Chinese [alternative of GitHub][3]. +openEuler 的源代码也被发布了。你在微软旗下的 GitHub 上找不到它——源代码可以在 [Gitee][2] 找到,这是一个中文的 [GitHub 的替代品][3] 。 -There are two separate repositories, one for the [source code][2] and the other as a [package source][4] to store software packages that help to build the OS. +它有两个独立的存储库,一个用于存储[源代码][2],另一个作为[包源][4] 存储有助于构建操作系统的软件包。 -![][5] +![][5] -The openEuler infrastructure team shared their experience to make the source code available: +openuler 基础架构团队分享了他们使源代码可用的经验: -> We are very excited at this moment. It was hard to imagine that we will manage thousands of repositories. And to ensure that they can be compiled successfully, we would like to thank all those who participated in contributing +>我们现在很兴奋。很难想象我们会管理成千上万的仓库。为了确保它们能被成功地编译,我们要感谢所有参与贡献的人。 -### openEuler is a Linux distribution based on CentOS +### openEuler 是基于 CentOS 的 Linux 发行版 -Like EulerOS, openEuler OS is also based on [CentOS][6] but is further developed by Huawei Technologies for enterprise applications. +与 EulerOS 一样,openEuler OS 也是基于 [CentOS][6],但华为技术有限公司为企业应用进一步开发了该操作系统。 -It is tailored for ARM64 architecture servers and Huawei claims to have made changes to boost its performance. You can read more about it at [Huawei’s dev blog][7]. +它是为 ARM64 架构的服务器量身定做的,同时华为声称已经做了一些改变来提高其性能。你可以在[华为发展博客][7]上了解更多。 ![][8] -At the moment, as per the official openEuler announcement, there are more than 50 contributors with nearly 600 commits for openEuler. -The contributors made it possible to make the source code available to the community. +目前,根据 openEuler 的官方声明,有 50 多名贡献者为 openEuler 贡献了近 600 个提交。 -It is also worth noting that the repositories also include two new projects (or sub-projects) associated with it, [iSulad][9] **and A-Tune**. +贡献者使源代码对社区可用成为可能。 -A-Tune is an AI-based OS tuning software and iSulad is a lightweight container runtime daemon that is designed for IoT and Cloud infrastructure, as mentioned on [Gitee][2]. +值得注意的是,存储库还包括两个与之相关的新项目(或子项目),[iSulad][9] 和 **A-Tune**。 -Also, the official [announcement post][10] mentioned that these systems are built on the Huawei Cloud through script automation. So, that is definitely something interesting. +A-Tune 是一个基于 AI 的操作系统调优软件, iSulad 是一个轻量级的容器运行时守护进程,如[Gitee][2]中提到的那样,它是为物联网和云基础设施设计的。 -### Downloading openEuler +另外,官方的[公告][10]提到,这些系统是在华为云上通过脚本自动化构建的。这确实十分有趣。 + +### 下载 openEuler ![][11] -As of now, you won’t find the documentation for it in English – so you will have to wait for it or choose to help them with the [documentation][12]. +到目前为止,你找不到它的英文文档,所以你必须等待或选择通过[文档][12]帮助他们。 -You can download the ISO directly from its [official website][13] to test it out: +你可以直接从它的[官方网站][13]下载 ISO 来测试它: -[Download openEuler][13] +[下载 openEuler ][13] -### What do you think of Huawei openEuler? +### 你认为华为的 openEuler 怎么样? -As per cnTechPost, Huawei had announced that EulerOS would become open source under the new name openEuler. +据 cnTechPost 报道,华为曾宣布 EulerOS 将以新名字 openEuler 成为开源软件。 -At this point, it’s not clear if openEuler is replacing EulerOS or both will exist together like CentOS (community edition) and Red Hat (commercial edition). +目前还不清楚 openEuler 是否会取代 EulerOS ,或者两者会像 CentOS (社区版)和 Red Hat (商业版)一样同时存在。 -I haven’t tested it yet so I cannot say if openEuler is suitable for English speaking users or not. +我还没有测试过它,所以我不能说 openEuler 是否适合英文用户。 -Are you willing to give this a try? In case you’ve already tried it out, feel free to let me know your experience with it in the comments below. +你愿意试一试吗?如果你已经尝试过了,欢迎在下面的评论中告诉我你的体验。 -------------------------------------------------------------------------------- @@ -66,13 +67,14 @@ via: https://itsfoss.com/openeuler/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qianmingtian][c] 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://itsfoss.com/author/ankush/ [b]: https://github.com/lujun9972 +[c]: (https://github.com/qianmingtian) [1]: https://openeuler.org/en/ [2]: https://gitee.com/openeuler [3]: https://itsfoss.com/github-alternatives/ From 6ded4c1e208b94712515a232db00fa7e35307e0c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 23:21:58 +0800 Subject: [PATCH 0230/3057] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qianmingtian 恭喜你完成了第一篇翻译 --- ...t of User Accounts Expiring in -X- Days.md | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index 1e073e3051..a7264d60c7 100644 --- a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -1,40 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days) [#]: via: (https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -使用Bash 脚本发送包含 “X” 天内到期的用户账号列表的电子邮件 +使用 Bash 脚本发送包含几天内到期的用户账号列表的电子邮件 ====== -密码强制策略对所有操作系统和应用程序都是通用的。 +![](https://img.linux.net.cn/data/attachment/album/202001/13/232047vfxkrr47mn7eapda.jpg) -如果要 **[在Linux上实现密码强制策略][1]** ,请参阅以下文章。 +密码强制策略对所有操作系统和应用程序都是通用的。如果要[在 Linux 上实现密码强制策略][1],请参阅以下文章。 -默认情况下,大多数公司都会强制执行密码强制策略,但根据公司的要求,密码的时间周期会有所不同。 +默认情况下,大多数公司都会强制执行密码强制策略,但根据公司的要求,密码的时间周期会有所不同。通常每个人都使用 90 天的密码周期。用户只会在他们使用的一些服务器上[更改密码][2],而不会在他们不经常使用的服务器上更改密码。 -通常每个人都使用 90 天的密码周期。 +特别地,大多数团队忘记更改服务帐户密码,这可能导致日常工作的中断,即使他们配置有[基于 SSH 密钥的身份验证][3]。如果用户帐户密码过期,基于SSH密钥的身份验证和 [cronjob][4] 将不起作用。 -用户只会在他们使用的一些服务器上 **[更改密码][2]**,而不会在他们不经常使用的服务器上更改密码。 +为了避免这种情况,我们创建了一个 [shell 脚本][5]来向你发送 10 天内到期的用户帐户列表。 -特别地,大多数团队忘记更改服务帐户密码,这可能导致日常工作的中断,即使他们配置有 **[SSH基于密钥的身份验证][3]** 。 - -如果用户帐户密码过期,基于SSH密钥的身份验证和 **[cronjobs][4]** 将不起作用。 - -为了避免这种情况,我们创建了一个 **[shell脚本][5]** 来向您发送 10 天内到期的用户帐户列表。 - -本教程中包含两个 **[bash脚本][6]** 可以帮助您收集系统中用户到期日的信息。 +本教程中包含两个 [bash 脚本][6]可以帮助你收集系统中用户到期天数的信息。 ### 1) 检查 10 天后到期的用户帐户列表 -此脚本将帮助您检查终端上 10 天内到期的用户帐户列表。 +此脚本将帮助你在终端上检查 10 天内到期的用户帐户列表。 ``` # vi /opt/script/user-password-expiry.sh +``` +``` #!/bin/sh /tmp/user-expiry-1.txt /tmp/user-expiry.txt @@ -54,7 +50,7 @@ cat /tmp/user-expiry.txt | awk '$2 <= 10' > /tmp/user-expiry-1.txt cat /tmp/user-expiry-1.txt | column -t ``` -将文件 **“user password expiry.sh”** 设置为 Linux 可执行文件权限。 +将文件 `user-password-expiry.sh` 设置为可执行的 Linux 文件权限。 ``` # chmod +x /opt/script/user-password-expiry.sh @@ -73,18 +69,21 @@ u2 9 u3 3 u4 5 ``` + ### 2) 发送包含 10 天内到期的用户帐户列表的电子邮件 此脚本将发送一封包含 10 天内到期的用户帐户列表的邮件。 ``` # vi /opt/script/user-password-expiry-mail.sh +``` +``` #!/bin/sh SUBJECT="Information About User Password Expiration on "`date`"" MESSAGE="/tmp/user-expiry.txt" MESSAGE1="/tmp/user-expiry-1.txt" -TO="[email protected]" +TO="magesh.m@rentacenter.com" echo "-------------------------------------------------" >> $MESSAGE1 echo "UserName The number of days the password expires" >> $MESSAGE1 echo "-------------------------------------------------" >> $MESSAGE1 @@ -103,13 +102,13 @@ rm $MESSAGE rm $MESSAGE1 ``` -将文件 **“user-password-expiry-mail.sh”** 设置为 Linux 可执行文件权限。 +将文件 `user-password-expiry-mail.sh` 设置为可执行的 Linux 文件权限。 ``` # chmod +x /opt/script/user-password-expiry-mail.sh ``` -最后,添加一个 **[cronjob][4]** 去自动执行脚本。每天早上 8 点运行一次。 +最后,添加一个 [cronjob][4] 去自动执行脚本。每天早上 8 点运行一次。 ``` # crontab -e @@ -125,14 +124,14 @@ via: https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[qianmingtian][c] -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 [c]: https://github.com/qianmingtian -[1]: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ +[1]: https://linux.cn/article-11709-1.html [2]: https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-users-password-in-linux-using-shell-script/ [3]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ [4]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ From 55a7462779e2e3f63029040fc61ef75b061f8665 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 23:23:21 +0800 Subject: [PATCH 0231/3057] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qianmingtian 本文首发地址: https://linux.cn/article-11781-1.html 你的 LCTT 专页地址: https://linux.cn/lctt/qianmingtian 请注册以领取 LCCN: https://lctt.linux.cn/ --- ...eMail With a List of User Accounts Expiring in -X- Days.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md (98%) diff --git a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/published/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md similarity index 98% rename from translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md rename to published/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index a7264d60c7..9a46a42281 100644 --- a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/published/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11781-1.html) [#]: subject: (Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days) [#]: via: (https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From bf643db505d3ef992fcb4a83c946cbab81434d47 Mon Sep 17 00:00:00 2001 From: qianmingtian Date: Mon, 13 Jan 2020 23:29:29 +0800 Subject: [PATCH 0232/3057] Translated by qianmigntian and Creat a folder of news to store article --- ...0109 Huawei-s Linux Distribution openEuler is Available Now.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md (100%) diff --git a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md similarity index 100% rename from sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md rename to translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md From bfb7d22eed4fd29929dabdd7ca7dccd33b065c8d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:55:18 +0800 Subject: [PATCH 0233/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200114=2016?= =?UTF-8?q?=20Places=20to=20Buy=20a=20Pre-installed=20Linux=20Laptop=20Onl?= =?UTF-8?q?ine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md --- ...Buy a Pre-installed Linux Laptop Online.md | 368 ++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md diff --git a/sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md b/sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md new file mode 100644 index 0000000000..c57b44dfd3 --- /dev/null +++ b/sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md @@ -0,0 +1,368 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (16 Places to Buy a Pre-installed Linux Laptop Online) +[#]: via: (https://www.2daygeek.com/buy-linux-laptops-computers-online/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +16 Places to Buy a Pre-installed Linux Laptop Online +====== + +Linux runs on most hardware these days, but most retailers do not have Linux operating systems pre-installed on their hardware. + +Gone are the days when users would only buy a Windows OS pre-installed laptop. + +Over the years, developers have purchased many Linux laptops as they work on major Linux applications related to Docker, Kubernetes, AI, cloud-native computing and machine learning. + +But now-a-days users are eager to buy a Linux laptop instead of Windows, which allows many vendors to choose Linux OS. + +### Why Pre-installed Linux? + +Now-a-days normal users also started using Linux OS because of its open source nature, security and reliability. + +But most of the retailers around the world do not sell Linux operating system pre-installed. + +It is difficult for Linux aspirants to find the compatible hardware and drivers to get Linux OS installed. + +So, we recommend to have Linux OS pre-installed computers instead of figuring out compatibility issues. + +Here we list the top 16 (not in particular order) manufacturer/vendor best known for preloaded Linux OS computers. + +### 1) Dell + +Dell is a US multinational computer technology company that commenced to sell and distribute pre-installed Ubuntu Linux computers for several years now. + +Initially it was started on 2012 as a community project called Sputnik. + +The strong community support to the project became a product. Over the year they launched the first Dell XPS 13 Developer Edition (Sputnik 3) after fixing some major issues in Sputnik 1 and Sputnik 2. + +[![][1]][2] + +They sells Red hat Enterprise Linux and Ubuntu Linux-based laptop for business use, developers and sysadmins. + +All systems are preloaded with Ubuntu but few of them were certified to install Red Hat Enterprise Linux 7.5 and RHEL 8. + +I hope you can install other distro as well if you want to run but i didn’t try it. + +The signature Linux products of Dell are **[XPS developer edition][3]**, **[Precision mobile workstation][4]** and Precision tower workstation. + + * **Availability:** Worldwide + * **Product Details:** [Dell Linux Systems][5] + + + +### 2) System 76 + +**[System76][6]** is an American computer manufacturer based in Denver, Colorado specializing in the sale of notebooks, desktops, and servers. + +From the year 2003, Sytem76 started to computers with the Linux operating system installed. + +They developed Linux distribution named Pop!_OS based on Ubuntu using the GNOME Desktop Environment for developers and professionals. + +[![][1]][7] + +The products are categorized majorly based on portability, storage, graphics and CPU performance. + +Lower laptop model Galago Pro is costing around $950 and higher models such as Adder WS and Serval WS are costing around $2000. + +They provide Destops(Thelio variants) in range of $800 to $2600. + +They also sell mini servers(Meerkat) ranges from $500 and Larger Servers(Jackal, Ibex and Starling) with preloaded Ubuntu ranges from $3000. + +They provide the laptop with the coreboot open source firmware, which is an alternative to the proprietary BIOS firmware. + +System76 ships their products to 60 countries all around the world in Africa, Europe, Asia, North America, South America, Australia and Zealandia. + + * **Availability:** To 60 countries worldwide + * **Product Details:** [System76][8] + + + +### 3) Purism + +Purism is a US-based company that commenced its operation in 2014. + +It manufactures the Librem personal computing devices with a focus on software freedom, computer security, and Internet privacy. + +[![][1]][9] + +Purism sell their products with PureOS installed, a Linux distribution based on Debain developed by purism. + +They sell multiple customized products such as Laptops, Tablets, Smartphones, Server and Librem key. + + * **Availability:** Worldwide + * **Product Details:** [Purism][10] + + + +### 4) Slimbook + +**[Slimbook][11]** commenced their operation in 2015 based in spain. + +It is a Linux friendly product that offers Laptops, Desktops, Mini Pc’s,All in one PC’s and Servers. + +[![][1]][12] + +It sell their products with with preloaded variety of Linux distributions, windows or both. + +They were the first to sell KDE OS installed. It is ideal for Linux beginners, since it is easy to use and easy to learn. + +The Laptop body is made of metal alloy based on aluminum and magnesium. + + * **Availability:** Worldwide + * **Product Details:** [Slimbook][13] + + + +### 5) Tuxedo Computers + +Tuxedo computers a german based company sells notebooks, desktops and mini computers with preloaded Linux. + +Their products desktop cost starts from around 480EUR, mini computers starts from 430EUR and notebooks starts from around 815EUR. + +They have both intel and AMD processors and come up with 5 years warranty and lifetime support. + +TUXEDO Computers are individually built computers and PCs being fully Linux-suitable. They sell their products to most part of Europe and USA. + + * **Availability:** Ships to many countries + * **Product Details:** [Tuxedo Computers][14] + + + +### 6) ThinkPenguin + +ThinkPengine is a US based company started their operation in 2008 to improve support for GNU/Linux and other free software operating systems. + +They sell desktops, notebooks, network equipment, storage devices, printers, scanners and other accessories that are compatible with Linux. + +They provide warranty from 90days to 3years based on the products. + + * **Availability:** Worldwide + * **Product Details:** [ThinkPenguin][15] + + + +### 7) Emperor Linux + +EmperorLinux is a US based company,since 1999 they provides Linux laptops with full hardware support under Linux. + +They offers Linux laptops with unique features such as Molecule RD3D using Sharp’s ground-breaking Auto-Stereo 3D display, Panasonic’s ToughBook line of rugged & semi-rugged Linux laptops. + +They also sell fully-functional Linux tablets, the Raven tablet (based on the ThinkPad X series). + + * **Availability:** USA (International shipping is available upon request). + * **Product Details:** [Emperor Linux][16] + + + +### 8) ZaReason + +ZaReason opened for business in the year 2007 based in US. + +They mainly focuses on R&D labs, businesses both small and large, universities and people’s homes. + +It has a long career building hardware for different distros such as Debian, Fedora, Ubuntu, Kubuntu, Edubuntu and Linux Mint Preloaded. + +[![][1]][17] + +And customer can even choose Linux disros of their choose other than specified. + +Their laptop ranges from $999 to $1699. Their desktop and mini computers ranges from $499 to $1199. + +They do sell desktop specific for game lovers (Gamebox9400). + +Default warranty will be for a year. Additional cost includes for extending the warranty till 3 years. + + * **Availability:** USA and Canada + * **Product Details:** [ZaReason][18] + + + +### 9) LAC Portland + +LAC(Los Alamos Computers) Portland is a US based company, provides Linux-based computers configured and supported by GNU and Linux professionals since 2000. + +They sell Lenovo desktops(ThinkCentre and ThinkStation) ranges from $845 to $2215 and laptops(ThinkPad) ranges from $926 to $2380. + +They install and sell Linux distors such as Ubuntu, Linux Mint, Debain, Fedora, CentOS, Scientific Linux, Open SUSE and Free DOS. + +They provide five years hardware and labor warranty with on-site support options backed worldwide by Lenovo. + + * **Availability:** USA + * **Product Details:** [LAC Portland][19] + + + +### 10) Entroware + +Entroware is a UK based company specialized in providing Ubuntu based computing solutions and services since early 2014 based on customers requirements. + +They sell Ubuntu and Ubuntu MATE powered Desktops, Laptops, and Servers using modern and high quality components. + +[![][1]][20] + +They do sell mini computers and All-in-one computers. + +Desktop ranges from $499 to $1900, laptops ranges from $740 to $1900 and server ranges from $1150 to $2000. + +They also sell accessories such as OS recovery drive, external hard drive, etc. + +The default warranty is for 3 years, they have three warranty plans for which additional may include. They also provide software support. + +Entroware currently ships to UK, Republic of Ireland, France, Germany, Italy and Spain. + + * **Availability:** UK and other European countries (Republic of Ireland, France, Germany, Italy and Spain). + * **Product Details:** [Entroware][21] + + + +### 11) Vikings + +Viking is based in Germany, sells Libre-friendly hardware certified by the Free Software Foundation with preinstalled Debian, Trisquel or Parabola Linux based on customer requirement. + +They sell desktops, laptops, servers, routers, mainboards, key generators, PCI cards and usb sound adaptors compatible with Linux. + +The Linux laptops and desktops by Vikings come with core boot or Libreboot. + +Their desktop ranges from 895EUR, laptop ranges from 250EUR and servers ranges from 990EUR. + +They provide refurbished/used parts: mainboard, CPU(s) with rigorous testing of all parts and also gives a comprehensive guarantee for all parts of the system. + +Their product warranty varies from 1year to 3year, with subsequent additional charges. + +They ship to all part of the world with very few exceptions such as North Korea. + + * **Availability:** Worldwide + * **Product Details:** [Viking][22] + + + +### 12) Juno Computers + +Juno Computers is company based in UK comes with pre-installed elementary OS or Ubuntu. + +They provide an application known as Kronos which allows for quick and easy installation of commercial applications such as Chrome, Dropbox, Spotify, Skype, etc. + +Their laptop ranges from $945/357EUR to $999/933EUR and mini PC ranges around $549/490EUR. + +They provide a 1-year limited warranty on all manufacture problems. + +Currently they ship to mainland USA, some Canadian provinces, and most part of the world includes South Africa, Asia and Europe. + + * **Availability:** Worldwide + * **Product Details:** [Juno Computers][23] + + + +### 13) Pine64 + +Pine64 is a US based community platform that offers laptops (**[Pinebooks][24]**), Pine Phones, Pine Watches(PineTime), Single board computers and other compatible Linux accessories. + +It commenced its operation in the year 2016 powered by ARM devices. + +[![][1]][25] + +The laptops ranges from $100 to $200. + +All single board and accessories sold on the Pine store are entitled to a 30 days Limited Warranty against defects in materials and workmanship, but provide online support through their forum. + +They almost ship to most part of the country, refer site shipping policy for more details. + + * **Availability:** Worldwide + * **Product Details:** [Pine64][26] + + + +### 14) Libiquity + +Libiquity is a US based company with R&D investments and its own personal computer brand since 2011. + +They offer laptop(Taurinus X200) preloaded with Trisquel and comes with ProteanOS, a free/libre and open source embedded operating system distribution endorsed by Free Software Foundation. + +Laptop ranges starts from $375. Product comes with limited warrant of 1 year. Currently their shipping are limited to US. + + * **Availability:** US + * **Product Details:** [Libiquity][27] + + + +### 15) LinuxCertified + +LinuxCertified an US based company offers lenovo desktops and laptops with Linux distros preinstalled. + +Various preloaded Linux distros offered are Ubuntu, Fedora, Open SUSE, CentOS, Redhat Enterprise Linux and Oracle Enterprise Linux. + +Desktops(ThinkStation) ranges from $899 to $2199 and laptops(Z1, LC series) ranges from $899 to $2199. + +Product warranty is for one year. They ship their product within US. + + * **Availability:** Worldwide + * **Product Details:** [LinuxCertified][28] + + + +### 16) Star Labs + +**[Star Labs][29]** was created by a group of Linux users, who created the ultimate Linux laptop for their own use. + +It’s based in the United Kingdom which sells laptops with Linux pre-installed. + +[![][1]][30] + +Star Labs offer a range of laptops designed and built specifically for Linux. + +All of their laptops come with a choice of Ubuntu Linux, Linux Mint or Zorin OS pre-installed. + +It is not limited to the above three distributions, and you can install any Linux distros on their hardware, and it runs flawlessly. + + * **Availability:** Worldwide + * **Product Details:** [Star Labs][31] + + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/buy-linux-laptops-computers-online/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.2daygeek.com/wp-content/uploads/2020/01/dell-xps-13-developer-deition-2.png +[3]: https://www.linuxtechnews.com/dells-new-xps-13-developer-edition-is-powered-by-the-10th-generation/ +[4]: https://www.linuxtechnews.com/dell-launches-three-new-dell-precision-developer-editions-laptops-preloaded-with-ubuntu-linux/ +[5]: https://www.dell.com/en-us/work/shop/overview/cp/linuxsystems +[6]: https://www.linuxtechnews.com/system76-has-announced-new-gazelle-laptops/ +[7]: https://www.2daygeek.com/wp-content/uploads/2020/01/system76-1.jpg +[8]: https://system76.com/laptops +[9]: https://www.2daygeek.com/wp-content/uploads/2020/01/librem-1.jpg +[10]: https://puri.sm/products/ +[11]: https://www.linuxtechnews.com/slimbook-is-offering-a-new-laptop-called-slimbook-pro-x/ +[12]: https://www.2daygeek.com/wp-content/uploads/2020/01/slimbook.jpg +[13]: https://slimbook.es/en/comparison-slimbook-pro-x-with-other-ultrabooks +[14]: https://www.tuxedocomputers.com/en/Linux-Hardware/Linux-Notebooks.tuxedo +[15]: https://www.thinkpenguin.com/catalog/notebook-computers-gnu-linux-2 +[16]: http://www.emperorlinux.com/systems/ +[17]: https://www.2daygeek.com/wp-content/uploads/2020/01/zareason-1.jpg +[18]: https://zareason.com/Laptops/ +[19]: https://shop.lacpdx.com/laptops/ +[20]: https://www.2daygeek.com/wp-content/uploads/2020/01/entroware.jpg +[21]: https://www.entroware.com/store/laptops +[22]: https://store.vikings.net/libre-friendly-hardware/x200-ryf-certfied +[23]: https://junocomputers.com/store/ +[24]: https://www.linuxtechnews.com/pinebook-pro-199-linux-laptop-pre-orders-ansi-iso-keyboards/ +[25]: https://www.2daygeek.com/wp-content/uploads/2020/01/Pinebook_Pro-photo-1.jpg +[26]: https://store.pine64.org/ +[27]: https://shop.libiquity.com/ +[28]: https://www.linuxcertified.com/linux_laptops.html +[29]: https://www.linuxtechnews.com/star-labs-offering-a-range-of-linux-laptops-with-zorin-os-15-pre-installed/ +[30]: https://www.2daygeek.com/wp-content/uploads/2020/01/starlabs-1.jpg +[31]: https://earth.starlabs.systems/pages/laptops From cd647dc917170514127d397669929ffcbb675e9b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:55:46 +0800 Subject: [PATCH 0234/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200113=20How?= =?UTF-8?q?=20to=20setup=20a=20DNS=20server=20with=20bind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200113 How to setup a DNS server with bind.md --- ...113 How to setup a DNS server with bind.md | 387 ++++++++++++++++++ 1 file changed, 387 insertions(+) create mode 100644 sources/tech/20200113 How to setup a DNS server with bind.md diff --git a/sources/tech/20200113 How to setup a DNS server with bind.md b/sources/tech/20200113 How to setup a DNS server with bind.md new file mode 100644 index 0000000000..897dc825a8 --- /dev/null +++ b/sources/tech/20200113 How to setup a DNS server with bind.md @@ -0,0 +1,387 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to setup a DNS server with bind) +[#]: via: (https://fedoramagazine.org/how-to-setup-a-dns-server-with-bind/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +How to setup a DNS server with bind +====== + +![][1] + +The Domain Name System, or DNS, as it’s more commonly known, translates or converts domain names into the IP addresses associated with that domain. DNS is the reason you are able to find your favorite website by name instead of typing an IP address into your browser. This guide shows you how to configure a Master DNS system and one client. + +Here are system details for the example used in this article: + +``` +dns01.fedora.local (192.168.1.160 ) - Master DNS server +client.fedora.local (192.168.1.136 ) - Client +``` + +### DNS server configuration + +Install the bind packages using sudo: + +``` +$ sudo dnf install bind bind-utils -y +``` + +The _/etc/named.conf_ configuration file is provided by the _bind_ package to allow you to configure the DNS server. + +Edit the _/etc/named.conf_ file: + +``` +sudo vi /etc/named.conf +``` + +Look for the following line: + +``` +listen-on port 53 { 127.0.0.1; }; +``` + +Add the IP address of your Master DNS server as follows: + +``` +listen-on port 53 { 127.0.0.1; 192.168.1.160; }; +``` + +Look for the next line: + +``` +allow-query { localhost; }; +``` + +Add your local network range. The example system uses IP addresses in the 192.168.1.X range. This is specified as follows: + +``` +allow-query { localhost; 192.168.1.0/24; }; +``` + +Specify a forward and reverse zone. Zone files are simply text files that have the DNS information, such as IP addresses and host-names, on your system. The forward zone file makes it possible for the translation of a host-name to its IP address. The reverse zone file does the opposite. It allows a remote system to translate an IP address to the host name. + +Look for the following line at the bottom of the /etc/named.conf file: + +``` +include "/etc/named.rfc1912.zones"; +``` + +Here, you’ll specify the zone file information _**directly above that line**_ as follows: + +``` +zone "dns01.fedora.local" IN { +type master; +file "forward.fedora.local"; +allow-update { none; }; +}; + +zone "1.168.192.in-addr.arpa" IN { +type master; +file "reverse.fedora.local"; +allow-update { none; }; +}; +``` + +The _forward.fedora.local_ and the file _reverse.fedora.local_ are just the names of the zone files you will be creating. They can be called anything you like. + +Save and exit. + +#### Create the zone files + +Create the forward and reverse zone files you specified in the /etc/named.conf file: + +``` +$ sudo vi /var/named/forward.fedora.local +``` + +Add the following lines: + +``` +$TTL 86400 +@ IN SOA dns01.fedora.local. root.fedora.local. ( + 2011071001 ;Serial + 3600 ;Refresh + 1800 ;Retry + 604800 ;Expire + 86400 ;Minimum TTL +) +@ IN NS dns01.fedora.local. +@ IN A 192.168.1.160 +dns01 IN A 192.168.1.160 +client IN A 192.168.1.136 +``` + +Everything in _**bold**_ is specific to your environment. Save the file and exit. Next, edit the _reverse.fedora.local_ file: + +``` +$ sudo vi /var/named/reverse.fedora.local +``` + +Add the following lines: + +``` +$TTL 86400 +@ IN SOA dns01.fedora.local. root.fedora.local. ( + 2011071001 ;Serial + 3600 ;Refresh + 1800 ;Retry + 604800 ;Expire + 86400 ;Minimum TTL +) +@ IN NS dns01.fedora.local. +@ IN PTR fedora.local. +dns01 IN A 192.168.1.160 +client IN A 192.168.1.136 +160 IN PTR dns01.fedora.local. +136 IN PTR client.fedora.local. +``` + +Everything in _**bold**_ is also specific to your environment. Save the file and exit. + +You’ll also need to configure SELinux and add the correct ownership for the configuration files. + +``` +sudo chgrp named -R /var/named +sudo chown -v root:named /etc/named.conf +sudo restorecon -rv /var/named +sudo restorecon /etc/named.conf +``` + +Configure the firewall: + +``` +sudo firewall-cmd --add-service=dns --perm +sudo firewall-cmd --reload +``` + +#### Check the configuration for any syntax errors + +``` +sudo named-checkconf /etc/named.conf +``` + +Your configuration is valid if no output or errors are returned. + +Check the forward and reverse zone files. + +``` +$ sudo named-checkzone forward.fedora.local /var/named/forward.fedora.local + +$ sudo named-checkzone reverse.fedora.local /var/named/reverse.fedora.local +``` + +You should see a response of OK: + +``` +zone forward.fedora.local/IN: loaded serial 2011071001 +OK + +zone reverse.fedora.local/IN: loaded serial 2011071001 +OK +``` + +#### Enable and start the DNS service + +``` +$ sudo systemctl enable named +$ sudo systemctl start named +``` + +#### Configuring the resolv.conf file + +Edit the _/etc/resolv.conf_ file: + +``` +$ sudo vi /etc/resolv.conf +``` + +Look for your current name server line or lines. On the example system, a cable modem/router is serving as the name server and so it currently looks like this: + +``` +nameserver 192.168.1.1 +``` + +This needs to be changed to the IP address of the Master DNS server: + +``` +nameserver 192.168.1.160 +``` + +Save your changes and exit. + +Unfortunately there is one caveat to be aware of. NetworkManager overwrites the _/etc/resolv.conf_ file if the system is rebooted or networking gets restarted. This means you will lose all of the changes that you made. + +To prevent this from happening, make _/etc/resolv.conf_ immutable: + +``` +$ sudo chattr +i /etc/resolv.conf +``` + +If you want to set it back and allow it to be overwritten again: + +``` +$ sudo chattr -i /etc/resolv.conf +``` + +#### Testing the DNS server + +``` +$ dig fedoramagazine.org +``` + +``` +; <<>> DiG 9.11.13-RedHat-9.11.13-2.fc30 <<>> fedoramagazine.org +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8391 +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 6 + +;; OPT PSEUDOSECTION: + ; EDNS: version: 0, flags:; udp: 4096 + ; COOKIE: c7350d07f8efaa1286c670ab5e13482d600f82274871195a (good) + ;; QUESTION SECTION: + ;fedoramagazine.org. IN A + +;; ANSWER SECTION: + fedoramagazine.org. 50 IN A 35.197.52.145 + +;; AUTHORITY SECTION: + fedoramagazine.org. 86150 IN NS ns05.fedoraproject.org. + fedoramagazine.org. 86150 IN NS ns02.fedoraproject.org. + fedoramagazine.org. 86150 IN NS ns04.fedoraproject.org. + +;; ADDITIONAL SECTION: + ns02.fedoraproject.org. 86150 IN A 152.19.134.139 + ns04.fedoraproject.org. 86150 IN A 209.132.181.17 + ns05.fedoraproject.org. 86150 IN A 85.236.55.10 + ns02.fedoraproject.org. 86150 IN AAAA 2610:28:3090:3001:dead:beef:cafe:fed5 + ns05.fedoraproject.org. 86150 IN AAAA 2001:4178:2:1269:dead:beef:cafe:fed5 + + ;; Query time: 830 msec + ;; SERVER: 192.168.1.160#53(192.168.1.160) + ;; WHEN: Mon Jan 06 08:46:05 CST 2020 + ;; MSG SIZE rcvd: 266 +``` + +There are a few things to look at to verify that the DNS server is working correctly. Obviously getting the results back are important, but that by itself doesn’t mean the DNS server is actually doing the work. + +The QUERY, ANSWER, and AUTHORITY fields at the top should show non-zero as it in does in our example: + +``` +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 6 +``` + +And the SERVER field should have the IP address of your DNS server: + +``` +;; SERVER: 192.168.1.160#53(192.168.1.160) +``` + +In case this is the first time you’ve run the _dig_ command, notice how it took 830 milliseconds for the query to complete: + +``` +;; Query time: 830 msec +``` + +If you run it again, the query will run much quicker: + +``` +$ dig fedoramagazine.org +``` + +``` +;; Query time: 0 msec +;; SERVER: 192.168.1.160#53(192.168.1.160) +``` + +### Client configuration + +The client configuration will be a lot simpler. + +Install the bind utilities: + +``` +$ sudo dnf install bind-utils -y +``` + +Edit the /etc/resolv.conf file and configure the Master DNS as the only name server: + +``` +$ sudo vi /etc/resolv.conf +``` + +This is how it should look: + +``` +nameserver 192.168.1.160 +``` + +Save your changes and exit. Then, make the _/etc/resolv.conf_ file immutable to prevent it from be overwritten and going back to its default settings: + +``` +$ sudo chattr +i /etc/resolv.conf +``` + +#### Testing the client + +You should get the same results as you did from the DNS server: + +``` +$ dig fedoramagazine.org +``` + +``` +; <<>> DiG 9.11.13-RedHat-9.11.13-2.fc30 <<>> fedoramagazine.org +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8391 +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 6 + +;; OPT PSEUDOSECTION: + ; EDNS: version: 0, flags:; udp: 4096 + ; COOKIE: c7350d07f8efaa1286c670ab5e13482d600f82274871195a (good) + ;; QUESTION SECTION: + ;fedoramagazine.org. IN A + +;; ANSWER SECTION: + fedoramagazine.org. 50 IN A 35.197.52.145 + +;; AUTHORITY SECTION: + fedoramagazine.org. 86150 IN NS ns05.fedoraproject.org. + fedoramagazine.org. 86150 IN NS ns02.fedoraproject.org. + fedoramagazine.org. 86150 IN NS ns04.fedoraproject.org. + +;; ADDITIONAL SECTION: + ns02.fedoraproject.org. 86150 IN A 152.19.134.139 + ns04.fedoraproject.org. 86150 IN A 209.132.181.17 + ns05.fedoraproject.org. 86150 IN A 85.236.55.10 + ns02.fedoraproject.org. 86150 IN AAAA 2610:28:3090:3001:dead:beef:cafe:fed5 + ns05.fedoraproject.org. 86150 IN AAAA 2001:4178:2:1269:dead:beef:cafe:fed5 + + ;; Query time: 1 msec + ;; SERVER: 192.168.1.160#53(192.168.1.160) + ;; WHEN: Mon Jan 06 08:46:05 CST 2020 + ;; MSG SIZE rcvd: 266 +``` + +Make sure the SERVER output has the IP Address of your DNS server. + +Your DNS server is now ready to use and all requests from the client should be going through your DNS server now! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-setup-a-dns-server-with-bind/ + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/dns-server-bind-1-816x345.png From 139dc9f8c316463b2407f431e8e42f033c3ec70c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:56:24 +0800 Subject: [PATCH 0235/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200114=20LMMS?= =?UTF-8?q?:=20A=20Free=20&=20Open=20Source=20Digital=20Audio=20Workstatio?= =?UTF-8?q?n=20(DAW)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md --- ... Source Digital Audio Workstation (DAW).md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md diff --git a/sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md b/sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md new file mode 100644 index 0000000000..1b3358f7bd --- /dev/null +++ b/sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LMMS: A Free & Open Source Digital Audio Workstation (DAW)) +[#]: via: (https://itsfoss.com/lmms/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +LMMS: A Free & Open Source Digital Audio Workstation (DAW) +====== + +_**In this week’s Linux application highlight, we take a look at a free and open-source DAW that helps make music with most of the essential features offered.**_ + +### LMMS: A Free & Open Source Software To Help Make Music + +[LMMS][1] is a cross-platform open source [DAW][2] hosted on [GitHub][3]. It is completely free to use and you do not need to purchase any kind of license to use it. + +If you’re curious, there’s no specific full-form for “LMMS” acronym but you can consider it along the lines of “**Let’s Make Music**” or formerly known as “**Linux MultiMedia Studio**” as stated in one of their [official forum post][4] years back. + +So, with the help of LMMS, you should be able to work on making music on Linux. + +Of course, you should not expect a free DAW to replace a full-fledged professional DAW bundled with proprietary plugins – but for starters, it isn’t a bad one. + +![][5] + +If you’re used to other DAWs, it might take a while to get comfortable with the user interface. For instance, I’ve used [Studio One][6] and [Mixcraft][7] as a beginner – so the UI of LMMS looked different. + +But, the good news is – you get a [detailed official documentation][8] of LMMS. So, if you have trouble learning how it works, simply refer to the official documentation available on their [website][1]. + +**Recommended Read:** + +![][9] + +#### [Best Audio Editors For Linux][10] + +These awesome free and open source audio editors let you create awesome music in Linux. Check out the list of top Linux audio editors. + +### Features of LMMS + +![][11] + +Just like any other DAW, you will find plugins, samples to use, instruments, and MIDI support. However, it is indeed a long list of features. So, instead of taking a whole day explaining it, let me highlight all the necessary features that LMMS provides. + + * Ability to add notes within the project without needing a separate note-taking app + * Bundled free plugins to use + * Note playback via MIDI or typing keyboard + * MIDI Editor + * Separate editor for instruments + * Track Automation support + * 64-bit VST instrument support (for wine-based VSTs) + * Built-in synthesizers that include some popular emulators for Yamaha and Roland + * Feature-rich audio plugins built-in + * Demo projects to easily get started + * Several samples included + * Native multisample support for SoundFont (SF2), Giga (GIG) and Gravis UltraSound (GUS) formats for high-quality instrument patches and banks (only if it’s relevant for your work) + * [LADSPA][12] plugin support + * You will also find the essential delay/reverb/compressor/limiter and distortion tools built-in + * Spectrum analyzer + + + +You can find some extensive [documentation on using LMMS][8]. If you face any difficulties, LMMS also has its [own forum][13] where you can ask for help. + +### Installing LMMS on Linux + +![][14] + +You can also find LMMS listed in the software center of your distribution- however, it might not feature the latest version. + +To get the latest LMMS version, you can download the .**AppImage** file from the [official download page][15]. If you want to take a look at the latest or previous releases on GitHub, you can find those in their [releases][16] section. + +If you want to use the AppImage file, you can refer to our guide on [using AppImage file][17]. + +You may also try [installing the Flatpak package][18] available on [Flathub][19]. + +[Download LMMS][15] + +### My Thoughts On LMMS + +![][20] + +Even though this is a feature-rich free and open-source DAW – personally, I found the UX a little dull. + +Of course, technically, it offers quite a lot of features and this could be useful for anyone who does not want to break their wallet to produce music. And, after all, it is an open-source solution. + +If you want a full-fledged professional DAW using the VST plugins, you might just hold on to Windows/Mac (if you’re used to it) because you still need to utilize Wine on Linux in order to make sure that the 64-bit VSTs work. + +**Wrapping Up** + +That being said, I’m not a professional music producer – so feel free to explore LMMS on Linux and make the most out of it without spending a penny. + +If you’ve used LMMS (or any similar DAW), let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lmms/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://lmms.io/ +[2]: https://en.wikipedia.org/wiki/Digital_audio_workstation +[3]: https://github.com/LMMS/lmms +[4]: https://lmms.io/forum/viewtopic.php?t=5908 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/lmms-screenshot.png?ssl=1 +[6]: https://www.presonus.com/products/studio-one/ +[7]: https://acoustica.com/mixcraft +[8]: https://docs.lmms.io/user-manual/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors.jpeg?fit=800%2C450&ssl=1 +[10]: https://itsfoss.com/best-audio-editors-linux/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/lmms-project.png?ssl=1 +[12]: https://www.ladspa.org/ +[13]: https://lmms.io/forum/ +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/lmms-setup.jpg?ssl=1 +[15]: https://lmms.io/download#linux +[16]: https://github.com/LMMS/lmms/releases +[17]: https://itsfoss.com/use-appimage-linux/ +[18]: https://itsfoss.com/flatpak-guide/ +[19]: https://flathub.org/apps/details/io.lmms.LMMS +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/lmms-midi-editor.png?ssl=1 From 075737d8223d57a0b4752b81a1d08e86993c500b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:57:16 +0800 Subject: [PATCH 0236/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200113=20Keep?= =?UTF-8?q?=20your=20email=20in=20sync=20with=20OfflineIMAP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200113 Keep your email in sync with OfflineIMAP.md --- ...eep your email in sync with OfflineIMAP.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/tech/20200113 Keep your email in sync with OfflineIMAP.md diff --git a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md new file mode 100644 index 0000000000..1cd8370870 --- /dev/null +++ b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keep your email in sync with OfflineIMAP) +[#]: via: (https://opensource.com/article/20/1/sync-email-offlineimap) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Keep your email in sync with OfflineIMAP +====== +Mirroring your email to a local folder is the first step in taming your +message pileup. Learn how in the third article in our series on 20 ways +to be more productive with open source in 2020. +![email or newsletters via inbox and browser][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Sync your email locally with OfflineIMAP + +I have a love/hate relationship with email. I love the way it allows me to communicate with people all over the world. But, like many of you, I get a lot of mail, much of it from lists as well as spammers, advertisers, and the like. And it builds up. + +![The OfflineIMAP "blinkenlights" UI][2] + +Almost all the tools I've tried (outside of the big mail providers) that work really well with large amounts of mail have one thing in common: they all rely on a local copy of your mail stored in [Maildir][3] format. And the most useful tool for that is [OfflineIMAP][4]. OfflineIMAP is a Python script that mirrors IMAP mailboxes to a local Maildir folder tree. I use it to create a local copy of my mail and keep it in sync. Most Linux distributions include it, and it is available via Python's pip package manager. + +The sample minimal configuration file is a good template to start with; begin by copying it to **~/.offlineimaprc**. Mine looks something like this: + + +``` +[general] +accounts = LocalSync +ui=Quiet +autorefresh=30 + +[Account LocalSync] +localrepository = LocalMail +remoterepository = MirrorIMAP + +[Repository MirrorIMAP] +type = IMAP +remotehost = my.mail.server +remoteuser = myusername +remotepass = mypassword +auth_mechanisms = LOGIN +createfolder = true +ssl = yes +sslcacertfile = OS-DEFAULT + +[Repository LocalMail] +type = Maildir +localfolders = ~/Maildir +sep = . +createfolder = true +``` + +What my configuration does is define two repositories: the remote IMAP server and the local Maildir folder. There is also the **Account** that tells OfflineIMAP what to sync when it runs. You can define multiple accounts linked to different repositories. This allows you to copy from one IMAP server to another as a backup, in addition to making a copy locally. + +The first run of OfflineIMAP will take a while if you have a lot of mail. But once it is done, future runs take a _lot_ less time. You can also run OfflineIMAP as a cron job (my preference) or as a daemon constantly syncing between repositories. The documentation covers all of this, as well as advanced configuration options for things like Gmail. + +Now that my mail is copied locally, there is a whole range of tools I can work with to speed up searching, filing, and managing mail. And I'll talk about that tomorrow. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-email-offlineimap + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) +[2]: https://opensource.com/sites/default/files/uploads/productivity_3-1.png (The OfflineIMAP "blinkenlights" UI) +[3]: https://en.wikipedia.org/wiki/Maildir +[4]: http://www.offlineimap.org/ From d8a14df8bdc22c8d4ac484714a578eba34fdddc6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:57:54 +0800 Subject: [PATCH 0237/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200113=20setV?= =?UTF-8?q?:=20A=20Bash=20function=20to=20maintain=20Python=20virtual=20en?= =?UTF-8?q?vironments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md --- ...to maintain Python virtual environments.md | 303 ++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md diff --git a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md new file mode 100644 index 0000000000..0a1192bccf --- /dev/null +++ b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -0,0 +1,303 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (setV: A Bash function to maintain Python virtual environments) +[#]: via: (https://opensource.com/article/20/1/setv-bash-function) +[#]: author: (Sachin Patil https://opensource.com/users/psachin) + +setV: A Bash function to maintain Python virtual environments +====== +Get to know setV, a lightweight Python virtual environment manager and +alternative to virtualenvwrapper. +![Coding on a computer][1] + +For more than a year, [setV][2] has been hidden away within my [bash_scripts][3] project, but it's time for it to become public. setV is a Bash function I use as an alternative to [virtualenvwrapper][4]. It provides basic features that enable you to do things such as: + + * Use Python 3 by default + * Create a new virtual environment + * Create a new virtual environment using a custom Python path with **-p** (or **\--python**) + * Delete an existing virtual environment + * List all existing virtual environment + * Use Tab completion (in case you don't remember the virtual environment name) + + + +### Installation + +To install setV, download the script: + + +``` +`curl https://gitlab.com/psachin/setV/raw/master/install.sh` +``` + +Review the script, and then run it: + + +``` +`sh ./install.sh` +``` + +When you install setV, the installation script asks you to source **~/.bashrc** or **~/.bash_profile**. Be sure to do that. + +### Usage + +The basic command is **setv**. + +#### Create a virtual environment: + + +``` +setv --new rango  # setv -n rango + +# Or using a custom Python binary path +setv --new --python /opt/python/python3 rango  # setv -n -p /opt/python/python3 rango +``` + +#### Activate an existing environment: + + +``` +setv VIRTUAL_ENVIRONMENT_NAME + +# For example +setv rango +``` + +#### List all virtual environments: + + +``` +setv --list +# or +setv [TAB] [TAB] +``` + +#### Delete a virtual environment: + + +``` +`setv --delete rango` +``` + +#### Switch to another virtual environment: + + +``` +# Assuming you are in 'rango', switch to 'tango' using +setv tango +``` + +#### Tab Completion + +If you don't fully remember the virtual environment's name, Bash-like Tab completion works for virtual environment names. + +### Get involved + +setV is open source under the GNU [GPLv3][5], and contributions are welcome. To learn more, visit the Contribute section of setV's [README][6] in its GitLab repository. + +### The setV script + + +``` +#!/usr/bin/env bash +# setV - A Lightweight Python virtual environment manager. +# Author: Sachin (psachin) <[iclcoolster@gmail.com][7]> +# Author's URL: +# +# License: GNU GPL v3, See LICENSE file +# +# Configure(Optional): +# Set `SETV_VIRTUAL_DIR_PATH` value to your virtual environments +# directory-path. By default it is set to '~/virtualenvs/' +# +# Usage: +# Manual install: Added below line to your .bashrc or any local rc script(): +# --- +# source /path/to/virtual.sh +# --- +# +# Now you can 'activate' the virtual environment by typing +# $ setv <YOUR VIRTUAL ENVIRONMENT NAME> +# +# For example: +# $ setv rango +# +# or type: +# setv [TAB] [TAB]  (to list all virtual envs) +# +# To list all your virtual environments: +# $ setv --list +# +# To create new virtual environment: +# $ setv --new new_virtualenv_name +# +# To delete existing virtual environment: +# $ setv --delete existing_virtualenv_name +# +# To deactivate, type: +# $ deactivate + +# Path to virtual environment directory +SETV_VIRTUAL_DIR_PATH="$HOME/virtualenvs/" +# Default python version to use. This decides whether to use `virtualenv` or `python3 -m venv` +SETV_PYTHON_VERSION=3  # Defaults to Python3 +SETV_PY_PATH=$(which python${SETV_PYTHON_VERSION}) + +function _setvcomplete_() +{ +    # Bash-autocompletion. +    # This ensures Tab-auto-completions work for virtual environment names. +    local cmd="${1##*/}" # to handle command(s). +                         # Not necessary as such. 'setv' is the only command + +    local word=${COMP_WORDS[COMP_CWORD]} # Words thats being completed +    local xpat='${word}'                 # Filter pattern. Include +                                         # only words in variable '$names' +    local names=$(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') # Virtual environment names + +    COMPREPLY=($(compgen -W "$names" -X "$xpat" -- "$word")) # compgen generates the results +} + +function _setv_help_() { +    # Echo help/usage message +    echo "Usage: setv [OPTIONS] [NAME]" +    echo Positional argument: +    echo -e "NAME                       Activate virtual env." +    echo Optional arguments: +    echo -e "-l, --list                 List all Virtual Envs." +    echo -e "-n, --new NAME             Create a new Python Virtual Env." +    echo -e "-d, --delete NAME          Delete existing Python Virtual Env." +    echo -e "-p, --python PATH          Python binary path." +} + +function _setv_custom_python_path() +{ +    if [ -f "${1}" ]; +    then +        if [ "`expr $1 : '.*python\\([2,3]\\)'`" = "3" ]; +        then +            SETV_PYTHON_VERSION=3 +        else +            SETV_PYTHON_VERSION=2 +        fi +        SETV_PY_PATH=${1} +        _setv_create $2 +    else +        echo "Error: Path ${1} does not exist!" +    fi +} + +function _setv_create() +{ +    # Creates new virtual environment if ran with -n|--new flag +    if [ -z ${1} ]; +    then +        echo "You need to pass virtual environment name" +        _setv_help_ +    else +        echo "Creating new virtual environment with the name: $1" + +        if [ ${SETV_PYTHON_VERSION} -eq 3 ]; +        then +            ${SETV_PY_PATH} -m venv ${SETV_VIRTUAL_DIR_PATH}${1} +        else +            virtualenv -p ${SETV_PY_PATH} ${SETV_VIRTUAL_DIR_PATH}${1} +        fi + +        echo "You can now activate the Python virtual environment by typing: setv ${1}" +    fi +} + +function _setv_delete() +{ +    # Deletes virtual environment if ran with -d|--delete flag +    # TODO: Refactor +    if [ -z ${1} ]; +    then +        echo "You need to pass virtual environment name" +        _setv_help_ +    else +        if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; +        then +            read -p "Really delete this virtual environment(Y/N)? " yes_no +            case $yes_no in +                Y|y) rm -rvf ${SETV_VIRTUAL_DIR_PATH}${1};; +                N|n) echo "Leaving the virtual environment as it is.";; +                *) echo "You need to enter either Y/y or N/n" +            esac +        else +            echo "Error: No virtual environment found by the name: ${1}" +        fi +    fi +} + +function _setv_list() +{ +    # Lists all virtual environments if ran with -l|--list flag +    echo -e "List of virtual environments you have under ${SETV_VIRTUAL_DIR_PATH}:\n" +    for virt in $(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') +    do +        echo ${virt} +    done +} + +function setv() { +    # Main function +    if [ $# -eq 0 ]; +    then +        _setv_help_ +    elif [ $# -le 3 ]; +    then +        case "${1}" in +            -n|--new) _setv_create ${2};; +            -d|--delete) _setv_delete ${2};; +            -l|--list) _setv_list;; +            *) if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; +               then +                   # Activate the virtual environment +                   source ${SETV_VIRTUAL_DIR_PATH}${1}/bin/activate +               else +                   # Else throw an error message +                   echo "Sorry, you don't have any virtual environment with the name: ${1}" +                   _setv_help_ +               fi +               ;; +        esac +    elif [ $# -le 5 ]; +    then +        case "${2}" in +            -p|--python) _setv_custom_python_path ${3} ${4};; +            *) _setv_help_;; +        esac +    fi +} + +# Calls bash-complete. The compgen command accepts most of the same +# options that complete does but it generates results rather than just +# storing the rules for future use. +complete  -F _setvcomplete_ setv +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/setv-bash-function + +作者:[Sachin Patil][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/psachin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://gitlab.com/psachin/setV +[3]: https://github.com/psachin/bash_scripts +[4]: https://virtualenvwrapper.readthedocs.org/ +[5]: https://gitlab.com/psachin/setV/blob/master/LICENSE +[6]: https://gitlab.com/psachin/setV/blob/master/ReadMe.org +[7]: mailto:iclcoolster@gmail.com From 7d946a5580087bec358a2bf18add6885852c84ae Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:58:20 +0800 Subject: [PATCH 0238/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200113=20Use?= =?UTF-8?q?=20this=20script=20to=20create,=20save,=20and=20run=20different?= =?UTF-8?q?=20rsync=20configurations=20via=20named=20profiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md --- ...rsync configurations via named profiles.md | 380 ++++++++++++++++++ 1 file changed, 380 insertions(+) create mode 100644 sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md diff --git a/sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md b/sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md new file mode 100644 index 0000000000..3b4e5fc6e4 --- /dev/null +++ b/sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md @@ -0,0 +1,380 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this script to create, save, and run different rsync configurations via named profiles) +[#]: via: (https://opensource.com/article/20/1/create-save-run-rsync-configurations) +[#]: author: (Petr Beránek https://opensource.com/users/pberanek) + +Use this script to create, save, and run different rsync configurations via named profiles +====== +A quick explanation of the rpf script. +![Person drinking a hat drink at the computer][1] + +The **rpf** script allows you to create, save, and run different rsync configurations via named profiles. + +For example, create a new profile named **backup** by typing **rpf -c backup**. Assume that the username is **user**. + +**rpf** creates the following directories: + + * **/home/user/.rpf** + * **/home/user/.rpf/shared** where you can place config files shared by multiple profiles + * **/home/user/.rpf/profiles** where all profiles are saved as subdirectories + + + +**rpf** also created **/home/user/.rpf/profiles/backup** that contains the files **conf** and **excluded**. + +The **conf** file defines rsync's configuration: + + +``` +# rsync config template +# +# Write each rsync option on separate line. For option details see man rsync. +# Empty lines and lines starting with # are ignored. Dynamic references +# (e.g. using command substitution) are not supported. +# +# Config files shared between different profiles should be saved in +# /home/user/.rpf/shared +# +# Example configuration: +# +\--verbose +\--archive +\--human-readable +# exclude all files that match pattern in: +\--exclude-from=/home/user/.rpf/profiles/backup/exclude +\--relative +# perform trial run, make no changes +\--dry-run +# source, e.g. +/home/user +# destination, e.g. +/mnt/usb_drive/users_backup +``` + +Now you can edit, add, or remove rsync options as needed. + +In **exclude**, you can define paths or patterns of files and directories you want to exclude from the transfer. To exclude **Trash** and **Downloads**, add the following lines: + + +``` +\- /home/user/.local/share/Trash +\- /home/user/Downloads +``` + +Or to transfer only **Documents** and **Projects** and exclude everything else: + + +``` +\+ /home/user/Documents +\+ /home/user/Projects +\- ** +``` + +For subtler pattern configurations, see the FILTER RULES section of **man rsync**, or Google for tutorials. + +When you are ready, you can start rsync transfer by typing **rpf backup**. + +That's it. + +For additional **rpf** options, see **rpf --help**. + +### Security + +Please be aware that **rpf** is not secure against code injection in the **conf** file. Any additional code (e.g., **; ./run_evil_script**) will also be executed. Therefore, protect your **.rpf/** config directory from malicious users by implementing appropriate permissions. Moreover, exploiting this behavior can lead to unexpected side effects. + +### The script + + +``` +#!/usr/bin/env bash +# +# Simple rsync profiler +# +# Author: [petrberanek.mail@gmail.com][2] (Petr Beranek) +# +# For usage details type `rpf --help' +# + +set -o errexit +set -o nounset + +__name=$(basename "${0}") +__version="0.1" + +config_dir="${HOME}/.rpf" +profiles_dir="${config_dir}/profiles" +shared_dir="${config_dir}/shared" +help="\ +Usage: ${__name} [OPTION...] PROFILE_NAME + +${__name} is simple rsync profiler that stores your different rsync +configurations in named profiles. + +Options: +    -c, --create-profile PROFILE_NAME   create new profile (profile data +                            are stored in ${config_dir}/PROFILE_NAME). +                            Profile name can contain alphanumeric +                            characters only. +    -s, --show-profile-config PROFILE_NAME  show content of profile +                            configuration file (stored in +                            ${config_dir}/PROFILE_NAME) +    -l, --list-profiles     list all available profiles +    -h, --help              show this help + +Example: +    Create new profile by typing +    ${__name} -c PROFILE_NAME + +    edit its config files stored by default in +    ${profiles_dir}/PROFILE_NAME + +    and then run it by typing +    ${__name} PROFILE_NAME + +    That's it. + +${__name} comes with ABSOLUTELY NO WARRANTY. This is free software, +and you are welcome to redistribute it under certain conditions. See +the GNU General Public Licence for details. + +Email bug reports or enhancement requests to [petrberanek.mail@gmail.com][2]. +" + +create_profile() { +    # Create dir with given profile name and with default content. +    # +    # Arguments: $1 -- profile name +    # +    # Creates files: conf, exclude +    # +    # If dir with the same name already exists, exits with error. +    # + +    local profile_name="${1}" +    local profile_dir="${profiles_dir}/${profile_name}" + +    # create default rpf dirs if missing +    if [[ ! -d "${profiles_dir}" ]]; then +        echo "Creating ${profiles_dir}" +        mkdir --parents "${profiles_dir}" +    fi +    if [[ ! -d "${shared_dir}" ]]; then +        echo "Creating ${shared_dir}" +        mkdir --parents "${shared_dir}" +    fi + +    # don't overwrite existing profile +    if [[ -d "${profile_dir}" ]]; then +        echo "${__name}: error: profile already exists." +        exit 1 +    fi + +    echo "Creating ${profile_dir}" +    mkdir "${profile_dir}" + +    # create `conf' template +    local conf="${profile_dir}/conf" +    echo "Creating ${conf}" +    cat << EOF > "${conf}" +# rsync config template +# +# Write each rsync option on separate line. For details see man rsync. +# Empty lines and lines starting with # are ignored. Dynamic references +# (e.g. using command substitution) are not supported. +# +# Config files shared between different profiles should be saved in +# ${shared_dir} +# +# Example configuration: +# +\--verbose +\--archive +\--human-readable +# file with patterns of files and directories in source excluded +# from transfer +\--exclude-from="${profiles_dir}/${profile_name}/exclude" +\--relative +# perform trial run, make no changes +\--dry-run +# source, e.g. +${HOME} +# destination, e.g. +/mnt/usb_drive/my_backup +EOF + +    # create `exclude' template +    local exclude="${profile_dir}/exclude" +    echo "Creating ${exclude}" +    cat << EOF > "${exclude}" +# \\`exclude' template +# +# Lines starting with # or ; are ignored. For details see man rsync, +# section FILTER RULES. +# +EOF + +    # all done +    echo "OK" +    echo "Edit profile config files in ${profile_dir} to fit your needs." +} + +list_profiles() { +    # Show all available rpf profiles. +    # +    # Assumes that all dirs in $profiles_dir are profiles. +    # + +    for item in "${profiles_dir}"/*; do +        if [[ -d "${item}" ]]; then +            basename "${item}" +        fi +    done +} + +show_help() { echo "${help}"; } + +show_profile_config() { +    # Show configuration file for given profile. +    # +    # Arguments: $1 -- profile name +    # + +    local profile_name="${1}" +    less "${profiles_dir}/${profile_name}/conf" +} + +check_profile_name() { +    # Check that name is not empty and contains alphanumeric chars only. +    # +    # Arguments: $1 -- profile name +    # +    # If test fails, exits with error. +    # + +    if [[ -z "${1}" ]]; then +        echo "${__name}: error: empty profile name." +        exit 1 +    elif [[ "${1}" =~ [^a-zA-Z0-9] ]]; then +        echo "${__name}: error: non-alphanumeric characters in profile name." +        exit 1 +    fi +} + +check_profile_exists() { +    # Check that $profile_name exists and is a directory. +    # +    # Arguments: $1 -- profile name +    # +    # If test fails, exits with error. +    # + +    local profile_name="${1}" +    if [[ ! -d "${profiles_dir}/${profile_name}" ]]; then +        echo "${__name}: error: profile ${profile_name} does not exist." +        exit 1 +    fi +} + +check_num_args() { +    # Check that value of $1 = number of arguments (excluding $1) +    # +    # Arguments: $1 -- limit (positive int) +    # +    # If test fails, exits with error. +    # + +    local num_args=$(( ${#} - 1 ))  # do not count $1 in total num of args +    if [[ "${1}" -ne "${num_args}" ]]; then +        echo "${__name}: error: expected num args: ${1}, received: $num_args" +        exit 1 +    fi +} + +run_rsync() { +    # Run rsync with configuration coresponding to given profile name. +    # +    # Arguments: $1 -- profile name +    # + +    local profile_name="${1}" +    local visual_div="==============================" +    local parsed_args +    parsed_args=$(grep --invert-match '^#' "${profiles_dir}/${profile_name}/conf" \ +                    | tr '\n' ' ') + +    # Print debug info +    echo "${visual_div}" +    echo "${__name} version: ${__version}" +    echo "args: ${parsed_args}" +    echo "${visual_div}" + +    # Expand $parsed_args - each item from conf file becomes rsync argument +    # shellcheck disable=SC2086 +    rsync ${parsed_args} +} + +if [[ "${#}" == 0 ]]; then +    show_help +    exit 1 +fi +while [[ "${#}" -gt 0 ]]; do +    case "${1}" in +        -c | --create-profile) +            check_num_args 2 "${@}" +            shift +            check_profile_name "${1:-}" # If $1 is not declared, set it empty. +            create_profile "${1}" +            exit 0;; +        -s | --show-profile-config) +            check_num_args 2 "${@}" +            shift +            check_profile_name "${1:-}" +            check_profile_exists "${1}" +            show_profile_config "${1}" +            exit 0;; +        -l | --list-profiles) +            check_num_args 1 "${@}" +            list_profiles +            exit 0;; +        -h | --help) +            check_num_args 1 "${@}" +            show_help +            exit 0;; +        -*) +            echo "${__name}: error: unknown option \\`${1}'" +            exit 1;; +        *) +            check_num_args 1 "${@}" +            check_profile_name "${1:-}" +            check_profile_exists "${1}" +            run_rsync "${1}" +            exit 0;; +    esac +    shift +done +``` + +* * * + +This was originally published in [Petr Beranek's GitHub repository][3] and it is licensed under GPLv3. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/create-save-run-rsync-configurations + +作者:[Petr Beránek][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/pberanek +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: mailto:petrberanek.mail@gmail.com +[3]: https://github.com/beranep/rpf From 3a1a4153bef23632ef52e57e97615d89c75cd9a0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 14 Jan 2020 08:57:20 +0800 Subject: [PATCH 0239/3057] translated --- ...Python web API with Pyramid and Cornice.md | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) rename {sources => translated}/tech/20200106 How to write a Python web API with Pyramid and Cornice.md (52%) diff --git a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md similarity index 52% rename from sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md rename to translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md index eaab46c5bc..ae3afc22af 100644 --- a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md +++ b/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -7,21 +7,20 @@ [#]: via: (https://opensource.com/article/20/1/python-web-api-pyramid-cornice) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) -How to write a Python web API with Pyramid and Cornice +如何使用 Pyramid 和 Cornice 编写 Python Web API ====== -Use Pyramid and Cornice to build and document scalable RESTful web -services. +使用 Pyramid 和 Cornice 构建可扩展的 RESTful Web 服务。 ![Searching for code][1] -[Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs. +[Python][2] 是一种高级的,面向对象的编程语言,它以其简单的语法而闻名。它一直是构建 RESTful API 的顶级编程语言之一。 -[Pyramid][3] is a Python web framework designed to scale up with an application: it's simple for simple applications but can grow for big, complex applications. Among other things, Pyramid powers PyPI, the Python package index. [Cornice][4] provides helpers to build and document REST-ish web services with Pyramid. +[Pyramid][3] 是一个 Python Web 框架,旨在随着应用的扩展而扩展:这对于简单的应用来说很简单,对于大型、复杂的应用也可以做到。Pyramid 为 PyPI (Python 软件包索引)提供了强大的支持。[Cornice][4] 提供了使用 Pyramid 构建 RESTful Web 服务的助手。 -This article will use the example of a web service to get famous quotes to show how to use these tools. +本文将使用 Web 服务的例子来获取名人名言,来展示如何使用这些工具。 -### Set up a Pyramid application +### 建立 Pyramid 应用 -Start by creating a virtual environment for your application and a file to hold the code: +首先为你的应用创建一个虚拟环境,并创建一个文件来保存代码: ``` @@ -33,9 +32,9 @@ $ source env/bin/activate (env) $ pip3 install cornice twisted ``` -### Import the Cornice and Pyramid modules +### 导入 Cornice 和 Pyramid 模块 -Import these modules with: +使用以下命令导入这些模块: ``` @@ -43,9 +42,9 @@ from pyramid.config import Configurator from cornice import Service ``` -### Define the service +### 定义服务 -Define the quotes service as a **Service** object: +将引用服务定义为 **Service** 对象: ``` @@ -54,9 +53,9 @@ QUOTES = Service(name='quotes',                  description='Get quotes') ``` -### Write the quotes logic +### 编写引用逻辑 -So far, this only supports **GET**ing quotes. Decorate the function with **QUOTES.get**; this is how you can tie in the logic to the REST service: +到目前为止,这仅支持 **GET** 获取名言。用 **QUOTES.get** 装饰函数。这是将逻辑绑定到 REST 服务的方法: ``` @@ -73,13 +72,13 @@ def get_quote(request):     } ``` -Note that unlike in other frameworks, the **get_quote** function is _not_ changed by the decorator. If you import this module, you can still call the function regularly and inspect the result. +请注意,与其他框架不同,装饰器_不能_更改 **get_quote** 函数。如果导入此模块,你仍然可以定期调用该函数并检查结果。 -This is useful when writing unit tests for Pyramid RESTful services. +在为 Pyramid RESTful 服务编写单元测试时,这很有用。 -### Define the application object +### 定义应用对象 -Finally, use **scan** to find all decorated functions and add them to the configuration:  +最后,使用 **scan** 查找所有修饰的函数并将其添加到配置中: ``` @@ -89,18 +88,18 @@ with Configurator() as config:     application = config.make_wsgi_app() ``` -The default for scan is to scan the current module. You can also give the name of a package if you want to scan all modules in a package. +默认扫描当前模块。如果要扫描软件包中的所有模块,你也可以提供软件包的名称。 -### Run the service +### 运行服务 -I use Twisted's WSGI server to run the application, but you can use any other [WSGI][5] server, like Gunicorn or uWSGI, if you want: +我使用 Twisted 的 WSGI 服务器运行该应用,但是如果需要,你可以使用任何其他 [WSGI][5] 服务器,例如 Gunicorn 或 uWSGI。 ``` `(env)$ python -m twisted web --wsgi=main.application` ``` -By default, Twisted's WSGI server runs on port 8080. You can test the service with [HTTPie][6]: +默认情况下,Twisted 的 WSGI 服务器运行在端口 8080 上。你可以使用 [HTTPie][6] 测试该服务: ``` @@ -129,11 +128,11 @@ X-Content-Type-Options: nosniff } ``` -### Why use Pyramid? +### 为什么要使用 Pyramid? -Pyramid is not the most popular framework, but it is used in some high-profile projects like [PyPI][7]. I like Pyramid because it is one of the frameworks that took unit testing seriously: because the decorators do not modify the function and there are no thread-local variables, functions are callable directly from unit tests. For example, functions that need access to the database will get it from the **request** object passed in via **request.config**. This allows a unit tester to put a mock (or real) database object in the request, instead of carefully setting globals, thread-local variables, or other framework-specific things. +Pyramid 不是最受欢迎的框架,但它已在 [PyPI][7] 等一些引人注目的项目中使用。我喜欢 Pyramid,因为它是认真对待单元测试的框架之一:因为装饰器不会修改函数并且没有线程局部变量,所以可以直接从单元测试中调用函数。例如,需要访问数据库的函数将从通过 **request.config** 传递的 **request.config** 对象中获取它。这允许单元测试人员将模拟(或真实)数据库对象放入请求中,而不用仔细设置全局变量,线程局部变量或其他特定于框架的东西。 -If you're looking for a well-tested library to build your next API, give Pyramid a try. You won't be disappointed. +如果你正在寻找一个经过测试的库来构建你接下来的 API,请尝试使用 Pyramid。你不会失望的。 -------------------------------------------------------------------------------- From d827e93709b6cbd73a92ced5e857ae5e81d76c1d Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 14 Jan 2020 09:02:35 +0800 Subject: [PATCH 0240/3057] translating --- ...se Stow for configuration management of multiple machines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md index 68a1eb0ebc..0d4a5f19d5 100644 --- a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md +++ b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a29479a75b4e81e5133d646b63a6e56cfb6bb622 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Tue, 14 Jan 2020 10:03:59 +0800 Subject: [PATCH 0241/3057] Update 20200112 What I learned going from prison to Python.md --- .../20200112 What I learned going from prison to Python.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200112 What I learned going from prison to Python.md b/sources/tech/20200112 What I learned going from prison to Python.md index 84dfa73ecb..93da6f1700 100644 --- a/sources/tech/20200112 What I learned going from prison to Python.md +++ b/sources/tech/20200112 What I learned going from prison to Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -84,7 +84,7 @@ via: https://opensource.com/article/20/1/prison-to-python 作者:[Shadeed "Sha" Wallace-Stepter][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 315c82742634f9de2047b0f3e9d7d40464f86673 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 14 Jan 2020 11:48:00 +0800 Subject: [PATCH 0242/3057] translating --- sources/tech/20200113 How to setup a DNS server with bind.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200113 How to setup a DNS server with bind.md b/sources/tech/20200113 How to setup a DNS server with bind.md index 897dc825a8..74cc32e747 100644 --- a/sources/tech/20200113 How to setup a DNS server with bind.md +++ b/sources/tech/20200113 How to setup a DNS server with bind.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 78bd977471aa002bd257e6f9bf960f164601b5a0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 15 Jan 2020 01:00:05 +0800 Subject: [PATCH 0243/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Root?= =?UTF-8?q?=20User=20in=20Ubuntu:=20Important=20Things=20You=20Should=20Kn?= =?UTF-8?q?ow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md --- ...buntu- Important Things You Should Know.md | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md diff --git a/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md b/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md new file mode 100644 index 0000000000..247391ff82 --- /dev/null +++ b/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Root User in Ubuntu: Important Things You Should Know) +[#]: via: (https://itsfoss.com/root-user-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Root User in Ubuntu: Important Things You Should Know +====== + +When you have just started using Linux, you’ll find many things that are different from Windows. One of those ‘different things’ is the concept of the root user. + +In this beginner series, I’ll explain a few important things about the root user in Ubuntu. + +**Please keep in mind that while I am writing this from Ubuntu user’s perspective, it should be valid for most Linux distributions.** + +You’ll learn the following in this article: + + * [Why root user is disabled in Ubuntu][1] + * [Using commands as root][2] + * [Switch to root user][3] + * [Unlock the root user][4] + + + +### What is root user? Why is it locked in Ubuntu? + +![][5] + +In Linux, there is always a super user called [root][6]. This is the super admin account that can do anything and everything with the system. It can access any file and run any command on your Linux system. + +With great power comes great responsibility. Root user gives you complete power over the system and hence it should be used with great cautious. Root user can access system files and run commands to make changes to the system configuration. And hence, an incorrect command may destroy the system. + +This is why [Ubuntu][7] and other Ubuntu-based distributions lock the root user by default to save you from accidental disasters. + +You don’t need to have root privilege for your daily tasks like moving file in your home directory, downloading files from internet, creating documents etc. + +_**Take this analogy for understanding it better. If you have to cut a fruit, you use a kitchen knife. If you have to cut down a tree, you have to use a saw. Now, you may use the saw to cut fruits but that’s not wise, is it?**_ + +Does this mean that you cannot be root in Ubuntu or use the system with root privileges? No, you can still have root access with the help of ‘sudo’ (explained in the next section). + +**Bottom line: +**Root user is too powerful to be used for regular tasks. This is why it is not recommended to use root all the time. You can still run specific commands with root. + +### How to run commands as root user in Ubuntu? + +![Image Credit: xkcd][8] + +You’ll need root privileges for some system specific tasks. For example, if you want to [update Ubuntu via command line][9], you cannot run the command as a regular user. It will give you permission denied error. + +``` +apt update +Reading package lists... Done +E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) +E: Unable to lock directory /var/lib/apt/lists/ +W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) +W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) +``` + +So, how do you run commands as root? The simple answer is to add sudo before the commands that require to be run as root. + +``` +sudo apt update +``` + +Ubuntu and many other Linux distributions use a special mechanism called sudo. Sudo is a program that controls access to running commands as root (or other users). + +Sudo is actually quite a versatile tool. It can be configured to allow a user to run all commands as root or only some commands as root. You can also configure if password is required for some commands or not to run it with sudo. It’s an extensive topic and maybe I’ll discuss it in details in another article. + +For the moment, you should know that [when you install Ubuntu][10], you are forced to create a user account. This user account works as the admin on your system and as per the default sudo policy in Ubuntu, it can run any command on your system with root privileges. + +The thing with sudo is that running **sudo doesn’t require root password but the user’s own password**. + +And this is why when you run a command with sudo, it asks for the password of the user who is running the sudo command: + +``` +[email protected]:~$ sudo apt update +[sudo] password for abhishek: +``` + +As you can see in the example above, user _abhishek_ was trying to run the ‘apt update’ command with _sudo_ and the system asked the password for _abhishek_. + +If you are absolutely new to Linux, you might be surprised that when you start typing your password in the terminal, nothing happens on the screen. This is perfectly normal because as the default security feature, nothing is displayed on the screen. Not even the asterisks (*). You type your password and press enter. + +**Bottom line: +**To run commands as root in Ubuntu, add sudo before the command. +When asked for password, enter your account’s password. +When you type the password on the screen, nothing is visible. Just keep on typing the password and press enter. + +### How to become root user in Ubuntu? + +You can use sudo to run the commands as root. However in situations, where you have to run several commands as root and you keep forogetting to add sudo before the commands, you may switch to root user temporarily. + +The sudo command allows you to simulate a root login shell with this command: + +``` +sudo -i +``` + +``` +[email protected]:~$ sudo -i +[sudo] password for abhishek: +[email protected]:~# whoami +root +[email protected]:~# +``` + +You’ll notice that when you switch to root, the shell command prompt changes from $ (dollar key sign) to # (pound key sign). This makes me crack a (lame) joke that pound is stronger than dollar. + +_**Though I have showed you how to become the root user, I must warn you that you should avoid using the system as root. It’s discouraged for a reason after all.**_ + +Another way to temporarily switch to root user is by using the su command: + +``` +sudo su +``` + +If you try to use the su command without sudo, you’ll encounter ‘su authentication failure’ error. + +You can go back to being the normal user by using the exit command. + +``` +exit +``` + +### How to enable root user in Ubuntu? + +By now you know that the root user is locked by default in Ubuntu based distributions. + +Linux gives you the freedom to do whatever you want with your system. Unlocking the root user is one of those freedoms. + +If, for some reasons, you decided to enable the root user, you can do so by setting up a password for it: + +``` +sudo passwd root +``` + +Again, this is not recommended and I won’t encourage you to do that on your desktop. If you forgot it, you won’t be able to [change the root password in Ubuntu][11] again. + +You can lock the root user again by removing the password: + +``` +sudo passwd -dl root +``` + +**In the end…** + +I hope you have a slightly better understanding of the root concept now. If you still have some confusion and questions about it, please let me know in the comments. I’ll try to answer your questions and might update the article as well. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/root-user-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: tmp.IrHYJBAqVn#what-is-root +[2]: tmp.IrHYJBAqVn#run-command-as-root +[3]: tmp.IrHYJBAqVn#become-root +[4]: tmp.IrHYJBAqVn#enable-root +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/root_user_ubuntu.png?ssl=1 +[6]: http://www.linfo.org/root.html +[7]: https://ubuntu.com/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/sudo_sandwich.png?ssl=1 +[9]: https://itsfoss.com/update-ubuntu/ +[10]: https://itsfoss.com/install-ubuntu/ +[11]: https://itsfoss.com/how-to-hack-ubuntu-password/ From 024c95a9e6b27345287ec0cad7fc43660fd918ff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 15 Jan 2020 01:00:41 +0800 Subject: [PATCH 0244/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200114=20Orga?= =?UTF-8?q?nize=20your=20email=20with=20Notmuch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200114 Organize your email with Notmuch.md --- ...200114 Organize your email with Notmuch.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20200114 Organize your email with Notmuch.md diff --git a/sources/tech/20200114 Organize your email with Notmuch.md b/sources/tech/20200114 Organize your email with Notmuch.md new file mode 100644 index 0000000000..f881ff5ad9 --- /dev/null +++ b/sources/tech/20200114 Organize your email with Notmuch.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organize your email with Notmuch) +[#]: via: (https://opensource.com/article/20/1/organize-email-notmuch) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Organize your email with Notmuch +====== +Notmuch indexes, tags, and sorts your email. Learn how to use it in the +fourth article in our series on 20 ways to be more productive with open +source in 2020. +![Filing cabinet for organization][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Index your email with Notmuch + +Yesterday, I talked about how I use OfflineIMAP to [sync my mail][2] to my local machine. Today, I'll talk about how I preprocess all that mail before I read it. + +![Notmuch][3] + +[Maildir][4] is probably one of the most useful mail storage formats out there. And there are a LOT of tools to help with managing your mail. The one I keep coming back to is a little program called [Notmuch][5] that indexes, tags, and searches mail messages. And there are several programs that work with Notmuch to make it even easier to handle a large amount of mail. + +Most Linux distributions include Notmuch, and you can also get it for MacOS. Windows users can access it through Windows Subsystem for Linux ([WSL][6]), but it may require some additional tweaks. + +![Notmuch's first run][7] + +On Notmuch's very first run, it will ask you some questions and create a **.notmuch-config** file in your home directory. Next, index and tag all your mail by running **notmuch new**. You can verify it with **notmuch search tag:new**; this will find all messages with the "new" tag. That's probably a lot of mail since Notmuch uses the "new" tag to indicate messages that are new to it, so you'll want to clean that up. + +Run **notmuch search tag:unread** to find any unread messages; that should result in quite a lot less mail. To remove the "new" tag from messages you've already seen, run **notmuch tag -new not tag:unread**, which will search for all messages without the "unread" tag and remove the "new" tag from them. Now when you run **notmuch search tag:new**, it should show only the unread mail messages. + +Tagging messages in bulk is probably more useful, though, since manually updating tags at every run can be really tedious. The **\--batch** command-line option tells Notmuch to read multiple lines of commands and execute them. There is also the **\--input=filename** option, which reads commands from a file and applies them. I have a file called **tagmail.notmuch** that I use to add tags to mail that is "new"; it looks something like this: + + +``` +# Manage sent, spam, and trash folders +-unread -new folder:Trash +-unread -new folder:Spam +-unread -new folder:Sent + +# Note mail sent specifically to me (excluding bug mail) ++to-me to:kevin at sonney.com and tag:new and not tag:to-me + +# And note all mail sent from me ++sent from:kevin at sonney.com and tag:new and not tag:sent + +# Remove the new tag from messages +-new tag:new +``` + +I can then run **notmuch tag --input=tagmail.notmuch** to bulk-process my mail messages after running **notmuch new**, and then I can search on those tags as well. + +Notmuch also supports running pre- and post-new hooks. These scripts, stored in **Maildir/.notmuch/hooks**, define actions to run before (pre-new) and after (post-new) to index new mail with **notmuch new**. In yesterday's article, I talked about using [OfflineIMAP][8] to sync mail from my IMAP server. It's very easy to run it from the "pre-new" hook: + + +``` +#!/bin/bash +# Remove the new tag from messages that are still tagged as new +notmuch tag -new tag:new + +# Sync mail messages +offlineimap -a LocalSync -u quiet +``` + +You can also use the Python application [afew][9], which interfaces with the Notmuch database, to tag things like _Mailing List_ and _Spam_ for you. You can run afew from the post-new hook in a similar way: + + +``` +#!/bin/bash +# tag with my custom tags +notmuch tag --input=~/tagmail.notmuch + +# Run afew to tag new mail +afew -t -n +``` + +I recommend that when using afew to tag messages, you do NOT use the **[ListMailsFilter]** since some mail handlers add obscure or downright junk List-ID headers to mail messages (I'm looking at you, Google). + +![alot email client][10] + +At this point, any mail reader that supports Notmuch or Maildir can work with my email. I'll sometimes use [alot][11], a Notmuch-specific client, to read mail at the console, but it's not as fancy as some other mail readers. + +In the coming days, I'll show you some other mail clients that will likely integrate with tools you already use. In the meantime, check out some of the other tools that work with Maildir mailboxes—you might find a hidden gem I've not tried yet. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/organize-email-notmuch + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) +[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch) +[4]: https://en.wikipedia.org/wiki/Maildir +[5]: https://notmuchmail.org/ +[6]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[7]: https://opensource.com/sites/default/files/uploads/productivity_4-2.png (Notmuch's first run) +[8]: http://www.offlineimap.org/ +[9]: https://afew.readthedocs.io/en/latest/index.html +[10]: https://opensource.com/sites/default/files/uploads/productivity_4-3.png (alot email client) +[11]: https://github.com/pazz/alot From 633dd3a525b81e87caaa5fe5e6c18988852725f0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 15 Jan 2020 01:01:59 +0800 Subject: [PATCH 0245/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200114=20What?= =?UTF-8?q?=20communities=20of=20practice=20can=20do=20for=20your=20organi?= =?UTF-8?q?zation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200114 What communities of practice can do for your organization.md --- ...f practice can do for your organization.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20200114 What communities of practice can do for your organization.md diff --git a/sources/tech/20200114 What communities of practice can do for your organization.md b/sources/tech/20200114 What communities of practice can do for your organization.md new file mode 100644 index 0000000000..886fc05201 --- /dev/null +++ b/sources/tech/20200114 What communities of practice can do for your organization.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What communities of practice can do for your organization) +[#]: via: (https://opensource.com/open-organization/20/1/why-build-community-of-practice) +[#]: author: (Tracy Buckner https://opensource.com/users/tracyb) + +What communities of practice can do for your organization +====== +In open organizations, fostering passionate communities can increase +collaboration, accelerate problem solving, and lead to greater +innovation. +![Lots of people in a crowd.][1] + +As I discussed in the [first part of this series][2], community is a fundamental principle in open organizations. In open organizations, people often define their roles, responsibilities, and affiliations through shared interests and passions—[not title, role, or position on an organizational chart][3]. + +So fostering and supporting communities of practice (CoPs) can be a great strategy for building a more open organization. Members of communities of practice interact regularly, discuss various topics, and solve problems collectively and collaboratively. These communities provide members with an opportunity to share their expertise, learn from others, and network with one another. + +As Luis Gonçalves states in [Learning Organisation][4]: + +> CoPs provide a shared context where members of the organisation can communicate and share information; stimulate learning through peer-to-peer mentoring, coaching, self-reflection, and collaboration; generate new knowledge; and initiate projects that develop tangible results. + +But those aren't the only value such communities can offer. Communities of practice can also enhance an organization in the following ways (summarized in Figure 1). + +**Decreased learning curves**. Many organizations face the challenge of rapidly increasing productivity of new employees (or members). This task becomes especially challenging in organizations where an employee's manager may be located in a different state, country, or region. Communities of practice offer new employees a network of connections they can tap into more quickly and easily. By joining a CoP, they can immediately access a network of experts and share resources, ask questions, and seek guidance outside the formal lines of the organizational chart. + +Members of communities of practice interact regularly, discuss various topics, and solve problems collectively and collaboratively. + +**Increased collaboration.** A recent survey from My Customer.com [shows][5] that 40 percent of company employees report not feeling adequately supported by their colleagues—because "different departments have their own agendas." A lack of collaboration between departments limits innovation and increases opportunities for miscommunication. Communities of practice encourage members from _all_ roles across _all_ departments to unite in sharing their expertise. This increases collaboration and reduces the threat of organizational silos. + +**Rapid problem-solving.** Communities of practice provide a centralized location for communication and resources useful for solving organizational or business problems. Enabling people to come together—regardless of their organizational reporting structure, location, and/or management structure—encourages problem-solving and can lead to faster resolution of those problems. + +**Enhanced innovation.** Researchers Pouwels and Koster [recently argued][6] that “collaboration contributes to innovation." CoPs provide a unique opportunity for members to collaborate on topics within their shared domains of interest and passion. This passion ignites a desire to discover new and innovative ways to solve problems and create new ideas. + +![Benefits of Communities of Practice][7] + +_Figure 1: Benefits of communities of practice. Courtesy of Tracy Buckner. CC BY-SA._ + +[Étienne Wenger][8], an educational theorist and proponent of communities of practice, said that learning doesn't only occur through a master; it also happens among apprentices. Communities of practice foster learning by connecting apprentices, while encouraging collaboration and offering an opportunity for creative problem-solving and innovation. + +In the final article of this series, I'll explain how you can reap these benefits by creating your own community of practice. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/1/why-build-community-of-practice + +作者:[Tracy Buckner][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/tracyb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_community2.png?itok=1blC7-NY (Lots of people in a crowd.) +[2]: https://opensource.com/open-organization/19/11/what-is-community-practice +[3]: https://opensource.com/open-organization/resources/open-org-definition +[4]: https://www.organisationalmastery.com/category/learning-organisation/ +[5]: https://www.mycustomer.com/experience/engagement/the-stats-that-prove-silos-are-your-biggest-cx-challenge +[6]: https://www.researchgate.net/profile/Ferry_Koster/publication/313659568_Inter-organizational_cooperation_and_organizational_innovativeness_A_comparative_study/links/59e64d510f7e9b13aca3c224/Inter-organizational-cooperation-and-organizational-innovativeness-A-comparative-study.pdf +[7]: https://opensource.com/sites/default/files/images/open-org/cop_benefits.png (Benefits of Communities of Practice) +[8]: https://en.wikipedia.org/wiki/%C3%89tienne_Wenger From 269d986ccda0b7b05bbcbfe6452a0cab33f5eb0a Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 15 Jan 2020 08:51:01 +0800 Subject: [PATCH 0246/3057] translated --- ... across multiple devices with Syncthing.md | 65 ------------------- ... across multiple devices with Syncthing.md | 63 ++++++++++++++++++ 2 files changed, 63 insertions(+), 65 deletions(-) delete mode 100644 sources/tech/20200111 Sync files across multiple devices with Syncthing.md create mode 100644 translated/tech/20200111 Sync files across multiple devices with Syncthing.md diff --git a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md deleted file mode 100644 index d662fc1a78..0000000000 --- a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Sync files across multiple devices with Syncthing) -[#]: via: (https://opensource.com/article/20/1/sync-files-syncthing) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Sync files across multiple devices with Syncthing -====== -Learn how to sync files between devices with Syncthing in the first -article in our series on 20 ways to be more productive with open source -in 2020. -![Files in a folder][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Syncing files with Synthing - -Setting up a new machine is a pain. We all have our "standard setups" that we copy from machine to machine. And over the years, I've used a lot of ways to keep them in sync between machines. In the old days (and this will tell you how old I am), it was with floppy disks, then Zip disks, USB sticks, SCP, Rsync, Dropbox, ownCloud—you name it. And they never seemed to work right for me. - -Then I stumbled upon [Syncthing][2]. - -![syncthing console][3] - -Syncthing is a lightweight, peer-to-peer file-synchronization system. You don't need to pay for a service, you don't need a third-party server, and it's fast. Much faster, in my experience, than many of the "big names" in file synchronization. - -Syncthing is available for Linux, MacOS, Windows, and several flavors of BSD. There is also an Android app (but nothing official for iOS yet). There are even handy graphical frontends for all of the above (although I'm not going to cover those here). On Linux, there are packages available for most distributions, so installation is very straightforward. - -![Installing Syncthing on Ubuntu][4] - -When you start Syncthing the first time, it launches a web browser to configure the daemon. There's not much to do on the first machine, but it is a good chance to poke around the user interface (UI) a little bit. The most important thing to see is System ID under the **Actions** menu in the top-right. - -![Machine ID][5] - -Once the first machine is set up, repeat the installation on the second machine. In the UI, there will be a button on the lower-right labeled **Add Remote Device**. Click the button, and you will be presented with a box to enter a **Device ID and a Name**. Copy and paste the **Device ID** from the first machine and click **Save**. - -You should see a pop-up on the first node asking to add the second. Once you accept it, the new machine will show up on the lower-right of the first one. Share the default directory with the second machine. Click on **Default Folder** and then click the **Edit** button. There are four links at the top of the pop-up. Click on **Sharing** and then select the second machine. Click **Save** and look at the second machine. You should get a prompt to accept the shared directory. Once you accept that, it will start synchronizing files between the two machines. - -![Sharing a directory in Syncthing][6] - -Test it out by copying a file to the default directory (**/your/home/Share**) on one of the machines. It should show up on the other one very quickly. - -You can add as many directories as you want or need to the sharing, which is pretty handy. As you can see in the first image, I have one for **myconfigs**—that's where I keep my configuration files. When I get a new machine, I just install Syncthing, and if I tune a configuration on one, I don't have to update all of them—it happens automatically. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/sync-files-syncthing - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) -[2]: https://syncthing.net/ -[3]: https://opensource.com/sites/default/files/uploads/productivity_1-1.png (syncthing console) -[4]: https://opensource.com/sites/default/files/uploads/productivity_1-2.png (Installing Syncthing on Ubuntu) -[5]: https://opensource.com/sites/default/files/uploads/productivity_1-3.png (Machine ID) -[6]: https://opensource.com/sites/default/files/uploads/productivity_1-4.png (Sharing a directory in Syncthing) diff --git a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md b/translated/tech/20200111 Sync files across multiple devices with Syncthing.md new file mode 100644 index 0000000000..e4bc076533 --- /dev/null +++ b/translated/tech/20200111 Sync files across multiple devices with Syncthing.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sync files across multiple devices with Syncthing) +[#]: via: (https://opensource.com/article/20/1/sync-files-syncthing) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Syncthing 在多个设备间同步文件 +====== +2020 年,在我们的 20 个使用开源提升生产力的系列文章中,首先了解如何使用 Syncthing 同步文件。 +![Files in a folder][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 Synthing 同步文件 + +置新机器很麻烦。我们都有在机器之间复制的“标准设置”。多年来,我使用了很多方法来使它们在计算机之间同步。在过去(这会告诉你我年纪有多大了),曾经是软盘、然后是 Zip 磁盘、U 盘、SCP、Rsync、Dropbox、ownCloud,你想到的都试过。但这些似乎对我都不够好。 + +然后我偶然发现了 [Syncthing][2]。 + +![syncthing console][3] + +Syncthing 是一个轻量级的点对点文件同步系统。你不需要为服务付费,也不需要第三方服务器,而且速度很快。以我的经验,比文件同步中的许多“大牌”要快得多。 + +Syncthing 可在 Linux、MacOS、Windows 和多种 BSD 中使用。还有一个 Android 应用(但尚无官方 iOS 版本)。以上所有终端都有方便的图形化前端(尽管我不会在这里介绍)。在 Linux 上,大多数发行版都有可用的软件包,因此安装非常简单。 + +![Installing Syncthing on Ubuntu][4] + +首次启动 Syncthing 时,它将启动 Web 浏览器以配置守护程序。第一台计算机上没有太多要做,但是这是一个很好的机会来介绍一下用户界面 (UI)。最重要的是在右上方的 **Actions** 菜单下的 “System ID”。 + +![Machine ID][5] + +设置第一台计算机后,请在第二台计算机上重复安装。在 UI 中,右下方将显示一个按钮,名为 **Add Remote Device**。单击按钮,你将会看到一个要求输入**设备 ID 和设备名**的框。从第一台计算机上复制并粘贴**设备 ID**,然后单击 **Save**。 + +你应该会在第一台上看到一个请求添加第二台的弹出窗口。接受后,新机器将显示在第一台机器的右下角。与第二台计算机共享默认目录。单击 **Default Folder**,然后单击 **Edit** 按钮。弹出窗口的顶部有四个链接。单击 **Sharing**,然后选择第二台计算机。单击 **Save**,然后查看第二台计算机。你会看到一个接受共享目录的提示。接受后,它将开始在两台计算机之间同步文件。 + +![Sharing a directory in Syncthing][6] + +测试从一台计算机上复制文件到默认目录(**/your/home/Share**)。它应该很快会在另一台上出现。 + +你可以根据需要添加任意数量的目录,这非常方便。如你在第一张图中所看到的,我有一个用于保存配置的 **myconfigs** 文件夹。当我买了一台新机器时,我只需安装 Syncthing,如果我在一台机器上调整了配置,我不必更新所有,它会自动更新。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-files-syncthing + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://syncthing.net/ +[3]: https://opensource.com/sites/default/files/uploads/productivity_1-1.png (syncthing console) +[4]: https://opensource.com/sites/default/files/uploads/productivity_1-2.png (Installing Syncthing on Ubuntu) +[5]: https://opensource.com/sites/default/files/uploads/productivity_1-3.png (Machine ID) +[6]: https://opensource.com/sites/default/files/uploads/productivity_1-4.png (Sharing a directory in Syncthing) From 2f97195dfc6e4d323771db85e669a52d25f09be4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 15 Jan 2020 09:02:17 +0800 Subject: [PATCH 0247/3057] translating --- .../tech/20200113 Keep your email in sync with OfflineIMAP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md index 1cd8370870..e4e1f1ba94 100644 --- a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md +++ b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fdbaeceba81281f21573c06ff2db9f81be806165 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 15 Jan 2020 09:12:23 +0800 Subject: [PATCH 0248/3057] Rename sources/tech/20200114 What communities of practice can do for your organization.md to sources/talk/20200114 What communities of practice can do for your organization.md --- ...4 What communities of practice can do for your organization.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200114 What communities of practice can do for your organization.md (100%) diff --git a/sources/tech/20200114 What communities of practice can do for your organization.md b/sources/talk/20200114 What communities of practice can do for your organization.md similarity index 100% rename from sources/tech/20200114 What communities of practice can do for your organization.md rename to sources/talk/20200114 What communities of practice can do for your organization.md From 903775bc5ee9f0b08d86bcf60b03a86f8429b776 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 15 Jan 2020 11:28:29 +0800 Subject: [PATCH 0249/3057] PRF @geekpi --- ...ic sequences with the Linux seq command.md | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md b/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md index 0b12dfb508..2a99b4b6b3 100644 --- a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md +++ b/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Generating numeric sequences with the Linux seq command) @@ -9,10 +9,12 @@ 使用 Linux seq 命令生成数字序列 ====== -Linux seq 命令可以以闪电般的速度生成数字列表。它易于使用而且灵活。 -[Jamie][1] [(CC BY 2.0)][2] -在 Linux 中生成数字列表的最简单方法之一是使用 **seq**(sequence)命令。最简单的形式是,**seq** 接收一个数字,并输出从 1 到该数字的列表。例如: +![](https://img.linux.net.cn/data/attachment/album/202001/15/112717drpb9nuwss84xebu.jpg) + +> Linux 的 seq 命令可以以闪电般的速度生成数字列表,而且它也易于使用而且灵活。 + +在 Linux 中生成数字列表的最简单方法之一是使用 `seq`(系列sequence)命令。其最简单的形式是,`seq` 接收一个数字参数,并输出从 1 到该数字的列表。例如: ``` $ seq 5 @@ -23,7 +25,7 @@ $ seq 5 5 ``` -除非另有指定,否则 **seq** 始终以 1 开头。你可以在最终数字前面插上不同数字开始。 +除非另有指定,否则 `seq` 始终以 1 开头。你可以在最终数字前面插上不同数字开始一个序列。 ``` $ seq 3 5 @@ -34,7 +36,7 @@ $ seq 3 5 ### 指定增量 -你还可以指定增量。假设你要列出 3 的倍数。指定起点(在此示例中为第一个 3 ),增量(第二个 3)和终点(18)。 +你还可以指定增量步幅。假设你要列出 3 的倍数。指定起点(在此示例中为第一个 3 ),增量(第二个 3)和终点(18)。 ``` $ seq 3 3 18 @@ -58,9 +60,7 @@ $ seq 18 -3 3 3 ``` -**seq** 命令也非常快。你或许可以在 10 秒内生成一百万个数字的列表。 - -Advertisement +`seq` 命令也非常快。你或许可以在 10 秒内生成一百万个数字的列表。 ``` $ time seq 1000000 @@ -78,9 +78,9 @@ user 0m0.020s sys 0m0.899s ``` -## 使用分隔符 +### 使用分隔符 -另一个非常有用的选项是使用分隔符。你可以插入逗号,冒号或其他一些字符,而不是在每行上列出单个数字。-s 选项后跟要使用的字符。 +另一个非常有用的选项是使用分隔符。你可以插入逗号、冒号或其他一些字符,而不是在每行上列出单个数字。`-s` 选项后跟要使用的字符。 ``` $ seq -s: 3 3 18 @@ -96,21 +96,21 @@ $ seq -s' ' 3 3 18 ### 开始数学运算 -从生成数字序列到进行数学运算似乎是一个巨大的飞跃,但是有了正确的分隔符,**seq** 可以轻松地传递给 **bc** 进行计算。例如: +从生成数字序列到进行数学运算似乎是一个巨大的飞跃,但是有了正确的分隔符,`seq` 可以轻松地传递给 `bc` 进行计算。例如: ``` $ seq -s* 5 | bc 120 ``` -该命令中发生了什么?让我们来看看。首先,**seq** 生成一个数字列表,并使用 \* 作为分隔符。 +该命令中发生了什么?让我们来看看。首先,`seq` 生成一个数字列表,并使用 `*` 作为分隔符。 ``` $ seq -s* 5 1*2*3*4*5 ``` -然后,它将字符串传递给计算器 (**bc**),计算器立即将数字相乘。你可以在不到一秒的时间内进行相当广泛的计算。 +然后,它将字符串传递给计算器(`bc`),计算器立即将数字相乘。你可以在不到一秒的时间内进行相当庞大的计算。 ``` $ time seq -s* 117 | bc @@ -125,15 +125,13 @@ sys 0m0.000s ### 局限性 -你只能选择一个分隔符,因此计算将非常有限。单独使用 **bc** 可进行更复杂的数学运算。此外,**seq** 仅适用于数字。要生成单个字母序列,请改用如下命令: +你只能选择一个分隔符,因此计算将非常有限。而单独使用 `bc` 可进行更复杂的数学运算。此外,`seq` 仅适用于数字。要生成单个字母的序列,请改用如下命令: ``` $ echo {a..g} a b c d e f g ``` -加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。 - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html @@ -141,7 +139,7 @@ via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-w 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f562b347c6ebf6c067f8fc6cc3f9e951ad0c2aec Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 15 Jan 2020 11:29:01 +0800 Subject: [PATCH 0250/3057] PUB @geekpi https://linux.cn/article-11784-1.html --- ...Generating numeric sequences with the Linux seq command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200107 Generating numeric sequences with the Linux seq command.md (98%) diff --git a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md b/published/20200107 Generating numeric sequences with the Linux seq command.md similarity index 98% rename from translated/tech/20200107 Generating numeric sequences with the Linux seq command.md rename to published/20200107 Generating numeric sequences with the Linux seq command.md index 2a99b4b6b3..c04fc6ff3a 100644 --- a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md +++ b/published/20200107 Generating numeric sequences with the Linux seq command.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11784-1.html) [#]: subject: (Generating numeric sequences with the Linux seq command) [#]: via: (https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From a8c19f772aceb32a5607c5f64001422cb29de015 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 15 Jan 2020 13:06:04 +0800 Subject: [PATCH 0251/3057] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @heguangzhi 要是这篇更严谨一些会更好 --- ...ll save Raspberry Pi users time in 2020.md | 82 +++++++++---------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md index 3b7ec879eb..9b3a7f9226 100644 --- a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md +++ b/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -1,89 +1,87 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How piwheels will save Raspberry Pi users time in 2020) [#]: via: (https://opensource.com/article/20/1/piwheels) [#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) - -piwheels 是如何在2020年节省树莓派用户的时间的 +piwheels 是如何为树莓派用户节省时间的 ====== -通过为树莓派提供预编译的 Python 包,piwheels 项目为用户节省了大量的时间和精力。![rainbow colors on pinwheels in the sun][1] -piwheels 自动为[PiPi][2]上的所有项目构建 Python wheels( 预编译的 Python包 ),即 Python 包索引,使用树莓派硬件确保其兼容性。这意味着,当树莓派用户想要使用 **pip**,安装一个Python库时,他们会得到一个现成的编译版本,并保证可以在树莓派上良好的工作。这使得树莓派用户更容易进入和开始他们的项目。 +> 通过为树莓派提供预编译的 Python 包,piwheels 项目为用户节省了大量的时间和精力。 + +![rainbow colors on pinwheels in the sun][1] + +piwheels 自动为 Python 包索引 [PiPi][2] 上的所有项目构建 Python wheels(预编译的 Python包),并使用了树莓派硬件以确保其兼容性。这意味着,当树莓派用户想要使用 `pip` 安装一个 Python 库时,他们会得到一个现成编译好的版本,并保证可以在树莓派上良好的工作。这使得树莓派用户更容易入门并开始他们的项目。 ![Piwheels logo][3] -当我在2018年10月写[piwheels:为树莓派提供快速 Python 包安装][4]时,piwheels 项目已经进入第一年,并且已经证明了其为树莓派用户节省大量时间和精力。但是这个项目已经进入第二年,它为树莓派提供了预编译的 Python 包走了更长的路。 +当我在 2018 年 10 月写 [piwheels:为树莓派提供快速 Python 包安装][4]时,那时 piwheels 项目已经有一年了,并且已经证明了其为树莓派用户节省大量时间和精力。但当这个项目进入第二年时,它为树莓派提供了预编译的 Python 包做了更多工作。 ![Raspberry Pi 4][5] ### 它是怎么工作的 -[Raspbian][6],树莓派的主要操作系统,预配置使用 piwheels,所以用户不需要做任何特殊的事情就可以使用piwheels。 +树莓派的主要操作系统 [Raspbian][6] 预配置使用了 piwheels,所以用户不需要做任何特殊的事情就可以使用 piwheels。 -配置文件(在 **/etc/pip.conf**)告诉 pip 使用[piwheels.org][7]作为 _附加索引_,因此 pip 首先查看PyPI,然后查看 piwheels。piwheels 网站位于树莓派 3的 hosts中,该项目建造的所有 wheels 都位于该派上。它每月提供100多万套服务——对于一台35美元的电脑来说还不错! +配置文件(在 `/etc/pip.conf`)告诉 `pip` 使用 [piwheels.org][7] 作*附加索引*,因此 `pip` 会首先查找 PyPI,然后查找 piwheels。piwheels 的网站被托管在一个树莓派 3 上,该项目构建的所有 wheels 都托管在该树莓派上。它每月提供 100 多万个软件包——这对于一台 35 美元的电脑来说还真不赖! -网站除了主要服务于树莓派以外,piwheels 项目还对使用其他七个派系统并构建软件包。有人运行 Raspbian Jessie,为 Python 3.4 建造 wheels,有人运行 Raspbian Stretch 为 Python 3.5,有人运行 Raspbian Buster 为 Python 3.7。该项目通常不支持其他 Python 版本。还有一个“合适的服务器”——运行 Postgres 数据库的虚拟机。由于 派3 只有1GB的内存,所以(非常大的)数据库不能在其上很好地运行,所以我们把它移到了虚拟机上。带 4GB 内存的 派4 可能是合适的,所以我们将来可能会用到它。 +除了提供网站服务的主树莓派以外,piwheels 项目还使用其他七个树莓派来构建软件包。其中一些运行 Raspbian Jessie,为 Python 3.4 构建 wheels;另外一些运行 Raspbian Stretch 为 Python 3.5 构建;还有一些运行 Raspbian Buster 为 Python 3.7 构建。该项目通常不支持其他 Python 版本。还有一个“合适的服务器”——一台运行 Postgres 数据库的虚拟机。由于树莓派 3 只有 1GB 的内存,所以(非常大的)数据库不能在其上很好地运行,所以我们把它移到了虚拟机上。带 4GB 内存的树莓派 4 可能是合用的,所以我们将来可能会用到它。 + +这些树莓派都在“派云”中的 IPv6 网络上——这是一项由总部位于剑桥的托管公司 [Mythic Beasts][8] 提供的卓越服务。 -派都在“派云”中的 IPv6 网络上——这是一项由总部位于剑桥的托管公司[Mythic Beasts][8]提供的卓越的服务。 ![Mythic Beasts hosting service][9] ### 下载和统计趋势 -每次下载 piwheels 文件时,它都会记录在数据库中。这提供了对什么包最受欢迎以及人们使用什么 Python 版本和操作系统的统计。我们没有太多来自用户代理的信息,但是因为 派1/Zero 的架构显示为 “armv6”,派2/3/4显示为“armv7”,所以我们可以将它们区分开来。 +每次下载 piwheels 文件时,它都会记录在数据库中。这提供了对什么包最受欢迎以及人们使用什么 Python 版本和操作系统的统计。我们没有太多来自用户代理的信息,但是因为树莓派 1/Zero 的架构显示为 “armv6”,树莓派 2/3/4 显示为 “armv7”,所以我们可以将它们区分开来。 -截至2019年12月中旬,从派风车下载的软件包超过1,400万个,仅2019年就有近900万个。 +截至 2019 年 12 月中旬,从 piwheels 下载的软件包超过 1400 万个,仅 2019 年就有近 900 万个。 -自项目开始以来最受欢迎的10个软件包是: +自项目开始以来最受欢迎的 10 个软件包是: - 1. [pycparser][10] (821,060 downloads) - 2. [PyYAML][11] (366,979) - 3. [numpy][12] (354,531) - 4. [cffi][13] (336,982) - 5. [MarkupSafe][14] (318,878) - 6. [future][15] (282,349) - 7. [aiohttp][16] (277,046) - 8. [cryptography][17] (276,167) - 9. [home-assistant-frontend][18] (266,667) - 10. [multidict][19] (256,185) + 1. [pycparser][10](821,060 个下载) + 2. [PyYAML][11](366,979 个下载) + 3. [numpy][12](354,531 个下载) + 4. [cffi][13](336,982 个下载) + 5. [MarkupSafe][14](318,878 个下载) + 6. [future][15](282,349 个下载) + 7. [aiohttp][16](277,046 个下载) + 8. [cryptography][17](276,167 个下载) + 9. [home-assistant-frontend][18](266,667 个下载) + 10. [multidict][19](256,185 个下载) +请注意,许多纯 Python 包,如 [urllib3][20],都是作为 PyPI 上的 wheels 提供的;因为这些是跨平台兼容的,所以通常不会从 piwheels 下载,因为 PyPI 优先。 - -请注意,许多纯 Python 包,如[urllib3][20],都是作为 PyPI 上的 wheels 提供的;因为这些是跨平台兼容的,所以通常不会从 piwheels 下载,因为PyPI优先。 - -随着时间的推移,我们也看到了使用哪些 Python 版本的趋势。这里显示了 Raspbian Buster 发布时从3.5版快速升级到了Python 3.7: +随着时间的推移,我们也看到了使用哪些 Python 版本的趋势。这里显示了 Raspbian Buster 发布时从 3.5 版快速升级到了 Python 3.7: ![Data from piwheels on Python versions used over time][21] +你可以在我们的这篇 [统计博文][22] 看到更多的统计趋势。 -你可以看到更多的统计趋势在[stats blog posts][22]。 +### 节省的时间 -### 节省时间 +每个包构建都被记录在数据库中,并且每个下载也被存储。交叉引用下载数和构建时间显示了节省了多少时间。一个例子是 numpy —— 最新版本大约需要 11 分钟来构建。 +迄今为止,piwheels 项目已经为用户节省了总计超过 165 年的构建时间。按照目前的使用率,piwheels 项目每天可以节省 200 多天。 -每个包构建都被记录在数据库中,并且每个下载也被存储。带有构建持续时间的交叉引用下载显示了节省了多少时间。一个例子是 numpy ——最新版本大约需要11分钟来构建。 - -迄今为止,piwheels 项目已经为用户节省了总计超过165年的构建时间。按照目前的使用率,piwheels 项目每天节省200多天。 - - -除了节省构建时间,拥有预编译的 wheels 也意味着人们不必安装各种开发工具来构建包。一些包需要其他apt包来访问共享库。弄清楚你需要哪一个可能会很痛苦,所以我们也让这一步变得容易了。首先,我们找到了这个过程,[在博客上记录了这个过程][23]。然后,我们将这个逻辑添加到构建过程中,这样当构建一个 wheels 时,它的依赖关系会被自动计算并添加到包的项目页面中: +除了节省构建时间,拥有预编译的 wheels 也意味着人们不必安装各种开发工具来构建包。一些包需要其他 apt 包来访问共享库。弄清楚你需要哪一个可能会很痛苦,所以我们也让这一步变得容易了。首先,我们找到了这个过程,[在博客上记录了这个过程][23]。然后,我们将这个逻辑添加到构建过程中,这样当构建一个 wheels 时,它的依赖关系会被自动计算并添加到包的项目页面中: ![numpy dependencies][24] -### 派风车的下一步是什么? +### piwheels 的下一步是什么? -今年,我们推出了项目页面(例如,[numpy][25),这是一种非常有用的方式,可以让人们以人类可读的方式查找项目信息。它们还使人们更容易报告问题,例如 piwheels 中缺少一个项目,或者他们下载的包有问题。 +今年,我们推出了项目页面(例如,[numpy][25]),这是一种非常有用的方式,可以让人们以人类可读的方式查找项目信息。它们还使人们更容易报告问题,例如 piwheels 中缺少一个项目,或者他们下载的包有问题。 -2020年初,我们计划对 piwheels 项目进行一些升级,以启用新的JSON应用编程接口,这样你就可以自动检查哪些版本可用,查找项目的依赖关系,等等。 +2020 年初,我们计划对 piwheels 项目进行一些升级,以启用新的 JSON 应用编程接口,这样你就可以自动检查哪些版本可用,查找项目的依赖关系,等等。 -下一次 Debian/Raspbian 升级要到2021年年中才会发生,所以在那之前我们不会开始为任何新的 Python 版本 制造 wheels。 +下一次 Debian/Raspbian 升级要到 2021 年年中才会发生,所以在那之前我们不会开始为任何新的 Python 版本构建 wheels。 -你可以在这个项目的[博客][26]上读到更多关于 piwheels 的信息,我将在2020年初在那里发表一篇2019年的综述。你也可以在推特上关注[@piwheels][27],在那里你可以看到每日和每月的统计数据以及任何达到的里程碑。 +你可以在这个项目的[博客][26]上读到更多关于 piwheels 的信息,我将在 2020 年初在那里发表一篇 2019 年的综述。你也可以在推特上关注 [@piwheels][27],在那里你可以看到每日和每月的统计数据以及任何达到的里程碑。 -当然,piwheels 是一个开源项目,你可以在[GitHub][28]上看到整个项目源代码。 +当然,piwheels 是一个开源项目,你可以在 [GitHub][28] 上看到整个项目源代码。 -------------------------------------------------------------------------------- @@ -92,7 +90,7 @@ via: https://opensource.com/article/20/1/piwheels 作者:[Ben Nuttall][a] 选题:[lujun9972][b] 译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2d28ac5fd922bc2f068c5144aecc7c8d1a3de642 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 15 Jan 2020 13:06:55 +0800 Subject: [PATCH 0252/3057] PUB @heguangzhi https://linux.cn/article-11786-1.html --- ... How piwheels will save Raspberry Pi users time in 2020.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200107 How piwheels will save Raspberry Pi users time in 2020.md (99%) diff --git a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/published/20200107 How piwheels will save Raspberry Pi users time in 2020.md similarity index 99% rename from translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md rename to published/20200107 How piwheels will save Raspberry Pi users time in 2020.md index 9b3a7f9226..2fc0aafef9 100644 --- a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md +++ b/published/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11786-1.html) [#]: subject: (How piwheels will save Raspberry Pi users time in 2020) [#]: via: (https://opensource.com/article/20/1/piwheels) [#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) From 4b21e11eb78c294f0893546af0cb818174d947bb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:53:06 +0800 Subject: [PATCH 0253/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Deve?= =?UTF-8?q?lop=20GUI=20apps=20using=20Flutter=20on=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md --- ...evelop GUI apps using Flutter on Fedora.md | 199 ++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md diff --git a/sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md b/sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md new file mode 100644 index 0000000000..afff65b34e --- /dev/null +++ b/sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md @@ -0,0 +1,199 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Develop GUI apps using Flutter on Fedora) +[#]: via: (https://fedoramagazine.org/develop-gui-apps-using-flutter-on-fedora/) +[#]: author: (Carmine Zaccagnino https://fedoramagazine.org/author/carzacc/) + +Develop GUI apps using Flutter on Fedora +====== + +![][1] + +When it comes to app development frameworks, Flutter is the latest and greatest. Google seems to be planning to take over the entire GUI app development world with Flutter, starting with mobile devices, which are already perfectly supported. Flutter allows you to develop cross-platform GUI apps for multiple targets — mobile, web, and desktop — from a single codebase. + +This post will go through how to install the Flutter SDK and tools on Fedora, as well as how to use them both for mobile development and web/desktop development. + +### Installing Flutter and Android SDKs on Fedora + +To get started building apps with Flutter, you need to install + + * the Android SDK; + * the Flutter SDK itself; and, + * optionally, an IDE and its Flutter plugins. + + + +#### Installing the Android SDK + +Flutter requires the installation of the Android SDK with the entire [Android Studio][2] suite of tools. Google provides a _tar.gz_ archive. The Android Studio executable can be found in the _android-studio/bin_ directory and is called _studio.sh_. To run it, open a terminal, _cd_ into the aforementioned directory, and then run: + +``` +$ ./studio.sh +``` + +#### Installing the Flutter SDK + +Before you install Flutter you may want to consider what release channel you want to be on. + +The _stable_ channel is least likely to give you a headache if you just want to build a mobile app using mainstream Flutter features. + +On the other hand, you may want to use the latest features, especially for desktop and web app development. In that case, you might be better off installing either the latest version of the _beta_ or even the _dev_ channel. + +Either way, you can switch between channels after you install using the _flutter channel_ command explained later in the article. + +Head over to the [official SDK archive page][3] and download the latest installation bundle for the release channel most appropriate for your use case. + +The installation bundle is simply a _xz-_compressed tarball (_.tar.xz_ extension). You can extract it wherever you want, given that you add the _flutter/bin_ subdirectory to the _PATH_ environment variable. + +#### Installing the IDE plugins + +To install the plugin for [Visual Studio Code][4], you need to search for _Flutter_ in the _Extensions_ tab. Installing it will also install the _Dart_ plugin. + +The same will happen when you install the plugin for Android Studio by opening the _Settings_, then the _Plugins_ tab and installing the _Flutter_ plugin. + +### Using the Flutter and Android CLI Tools on Fedora + +Now that you’ve installed Flutter, here’s how to use the CLI tool. + +#### Upgrading and Maintaining Your Flutter Installations + +The _flutter doctor_ command is used to check whether your installation and related tools are complete and don’t require any further action. + +For example, the output you may get from _flutter doctor_ right after installing on Fedora is: + +``` +Doctor summary (to see all details, run flutter doctor -v): + +[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Linux, locale it_IT.UTF-8) + +[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2) + + ✗ Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses + +[!] Android Studio (version 3.5) + + ✗ Flutter plugin not installed; this adds Flutter specific functionality. + + ✗ Dart plugin not installed; this adds Dart specific functionality. + +[!] Connected device + + ! No devices available + +! Doctor found issues in 3 categories. +``` + +Of course the issue with the Android toolchain has to be resolved in order to build for Android. Run this command to accept the licenses: + +``` +$ flutter doctor --android-licenses +``` + +Use the _flutter channel_ command to switch channels after installation. It’s just like switching branches on Git (and that’s actually what it does). You use it in the following way: + +``` +$ flutter channel +``` + +…where you’d replace _<channel_name>_ with the release channel you want to switch to. + +After doing that, or whenever you feel the need to do it, you need to update your installation. You might consider running this every once in a while or when a major update comes out if you follow Flutter news. Run this command: + +``` +$ flutter upgrade +``` + +#### Building for Mobile + +You can build for Android very easily: the _flutter build_ command supports it by default, and it allows you to build both APKs and newfangled app bundles. + +All you need to do is to create a project with _flutter create_, which will generate some code for an example app and the necessary _android_ and _ios_ folders. + +When you’re done coding you can either run: + + * _flutter build apk_ or _flutter build appbundle_ to generate the necessary app files to distribute, or + * _flutter run_ to run the app on a connected device or emulator directly. + + + +When you run the app on a phone or emulator with _flutter run_, you can use the _R_ button on the keyboard to use _stateful hot reload_. This feature updates what’s displayed on the phone or emulator to reflect the changes you’ve made to the code without requiring a full rebuild. + +If you input a capital _R_ character to the debug console, you trigger a _hot restart_. This restart doesn’t preserve state and is necessary for bigger changes to the app. + +If you’re using a GUI IDE, you can trigger a hot reload using the _bolt_ icon button and a hot restart with the typical _refresh_ button. + +#### Building for the Desktop + +To build apps for the desktop on Fedora, use the [flutter-desktop-embedding][5] repository. The _flutter create_ command doesn’t have templates for desktop Linux apps yet. That repository contains examples of desktop apps and files required to build on desktop, as well as examples of plugins for desktop apps. + +To build or run apps for Linux, you also need to be on the _master_ release channel and enable Linux desktop app development. To do this, run: + +``` +$ flutter config --enable-linux-desktop +``` + +After that, you can use _flutter run_ to run the app on your development workstation directly, or run _flutter build linux_ to build a binary file in the _build/_ directory. + +If those commands don’t work, run this command in the project directory to generate the required files to build in the _linux/_ directory: + +``` +$ flutter create . +``` + +#### Building for the Web + +Starting with Flutter 1.12, you can build Web apps using Flutter with the mainline codebase, without having to use the _flutter_web_ forked libraries, but you have to be running on the _beta_ channel. + +If you are (you can switch to it using _flutter channel beta_ and _flutter upgrade_ as we’ve seen earlier), you need to enable web development by running _flutter config –enable-web_. + +After doing that, you can run _flutter run -d web_ and a local web server will be started from which you can access your app. The command returns the URL at which the server is listening, including the port number. + +You can also run _flutter build web_ to build the static website files in the _build/_ directory. + +If those commands don’t work, run this command in the project directory to generate the required files to build in the _web/_ directory: + +``` +$ flutter create . +``` + +### Packages for Installing Flutter + +Other distributions have packages or community repositories to install and update in a more straightforward and intuitive way. However, at the time of writing, no such thing exists for Flutter. If you have experience packaging RPMs for Fedora, consider contributing to [this GitHub repository][6] for [this COPR package][7]. + +The next step is learning Flutter. You can do that in a number of ways: + + * Read the good API reference documentation on the official site + * Watching some of the introductory video courses available online + * Read one of the many books out there today. _[Check out the author’s bio for a suggestion! — Ed.]_ + + + +* * * + +_Photo by [Randall Ruiz][8] on [Unsplash][9]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/develop-gui-apps-using-flutter-on-fedora/ + +作者:[Carmine Zaccagnino][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/carzacc/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/flutter-816x345.jpg +[2]: https://developer.android.com/studio +[3]: https://flutter.dev/docs/development/tools/sdk/releases?tab=linux +[4]: https://fedoramagazine.org/using-visual-studio-code-fedora/ +[5]: https://github.com/google/flutter-desktop-embedding +[6]: https://github.com/carzacc/flutter-copr +[7]: https://copr.fedorainfracloud.org/coprs/carzacc/flutter/ +[8]: https://unsplash.com/@ruizra?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[9]: https://unsplash.com/s/photos/flutter?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From 0d62e47c46ce814620f58368ba069f1004ca1aea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:54:04 +0800 Subject: [PATCH 0254/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Orga?= =?UTF-8?q?nize=20and=20sync=20your=20calendar=20with=20khal=20and=20vdirs?= =?UTF-8?q?yncer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md --- ... your calendar with khal and vdirsyncer.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md diff --git a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md new file mode 100644 index 0000000000..b78ad493af --- /dev/null +++ b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organize and sync your calendar with khal and vdirsyncer) +[#]: via: (https://opensource.com/article/20/1/open-source-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Organize and sync your calendar with khal and vdirsyncer +====== +Keeping and sharing a calendar can be a pain. Learn how to make it +easier in the fifth article in our series on 20 ways to be more +productive with open source in 2020. +![Calendar close up snapshot][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Keep track of your schedule with khal and vdirsyncer + +Calendars are a _pain_ to deal with, and finding good tooling is always hard. But I've made some progress since last year when I listed calendaring as [one of my "fails."][2] + +The most difficult thing about calendars today is that now they almost always need to be shared online in some way. The two most popular online calendars are Google Calendar and Microsoft Outlook/Exchange. Both are used heavily in corporate environments, which means my calendar has to support one or both options. + +![khal calendar][3] + +[Khal][4] is a console-based calendar that reads and writes VCalendar files. It's fairly easy to configure, but it does not support syncing with other applications. + +Fortunately, khal works with [vdirsyncer][5], a nifty command-line program that can synchronize online calendars (and contacts, which I'll talk about in a separate article) to your local drive. And yes, this includes uploading new events, too. + +![vdirsyncer][6] + +Vdirsyncer is a Python 3 program, and it can be installed via your package manager or pip. It can synchronize CalDAV, VCalendar/iCalendar, Google Calendar, and local files in a directory. Since I use Google Calendar, I'll use that as an example, although it is not the easiest thing to set up. + +Setting vdirsyncer up for Google is [well-documented][7], so I won't go into the nuts and bolts here. The important thing is to make sure your sync pairs are set up in a way that sets Google Calendar as the "winner" for conflict resolution. That is, if there are two updates to the same event, it needs to know which one takes precedence. Do so with something like this: + + +``` +[general] +status_path = "~/.calendars/status" + +[pair personal_sync] +a = "personal" +b = "personallocal" +collections = ["from a", "from b"] +conflict_resolution = "a wins" +metadata = ["color"] + +[storage personal] +type = "google_calendar" +token_file = "~/.vdirsyncer/google_calendar_token" +client_id = "google_client_id" +client_secret = "google_client_secret" + +[storage personallocal] +type = "filesystem" +path = "~/.calendars/Personal" +fileext = ".ics" +``` + +After the first sync of vdirsyncer, you will end up with a series of directories in the storage path. Each will contain several files, one for each entry in the calendar. The next step is to get them into khal. Start by running **khal configure** to do the initial setup. + +![Configuring khal][8] + +Now, running **khal interactive** will bring up the display shown at the beginning of this article. Typing **n** will bring up the New Event dialog. One small thing to note here: the calendars are named to match the directories that vdirsyncer creates, but you can change the khal config file to give them clearer names. Adding colors to entries based on which calendar they're on will also help you identify which is which on the list: + + +``` +[calendars] +[[personal]] +path = ~/.calendars/Personal/kevin@sonney.com/ +color = light magenta +[[holidays]] +path = ~/.calendars/Personal/cln2stbjc4hmgrrcd5i62ua0ctp6utbg5pr2sor1dhimsp31e8n6errfctm6abj3dtmg@virtual/ +color = light blue +[[birthdays]] +path = ~/.calendars/Personal/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual/ +color = brown +``` + +Now when you run **khal interactive**, each calendar will be colored to distinguish it from the others, and when you add a new entry, it will have a more descriptive name. + +![Adding a new calendar entry][9] + +The setup is a little tricky, but once it's done, khal with vdirsyncer gives you an easy way to manage calendar events and keep them in sync with your online services. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-calendar + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://opensource.com/article/19/1/productivity-tool-wish-list +[3]: https://opensource.com/sites/default/files/uploads/productivity_5-1.png (khal calendar) +[4]: https://khal.readthedocs.io/en/v0.9.2/index.html +[5]: https://github.com/pimutils/vdirsyncer +[6]: https://opensource.com/sites/default/files/uploads/productivity_5-2.png (vdirsyncer) +[7]: https://vdirsyncer.pimutils.org/en/stable/config.html#google +[8]: https://opensource.com/sites/default/files/uploads/productivity_5-3.png (Configuring khal) +[9]: https://opensource.com/sites/default/files/uploads/productivity_5-4.png (Adding a new calendar entry) From dc866e23883e5a37de9e8e8a92af2b4ccafeaf32 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:54:31 +0800 Subject: [PATCH 0255/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Why?= =?UTF-8?q?=20everyone=20is=20talking=20about=20WebAssembly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 Why everyone is talking about WebAssembly.md --- ...y everyone is talking about WebAssembly.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20200115 Why everyone is talking about WebAssembly.md diff --git a/sources/tech/20200115 Why everyone is talking about WebAssembly.md b/sources/tech/20200115 Why everyone is talking about WebAssembly.md new file mode 100644 index 0000000000..80b5a83060 --- /dev/null +++ b/sources/tech/20200115 Why everyone is talking about WebAssembly.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why everyone is talking about WebAssembly) +[#]: via: (https://opensource.com/article/20/1/webassembly) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +Why everyone is talking about WebAssembly +====== +Learn more about the newest way to run any code in a web browser. +![Digital creative of a browser on the internet][1] + +If you haven’t heard of [WebAssembly][2] yet, then you will soon. It’s one of the industry’s best-kept secrets, but it’s everywhere. It’s supported by all the major browsers, and it’s coming to the server-side, too. It’s fast. It’s being used for gaming. It’s an open World Wide Web Consortium (W3C), the main international standards organization for the web, standard. It’s platform-neutral and can run on Linux, Macs, and Windows. + +"Wow," you may be saying, "this sounds like something I should learn to code in!" You’d be right, but you’d be wrong too; you don’t code in WebAssembly. Let’s take some time to learn about the technology that’s often fondly abbreviated to "Wasm." + +### Where did it come from? + +Going back about ten years, there was a growing recognition that the widely-used JavaScript wasn’t fast enough for many purposes. JavaScript was undoubtedly successful and convenient. It ran in any browser and enabled the type of dynamic web pages that we take for granted today. But it was a high-level language and wasn’t designed with compute-intensive workloads in mind. + +However, although engineers responsible for the leading web browsers were generally in agreement about the performance problem, they weren’t aligned on what to do about it. Two camps emerged. Google began its Native Client project and, later, its Portable Native Client variation, to focus on allowing games and other software written in C/C++ to run in a secure compartment within Chrome. Mozilla, meanwhile, won the backing of Microsoft for asm.js, an approach that updated the browser so it can run a low-level subset of JavaScript instructions very quickly (another project enabled the conversion of C/C++ code into these instructions). + +With neither camp gaining widespread adoption, the various parties agreed to join forces in 2015 around a new standard called WebAssembly that built on the basic approach taken by asm.js. [As CNET’s Stephen Shankland wrote at the time][3], "On today’s Web, the browser’s JavaScript translates those instructions into machine code. But with WebAssembly, the programmer does a lot of the work earlier in the process, producing a program that’s in between the two states. That frees the browser from a lot of the hard work of creating the machine code, but it also fulfills the promise of the Web—that software will run on any device with a browser regardless of the underlying hardware details." + +In 2017, Mozilla declared it to be a minimum viable product and brought it out of preview. All the main browsers had adopted it by the end of that year. [In December 2019][4], the WebAssembly Working Group published the three WebAssembly specifications as W3C recommendations. + +WebAssembly defines a portable binary code format for executable programs, a corresponding textual assembly language, and interfaces for facilitating interactions between such programs and their host environment. WebAssembly code runs within a low-level virtual machine that mimics the functionality of the many microprocessors upon which it can be run. Either through Just-In-Time (JIT) compilation or interpretation, the WebAssembly engine can perform at nearly the speed of code compiled for a native platform. + +### Why the interest now? + +Certainly, some of the recent interest in WebAssembly stems from that initial desire to run more compute-intensive code in browsers. Laptop users, in particular, are spending more and more of their time in a browser (or, in the case of Chromebooks, essentially all their time). This trend has created an urgency around removing barriers to running a broad range of applications within a browser. And one of those barriers is often some aspect of performance, which is what WebAssembly and its predecessors were originally conceived to address. + +However, WebAssembly isn’t just for browsers. In 2019, [Mozilla announced a project called WASI][5] (WebAssembly System Interface) to standardize how WebAssembly code interacts with operating systems outside of a browser context. With the combination of browser support for WebAssembly and WASI, compiled binaries will be able to run both within and without browsers, across different devices and operating systems, at near-native speeds. + +WebAssembly’s low overhead immediately makes it practical for use beyond browsers, but that’s arguably table stakes; there are obviously other ways to run applications that don’t introduce performance bottlenecks. Why use WebAssembly, specifically? + +One important reason is its portability. Widely used compiled languages like C++ and Rust are probably the ones most associated with WebAssembly today. However, [a wide range of other languages][6] compile to or have their virtual machines in WebAssembly. Furthermore, while WebAssembly [assumes certain prerequisites][7] for its execution environments, it is designed to execute efficiently on a variety of operating systems and instruction set architectures. WebAssembly code can, therefore, be written using a wide range of languages and run on a wide range of operating systems and processor types. + +Another WebAssembly advantage stems from the fact that code runs within a virtual machine. As a result, each WebAssembly module executes within a sandboxed environment, separated from the host runtime using fault isolation techniques. This implies, among other things, that applications execute in isolation from the rest of their host environment and can’t escape the sandbox without going through appropriate APIs. + +### WebAssembly in action + +What does all this mean in practice? + +One example of WebAssembly in action is [Enarx][8]. + +Enarx is a project that provides hardware independence for securing applications using Trusted Execution Environments (TEE). Enarx lets you securely deliver an application compiled into WebAssembly all the way into a cloud provider and execute it remotely. As Red Hat security engineer [Nathaniel McCallum puts it][9], "The way that we do this is, we take your application as inputs, and we perform an attestation process with the remote hardware. We validate that the remote hardware is, in fact, the hardware that it claims to be, using cryptographic techniques. The end result of that is not only an increased level of trust in the hardware that we’re speaking to; it’s also a session key, which we can then use to deliver encrypted code and data into this environment that we have just asked for cryptographic attestation on." + +Another example is OPA, the Open Policy Agent, which [announced][10] in November 2019 that you could [compile][11] their policy definition language, Rego, into WebAssembly. Rego lets you write logic to search and combine JSON/YAML data from different sources to ask questions like, "Is this API allowed?" + +OPA has been used to policy-enable software including, but not limited to, Kubernetes. Simplifying policy using tools like OPA [is considered an important step][12] for properly securing Kubernetes deployments across a variety of different environments. WebAssembly’s portability and built-in security features are a good match for these tools. + +Our last example is [Unity][13]. Remember, we mentioned at the beginning of the article that WebAssembly is used for gaming? Well, Unity, the cross-platform game engine, was an early adopter of WebAssembly, providing the first demo of Wasm running in browsers, and, since August 2018, [has used WebAssembly][14] as the output target for the Unity WebGL build target. + +These are just a few of the ways WebAssembly has already begun to make an impact. Find out more and keep up to date with all things Wasm at + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/webassembly + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://opensource.com/article/19/8/webassembly-speed-code-reuse +[3]: https://www.cnet.com/news/the-secret-alliance-that-could-give-the-web-a-massive-speed-boost/ +[4]: https://www.w3.org/blog/news/archives/8123 +[5]: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ +[6]: https://github.com/appcypher/awesome-wasm-langs +[7]: https://webassembly.org/docs/portability/ +[8]: https://enarx.io +[9]: https://enterprisersproject.com/article/2019/9/application-security-4-facts-confidential-computing-consortium +[10]: https://blog.openpolicyagent.org/tagged/webassembly +[11]: https://github.com/open-policy-agent/opa/tree/master/wasm +[12]: https://enterprisersproject.com/article/2019/11/kubernetes-reality-check-3-takeaways-kubecon +[13]: https://opensource.com/article/20/1/www.unity.com +[14]: https://blogs.unity3d.com/2018/08/15/webassembly-is-here/ From 86b4b65f4d9ebede609b20fd6bfa7f73daa4e220 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:55:02 +0800 Subject: [PATCH 0256/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=206=20?= =?UTF-8?q?handy=20Bash=20scripts=20for=20Git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 6 handy Bash scripts for Git.md --- .../20200115 6 handy Bash scripts for Git.md | 524 ++++++++++++++++++ 1 file changed, 524 insertions(+) create mode 100644 sources/tech/20200115 6 handy Bash scripts for Git.md diff --git a/sources/tech/20200115 6 handy Bash scripts for Git.md b/sources/tech/20200115 6 handy Bash scripts for Git.md new file mode 100644 index 0000000000..03464a840b --- /dev/null +++ b/sources/tech/20200115 6 handy Bash scripts for Git.md @@ -0,0 +1,524 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 handy Bash scripts for Git) +[#]: via: (https://opensource.com/article/20/1/bash-scripts-git) +[#]: author: (Bob Peterson https://opensource.com/users/bobpeterson) + +6 handy Bash scripts for Git +====== +These six Bash scripts will make your life easier when you're working +with Git repositories. +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +I wrote a bunch of Bash scripts that make my life easier when I'm working with Git repositories. Many of my colleagues say there's no need; that everything I need to do can be done with Git commands. While that may be true, I find the scripts infinitely more convenient than trying to figure out the appropriate Git command to do what I want. + +### 1\. gitlog + +**gitlog** prints an abbreviated list of current patches against the master version. It prints them from oldest to newest and shows the author and description, with **H** for **HEAD**, **^** for **HEAD^**, **2** for **HEAD~2,** and so forth. For example: + + +``` +$ gitlog +\-----------------------[ recovery25 ]----------------------- +(snip) +11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation + 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops + ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq + H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time +``` + +If I want to see what patches are on a different branch, I can specify an alternate branch: + + +``` +`$ gitlog recovery24` +``` + +### 2\. gitlog.id + +**gitlog.id** just prints the patch SHA1 IDs: + + +``` +$ gitlog.id +\-----------------------[ recovery25 ]----------------------- +56908eeb6940 2ca4a6b628a1 fc64ad5d99fe 02031a00a251 f6f38da7dd18 d8546e8f0023 fc3cc1f98f6b 12c3e0cb3523 76cce178b134 6fc1dce3ab9c 1b681ab074ca 26fed8de719b 802ff51a5670 49f67a512d8c f04f20193bbb 5f6afe809d23 2030521dc70e dada79b3be94 9b19a1e08161 78a035041d3e f03da011cae2 0d2b2e068fcd 2449976aa133 57dfb5e12ccd 53abedfdcf72 6fbdda3474b3 49544a547188 187032f7a63c 6f75dae23d93 95fc2a261b00 ebfb14ded191 f653ee9e414a 0e2911cb8111 73968b76e2e3 8a3e4cb5e92c a5f2da803b5b 7c9ef68388ed 71ca19d0cba8 340d27a33895 9b3c4e6efb10 d2e8c22be39b 9563e31f8bfd ebac7a38036c f703a3c27874 a3e86d2ef30e da3c604755b0 4525c2f5b46f a06a5b7dea02 8ba93c796d5c e8b5ff851bb9 +``` + +Again, it assumes the current branch, but I can specify a different branch if I want. + +### 3\. gitlog.id2 + +**gitlog.id2** is the same as **gitlog.id** but without the branch line at the top. This is handy for cherry-picking all patches from one branch to the current branch: + + +``` +$ # create a new branch +$ git branch --track origin/master +$ # check out the new branch I just created +$ git checkout recovery26 +$ # cherry-pick all patches from the old branch to the new one +$ for i in `gitlog.id2 recovery25` ; do git cherry-pick $i ;done +``` + +### 4\. gitlog.grep + +**gitlog.grep** greps for a string within that collection of patches. For example, if I find a bug and want to fix the patch that has a reference to function **inode_go_sync**, I simply do: + + +``` +$ gitlog.grep inode_go_sync +\-----------------------[ recovery25 - 50 patches ]----------------------- +(snip) +11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops +152:-static void inode_go_sync(struct gfs2_glock *gl) +153:+static int inode_go_sync(struct gfs2_glock *gl) +163:@@ -296,6 +302,7 @@ static void inode_go_sync(struct gfs2_glock *gl) + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation + 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops + ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq + H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time +``` + +So, now I know that patch **HEAD~9** is the one that needs fixing. I use **git rebase -i HEAD~10** to edit patch 9, **git commit -a --amend**, then **git rebase --continue** to make the necessary adjustments. + +### 5\. gitbranchcmp3 + +**gitbranchcmp3** lets me compare my current branch to another branch, so I can compare older versions of patches to my newer versions and quickly see what's changed and what hasn't. It generates a compare script (that uses the KDE tool [Kompare][2], which works on GNOME3, as well) to compare the patches that aren't quite the same. If there are no differences other than line numbers, it prints **[SAME]**. If there are only comment differences, it prints **[same]** (in lower case). For example: + + +``` +$ gitbranchcmp3 recovery24 +Branch recovery24 has 47 patches +Branch recovery25 has 50 patches + +(snip) +38 87eb6901607a 340d27a33895 [same] gfs2: drain the ail2 list after io errors +39 90fefb577a26 9b3c4e6efb10 [same] gfs2: clean up iopen glock mess in gfs2_create_inode +40 ba3ae06b8b0e d2e8c22be39b [same] gfs2: Do proper error checking for go_sync family of glops +41 2ab662294329 9563e31f8bfd [SAME] gfs2: use page_offset in gfs2_page_mkwrite +42 0adc6d817b7a ebac7a38036c [SAME] gfs2: don't use buffer_heads in gfs2_allocate_page_backing +43 55ef1f8d0be8 f703a3c27874 [SAME] gfs2: Improve mmap write vs. punch_hole consistency +44 de57c2f72570 a3e86d2ef30e [SAME] gfs2: Multi-block allocations in gfs2_page_mkwrite +45 7c5305fbd68a da3c604755b0 [SAME] gfs2: Fix end-of-file handling in gfs2_page_mkwrite +46 162524005151 4525c2f5b46f [SAME] Rafael Aquini's slab instrumentation +47              a06a5b7dea02 [    ] GFS2: Add go_get_holdtime to gl_ops +48              8ba93c796d5c [    ] gfs2: introduce new function remaining_hold_time and use it in dq +49              e8b5ff851bb9 [    ] gfs2: Allow rgrps to have a minimum hold time + +Missing from recovery25: +The missing: +Compare script generated at: /tmp/compare_mismatches.sh +``` + +### 6\. gitlog.find + +Finally, I have **gitlog.find**, a script to help me identify where the upstream versions of my patches are and each patch's current status. It does this by matching the patch description. It also generates a compare script (again, using Kompare) to compare the current patch to the upstream counterpart: + + +``` +$ gitlog.find +\-----------------------[ recovery25 - 50 patches ]----------------------- +(snip) +11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors +lo 5bcb9be74b2a Bob Peterson     gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode +fn 2c47c1be51fb Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops +lo feb7ea639472 Bob Peterson     gfs2: Do proper error checking for go_sync family of glops + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite +ms f3915f83e84c Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing +ms 35af80aef99b Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency +fn 39c3a948ecf6 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite +fn f53056c43063 Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite +fn 184b4e60853d Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation +   Not found upstream + 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops +   Not found upstream + ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq +   Not found upstream + H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time +   Not found upstream +Compare script generated: /tmp/compare_upstream.sh +``` + +The patches are shown on two lines, the first of which is your current patch, followed by the corresponding upstream patch, and a 2-character abbreviation to indicate its upstream status: + + * **lo** means the patch is in the local upstream Git repo only (i.e., not pushed upstream yet). + * **ms** means the patch is in Linus Torvald's master branch. + * **fn** means the patch is pushed to my "for-next" development branch, intended for the next upstream merge window. + + + +Some of my scripts make assumptions based on how I normally work with Git. For example, when searching for upstream patches, it uses my well-known Git tree's location. So, you will need to adjust or improve them to suit your conditions. The **gitlog.find** script is designed to locate [GFS2][3] and [DLM][4] patches only, so unless you're a GFS2 developer, you will want to customize it to the components that interest you. + +### Source code + +Here is the source for these scripts. + +#### 1\. gitlog + + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then +    branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +patches=0 +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done + +if [[ $branch =~ .*for-next.* ]] +then +    start=HEAD +#    start=origin/for-next +else +    start=origin/master +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +/usr/bin/echo "-----------------------[" $branch "]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do +    if [ $patches -eq 1 ]; then +        cnt=" ^" +    elif [ $patches -eq 0 ]; then +        cnt=" H" +    else +        if [ $patches -lt 10 ]; then +            cnt=" $patches" +        else +            cnt="$patches" +        fi +    fi +    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s %n" $i +    patches=$(echo $patches - 1 | bc) +done +#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" $tracking..$branch +#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" ^origin/master ^linux-gfs2/for-next $branch +``` + +#### 2\. gitlog.id + + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then +    branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +/usr/bin/echo "-----------------------[" $branch "]-----------------------" +git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 3\. gitlog.id2 + + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then +    branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` +git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 4\. gitlog.grep + + +``` +#!/bin/bash +param1=$1 +param2=$2 + +if test "x$param2" = x; then +    branch=`git branch -a | grep "*" | cut -d ' ' -f2` +    string=$param1 +else +    branch=$param1 +    string=$param2 +fi + +patches=0 +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done +/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do +    if [ $patches -eq 1 ]; then +        cnt=" ^" +    elif [ $patches -eq 0 ]; then +        cnt=" H" +    else +        if [ $patches -lt 10 ]; then +            cnt=" $patches" +        else +            cnt="$patches" +        fi +    fi +    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i +    /usr/bin/git show --pretty=email --patch-with-stat $i | grep -n "$string" +    patches=$(echo $patches - 1 | bc) +done +``` + +#### 5\. gitbranchcmp3 + + +``` +#!/bin/bash +# +# gitbranchcmp3 <old branch> [<new_branch>] +# +oldbranch=$1 +newbranch=$2 +script=/tmp/compare_mismatches.sh + +/usr/bin/rm -f $script +echo "#!/bin/bash" > $script +/usr/bin/chmod 755 $script +echo "# Generated by gitbranchcmp3.sh" >> $script +echo "# Run this script to compare the mismatched patches" >> $script +echo " " >> $script +echo "function compare_them()" >> $script +echo "{"  >> $script +echo "    git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script +echo "    git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script +echo "    kompare /tmp/gronk1 /tmp/gronk2" >> $script +echo "}" >> $script +echo " " >> $script + +if test "x$newbranch" = x; then +    newbranch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +declare -a oldsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$oldbranch | cut -d ' ' -f1 |paste -s -d ' '`) +declare -a newsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$newbranch | cut -d ' ' -f1 |paste -s -d ' '`) + +#echo "old: " $oldsha1s +oldcount=${#oldsha1s[@]} +echo "Branch $oldbranch has $oldcount patches" +oldcount=$(echo $oldcount - 1 | bc) +#for o in `seq 0 ${#oldsha1s[@]}`; do +#    echo -n ${oldsha1s[$o]} " " +#    desc=`git show $i | head -5 | tail -1|cut -b5-` +#done + +#echo "new: " $newsha1s +newcount=${#newsha1s[@]} +echo "Branch $newbranch has $newcount patches" +newcount=$(echo $newcount - 1 | bc) +#for o in `seq 0 ${#newsha1s[@]}`; do +#    echo -n ${newsha1s[$o]} " " +#    desc=`git show $i | head -5 | tail -1|cut -b5-` +#done +echo + +for new in `seq 0 $newcount`; do +    newsha=${newsha1s[$new]} +    newdesc=`git show $newsha | head -5 | tail -1|cut -b5-` +    oldsha="            " +    same="[    ]" +    for old in `seq 0 $oldcount`; do +        if test "${oldsha1s[$old]}" = "match"; then +            continue; +        fi +        olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` +        if test "$olddesc" = "$newdesc" ; then +            oldsha=${oldsha1s[$old]} +            #echo $oldsha +            git show $oldsha |tail -n +2 |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk1 +            git show $newsha |tail -n +2 |grep -v "index.*\\.\\." |grep -v "@@"  > /tmp/gronk2 +            diff /tmp/gronk1 /tmp/gronk2 &> /dev/null +            if [ $? -eq 0 ] ;then +# No differences +                same="[SAME]" +                oldsha1s[$old]="match" +                break +            fi +            git show $oldsha |sed -n '/diff/,$p' |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk1 +            git show $newsha |sed -n '/diff/,$p' |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk2 +            diff /tmp/gronk1 /tmp/gronk2 &> /dev/null +            if [ $? -eq 0 ] ;then +# Differences in comments only +                same="[same]" +                oldsha1s[$old]="match" +                break +            fi +            oldsha1s[$old]="match" +            echo "compare_them $oldsha $newsha" >> $script +        fi +    done +    echo "$new $oldsha $newsha $same $newdesc" +done + +echo +echo "Missing from $newbranch:" +the_missing="" +# Now run through the olds we haven't matched up +for old in `seq 0 $oldcount`; do +    if test ${oldsha1s[$old]} != "match"; then +        olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` +        echo "${oldsha1s[$old]} $olddesc" +        the_missing=`echo "$the_missing ${oldsha1s[$old]}"` +    fi +done + +echo "The missing: " $the_missing +echo "Compare script generated at: $script" +#git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 6\. gitlog.find + + +``` +#!/bin/bash +# +# Find the upstream equivalent patch +# +# gitlog.find +# +cwd=$PWD +param1=$1 +ubranch=$2 +patches=0 +script=/tmp/compare_upstream.sh +echo "#!/bin/bash" > $script +/usr/bin/chmod 755 $script +echo "# Generated by gitbranchcmp3.sh" >> $script +echo "# Run this script to compare the mismatched patches" >> $script +echo " " >> $script +echo "function compare_them()" >> $script +echo "{"  >> $script +echo "    cwd=$PWD" >> $script +echo "    git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script +echo "    cd ~/linux.git/fs/gfs2" >> $script +echo "    git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script +echo "    cd $cwd" >> $script +echo "    kompare /tmp/gronk1 /tmp/gronk2" >> $script +echo "}" >> $script +echo " " >> $script + +#echo "Gathering upstream patch info. Please wait." +branch=`git branch -a | grep "*" | cut -d ' ' -f2` +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +cd ~/linux.git +if test "X${ubranch}" = "X"; then +    ubranch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi +utracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` +# +# gather a list of gfs2 patches from master just in case we can't find it +# +#git log --abbrev-commit --pretty=format:"   %h %<|(32)%an %s" master |grep -i -e "gfs2" -e "dlm" > /tmp/gronk +git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/gfs2/ > /tmp/gronk.gfs2 +# ms = in Linus's master +git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/dlm/ > /tmp/gronk.dlm + +cd $cwd +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done +/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do +    if [ $patches -eq 1 ]; then +        cnt=" ^" +    elif [ $patches -eq 0 ]; then +        cnt=" H" +    else +        if [ $patches -lt 10 ]; then +            cnt=" $patches" +        else +            cnt="$patches" +        fi +    fi +    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i +    desc=`/usr/bin/git show --abbrev-commit -s --pretty=format:"%s" $i` +    cd ~/linux.git +    cmp=1 +    up_eq=`git log --reverse --abbrev-commit --pretty=format:"lo %h %<|(32)%an %s" $utracking..$ubranch | grep "$desc"` +# lo = in local for-next +    if test "X$up_eq" = "X"; then +        up_eq=`git log --reverse --abbrev-commit --pretty=format:"fn %h %<|(32)%an %s" master..$utracking | grep "$desc"` +# fn = in for-next for next merge window +        if test "X$up_eq" = "X"; then +            up_eq=`grep "$desc" /tmp/gronk.gfs2` +            if test "X$up_eq" = "X"; then +                up_eq=`grep "$desc" /tmp/gronk.dlm` +                if test "X$up_eq" = "X"; then +                    up_eq="   Not found upstream" +                    cmp=0 +                fi +            fi +        fi +    fi +    echo "$up_eq" +    if [ $cmp -eq 1 ] ; then +        UP_SHA1=`echo $up_eq|cut -d' ' -f2` +        echo "compare_them $UP_SHA1 $i" >> $script +    fi +    cd $cwd +    patches=$(echo $patches - 1 | bc) +done +echo "Compare script generated: $script" +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/bash-scripts-git + +作者:[Bob Peterson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bobpeterson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://kde.org/applications/development/org.kde.kompare +[3]: https://en.wikipedia.org/wiki/GFS2 +[4]: https://en.wikipedia.org/wiki/Distributed_lock_manager From 01bbc8aefef6bfbc83d2129aee4b2860f8b18bc8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:56:08 +0800 Subject: [PATCH 0257/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=20Goog?= =?UTF-8?q?le=20Cloud=20launches=20Archive=20cold=20storage=20service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200116 Google Cloud launches Archive cold storage service.md --- ...d launches Archive cold storage service.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/talk/20200116 Google Cloud launches Archive cold storage service.md diff --git a/sources/talk/20200116 Google Cloud launches Archive cold storage service.md b/sources/talk/20200116 Google Cloud launches Archive cold storage service.md new file mode 100644 index 0000000000..cd395aafb5 --- /dev/null +++ b/sources/talk/20200116 Google Cloud launches Archive cold storage service.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Google Cloud launches Archive cold storage service) +[#]: via: (https://www.networkworld.com/article/3513903/google-cloud-launches-archive-cold-storage-service.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Google Cloud launches Archive cold storage service +====== +Archive will focus on long-term data retention and compete against AWS Glacier, Microsoft Cool Blob Storage, and IBM Cloud Storage. +Google + +Google Cloud announced the general availability of Archive, a long-term data retention service intended as an alternative to on-premises tape backup. + +Google pitches it as cold storage, meaning it is for data which is accessed less than once a year and has been stored for many years. Cold storage data is usually consigned to tape backup, which remains a [surprisingly successful][1] market despite repeated predictions of its demise. + +Of course, Google's competition has their own products. Amazon Web Services has Glacier, Microsoft has Cool Blob Storage, and IBM has Cloud Storage. Google also offers its own Coldline and Nearline cloud storage offerings; Coldline is designed for data a business expects to touch less than once a quarter, while Nearline is aimed at data that requires access less than once a month. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +With Archive, Google highlights a few differentiators from the competition and its own archival offerings. First, Google promises no delay on data retrieval, claiming millisecond latency. AWS can take minutes or hours. While Archive costs a little more than AWS and Azure – $1.23 per terabyte per month vs. $1 per terabyte per month for AWS and Azure – that’s due in part to the longer remit for an early deletion charge. Google offers 365 days compared with 180 days for AWS and Azure. + +"Having flexible storage options allows you to optimize your total cost of ownership while meeting your business needs," [wrote][3] Geoffrey Noer, Google Cloud storage product manager in a blog post announcing the service’s availability. "At Google Cloud, we think that you should have a range of straightforward storage options that allow you to more securely and reliably access your data when and where you need it, without performance bottlenecks or delays to your users." + +Archive is a store-and-forget service, where you keep stuff only because you have to. Tape replacement and archiving data under regulatory retention requirements are two of the most common use cases, according to Google. Other examples include long-term backups and original master copies of videos and images. + +The Archive class can also be combined with [Bucket Lock][4], Google Cloud’s data locking mechanism to prevent data from being modified, which is available to enterprises for meeting various data retention laws, according to Noer. + + * [Backup vs. archive: Why it’s important to know the difference][5] + * [How to pick an off-site data-backup method][6] + * [Tape vs. disk storage: Why isn’t tape dead yet?][7] + * [The correct levels of backup save time, bandwidth, space][8] + + + +The Archive class can be set up in dual-regions or multi-regions for geo-redundancy and offers checksum verification durability of "11 nines" – 99.999999999 percent. + +More information can be found [here][9]. + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3513903/google-cloud-launches-archive-cold-storage-service.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3263452/theres-still-a-lot-of-life-left-in-tape-backup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://cloud.google.com/blog/products/storage-data-transfer/archive-storage-class-for-coldest-data-now-available +[4]: https://cloud.google.com/storage/docs/bucket-lock +[5]: https://www.networkworld.com/article/3285652/storage/backup-vs-archive-why-its-important-to-know-the-difference.html +[6]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html +[7]: https://www.networkworld.com/article/3315156/storage/tape-vs-disk-storage-why-isnt-tape-dead-yet.html +[8]: https://www.networkworld.com/article/3302804/storage/the-correct-levels-of-backup-save-time-bandwidth-space.html +[9]: https://cloud.google.com/blog/products/storage-data-transfer/whats-cooler-than-being-cool-ice-cold-archive-storage +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world From d9a88d6603185cc9d9f67ded4ba32cccce883e10 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:57:32 +0800 Subject: [PATCH 0258/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Inst?= =?UTF-8?q?ant,=20secure=20=E2=80=98teleportation=E2=80=99=20of=20data=20i?= =?UTF-8?q?n=20the=20works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md --- ...re ‘teleportation- of data in the works.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md diff --git a/sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md b/sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md new file mode 100644 index 0000000000..d314baba66 --- /dev/null +++ b/sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Instant, secure ‘teleportation’ of data in the works) +[#]: via: (https://www.networkworld.com/article/3512037/instant-secure-teleportation-of-data-in-the-works.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Instant, secure ‘teleportation’ of data in the works +====== +Quantum teleportation, where information is sent instantaneously, will secure the Internet, researchers say. Scientists are making progress. +Thinkstock + +Sending information instantly between two computer chips using quantum teleportation has been accomplished reliably for the first time, according to scientists from the University of Bristol, in collaboration with the Technical University of Denmark (DTU). Data was exchanged without any electrical or physical connection – a transmission method that may influence the next generation of ultra-secure data networks. + +Teleportation involves the moving of information instantaneously and securely. In the “Star Trek” series, fictional people move immediately from one place to another via teleportation. In the University of Bristol experiment, data is passed instantly via a single quantum state across two chips using light particles, or photons. Importantly, each of the two chips knows the characteristics of the other, because they’re entangled through quantum physics, meaning they therefore share a single physics-based state. + +The researchers involved in these successful silicon tests said they built the photon-based silicon chips in a lab and then used them to encode the quantum information in single particles. It was “a high-quality entanglement link across two chips, where photons on either chip share a single quantum state,” said Dan Llewellyn of University of Bristol in a [press release][1]. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +“These chips are able to encode quantum information in light generated inside the circuits and can process the quantum information,” the school stated. It claims a successful quantum teleportation of 91%, which is considered high quality. + +### Entanglement boosts data transmission + +Entanglement links to be used in data transmission are where information is conjoined, or entangled, so that the start of a link has the same state as the end of a link. The particles, and thus data, are at the beginning of the link and at the end of the link at the same time. + +The physics principle holds promise for data transmissions, in part because intrusion is easily seen; interference by a bad actor becomes obvious if the beginning state of the link and the end state are no longer the same. In other words, any change in one element means a change in the other, and that can be over distance, too. Additionally, the technique allows leaks to be stopped: Instant key destruction can occur at the actual moment of attempted interference. + +“Particles can be in two places at the same time, and they can even be entangled with twin particles, so that they can feel everything that happens to each other,” explained Jonas Schou Neergaard-Nielsen, a senior researcher at DTU, [in a 2015 story][3] about the university’s earlier teleportation exploration. “At the sub-microscopic level, where quantum mechanics rule, you find a completely different logic to what we are used to in our macroscopic reality,” Schou Neergaard-Nielsen said back in 2015. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +### Quantum chips gain momentum + +In the bigger picture, the area of quantum-based microprocessors is gaining momentum. It is thought, for example, that quantum-embedded chips could ultimately secure the internet of things. IoT security vendor Crypto Quantique has said that quantum chips could be made unclonable. Its solution uses a quantum method of [creating totally random keys][5] from the measurement of low currents on the silicon. It’s related to how electrons can leak through transistor gates. “Unforgeable hardware trust anchors [are] generated by the device,” Crypto Quantique explains on its website. “Our technology offers true randomness.” + +A secure quantum computing environment overall could have “profound impacts on modern society,” the University of Bristol said. And with the introduction of entangled physics states across networks, a highly secured “quantum internet could ultimately protect the world’s information from malicious attacks.” + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3512037/instant-secure-teleportation-of-data-in-the-works.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.bristol.ac.uk/news/2019/december/quantum-teleportation.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.dtu.dk/english/news/2015/01/dtu-physics-researchers-developing-tomorrows-teleportation?id=ece937e9-1402-437a-8f57-cc3124563bc8 +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: mailto:https://www.networkworld.com/article/3333808/quantum-embedded-chips-could-secure-iot.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 6f6eceb0a72a8fe315e56876d8ea6c1a8373e986 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 16 Jan 2020 08:57:57 +0800 Subject: [PATCH 0259/3057] translated --- ...uration management of multiple machines.md | 60 ------------------- ...uration management of multiple machines.md | 58 ++++++++++++++++++ 2 files changed, 58 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20200112 Use Stow for configuration management of multiple machines.md create mode 100644 translated/tech/20200112 Use Stow for configuration management of multiple machines.md diff --git a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md deleted file mode 100644 index 0d4a5f19d5..0000000000 --- a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Stow for configuration management of multiple machines) -[#]: via: (https://opensource.com/article/20/1/configuration-management-stow) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use Stow for configuration management of multiple machines -====== -Learn how to use Stow to manage configurations across machines in the -second article in our series on 20 ways to be more productive with open -source in 2020. -![A person programming][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Manage symlinks with Stow - -Yesterday, I explained how I keep my files in sync across multiple machines with [Syncthing][2]. But that's only one of the tools I use to keep my configurations consistent. The other is a seemingly simple tool called [Stow][3]. - -![Stow help screen][4] - -Stow manages symlinks. By default, it makes symlinks from the directory it is in to the directory below it. There are also options to set a source and target directory, but I don't usually use them. - -As I mentioned in the Syncthing [article][5], I use Syncthing to keep a directory called **myconfigs** consistent across all of my machines. The **myconfigs** directory has several subdirectories underneath it. Each subdirectory contains the configuration files for one of the applications I use regularly. - -![myconfigs directory][6] - -On each machine, I change to the **myconfigs** directory and run **stow -S <directory name>** to symlink the files inside the directory to my home directory. For example, under the **vim** directory, I have my **.vimrc** and **.vim** directories. On each machine, I run **stow -S vim** to create the symlinks **~/.vimrc** and **~/.vim**. When I make a change to my Vim configuration on one machine, it applies to ALL of my machines. - -Sometimes, though, I need something machine-specific, which is why I have directories like **msmtp-personal** and **msmtp-elastic** (my employer). Since my **msmtp** SMTP client needs to know what email server to relay through, and each one has different setups and credentials, I can use Stow to swap between the two by "unstowing" one with the **-D** flag and then putting the other in place. - -![Unstow one, stow the other][7] - -Sometimes I find myself adding files to a configuration. For that, there is the "restow" option with **-R**. For example, I like to use a specific font when I use Vim as a graphical application and not a console. The **.gvimrc** file lets me set options that apply only to the graphical version, in addition to the standard **.vimrc** file. When I first set this up, I moved **~/.gvimrc** to **~/myconfigs/vim** and then ran **stow -R vim**, which unlinks and relinks everything in that directory. - -Stow lets me switch between several configurations with a simple command line and, in combination with Syncthing, I can be sure that I have the setup I like for the tools I use ready to go, no matter where I am or where I make changes. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/configuration-management-stow - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) -[2]: https://syncthing.net/ -[3]: https://www.gnu.org/software/stow/ -[4]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png (Stow help screen) -[5]: https://opensource.com/article/20/1/20-productivity-tools-syncthing -[6]: https://opensource.com/sites/default/files/uploads/productivity_2-2.png (myconfigs directory) -[7]: https://opensource.com/sites/default/files/uploads/productivity_2-3.png (Unstow one, stow the other) diff --git a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md b/translated/tech/20200112 Use Stow for configuration management of multiple machines.md new file mode 100644 index 0000000000..1a31d9728a --- /dev/null +++ b/translated/tech/20200112 Use Stow for configuration management of multiple machines.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Stow for configuration management of multiple machines) +[#]: via: (https://opensource.com/article/20/1/configuration-management-stow) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Stow 管理多台机器配置 +====== +2020 年,在我们的 20 个使用开源提升生产力的系列文章中,让我们了解如何使用 Stow 跨机器管理配置。 +![A person programming][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 Stow 管理符号链接 + +昨天,我解释了如何使用 [Syncthing][2] 在多台计算机上保持文件同步。但是,这只是我用来保持配置一致性的工具之一。还有另一个简单的工具 [Stow][3]。 + +![Stow help screen][4] + +Stow 管理符号链接。默认情况下,它会链接目录到上一级目录。还有设置源和目标目录的选项,但我通常不使用它们。 + +正如我在 Syncthing 的[文章][5] 中提到的,我使用 Syncthing 来保持 **myconfigs** 目录在我所有的计算机上一致。**myconfigs** 目录下面有多个子目录。每个子目录包含我经常使用的应用之一的配置文件。 + +![myconfigs directory][6] + +在每台计算机上,我进入 **myconfigs** 目录,并运行 **stow -S <目录名称>** 以将目录中的文件符号链接到我的家目录。例如,在**vim** 目录下,我有 **.vimrc** 和 **.vim** 目录。在每台机器上,我运行 **stow -S vim** 来创建符号链接 **~/.vimrc** 和 **~/.vim**。当我在一台计算机上更改 Vim 配置时,它会应用到我的所有机器上。 + +然而,有时候,我需要一些特定于机器的配置,这就是为什么我有如 **msmtp-personal** 和 **msmtp-elastic**(我的雇主)这样的目录。由于我的 **msmtp** SMTP 客户端需要知道要中继的电子邮件服务器,并且每个服务器都有不同的设置和凭据,我会使用 **-D** 标志来取消链接,接着链接另外一个。 + +![Unstow one, stow the other][7] + +有时我要给配置添加文件。为此,有一个 **-R** 选项来”重新链接“。例如,我喜欢在图形化 Vim 中使用一种与控制台不同的特定字体。除了标准 **.vimrc** 文件,**.gvimrc** 文件能让我设置特定于图形化版本的选项。当我第一次设置它时,我移动 **~/.gvimrc** 到 **~/myconfigs/vim** 中,然后运行 **stow -R vim**,它取消链接并重新链接该目录中的所有内容。 + +Stow 让我使用一个简单的命令行在多种配置之间切换,并且,结合 Syncthing,我可以确保无论我身在何处或在哪里进行更改,我都有我喜欢的工具的设置。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/configuration-management-stow + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://syncthing.net/ +[3]: https://www.gnu.org/software/stow/ +[4]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png (Stow help screen) +[5]: https://opensource.com/article/20/1/20-productivity-tools-syncthing +[6]: https://opensource.com/sites/default/files/uploads/productivity_2-2.png (myconfigs directory) +[7]: https://opensource.com/sites/default/files/uploads/productivity_2-3.png (Unstow one, stow the other) From 727f9f185843c89928b73892f25d6053e7d711e3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 16 Jan 2020 09:02:46 +0800 Subject: [PATCH 0260/3057] translating --- sources/tech/20200114 Organize your email with Notmuch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200114 Organize your email with Notmuch.md b/sources/tech/20200114 Organize your email with Notmuch.md index f881ff5ad9..c9d5cac441 100644 --- a/sources/tech/20200114 Organize your email with Notmuch.md +++ b/sources/tech/20200114 Organize your email with Notmuch.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e2dac9f5f850122c10308733e3e8dc797b6dd861 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Thu, 16 Jan 2020 09:49:36 +0800 Subject: [PATCH 0261/3057] translating by hopefully2333 translating by hopefully2333 --- sources/tech/20200109 What-s HTTPS for secure computing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200109 What-s HTTPS for secure computing.md b/sources/tech/20200109 What-s HTTPS for secure computing.md index 364ff39b13..8a1d1d47e3 100644 --- a/sources/tech/20200109 What-s HTTPS for secure computing.md +++ b/sources/tech/20200109 What-s HTTPS for secure computing.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hopefully2333) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 01bf6238e63212205d88f4d66a6e0ec31fc757ab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 10:58:19 +0800 Subject: [PATCH 0262/3057] PRF @qianmingtian --- ...Distribution openEuler is Available Now.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md index ea6b5d24a5..0671c83bec 100644 --- a/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md +++ b/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -1,61 +1,60 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Huawei’s Linux Distribution openEuler is Available Now!) [#]: via: (https://itsfoss.com/openeuler/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -华为的linux发行版 openEuler 可以使用了! +外媒:华为的 Linux 发行版 openEuler 可以使用了! ====== -华为提供了一个基于 CentOS 的企业 Linux 发行版 EulerOS 。最近,华为发布了一个名为 [openEuler][1] 的 EulerOS 社区版。 +> 华为提供了一个基于 CentOS 的企业级 Linux 发行版 EulerOS。最近,华为发布了一个名为 [openEuler][1] 的 EulerOS 社区版。 -openEuler 的源代码也被发布了。你在微软旗下的 GitHub 上找不到它——源代码可以在 [Gitee][2] 找到,这是一个中文的 [GitHub 的替代品][3] 。 +openEuler 的源代码也一同发布了。你在微软旗下的 GitHub 上找不到它——源代码可以在 [Gitee][2] 找到,这是一个中文的 [GitHub 的替代品][3]。 -它有两个独立的存储库,一个用于存储[源代码][2],另一个作为[包源][4] 存储有助于构建操作系统的软件包。 +它有两个独立的存储库,一个用于存储[源代码][2];另一个作为[软件包的源代码][4],存储有助于构建该操作系统的软件包。 -![][5] +![][5] -openuler 基础架构团队分享了他们使源代码可用的经验: +openEuler 基础架构团队分享了他们使源代码可用的经验: ->我们现在很兴奋。很难想象我们会管理成千上万的仓库。为了确保它们能被成功地编译,我们要感谢所有参与贡献的人。 +> 我们现在很兴奋。很难想象我们会管理成千上万的仓库。为了确保它们能被成功地编译,我们要感谢所有参与贡献的人。 ### openEuler 是基于 CentOS 的 Linux 发行版 与 EulerOS 一样,openEuler OS 也是基于 [CentOS][6],但华为技术有限公司为企业应用进一步开发了该操作系统。 -它是为 ARM64 架构的服务器量身定做的,同时华为声称已经做了一些改变来提高其性能。你可以在[华为发展博客][7]上了解更多。 +它是为 ARM64 架构的服务器量身定做的,同时华为声称已经做了一些改变来提高其性能。你可以在[华为开发博客][7]上了解更多。 ![][8] - 目前,根据 openEuler 的官方声明,有 50 多名贡献者为 openEuler 贡献了近 600 个提交。 -贡献者使源代码对社区可用成为可能。 +贡献者们使源代码对社区可用成为可能。 -值得注意的是,存储库还包括两个与之相关的新项目(或子项目),[iSulad][9] 和 **A-Tune**。 +值得注意的是,存储库还包括两个与之相关的新项目(或子项目),[iSulad][9] 和 A-Tune。 -A-Tune 是一个基于 AI 的操作系统调优软件, iSulad 是一个轻量级的容器运行时守护进程,如[Gitee][2]中提到的那样,它是为物联网和云基础设施设计的。 +A-Tune 是一个基于 AI 的操作系统调优软件,iSulad 是一个轻量级的容器运行时守护进程,如在 [Gitee][2] 中提到的那样,它是为物联网和云基础设施设计的。 -另外,官方的[公告][10]提到,这些系统是在华为云上通过脚本自动化构建的。这确实十分有趣。 +另外,官方的[公告][10]提到,这些系统是在华为云上通过脚本自动构建的。这确实十分有趣。 ### 下载 openEuler ![][11] -到目前为止,你找不到它的英文文档,所以你必须等待或选择通过[文档][12]帮助他们。 +到目前为止,你找不到它的英文文档,所以你必须等待或选择通过(贡献)[文档][12]来帮助他们。 你可以直接从它的[官方网站][13]下载 ISO 来测试它: -[下载 openEuler ][13] +- [下载 openEuler ][13] ### 你认为华为的 openEuler 怎么样? 据 cnTechPost 报道,华为曾宣布 EulerOS 将以新名字 openEuler 成为开源软件。 -目前还不清楚 openEuler 是否会取代 EulerOS ,或者两者会像 CentOS (社区版)和 Red Hat (商业版)一样同时存在。 +目前还不清楚 openEuler 是否会取代 EulerOS ,或者两者会像 CentOS(社区版)和 Red Hat(商业版)一样同时存在。 我还没有测试过它,所以我不能说 openEuler 是否适合英文用户。 @@ -68,7 +67,7 @@ via: https://itsfoss.com/openeuler/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[qianmingtian][c] -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 098a84e15a550d4650bd7d8a6b16f5ac05342cdb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 10:59:34 +0800 Subject: [PATCH 0263/3057] PUB @qianmingtian https://linux.cn/article-11787-1.html --- ... Huawei-s Linux Distribution openEuler is Available Now.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20200109 Huawei-s Linux Distribution openEuler is Available Now.md (98%) diff --git a/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/published/20200109 Huawei-s Linux Distribution openEuler is Available Now.md similarity index 98% rename from translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md rename to published/20200109 Huawei-s Linux Distribution openEuler is Available Now.md index 0671c83bec..891902da7e 100644 --- a/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md +++ b/published/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11787-1.html) [#]: subject: (Huawei’s Linux Distribution openEuler is Available Now!) [#]: via: (https://itsfoss.com/openeuler/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 85dd526232006c2ec60e99cbb4087f177b090bb0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 12:05:29 +0800 Subject: [PATCH 0264/3057] PRF @geekpi --- ...Python web API with Pyramid and Cornice.md | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md index ae3afc22af..c6fc97c88a 100644 --- a/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md +++ b/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to write a Python web API with Pyramid and Cornice) @@ -9,12 +9,14 @@ 如何使用 Pyramid 和 Cornice 编写 Python Web API ====== -使用 Pyramid 和 Cornice 构建可扩展的 RESTful Web 服务。 -![Searching for code][1] -[Python][2] 是一种高级的,面向对象的编程语言,它以其简单的语法而闻名。它一直是构建 RESTful API 的顶级编程语言之一。 +> 使用 Pyramid 和 Cornice 构建和描述可扩展的 RESTful Web 服务。 -[Pyramid][3] 是一个 Python Web 框架,旨在随着应用的扩展而扩展:这对于简单的应用来说很简单,对于大型、复杂的应用也可以做到。Pyramid 为 PyPI (Python 软件包索引)提供了强大的支持。[Cornice][4] 提供了使用 Pyramid 构建 RESTful Web 服务的助手。 +![](https://img.linux.net.cn/data/attachment/album/202001/16/120352fcgeeccvfgt8sfvc.jpg) + +[Python][2] 是一种高级的、面向对象的编程语言,它以其简单的语法而闻名。它一直是构建 RESTful API 的顶级编程语言之一。 + +[Pyramid][3] 是一个 Python Web 框架,旨在随着应用的扩展而扩展:这可以让简单的应用很简单,也可以增长为大型、复杂的应用。此外,Pyramid 为 PyPI (Python 软件包索引)提供了强大的支持。[Cornice][4] 为使用 Pyramid 构建和描述 RESTful Web 服务提供了助力。 本文将使用 Web 服务的例子来获取名人名言,来展示如何使用这些工具。 @@ -22,7 +24,6 @@ 首先为你的应用创建一个虚拟环境,并创建一个文件来保存代码: - ``` $ mkdir tutorial $ cd tutorial @@ -36,7 +37,6 @@ $ source env/bin/activate 使用以下命令导入这些模块: - ``` from pyramid.config import Configurator from cornice import Service @@ -44,8 +44,7 @@ from cornice import Service ### 定义服务 -将引用服务定义为 **Service** 对象: - +将引用服务定义为 `Service` 对象: ``` QUOTES = Service(name='quotes', @@ -55,8 +54,7 @@ QUOTES = Service(name='quotes', ### 编写引用逻辑 -到目前为止,这仅支持 **GET** 获取名言。用 **QUOTES.get** 装饰函数。这是将逻辑绑定到 REST 服务的方法: - +到目前为止,这仅支持获取名言。用 `QUOTES.get` 装饰函数。这是将逻辑绑定到 REST 服务的方法: ``` @QUOTES.get() @@ -72,14 +70,13 @@ def get_quote(request):     } ``` -请注意,与其他框架不同,装饰器_不能_更改 **get_quote** 函数。如果导入此模块,你仍然可以定期调用该函数并检查结果。 +请注意,与其他框架不同,装饰器*不会*更改 `get_quote` 函数。如果导入此模块,你仍然可以定期调用该函数并检查结果。 在为 Pyramid RESTful 服务编写单元测试时,这很有用。 ### 定义应用对象 -最后,使用 **scan** 查找所有修饰的函数并将其添加到配置中: - +最后,使用 `scan` 查找所有修饰的函数并将其添加到配置中: ``` with Configurator() as config: @@ -94,14 +91,12 @@ with Configurator() as config: 我使用 Twisted 的 WSGI 服务器运行该应用,但是如果需要,你可以使用任何其他 [WSGI][5] 服务器,例如 Gunicorn 或 uWSGI。 - ``` -`(env)$ python -m twisted web --wsgi=main.application` +(env)$ python -m twisted web --wsgi=main.application ``` 默认情况下,Twisted 的 WSGI 服务器运行在端口 8080 上。你可以使用 [HTTPie][6] 测试该服务: - ``` (env) $ pip install httpie ... @@ -130,7 +125,7 @@ X-Content-Type-Options: nosniff ### 为什么要使用 Pyramid? -Pyramid 不是最受欢迎的框架,但它已在 [PyPI][7] 等一些引人注目的项目中使用。我喜欢 Pyramid,因为它是认真对待单元测试的框架之一:因为装饰器不会修改函数并且没有线程局部变量,所以可以直接从单元测试中调用函数。例如,需要访问数据库的函数将从通过 **request.config** 传递的 **request.config** 对象中获取它。这允许单元测试人员将模拟(或真实)数据库对象放入请求中,而不用仔细设置全局变量,线程局部变量或其他特定于框架的东西。 +Pyramid 并不是最受欢迎的框架,但它已在 [PyPI][7] 等一些引人注目的项目中使用。我喜欢 Pyramid,因为它是认真对待单元测试的框架之一:因为装饰器不会修改函数并且没有线程局部变量,所以可以直接从单元测试中调用函数。例如,需要访问数据库的函数将从通过 `request.config` 传递的 `request.config` 对象中获取它。这允许单元测试人员将模拟(或真实)数据库对象放入请求中,而不用仔细设置全局变量、线程局部变量或其他特定于框架的东西。 如果你正在寻找一个经过测试的库来构建你接下来的 API,请尝试使用 Pyramid。你不会失望的。 @@ -140,8 +135,8 @@ via: https://opensource.com/article/20/1/python-web-api-pyramid-cornice 作者:[Moshe Zadka][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a9d02b2f1c90e95cc4e14ade75b515681c6ec1f8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 12:05:49 +0800 Subject: [PATCH 0265/3057] PUB @geekpi https://linux.cn/article-11788-1.html --- ... How to write a Python web API with Pyramid and Cornice.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200106 How to write a Python web API with Pyramid and Cornice.md (98%) diff --git a/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/published/20200106 How to write a Python web API with Pyramid and Cornice.md similarity index 98% rename from translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md rename to published/20200106 How to write a Python web API with Pyramid and Cornice.md index c6fc97c88a..1ebcc920e9 100644 --- a/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md +++ b/published/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11788-1.html) [#]: subject: (How to write a Python web API with Pyramid and Cornice) [#]: via: (https://opensource.com/article/20/1/python-web-api-pyramid-cornice) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 0051d1ef3dc1760a68c261e92d13725cb0b86679 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 21:50:11 +0800 Subject: [PATCH 0266/3057] PRF @cycoe --- ... jumping to your Python platformer game.md | 141 +++++++++--------- 1 file changed, 67 insertions(+), 74 deletions(-) diff --git a/translated/tech/20191205 Add jumping to your Python platformer game.md b/translated/tech/20191205 Add jumping to your Python platformer game.md index 0487cc1491..06fe32cdc0 100644 --- a/translated/tech/20191205 Add jumping to your Python platformer game.md +++ b/translated/tech/20191205 Add jumping to your Python platformer game.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (cycoe) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Add jumping to your Python platformer game) @@ -9,26 +9,25 @@ 为你的 Python 平台类游戏添加跳跃功能 ====== -在本期使用 Python Pygame 模块编写视频游戏中,学会如何使用跳跃来对抗重力。 -![游戏厅中的游戏][1] + +> 在本期使用 Python Pygame 模块编写视频游戏中,学会如何使用跳跃来对抗重力。 + +![](https://img.linux.net.cn/data/attachment/album/202001/16/214917c8mxn82fot82fx88.jpg) 在本系列的 [前一篇文章][2] 中,你已经模拟了重力。但现在,你需要赋予你的角色跳跃的能力来对抗重力。 -跳跃是对重力作用的暂时延缓。在这一小段时间里,你是向_上_跳,而不是被重力拉着向下落。但你一旦到达了跳跃的最高点,重力就会重新发挥作用,将你拉回地面。 +跳跃是对重力作用的暂时延缓。在这一小段时间里,你是向*上*跳,而不是被重力拉着向下落。但你一旦到达了跳跃的最高点,重力就会重新发挥作用,将你拉回地面。 -在代码中,跳跃被表示为变量。首先,你需要为玩家对象建立一个变量,使得 Python 能够跟踪对象是否正在跳跃中。一旦玩家对象开始跳跃,他就会再次受到重力的作用,并被拉回最近的物体。 +在代码中,这种变化被表示为变量。首先,你需要为玩家精灵建立一个变量,使得 Python 能够跟踪该精灵是否正在跳跃中。一旦玩家精灵开始跳跃,他就会再次受到重力的作用,并被拉回最近的物体。 ### 设置跳跃状态变量 -你需要为你的 Player 类添加两个新变量: +你需要为你的 `Player` 类添加两个新变量: - * 一个是为了跟踪你的角色是否正在跳跃中,可通过你的玩家对象是否站在坚实的地面来确定 + * 一个是为了跟踪你的角色是否正在跳跃中,可通过你的玩家精灵是否站在坚实的地面来确定 * 一个是为了将玩家带回地面 - - -将如下两个变量添加到你的 **Player** 类中。在下方的代码中,注释前的部分用于提示上下文,因此只需要添加最后两行: - +将如下两个变量添加到你的 `Player` 类中。在下方的代码中,注释前的部分用于提示上下文,因此只需要添加最后两行: ```                 self.movex = 0 @@ -40,16 +39,15 @@                 self.jump_delta = 6 ``` -第一个变量 **collide_delta** 被设为 0 是因为在正常状态下,玩家对象没有处在跳跃中的状态。另一个变量 **jump_delta** 被设为 6,是为了防止对象在第一次进入游戏世界时就发生反弹(实际上就是跳跃)。当你完成了本篇文章的示例,尝试把该变量设为 0 看看会发生什么。 +第一个变量 `collide_delta` 被设为 0 是因为在正常状态下,玩家精灵没有处在跳跃中的状态。另一个变量 `jump_delta` 被设为 6,是为了防止精灵在第一次进入游戏世界时就发生反弹(实际上就是跳跃)。当你完成了本篇文章的示例,尝试把该变量设为 0 看看会发生什么。 ### 跳跃中的碰撞 -如果你是跳到一个蹦床上,那你的跳跃一定非常优美。但是如果你是跳向一面墙会发生什么呢?(千万不要去尝试!)不管你的起跳多么令人印象深刻,当你撞到比你更大更硬的物体时,你都会立马停下。(译注:原理参考动量守恒定律) +如果你是跳到一个蹦床上,那你的跳跃一定非常优美。但是如果你是跳向一面墙会发生什么呢?(千万不要去尝试!)不管你的起跳多么令人印象深刻,当你撞到比你更大更硬的物体时,你都会立马停下。(LCTT 译注:原理参考动量守恒定律) -为了在你的视频游戏中模拟这一点,你需要在你的玩家对象与地面等东西发生碰撞时,将 **self.collide_delta** 变量设为 0。如果你的 **self.collide_delta** 不是 0 而是其它的什么值,那么你的玩家就会发生跳跃,并且当你的玩家与墙或者地面发生碰撞时无法跳跃。 - -在你的 **Player** 类的 **update** 方法中,将地面碰撞相关代码块修改为如下所示: +为了在你的视频游戏中模拟这一点,你需要在你的玩家精灵与地面等东西发生碰撞时,将 `self.collide_delta` 变量设为 0。如果你的 `self.collide_delta` 不是 0 而是其它的什么值,那么你的玩家就会发生跳跃,并且当你的玩家与墙或者地面发生碰撞时无法跳跃。 +在你的 `Player` 类的 `update` 方法中,将地面碰撞相关代码块修改为如下所示: ```         ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) @@ -57,42 +55,40 @@             self.movey = 0             self.rect.y = worldy-ty-ty             self.collide_delta = 0 # 停止跳跃 -            if self.rect.y > g.rect.y: -                self.health -=1 -                print(self.health) + if self.rect.y > g.rect.y: + self.health -=1 + print(self.health) ``` -这段代码块检查了地面对象和玩家对象之间发生的碰撞。当发生碰撞时,它会将玩家 Y 方向的坐标值设置为游戏窗口的高度减去一个瓷贴的高度再减去另一个瓷贴的高度。以此保证了玩家对象是站在地面**上**,而不是嵌在地面里。同时它也将 **self.collide_delta** 设为 0,使得程序能够知道玩家未处在跳跃中。除此之外,它将 **self.movey** 设为 0,使得程序能够知道玩家当前未受到重力的牵引作用(这是游戏物理引擎的奇怪之处,一旦玩家落地,也就没有必要继续将玩家拉向地面)。 +这段代码块检查了地面精灵和玩家精灵之间发生的碰撞。当发生碰撞时,它会将玩家 Y 方向的坐标值设置为游戏窗口的高度减去一个瓷砖的高度再减去另一个瓷砖的高度。以此保证了玩家精灵是站在地面*上*,而不是嵌在地面里。同时它也将 `self.collide_delta` 设为 0,使得程序能够知道玩家未处在跳跃中。除此之外,它将 `self.movey` 设为 0,使得程序能够知道玩家当前未受到重力的牵引作用(这是游戏物理引擎的奇怪之处,一旦玩家落地,也就没有必要继续将玩家拉向地面)。 -此处 **if** 语句用来检测玩家是否已经落到地面之_下_,如果是,那就扣除一点生命值作为惩罚。此处假定了你希望当你的玩家落到地图之外时失去生命值。这个设定不是必需的,它只是平台类游戏的一种惯例。更有可能的是,你希望这个事件能够触发另一些事件,或者说是一种能够让你的现实世界玩家沉迷于让对象掉到屏幕之外的东西。一种简单的恢复方式是在玩家对象掉落到地图之外时,将 **self.rect.y** 重新设置为 0,这样它就会在地图上方重新生成,并落到坚实的地面上。 +此处 `if` 语句用来检测玩家是否已经落到地面之*下*,如果是,那就扣除一点生命值作为惩罚。此处假定了你希望当你的玩家落到地图之外时失去生命值。这个设定不是必需的,它只是平台类游戏的一种惯例。更有可能的是,你希望这个事件能够触发另一些事件,或者说是一种能够让你的现实世界玩家沉迷于让精灵掉到屏幕之外的东西。一种简单的恢复方式是在玩家精灵掉落到地图之外时,将 `self.rect.y` 重新设置为 0,这样它就会在地图上方重新生成,并落到坚实的地面上。 ### 撞向地面 -模拟的重力使你玩家的 Y 坐标不断增大(译注:此处原文中为 0,但在 Pygame 中越靠下方 Y 坐标应越大)。要实现跳跃,完成如下代码使你的玩家对象离开地面,飞向空中。 - -在你的 **Player** 类的 **update** 方法中,添加如下代码来暂时延缓重力的作用: +模拟的重力使你玩家的 Y 坐标不断增大(LCTT 译注:此处原文中为 0,但在 Pygame 中越靠下方 Y 坐标应越大)。要实现跳跃,完成如下代码使你的玩家精灵离开地面,飞向空中。 +在你的 `Player` 类的 `update` 方法中,添加如下代码来暂时延缓重力的作用: ``` -        if self.collide_delta < 6 and self.jump_delta < 6: +        if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2             self.movey -= 33  # 跳跃的高度             self.collide_delta += 6             self.jump_delta    += 6 ``` -根据此代码所示,跳跃使玩家对象向空中移动了 33 个像素。此处是_负_ 33 是因为在 Pygame 中,越小的数代表距离屏幕顶端越近。 +根据此代码所示,跳跃使玩家精灵向空中移动了 33 个像素。此处是*负* 33 是因为在 Pygame 中,越小的数代表距离屏幕顶端越近。 -不过此事件视条件而定,只有当 **self.collide_delta** 小于 6(缺省值定义在你 **Player** 类的 **init** 方法中)并且 **self.jump_delta** 也于 6 的时候才会发生。此条件能够保证直到玩家碰到一个平台,才能触发另一次跳跃。换言之,它能够阻止空中二段跳。 +不过此事件视条件而定,只有当 `self.collide_delta` 小于 6(缺省值定义在你 `Player` 类的 `init` 方法中)并且 `self.jump_delta` 也于 6 的时候才会发生。此条件能够保证直到玩家碰到一个平台,才能触发另一次跳跃。换言之,它能够阻止空中二段跳。 在某些特殊条件下,你可能不想阻止空中二段跳,或者说你允许玩家进行空中二段跳。举个栗子,如果玩家获得了某个战利品,那么在他被敌人攻击到之前,都能够拥有空中二段跳的能力。 -当你完成本篇文章中的示例,尝试将 **self.collide_delta** 和 **self.jump_delta** 设置为 0,从而获得百分之百的几率触发空中二段跳。 +当你完成本篇文章中的示例,尝试将 `self.collide_delta` 和 `self.jump_delta` 设置为 0,从而获得百分之百的几率触发空中二段跳。 ### 在平台上着陆 -目前你已经定义了再玩家对象摔落地面时的抵抗重力条件,但此时你的游戏代码仍保持平台与地面置于不同的列表中(就像本文中做的很多其他选择一样,这个设定并不是必需的,你可以尝试将地面作为另一种平台)。为了允许玩家对象站在平台之上,你必须像检测地面碰撞一样,检测玩家对象与平台对象之间的碰撞。将如下代码放于你的 **update** 方法中: - +目前你已经定义了在玩家精灵摔落地面时的抵抗重力条件,但此时你的游戏代码仍保持平台与地面置于不同的列表中(就像本文中做的很多其他选择一样,这个设定并不是必需的,你可以尝试将地面作为另一种平台)。为了允许玩家精灵站在平台之上,你必须像检测地面碰撞一样,检测玩家精灵与平台精灵之间的碰撞。将如下代码放于你的 `update` 方法中: ```         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) @@ -103,27 +99,26 @@ 但此处还有一点需要考虑:平台悬在空中,也就意味着玩家可以通过从上面或者从下面接触平台来与之互动。 -确定平台如何与玩家互动取决于你,阻止玩家从下方到达平台也并不稀奇。将如下代码加到上方的代码块中,使得平台表现得像天花板或者说是藤架。只有在玩家对象跳得比平台上沿更高时才能跳到平台上,但会阻止玩家从平台下方跳上来: - +确定平台如何与玩家互动取决于你,阻止玩家从下方到达平台也并不稀奇。将如下代码加到上方的代码块中,使得平台表现得像天花板或者说是藤架。只有在玩家精灵跳得比平台上沿更高时才能跳到平台上,但会阻止玩家从平台下方跳上来: ``` -            if self.rect.y > p.rect.y: +            if self.rect.y > p.rect.y:                 self.rect.y = p.rect.y+ty             else:                 self.rect.y = p.rect.y-ty ``` -此处 **if** 语句代码块的第一个子句阻止玩家对象从平台正下方跳到平台上。如果它检测到玩家对象的坐标比平台更大(在 Pygame 中,坐标更大意味着在屏幕的更下方),那么将玩家对象新的 Y 坐标设置为当前平台的 Y 坐标加上一个瓷贴的高度。实际效果就是保证玩家对象距离平台一个瓷贴的高度,防止其从下方穿过平台。 +此处 `if` 语句代码块的第一个子句阻止玩家精灵从平台正下方跳到平台上。如果它检测到玩家精灵的坐标比平台更大(在 Pygame 中,坐标更大意味着在屏幕的更下方),那么将玩家精灵新的 Y 坐标设置为当前平台的 Y 坐标加上一个瓷砖的高度。实际效果就是保证玩家精灵距离平台一个瓷砖的高度,防止其从下方穿过平台。 -**else** 子句做了相反的事情。当程序运行到此处时,如果玩家对象的 Y 坐标_不_比平台的更大,意味着玩家对象是从空中落下(不论是由于玩家刚刚从此处生成,或者是玩家执行了跳跃)。在这种情况下,玩家对象的 Y 坐标被设为平台的 Y 坐标减去一个瓷贴的高度(切记,在 Pygame 中更小的 Y 坐标代表在屏幕上的更高处)。这样就能保证玩家在平台_上_,除非他从平台上跳下来或者走下来。 +`else` 子句做了相反的事情。当程序运行到此处时,如果玩家精灵的 Y 坐标*不*比平台的更大,意味着玩家精灵是从空中落下(不论是由于玩家刚刚从此处生成,或者是玩家执行了跳跃)。在这种情况下,玩家精灵的 Y 坐标被设为平台的 Y 坐标减去一个瓷砖的高度(切记,在 Pygame 中更小的 Y 坐标代表在屏幕上的更高处)。这样就能保证玩家在平台*上*,除非他从平台上跳下来或者走下来。 -你也可以尝试其他的方式来处理玩家与平台之间的互动。举个栗子,也许玩家对象被设定为处在平台的“前面”,他能够无障碍地跳跃穿过平台并站在上面。或者你可以设计一种平台会减缓而又不完全阻止玩家的跳跃过程。甚至你可以通过将不同平台分到不同列表中来混合搭配使用。 +你也可以尝试其他的方式来处理玩家与平台之间的互动。举个栗子,也许玩家精灵被设定为处在平台的“前面”,他能够无障碍地跳跃穿过平台并站在上面。或者你可以设计一种平台会减缓而又不完全阻止玩家的跳跃过程。甚至你可以通过将不同平台分到不同列表中来混合搭配使用。 ### 触发一次跳跃 -目前为此,你的代码已经模拟了所有必需的跳跃条件,但仍缺少一个跳跃触发器。你的玩家对象的 **self.jump_delta** 初始值被设置为 6,只有当它比 6 小时才会触发更新跳跃的代码。 +目前为此,你的代码已经模拟了所有必需的跳跃条件,但仍缺少一个跳跃触发器。你的玩家精灵的 `self.jump_delta` 初始值被设置为 6,只有当它比 6 小的时候才会触发更新跳跃的代码。 -为跳跃变量设置一个新的设置方法,在你的 **Player** 类中创建一个 **jump** 方法,并将 **self.jump_delta** 设为小于 6 的值。通过使玩家对象向空中移动 33 个像素,来暂时减缓重力的作用。 +为跳跃变量设置一个新的设置方法,在你的 `Player` 类中创建一个 `jump` 方法,并将 `self.jump_delta` 设为小于 6 的值。通过使玩家精灵向空中移动 33 个像素,来暂时减缓重力的作用。 ``` @@ -131,25 +126,24 @@         self.jump_delta = 0 ``` -不管你相信与否,这就是 **jump** 方法的全部。剩余的部分在 **update** 方法中,你已经在前面实现了相关代码。 +不管你相信与否,这就是 `jump` 方法的全部。剩余的部分在 `update` 方法中,你已经在前面实现了相关代码。 要使你游戏中的跳跃功能生效,还有最后一件事情要做。如果你想不起来是什么,运行游戏并观察跳跃是如何生效的。 -问题就在于你的主循环中没有调用 **jump** 方法。先前你已经为该方法创建了一个按键占位符,现在,跳跃键所做的就是将 **jump** 打印到终端。 +问题就在于你的主循环中没有调用 `jump` 方法。先前你已经为该方法创建了一个按键占位符,现在,跳跃键所做的就是将 `jump` 打印到终端。 ### 调用 jump 方法 -在你的主循环中,将_上_方向键的效果从打印一条调试语句,改为调用 **jump** 方法。 - -注意此处,与 **update** 方法类似,**jump** 方法也需要检测碰撞,因此你需要告诉它使用哪个 **plat_list**。 +在你的主循环中,将*上*方向键的效果从打印一条调试语句,改为调用 `jump` 方法。 +注意此处,与 `update` 方法类似,`jump` 方法也需要检测碰撞,因此你需要告诉它使用哪个 `plat_list`。 ```             if event.key == pygame.K_UP or event.key == ord('w'):                 player.jump(plat_list) ``` -如果你倾向于使用空格键作为跳跃键,使用 **pygame.K_SPACE** 替代 **pygame.K_UP** 作为按键。另一种选择,你可以同时使用两种方式(使用单独的 **if** 语句),给玩家多一种选择。 +如果你倾向于使用空格键作为跳跃键,使用 `pygame.K_SPACE` 替代 `pygame.K_UP` 作为按键。另一种选择,你可以同时使用两种方式(使用单独的 `if` 语句),给玩家多一种选择。 现在来尝试你的游戏吧!在下一篇文章中,你将让你的游戏卷动起来。 @@ -157,7 +151,6 @@ 以下是目前为止的所有代码: - ``` #!/usr/bin/env python3 # draw a world @@ -220,7 +213,7 @@ class Player(pygame.sprite.Sprite):     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty         @@ -233,23 +226,23 @@ class Player(pygame.sprite.Sprite):             def update(self):         ''' -        更新对象位置 +        更新精灵位置         '''                 self.rect.x = self.rect.x + self.movex         self.rect.y = self.rect.y + self.movey         # 向左移动 -        if self.movex < 0: +        if self.movex < 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani]         # 向右移动 -        if self.movex > 0: +        if self.movex > 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] @@ -263,7 +256,7 @@ class Player(pygame.sprite.Sprite):         for p in plat_hit_list:             self.collide_delta = 0 # stop jumping             self.movey = 0 -            if self.rect.y > p.rect.y: +            if self.rect.y > p.rect.y:                 self.rect.y = p.rect.y+ty             else:                 self.rect.y = p.rect.y-ty @@ -273,11 +266,11 @@ class Player(pygame.sprite.Sprite):             self.movey = 0             self.rect.y = worldy-ty-ty             self.collide_delta = 0 # stop jumping -            if self.rect.y > g.rect.y: +            if self.rect.y > g.rect.y:                 self.health -=1                 print(self.health)                 -        if self.collide_delta < 6 and self.jump_delta < 6: +        if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2             self.movey -= 33  # how high to jump             self.collide_delta += 6 @@ -308,22 +301,22 @@ class Enemy(pygame.sprite.Sprite):         self.movey += 3.2         -        if self.counter >= 0 and self.counter <= distance: +        if self.counter >= 0 and self.counter <= distance:             self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: +        elif self.counter >= distance and self.counter <= distance*2:             self.rect.x -= speed         else:             self.counter = 0                 self.counter += 1 -        if not self.rect.y >= worldy-ty-ty: +        if not self.rect.y >= worldy-ty-ty:             self.rect.y += self.movey         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False)         for p in plat_hit_list:             self.movey = 0 -            if self.rect.y > p.rect.y: +            if self.rect.y > p.rect.y:                 self.rect.y = p.rect.y+ty             else:                 self.rect.y = p.rect.y-ty @@ -352,7 +345,7 @@ class Level():         ground_list = pygame.sprite.Group()         i=0         if lvl == 1: -            while i < len(gloc): +            while i < len(gloc):                 ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png')                 ground_list.add(ground)                 i=i+1 @@ -371,9 +364,9 @@ class Level():             ploc.append((300,worldy-ty-256,3))             ploc.append((500,worldy-ty-128,4)) -            while i < len(ploc): +            while i < len(ploc):                 j=0 -                while j <= ploc[i][2]: +                while j <= ploc[i][2]:                     plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png')                     plat_list.add(plat)                     j=j+1 @@ -417,11 +410,11 @@ eloc = [] eloc = [200,20] gloc = [] #gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] -tx = 64 # 瓷贴尺寸 -ty = 64 # 瓷贴尺寸 +tx = 64 # 瓷砖尺寸 +ty = 64 # 瓷砖尺寸 i=0 -while i <= (worldx/tx)+tx: +while i <= (worldx/tx)+tx:     gloc.append(i*tx)     i=i+1 @@ -482,9 +475,8 @@ while main == True: * [如何在你的 Python 游戏中添加一个玩家][8] * [用 Pygame 使你的游戏角色移动起来][9] * [如何向你的 Python 游戏中添加一个敌人][10] - * [在你的 Python 游戏中模拟重力][2] - - + * [在 Pygame 游戏中放置平台][11] + * [在你的 Python 游戏中模拟引力][2] -------------------------------------------------------------------------------- @@ -493,19 +485,20 @@ via: https://opensource.com/article/19/12/jumping-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[cycoe](https://github.com/cycoe) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/seth [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32 (Arcade games) -[2]: https://opensource.com/article/19/11/simulate-gravity-python +[2]: https://linux.cn/article-11780-1.html [3]: https://opensource.com/sites/default/files/uploads/pygame-jump.jpg (Pygame platformer) [4]: https://www.python.org/ [5]: https://www.pygame.org/ -[6]: https://opensource.com/article/17/10/python-101 -[7]: https://opensource.com/article/17/12/game-framework-python -[8]: https://opensource.com/article/17/12/game-python-add-a-player -[9]: https://opensource.com/article/17/12/game-python-moving-player -[10]: https://opensource.com/article/18/5/pygame-enemy +[6]: https://linux.cn/article-9071-1.html +[7]: https://linux.cn/article-10850-1.html +[8]: https://linux.cn/article-10858-1.html +[9]: https://linux.cn/article-10874-1.html +[10]: https://linux.cn/article-10883-1.html +[11]: https://linux.cn/article-10902-1.html From 419615b21b0d8d8cec51990d801bb5f41537f0a0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 21:50:43 +0800 Subject: [PATCH 0267/3057] PUB @cycoe https://linux.cn/article-11790-1.html --- .../20191205 Add jumping to your Python platformer game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191205 Add jumping to your Python platformer game.md (99%) diff --git a/translated/tech/20191205 Add jumping to your Python platformer game.md b/published/20191205 Add jumping to your Python platformer game.md similarity index 99% rename from translated/tech/20191205 Add jumping to your Python platformer game.md rename to published/20191205 Add jumping to your Python platformer game.md index 06fe32cdc0..d7195a008a 100644 --- a/translated/tech/20191205 Add jumping to your Python platformer game.md +++ b/published/20191205 Add jumping to your Python platformer game.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (cycoe) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11790-1.html) [#]: subject: (Add jumping to your Python platformer game) [#]: via: (https://opensource.com/article/19/12/jumping-python-platformer-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From f2e58086eb7e27ea6f2acbecb5d65b39969c688c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 23:00:19 +0800 Subject: [PATCH 0268/3057] PRF&PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @chen-ni https://linux.cn/article-11791-1.html 翻译的很好! --- ... Still Using an ‘Outdated- Linux Kernel.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) rename {translated/tech => published}/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md (77%) diff --git a/translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md b/published/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md similarity index 77% rename from translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md rename to published/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md index b8af543814..4075e017a8 100644 --- a/translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md +++ b/published/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11791-1.html) [#]: subject: (Explained! Why Your Distribution Still Using an ‘Outdated’ Linux Kernel?) [#]: via: (https://itsfoss.com/why-distros-use-old-kernel/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) @@ -10,7 +10,9 @@ 为什么你的发行版仍然在使用“过时的”Linux 内核? ====== -[检查一下你的系统所使用的 Linux 内核版本][1],你十有八九会发现,按照 Linux 内核官网提供的信息,该内核版本已经达到使用寿命终期了。 +![](https://img.linux.net.cn/data/attachment/album/202001/16/225806jbqyacu3loolobae.png) + +[检查一下你的系统所使用的 Linux 内核版本][1],你十有八九会发现,按照 Linux 内核官网提供的信息,该内核版本已经达到使用寿命终期(EOL)了。 一个软件一旦达到了使用寿命终期,那么就意味着它再也不会得到 bug 修复和维护了。 @@ -18,11 +20,11 @@ 下面将逐一解答这些问题。 -总结 - -上游内核维护与你的发行版的内核维护是两个不同的概念。 - -例如,根据 Linux 内核官网,Linux 内核 4.15 版本可能已经达到使用寿命终期了,但是在 2023 年 4 月之前,Ubuntu 18.04 长期维护版本将会继续使用这个版本,并通过向后移植安全补丁和修复 bug 来提供维护。 +> **总结** +> +> 上游内核维护与你的发行版的内核维护是两个不同的概念。 +> +> 例如,根据 Linux 内核官网,Linux 内核 4.15 版本可能已经达到使用寿命终期了,但是在 2023 年 4 月之前,Ubuntu 18.04 长期维护版本将会继续使用这个版本,并通过向后移植安全补丁和修复 bug 来提供维护。 ### 检查 Linux 内核版本,以及是否达到使用寿命终期 @@ -35,13 +37,11 @@ uname -r 我使用的是 Ubuntu 18.04,输出的 Linux 内核版本如下: ``` -[email protected]:~$ uname -r +abhishek@itsfoss:~$ uname -r 5.0.0-37-generic ``` -接下来,可以到 Linux 内核官网上看看哪些 Linux 内核版本仍然在维护状态。在网站主页上就可以看到相关信息。 - -[Linux 内核官网][2] +接下来,可以到 [Linux 内核官网][2]上看看哪些 Linux 内核版本仍然在维护状态。在网站主页上就可以看到相关信息。 你看到的内核版本状态应该类似于下图: @@ -53,7 +53,7 @@ uname -r 不幸的是,Linux 内核的生命周期没有任何规律可循。不是说常规的内核稳定发布版可以得到 X 月的维护、长期维护版本(LTS)可以得到 Y 年的维护。没有这回事。 -根据实际需求,可能会存在内核的多个 LTS 版本,其使用寿命终期各不相同。在[这个页面][5]上可以查到这些 LTS 版本的相关信息,包括推定的使用寿命终期。 +根据实际需求,可能会存在内核的多个 LTS 版本,其使用寿命终期各不相同。在[这个页面][5]上可以查到这些 LTS 版本的相关信息,包括计划的使用寿命终期。 那么问题来了:既然 Linux 内核官网上明确表示 5.0 版本的内核已经达到了使用寿命终期,Ubuntu 为什么还在提供这个内核版本呢? @@ -63,11 +63,11 @@ uname -r 你是否想过,为什么 Ubuntu/Debian/Fedora 等发行版被称为 Linux “发行版”?这是因为,它们“发行” Linux 内核。 -这些发行版会对 Linux 内核进行不同的修改,并添加各种 GUI 元素(包括桌面环境,显示服务器等)以及软件,然后再呈现给用户。 +这些发行版会对 Linux 内核进行不同的修改,并添加各种 GUI 元素(包括桌面环境、显示服务器等)以及软件,然后再呈现给用户。 按照通常的工作流,Linux 发行版会选择一个内核,提供给其用户,然后在接下来的几个月、几年中,甚至是达到内核的使用寿命终期之后,仍然会继续使用该内核。 -这样能够保障安全吗?其实是可以的,因为 _**发行版会通过向后移植全部的重要修补来维护内核**_。 +这样能够保障安全吗?其实是可以的,因为 **发行版会通过向后移植全部的重要修补来维护内核**。 换句话说,你的 Linux 发行版会确保 Linux 内核没有漏洞和 bug,并且已经通过向后移植获得了重要的新特性。在“过时的旧版本 Linux 内核”上,其实有着数以千计的改动。 @@ -83,13 +83,13 @@ uname -r 新的 Linux 内核稳定版本每隔 2 到 3 个月发布一次,有不少用户跃跃欲试。 -实话说,除非有十分充分的理由,否则不应该使用最新版本的稳定内核。你使用的发行版并不会提供这个选项,你也不能指望通过在键盘上敲出“_sudo apt give-me-the-latest-stable-kernel_”解决问题。 +实话说,除非有十分充分的理由,否则不应该使用最新版本的稳定内核。你使用的发行版并不会提供这个选项,你也不能指望通过在键盘上敲出 `sudo apt give-me-the-latest-stable-kernel` 解决问题。 -此外,手动[安装主流 Linux 内核版本][8]本身就是一个挑战。即使安装成功,之后每次发布 bug 修复的时候,负责更新内核的就会是你了。此外,当新内核达到使用寿命终期之后,你就有责任将它升级到更新的内核版本了。和常规的[Ubuntu 更新][9]不同,内核升级无法通过 apt upgrade 完成。 +此外,手动[安装主流 Linux 内核版本][8]本身就是一个挑战。即使安装成功,之后每次发布 bug 修复的时候,负责更新内核的就会是你了。此外,当新内核达到使用寿命终期之后,你就有责任将它升级到更新的内核版本了。和常规的 [Ubuntu 更新][9]不同,内核升级无法通过 `apt upgrade` 完成。 同样需要记住的是,切换到主流内核之后,可能就无法使用你的发行版提供的一些驱动程序和补丁了。 -正如 [Greg Kroah-Hartman][10]所言,“_**你能使用的最好的内核,就是别人在维护的内核。**_”除了你的 Linux 发行版之外,又有谁更胜任这份工作呢! +正如 [Greg Kroah-Hartman][10]所言,“**你能使用的最好的内核,就是别人在维护的内核。**”除了你的 Linux 发行版之外,又有谁更胜任这份工作呢! 希望你对这个主题已经有了更好的理解。下回发现你的系统正在使用的内核版本已经达到使用寿命终期的时候,希望你不会感到惊慌失措。 @@ -102,7 +102,7 @@ via: https://itsfoss.com/why-distros-use-old-kernel/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[chen-ni](https://github.com/chen-ni) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3f6b672ec7f97aeba6e30e9a9c852b44b66fd22c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 00:57:09 +0800 Subject: [PATCH 0269/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Insi?= =?UTF-8?q?ghts=20into=20Why=20Hyperbola=20GNU/Linux=20is=20Turning=20into?= =?UTF-8?q?=20Hyperbola=20BSD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md --- ...GNU-Linux is Turning into Hyperbola BSD.md | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md diff --git a/sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md new file mode 100644 index 0000000000..68ede9acfa --- /dev/null +++ b/sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Insights into Why Hyperbola GNU/Linux is Turning into Hyperbola BSD) +[#]: via: (https://itsfoss.com/hyperbola-linux-bsd/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Insights into Why Hyperbola GNU/Linux is Turning into Hyperbola BSD +====== + +In late December 2019, [Hyperbola][1] [announced][2] that they would be making major changes to their project. They have decided to drop the Linux kernel in favor of forking the OpenBSD kernel. This announcement only came months after Project Trident [announced][3] that they were going in the opposite direction (from BSD to Linux). + +Hyperbola also plans to replace all software that is not GPL v3 compliant with new versions that are. + +To get more insight into the future of their new project, I interviewed **Andre, co-founder of Hyperbola**. + +### Why Hyperbola GNU/Linux Turned into Hyperbola BSD + +![][4] + +_**It’s FOSS: In your announcement, you state that the Linux kernel is “rapidly proceeding down an unstable path”. Could you explain what you mean by that?**_ + +**Andre:** First of all, it’s including the adaption of DRM features such as [HDCP][5] (High-bandwidth Digital Content Protection). Currently there is an option to disable it at build time, however there isn’t a policy that guarantees us that it will be optional forever. + +Historically, some features began as optional ones until they reached total functionality. Then they became forced and difficult to patch out. Even if this does not happen in the case of HDCP, we remain cautious about such implementations. + +Another of the reasons is that the _**Linux kernel is no longer getting proper hardening**_. [Grsecurity][6] stopped offering public patches several years ago, and we depended on that for our system’s security. Although we could use their patches still for a very expensive subscription, the subscription would be terminated if we chose to make those patches public. + +Such restrictions goes against the FSDG principles that require us to provide full source code, deblobbed, and unrestricted, to our users. + +KSPP is a project that was intended to upstream Grsec into the kernel, but thus far it has not come close to reaching Grsec / PaX level of kernel hardening. There also has not been many recent developments, which leads us to believe it is now an inactive project for the most part. + +Lastly, the interest in [allowing Rust modules][7] into the kernel are a problem for us, due to Rust trademark restrictions which prevent us from applying patches in our distribution without express permission. We patch to remove non-free software, unlicensed files, and enhancements to user-privacy anywhere it is applicable. We also expect our users to be able to re-use our code without any additional restrictions or permission required. + +This is also in part why we use UXP, a fully free browser engine and application toolkit without Rust, for our mail and browser applications. + +Due to these restrictions, and the concern that it may at some point become a forced build-time dependency for the kernel we needed another option. + +_**It’s FOSS: You also said in the announcement that you would be forking the OpenBSD kernel. Why did you pick the OpenBSD kennel over the FreeBSD, the DragonflyBSD kernel or the MidnightBSD kernel?**_ + +**Andre:** [OpenBSD][8] was chosen as our base for hard-forking because it’s a system that has always had quality code and security in mind. + +Some of their ideas which greatly interested us were new system calls, including pledge and unveil which adds additional hardening to userspace and the removal of the systrace system policy-enforcement tool. + +They also are known for [Xenocara][9] and [LibreSSL][10], both of which we had already been using after porting them to [GNU/Linux-libre][11]. We found them to be well written and generally more stable than Xorg/OpenSSL respectively. + +None of the other BSD implementations we are aware of have that level of security. We also were aware [LibertyBSD][12] has been working on liberating the OpenBSD kernel, which allowed us to use their patches to begin the initial development. + +_**It’s FOSS: Why fork the kernel in the first place? How will you keep the new kernel up-to-date with newer hardware support?**_ + +**Andre:** The kernel is one of the most important parts of any operating system, and we felt it is critical to start on a firm foundation moving forward. + +For the first version we plan to keep in synchronization with OpenBSD where it is possible. In future versions we may adapt code from other BSDs and even the Linux kernel where needed to keep up with hardware support and features. + +We are working in coordination with [Libreware Group][13] (our representative for business activities) and have plans to open our foundation soon. + +This will help to sustain development, hire future developers and encourage new enthusiasts for newer hardware support and code. We know that deblobbing isn’t enough because it’s a mitigation, not a solution for us. So, for that reason, we need to improve our structure and go to the next stage of development for our projects. + +_**It’s FOSS: You state that you plan to replace the parts of the OpenBSD kernel and userspace that are not GPL compatible or non-free with those that are. What percentage of the code falls into the non-GPL zone?**_ + +**Andre:** It’s around 20% in the OpenBSD kernel and userspace. + +Mostly, the non-GPL compatible licensed parts are under the Original BSD license, sometimes called the “4-clause BSD license” that contains a serious flaw: the “obnoxious BSD advertising clause”. It isn’t fatal, but it does cause practical problems for us because it generates incompatibility with our code and future development under GPLv3 and LGPLv3. + +The non-free files in OpenBSD include files without an appropriate license header, or without a license in the folder containing a particular component. + +If those files don’t contain a license to give users the four essential freedoms or if it has not been explicitly added in the public domain, it isn’t free software. Some developers think that code without a license is automatically in the public domain. That isn’t true under today’s copyright law; rather, all copyrightable works are copyrighted by default. + +The non-free firmware blobs in OpenBSD include various hardware firmwares. These firmware blobs occur in Linux kernel also and have been manually removed by the Linux-libre project for years following each new kernel release. + +They are typically in the form of a hex encoded binary and are provided to kernel developers without source in order to provide support for proprietary-designed hardware. These blobs may contain vulnerabilities or backdoors in addition to violating your freedom, but no one would know since the source code is not available for them. They must be removed to respect user freedom. + +_**It’s FOSS: I was talking with someone about HyperbolaBSD and they mentioned [HardenedBSD][14]. Have you considered HardenedBSD?**_ + +**Andre:** We had looked into HardenedBSD, but it was forked from FreeBSD. FreeBSD has a much larger codebase. While HardenedBSD is likely a good project, it would require much more effort for us to deblob and verify licenses of all files. + +We decided to use OpenBSD as a base to fork from instead of FreeBSD due to their past commitment to code quality, security, and minimalism. + +_**It’s FOSS: You mentioned UXP (or [Unified XUL Platform][15]). It appears that you are using [Moonchild’s fork of the pre-Servo Mozilla codebase][16] to create a suite of applications for the web. Is that about the size of it?**_ + +**Andre:** Yes. Our decision to use UXP was for several reasons. We were already rebranding Firefox as Iceweasel for several years to remove DRM, disable telemetry, and apply preset privacy options. However, it became harder and harder for us to maintain when Mozilla kept adding anti-features, removing user customization, and rapidly breaking our rebranding and privacy patches. + +After FF52, all XUL extensions were removed in favor of WebExt and Rust became enforced at compile time. We maintain several XUL addons to enhance user-privacy/security which would no longer work in the new engine. We also were concerned that the feature limited WebExt addons were introducing additional privacy issues. E.g. each installed WebExt addon contains a UUID which can be used to uniquely and precisely identify users (see [Bugzilla 1372288][17]). + +After some research, we discovered UXP and that it was regularly keeping up with security fixes without rushing to implement new features. They had already disabled telemetry in the toolkit and remain committed to deleting all of it from the codebase. + +We knew this was well-aligned with our goals, but still needed to apply a few patches to tweak privacy settings and remove DRM. Hence, we started creating our own applications on top of the toolkit. + +This has allowed us to go far beyond basic rebranding/deblobbing as we were doing before and create our own fully customized XUL applications. We currently maintain [Iceweasel-UXP][18], [Icedove-UXP][19] and [Iceape-UXP][20] in addition to sharing toolkit improvements back to UXP. + +_**It’s FOSS: In a [forum post][21], I noticed mentions of HyperRC, HyperBLibC, and hyperman. Are these forks or rewrites of current BSD tools to be GPL compliant?**_ + +**Andre:** They are forks of existing projects. + +Hyperman is a fork of our current package manager, pacman. As pacman does not currently work on BSD, and the minimal support it had in the past was removed in recent versions, a fork was required. Hyperman already has a working implementation using LibreSSL and BSD support. + +HyperRC will be a patched version of OpenRC init. HyperBLibC will be a fork from BSD LibC. + +_**It’s FOSS: Since the beginning of time, Linux has championed the GPL license and BSD has championed the BSD license. Now, you are working to create a BSD that is GPL licensed. How would you respond to those in the BSD community who don’t agree with this move?**_ + +**Andre:** We are aware that there are disagreements between the GPL and BSD world. There are even disagreements over calling our previous distribution “GNU/Linux” rather than simply “Linux”, since the latter definition ignores that the GNU userspace was created in 1984, several years prior to the Linux kernel being created by Linus Torvalds. It was the two different software combined that make a complete system. + +Some of the primary differences from BSD, is that the GPL requires that our source code must be made public, including future versions, and that it can only be used in tandem with compatibly licensed files. BSD systems do not have to share their source code publicly, and may bundle themselves with various licenses and non-free software without restriction. + +Since we are strong supporters of the Free Software Movement and wish that our future code remain in the public space always, we chose the GPL. + +_**It’s FOSS: I know at this point you are just starting the process, but do you have any idea who you might have a usable version of HyperbolaBSD available?**_ + +**Andre:** We expect to have an alpha release ready by 2021 (Q3) for initial testing. + +_**It’s FOSS: How long will you continue to support the current Linux version of Hyperbola? Will it be easy for current users to switch over to**_? + +**Andre:** As per our announcement, we will continue to support Hyperbola GNU/Linux-libre until 2022 (Q4). We expect there to be some difficulty in migration due to ABI changes, but will prepare an announcement and information on our wiki once it is ready. + +_**It’s FOSS: If someone is interested in helping you work on HyperbolaBSD, how can they go about doing that? What kind of expertise would you be looking for?**_ + +**Andre:** Anyone who is interested and able to learn is welcome. We need C programmers and users who are interested in improving security and privacy in software. Developers need to follow the FSDG principles of free software development, as well as the YAGNI principle which means we will implement new features only as we need them. + +Users can fork our git repository and submit patches to us for inclusion. + +_**It’s FOSS: Do you have any plans to support ZFS? What filesystems will you support?**_ + +**Andre:** [ZFS][22] support is not currently planned, because it uses the Common Development and Distribution License, version 1.0 (CDDL). This license is incompatible with all versions of the GNU General Public License (GPL). + +It would be possible to write new code under GPLv3 and release it under a new name (eg. HyperZFS), however there is no official decision to include ZFS compatibility code in HyperbolaBSD at this time. + +We have plans on porting BTRFS, JFS2, NetBSD’s CHFS, DragonFlyBSD’s HAMMER/HAMMER2 and the Linux kernel’s JFFS2, all of which have licenses compatible with GPLv3. Long term, we may also support Ext4, F2FS, ReiserFS and Reiser4, but they will need to be rewritten due to being licensed exclusively under GPLv2, which does not allow use with GPLv3. All of these file systems will require development and stability testing, so they will be in later HyperbolaBSD releases and not for our initial stable version(s). + +* * * + +I would like to thank Andre for taking the time to answer my questions and for revealing more about the future of HyperbolaBSD. + +What are your thoughts on Hyperbola switching to a BSD kernel? What do you think about a BSD being released under the GPL? Please let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][23]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/hyperbola-linux-bsd/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://www.hyperbola.info/ +[2]: https://www.hyperbola.info/news/announcing-hyperbolabsd-roadmap/ +[3]: https://itsfoss.com/bsd-project-trident-linux/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/hyperbola_linux_bsd.png?ssl=1 +[5]: https://patchwork.kernel.org/patch/10084131/ +[6]: https://grsecurity.net/ +[7]: https://lwn.net/Articles/797828/ +[8]: https://www.openbsd.org/ +[9]: https://www.xenocara.org/ +[10]: https://www.libressl.org/ +[11]: https://en.wikipedia.org/wiki/Linux-libre +[12]: https://libertybsd.net/ +[13]: https://en.libreware.info/ +[14]: https://hardenedbsd.org/ +[15]: http://thereisonlyxul.org/ +[16]: https://github.com/MoonchildProductions/UXP +[17]: https://bugzilla.mozilla.org/show_bug.cgi?id=1372288 +[18]: https://wiki.hyperbola.info/doku.php?id=en:project:iceweasel-uxp +[19]: https://wiki.hyperbola.info/doku.php?id=en:project:icedove-uxp +[20]: https://wiki.hyperbola.info/doku.php?id=en:project:iceape-uxp +[21]: https://forums.hyperbola.info/viewtopic.php?id=315 +[22]: https://itsfoss.com/what-is-zfs/ +[23]: https://reddit.com/r/linuxusersgroup From ea96b681141b1a5bc6b5d0d536bc1429f9e3eed3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 00:57:54 +0800 Subject: [PATCH 0270/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=203=20?= =?UTF-8?q?open=20source=20tools=20to=20manage=20your=20contacts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200116 3 open source tools to manage your contacts.md --- ...en source tools to manage your contacts.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/tech/20200116 3 open source tools to manage your contacts.md diff --git a/sources/tech/20200116 3 open source tools to manage your contacts.md b/sources/tech/20200116 3 open source tools to manage your contacts.md new file mode 100644 index 0000000000..eeb7877de1 --- /dev/null +++ b/sources/tech/20200116 3 open source tools to manage your contacts.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 open source tools to manage your contacts) +[#]: via: (https://opensource.com/article/20/1/sync-contacts-locally) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +3 open source tools to manage your contacts +====== +Access your contacts more quickly by syncing them locally. Learn how in +the sixth in our series on 20 ways to be more productive with open +source in 2020. +![Team communication, chat][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Open source tools for contact management + +In previous articles in this series, I explained how to synchronize your [mail][2] and [calendars][3] locally. Hopefully, that has sped up accessing your mail and calendar. Now I'll talk about contacts, which you can use to send mail and calendar invites. + +![abook][4] + +I have collected a lot of email addresses over the course of my, well, life so far. And managing all that data can be a bit of a pain. There are web-based services, but they aren't as fast as a local copy. + +A few days ago, I talked about [vdirsyncer][5] for managing calendars. Vdirsyncer also handles contacts using the CardDAV protocol. Vdirsyncer supports **google_contacts** and **carddav** to do contact synchronizations in addition to the **filesystem** store it uses for calendars, but the **fileext** setting will change, so you won't be trying to store contacts in calendar files. + +I added a configuration block to the config file and mirrored my contacts from Google. Extra steps are required to set it up. Once the Google setup is complete, the configuration is pretty simple: + + +``` +[pair address_sync] +a = "googlecard" +b = "localcard" +collections = ["from a", "from b"] +conflict_resolution = "a wins" + +[storage googlecard] +type = "google_contacts" +token_file = "~/.vdirsyncer/google_token" +client_id = "my_client_id" +client_secret = "my_client_secret" + +[storage localcard] +type = "filesystem" +path = "~/.calendars/Addresses/" +fileext = ".vcf" +``` + +Now when I run **vdirsyncer discover**, it finds my Google contacts, and **vdirsyncer sync** copies them to my local machine. But again, that's only half the story. Now I want to read and use the contacts. Enter [khard][6] and [abook][7]. + +![khard search][8] + +Why two applications? Each has its own use case, and in this case, more is better. Khard does for addresses what [khal][9] does for calendar entries. You'll probably want to install the latest release via pip if your distribution ships an older version. Once khard is installed, you need to create **~/.config/khard/khard.conf** because khard doesn't have a nifty configuration wizard the way khal does. Mine looks like this: + + +``` +[addressbooks] +[[addresses]] +path = ~/.calendars/Addresses/default/ + +[general] +debug = no +default_action = list +editor = vim, -i, NONE +merge_editor = vimdiff + +[contact table] +display = first_name +group_by_addressbook = no +reverse = no +show_nicknames = yes +show_uids = no +sort = last_name +localize_dates = yes + +[vcard] +preferred_version = 3.0 +search_in_source_files = yes +skip_unparsable = no +``` + +This defines the source address book (and gives it a friendly name), as well as what to display and what do use to edit contacts. Running **khard list** will list all the entries, and **khard list <[some@email.adr][10]>** will search for a specific entry. If you want to add or edit an entry, the **add** and **edit** commands launch the configured editor with the same basic template, the only difference being that the **add** template will be blank. + +![editing in khard][11] + +Abook requires you to import and export VCF files but offers some nice features for lookups. To convert your files to the abook format, first install abook and create the **~/.abook** default directory. Now tell abook to parse all the files and put them into the **~/.abook/addresses** file: + + +``` +apt install abook +ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses +``` + +Now run **abook**, and you'll have a very nice UI to browse, search, and edit the entries. Exporting them back to individual entries is a bit of a pain, so I do most of my edits with khard and have a cron job to import them into abook. + +Abook can also search on the command line and has a lot of documentation about integrating it with mail clients. For example, you can use abook for lookups in the [Notmuch][12] email client [alot][13] by adding some information to the **.config/alot/config** file: + + +``` +[accounts] +  [[Personal]] +     realname = Kevin Sonney +     address = [kevin@sonney.com][14] +     alias_regexp = kevin\[+.+@sonney.com][15] +     gpg_key = 7BB612C9 +     sendmail_command = msmtp --account=Personal -t +     # ~ expansion works +     sent_box = maildir://~/Maildir/Sent +     draft_box = maildir://~/Maildir/Drafts +    [[[abook]]] +        type = abook +``` + +And there you have it: fast lookup of your contacts to go with your mail and calendars! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-contacts-locally + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) +[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[3]: https://opensource.com/article/20/1/open-source-calendar +[4]: https://opensource.com/sites/default/files/uploads/productivity_6-1.png (abook) +[5]: https://github.com/pimutils/vdirsyncer +[6]: https://github.com/scheibler/khard +[7]: http://abook.sourceforge.net/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_6-2.png (khard search) +[9]: https://khal.readthedocs.io/en/v0.9.2/index.html +[10]: mailto:some@email.adr +[11]: https://opensource.com/sites/default/files/uploads/productivity_6-3.png (editing in khard) +[12]: https://opensource.com/article/20/1/organize-email-notmuch +[13]: https://github.com/pazz/alot +[14]: mailto:kevin@sonney.com +[15]: mailto:+.+@sonney.com From 0a8d926d5cb7f63509a8cf3327f2c1d077db55df Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 00:58:23 +0800 Subject: [PATCH 0271/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=20Auto?= =?UTF-8?q?mating=20Helm=20deployments=20with=20Bash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200116 Automating Helm deployments with Bash.md --- ...6 Automating Helm deployments with Bash.md | 385 ++++++++++++++++++ 1 file changed, 385 insertions(+) create mode 100644 sources/tech/20200116 Automating Helm deployments with Bash.md diff --git a/sources/tech/20200116 Automating Helm deployments with Bash.md b/sources/tech/20200116 Automating Helm deployments with Bash.md new file mode 100644 index 0000000000..a8e8567b0b --- /dev/null +++ b/sources/tech/20200116 Automating Helm deployments with Bash.md @@ -0,0 +1,385 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automating Helm deployments with Bash) +[#]: via: (https://opensource.com/article/20/1/automating-helm-deployments-bash) +[#]: author: (Darin London https://opensource.com/users/dmlond) + +Automating Helm deployments with Bash +====== +This Bash script enables developers to focus on their code rather than +the deployment logic in each project. +![Person using a laptop][1] + +Some of our applications are hosted in a [Kubernetes][2] cluster, and we use GitLab Continuous Integration (CI) to automate deployments and Helm 2 to deploy our applications. Helm charts enable the storage of templates of Kubernetes object YAML files with variables that can be programmatically set from command-line arguments passed when the chart is used during deployments. This allows us to store critical secrets in GitLab-protected environment variables or in Hashicorp Vault and use them within the CI deployment job. + +Our deployment job uses a [Bash script to run the deployment process][3]. This Bash script presents a number of features that are valuable for use within a CI/CD environment: + + 1. It facilitates use outside of the CI/CD environment. GitLab CI and other CI systems store job steps as lines of executable shell code in a "script" section of a CI text file (.gitlab-ci.yml, for example). While this is useful to ensure basic executable steps can be stored without external dependencies, it prevents developers from using the same code in testing or manual deployment scenarios. In addition, many advanced features of the Bash system cannot be easily used in these script sections. + 2. It facilitates unit testing of important deployment processes. None of the CI systems provide a way of testing whether deployment logic performs as expected. Carefully constructed [Bash scripts can be unit tested with BATS][4]. + 3. It facilitates reuse of individual functions within the script. The last section uses a guard clause, **if [[ "${BASH_SOURCE[0]}" == "${0}" ]]**, which prevents the **run_main** function from being called when the script is not being executed. This allows the script to be sourced, which then allows users to make use of the many useful individual functions within it. This is crucial for proper BATS testing. + 4. It uses environment variables to protect sensitive information and make the script reusable across many projects and project application environments. GitLab CI makes many of these environment variables available when run by a GitLab CI runner. These must be manually set before using the script outside GitLab CI. + + + +The script performs all tasks required to deploy a Helm chart for an application to Kubernetes and waits for the deployment to be ready using kubectl and Helm. Helm runs with a local Tiller installation instead of running Tiller in the Kubernetes cluster. The Kubernetes **HELM_USER** and **HELM_PASSWORD** are used to log into the Kubernetes **CLUSTER_SERVER** and **PROJECT_NAMESPACE**. Tiller is started, Helm is initialized in client-only mode, and its repo is updated. The template is linted with Helm to ensure that syntax errors have not been accidentally committed. The template is then deployed in declarative mode, using **helm upgrade --install**. Helm waits for the deployment to be ready using the **\--wait flag**. + +The script ensures that certain template variables are set during the deployment and allows special project-specific variables to be specified in the GitLab CI **PROJECT_SPECIFIC_DEPLOY_ARGS** environment variable. All environment variables required in the deployment are checked early in the script execution, and the script exits with a non-zero exit status if any are missing. + +This script has been used in multiple GitLab CI-hosted projects. It has helped us focus on our code rather than the deployment logic in each project. + +### The script + + +``` +#!/bin/bash + +# MIT License +# +# Copyright (c) 2019 Darin London +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +log_level_for() +{ +  case "${1}" in +    "error") +      echo 1 +      ;; + +    "warn") +      echo 2 +      ;; + +    "debug") +      echo 3 +      ;; + +    "info") +      echo 4 +      ;; +    *) +      echo -1 +      ;; +  esac +} + +current_log_level() +{ +  log_level_for "${LOG_LEVEL}" +} + +error() +{ +  [ $(log_level_for "error") -le $(current_log_level) ] &&  echo "${1}" >&2 +} + +warn() +{ +  [ $(log_level_for "warn") -le $(current_log_level) ] &&  echo "${1}" >&2 +} + +debug() +{ +  [ $(log_level_for "debug") -le $(current_log_level) ] &&  echo "${1}" >&2 +} + +info() +{ +  [ $(log_level_for "info") -le $(current_log_level) ] &&  echo "${1}" >&2 +} + +check_required_environment() { +  local required_env="${1}" + +  for reqvar in $required_env +  do +    if [ -z "${!reqvar}" ] +    then +      error "missing ENVIRONMENT ${reqvar}!" +      return 1 +    fi +  done +} + +check_default_environment() { +  local required_env="${1}" + +  for varpair in $required_env +  do +    local manual_environment=$(echo "${varpair}" | cut -d':' -f1) +    local default_if_not_set=$(echo "${varpair}" | cut -d':' -f2) +    if [ -z "${!manual_environment}" ] && [ -z "${!default_if_not_set}" ] +    then +      error "missing default ENVIRONMENT, set ${manual_environment} or ${default_if_not_set}!" +      return 1 +    fi +  done +} + +dry_run() { +  [ ${DRY_RUN} ] && info "skipping for dry run" && return +  return 1 +} + +init_tiller() { +  info "initializing local tiller" +  dry_run && return + +  export TILLER_NAMESPACE=$PROJECT_NAMESPACE +  export HELM_HOST=localhost:44134 +  # +  # run tiller locally instead of in the cluster +  tiller --storage=secret & +  export TILLER_PID=$! +  sleep 1 +  kill -0 ${TILLER_PID} +  if [ $? -gt 0 ] +  then +    error "tiller not running!" +    return 1 +  fi +} + +init_helm() { +  info "initializing helm" +  dry_run && return + +  helm init --client-only +  if [ $? -gt 0 ] +  then +    error "could not initialize helm" +    return 1 +  fi +} + +init_helm_with_tiller() { +  init_tiller || return 1 +  init_helm || return 1 +  info "updating helm client repository information" +  dry_run && return +  helm repo update +  if [ $? -gt 0 ] +  then +    error "could not update helm repository information" +    return 1 +  fi +} + +decommission_tiller() { +  if [ -n "${TILLER_PID}" ] +  then +    kill ${TILLER_PID} +    if [ $? -gt 0 ] +    then +     return +    fi +  fi +} + +check_required_deploy_arg_environment() { +  [ -z "${PROJECT_SPECIFIC_DEPLOY_ARGS}" ] && return +  for reqvar in ${PROJECT_SPECIFIC_DEPLOY_ARGS} +  do +    if [ -z ${!reqvar} ] +    then +      error "missing Deployment ENVIRONMENT ${reqvar} required!" +      return 1 +    fi +  done +} + +project_specific_deploy_args() { +  [ -z "${PROJECT_SPECIFIC_DEPLOY_ARGS}" ] && echo "" && return + +  extraArgs='' +  for deploy_arg_key in ${PROJECT_SPECIFIC_DEPLOY_ARGS} +  do +    extraArgs="${extraArgs} --set $(echo "${deploy_arg_key}" | sed 's/__/\\./g' | tr '[:upper:]' '[:lower:]')=${!deploy_arg_key}" +  done + +  echo "${extraArgs}" +} + +check_required_cluster_login_environment() { +  check_required_environment "HELM_TOKEN HELM_USER PROJECT_NAMESPACE CLUSTER_SERVER" || return 1 +} + +cluster_login() { +  info "authenticating ${HELM_USER} in ${PROJECT_NAMESPACE}" +  dry_run && return + +  kubectl config set-cluster ci_kube --server="${CLUSTER_SERVER}" || return 1 +  kubectl config set-credentials "${HELM_USER}" --token="${HELM_TOKEN}" || return 1 +  kubectl config set-context ${PROJECT_NAMESPACE}-deploy  --cluster=ci_kube --namespace=${PROJECT_NAMESPACE} --user=${HELM_USER} || return 1 +  kubectl config use-context ${PROJECT_NAMESPACE}-deploy || return 1 +} + +lint_template() { +  info "linting template" +  dry_run && return + +  helm lint ${CI_PROJECT_DIR}/helm-chart/${CI_PROJECT_NAME} +} + +check_required_image_pull_environment() { +  if [ "${CI_PROJECT_VISIBILITY}" == "public" ] +  then +    check_required_environment "CI_REGISTRY CI_DEPLOY_USER CI_DEPLOY_PASSWORD" || return 1 +  fi +} + +image_pull_settings() { +  if [ "${CI_PROJECT_VISIBILITY}" == "public" ] +  then +    echo "" +  else +    echo "--set registry.root=${CI_REGISTRY} --set registry.secret.username=${CI_DEPLOY_USER} --set registry.secret.password=${CI_DEPLOY_PASSWORD}" +  fi +} + +deployment_name() { +  if [ -n "${DEPLOYMENT_NAME}" ] +  then +    echo "${DEPLOYMENT_NAME}" +  else +    echo "${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_NAME}" +  fi +} + +deploy_template() { +  info "deploying $(deployment_name) from template" +  if dry_run +  then +    info "helm upgrade --force --recreate-pods --debug --set image.repository=${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME} --set image.tag=${CI_COMMIT_SHORT_SHA} --set environment=${CI_ENVIRONMENT_NAME} --set-string git_commit=${CI_COMMIT_SHORT_SHA} --set git_ref=${CI_COMMIT_REF_SLUG} --set ci_job_id=${CI_JOB_ID} $(environment_url_settings) $(image_pull_settings) $(project_specific_deploy_args) --wait --install $(deployment_name) ${CI_PROJECT_DIR}/helm-chart/${CI_PROJECT_NAME}" +  else +    helm upgrade --force --recreate-pods --debug \ +    --set image.repository="${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME}" \ +    --set image.tag="${CI_COMMIT_SHORT_SHA}" \ +    --set environment="${CI_ENVIRONMENT_NAME}" \ +    --set-string git_commit="${CI_COMMIT_SHORT_SHA}" \ +    --set git_ref="${CI_COMMIT_REF_SLUG}" \ +    --set ci_job_id="${CI_JOB_ID}" \ +    $(image_pull_settings) \ +    $(project_specific_deploy_args) \ +    --wait \ +    --install $(deployment_name) ${CI_PROJECT_DIR}/helm-chart/${CI_PROJECT_NAME} +  fi +} + +get_pods() { +  kubectl get pods -l ci_job_id="${CI_JOB_ID}" +} + +watch_deployment() { +  local watch_deployment=$(deployment_name) +  if [ -n "${WATCH_DEPLOYMENT}" ] +  then +    watch_deployment="${WATCH_DEPLOYMENT}" +  fi +  info "waiting until deployment ${watch_deployment} is ready" +  dry_run && return + +  kubectl rollout status deployment/${watch_deployment} -w || return 1 +  sleep 5 +  get_pods || return 1 +  # see what has been deployed +  kubectl describe deployment -l app=${CI_PROJECT_NAME},environment=${CI_ENVIRONMENT_NAME},git_commit=${CI_COMMIT_SHORT_SHA} || return 1 +  if [ -n "${CI_ENVIRONMENT_URL}" ] +  then +    kubectl describe service -l app=${CI_PROJECT_NAME},environment=${CI_ENVIRONMENT_NAME} || return 1 +    kubectl describe route -l app=${CI_PROJECT_NAME},environment=${CI_ENVIRONMENT_NAME} || return 1 +  fi +} + +run_main() { +  check_required_environment "CI_PROJECT_NAME CI_PROJECT_DIR CI_COMMIT_REF_SLUG CI_REGISTRY_IMAGE CI_ENVIRONMENT_NAME CI_JOB_ID CI_COMMIT_SHORT_SHA" || return 1 +  check_default_environment "WATCH_DEPLOYMENT:CI_ENVIRONMENT_SLUG" || return 1 +  check_required_deploy_arg_environment || return 1 +  check_required_cluster_login_environment || return 1 +  check_required_image_pull_environment || return 1 +  cluster_login +  if [ $? -gt 0 ] +  then +    error "could not login kubectl" +    return 1 +  fi + +  init_helm_with_tiller +  if [ $? -gt 0 ] +  then +    error "could not initialize helm" +    return 1 +  fi + +  lint_template +  if [ $? -gt 0 ] +  then +    error "linting failed" +    return 1 +  fi + +  deploy_template +  if [ $? -gt 0 ] +  then +    error "could not deploy template" +    return 1 +  fi + +  watch_deployment +  if [ $? -gt 0 ] +  then +    error "could not watch deployment" +    return 1 +  fi + +  decommission_tiller +  info "ALL Complete!" +  return +} + +if [[ "${BASH_SOURCE[0]}" == "${0}" ]] +then +  run_main +  if [ $? -gt 0 ] +  then +    exit 1 +  fi +fi +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/automating-helm-deployments-bash + +作者:[Darin London][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dmlond +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://gist.github.com/dmlond/016ff7c3757fee00f9d02e36e6c0c298 +[4]: https://opensource.com/article/19/2/testing-bash-bats From 733c67ae8eec11897755fc93fd841b1a60f2f816 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 00:59:01 +0800 Subject: [PATCH 0272/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=204=20?= =?UTF-8?q?core=20skills=20to=20level-up=20your=20tech=20career=20in=20202?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200116 4 core skills to level-up your tech career in 2020.md --- ...ls to level-up your tech career in 2020.md | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 sources/tech/20200116 4 core skills to level-up your tech career in 2020.md diff --git a/sources/tech/20200116 4 core skills to level-up your tech career in 2020.md b/sources/tech/20200116 4 core skills to level-up your tech career in 2020.md new file mode 100644 index 0000000000..e8385910d4 --- /dev/null +++ b/sources/tech/20200116 4 core skills to level-up your tech career in 2020.md @@ -0,0 +1,160 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 core skills to level-up your tech career in 2020) +[#]: via: (https://opensource.com/article/20/1/core-skills-tech-career) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +4 core skills to level-up your tech career in 2020 +====== +There is one category of skill you should focus on to advance your +career this year. Here's how. +![Two hands holding a resume with computer, clock, and desk chair ][1] + +We do a lot to level-up our careers. We learn new programming languages; we take on new projects at work; we work on side projects on the weekend; we contribute to open source communities. What if I were to tell you that, while these activities are helpful, there is one set of skills you should focus on if you truly want to advance your career. + +These skills go by many names, such as soft skills, non-technical skills, leadership skills, and people skills. Calling them soft or non-technical skills leads to the mistaken idea that they are easy. For some, these skills are incredibly difficult. Calling them leadership skills makes people think they don't need to put effort into developing them if they don't want to be a leader. + +I prefer to call them core or functional skills. These skills are part of the core of what makes us human, and it is hard to function without them. + +When we have these skills, we can: + + * Communicate with others + * Collaborate and work with others + * Solve problems + * Understand and share the feelings of others + * Use time effectively or productively + + + +These skills are part of what makes us human, and everything in software is about humans. Humans are reviewing your code. Humans are installing or using the application you are writing. + +If these skills are so essential, why do we often dismiss them in favor of more "technical" skills and give them a bad rap? This isn't about focusing on one versus the other. Both are important and relevant. + +### Mindset and biases + +Our biases and mindset contribute to the importance we place on functional skills. Bias isn't a bad thing. There are [175 biases][2] that exist to help our brains combat four problems: + + * We have too much information to process. + * There's not enough meaning in the information we receive. + * There's not enough time to process information. + * We can't remember everything. Our memory is finite. + + + +One bias that sneaks in when it comes to assessing our skills is the Dunning-Kruger effect. We mistakenly assess our abilities as more exceptional than they are, which comes from an inability to recognize our own faults. You may think you know what you are doing when you don't because of the Dunning-Kruger effect. You think you are managing your time effectively, but in reality, you are working nights and weekends to get caught up. Yes, the work is getting completed, but at what cost? Working non-stop can lead to burnout or a decline in health. + +Another factor is your [mindset][3]. Do you have a growth mindset or a fixed mindset when it comes to learning a new skill? People with a fixed mindset believe that abilities are innate and can't be improved. Those with a growth mindset believe there is room for improvement, and you can improve any skill with practice. + +These statements reflect a fixed mindset: + + * "I'm just not a people person." + * "They're a natural-born leader." + + + +You're not born with the ability to speak or write. You learn these skills over time. The same goes for the core and functional skills important for developers. + +### Communication + +> "Over time I've learned the biggest source of failure is often due to people and teams. A lack of communication and coordination can cause serious problems." +> — Laurie Barth, [_How architecture improved my coding skills_][4] + +Communication includes verbal, non-verbal, and written communication. Failures along any of these can cause serious problems. Communication failures in tech look like: + + * Delays in resolving incidents + * Redesigning a feature + * Scope creep + * Lack of meaningful comments on pull requests (PRs)—these can be especially impactful to junior engineers + * Unnecessary conflicts and lack of alignment + * Delivering above or below expectations + + + +Cultural norms and personal preferences impact communication. Everybody has a preferred method of communicating, whether that is via email, face-to-face, Slack messages, phone, text, etc. Think about the cultural norms regarding communication in your workplace. Do they match your preferred method of communicating? If there is a mismatch, problems may arise. + +If you're a manager, do you know your direct reports' preferred communication style, or do you just utilize your preferred method? If a direct report prefers email so they can have some time to think before responding and you prefer face-to-face communication, a quick Slack message asking them to come to your office can cause unnecessary anxiety. + +### Empathy + +> "Empathy is much harder than we think… But to build empathy we need to slow down." +> —Andrew Tenzer and Ian Murray, [_The empathy delusion_][5] + +Empathy is one of the most important skills you can learn. Empathy is our ability to understand and share the feelings of others. We feel more connected to one another because of empathy. + +There are four attributes of empathy: + + * Seeing another person's perspective + * Being non-judgmental + * Recognizing emotions in other people + * Communicating your understanding of another person's feelings + + + +Communication and empathy are closely tied. To communicate effectively, you need to listen. To listen effectively, you need empathy. Instead of listening to what a colleague is saying, we usually think about how to best respond. As the adage goes, you have two ears and one mouth for a reason; you should be listening twice as often as you speak. + +When you show empathy towards another person, you are not minimizing their thoughts, feelings, or experiences. Instead of using comments like "it could be worse" or "at least…" use phrases like "that sounds horrible," "I can't imagine how you must feel," or "I'm here for you, how can I help?" + +### Get ready to level-up + +Improving on a skill takes time, but we often give up while we are learning once [impostor syndrome][6] kicks in. It takes years of practice to perfect something, and even with years of practice, you won't be perfect. You will make mistakes. When learning a new skill or improving on an existing skill, mastery—not perfection—should be the goal. Perfection implies there is no room for improvement; mastery indicates learning a skill is an ongoing journey, and there is room to improve. + +You don't want to be a perfect communicator. You want to be a master communicator. Even the most experienced public speakers make mistakes. If you aim for perfection, you will be disappointed. + +To improve a skill, you need to schedule time to practice. But not just any type of practice; to master a skill, use deliberate practice. Deliberate practice has five main components: + + 1. Create a specific goal. + 2. Break the goal down into small steps. + 3. Get feedback from a master. + 4. Step out of your comfort zone. + 5. Stay motivated. + + + +To illustrate this process, say you have a goal of presenting at a conference, but you aren't a confident public speaker. What are some small steps you can take to practice? + + * Identify and reduce the use of filler words like "um," "ah," or "you know." + * Make eye contact when speaking with others or let people know why you don't. + * Control mannerisms like fidgeting with your hands or nodding your head while talking. + * Incorporate appropriate pauses. + + + +Feedback is a necessary part of practicing. Seek out others to provide you with feedback. A great way to step out of your comfort zone and get feedback from master public speakers is to sign up for Toastmasters. This can also help you stay motivated as you work through the speeches towards becoming a Distinguished Toastmaster. + +You can apply this same process to any skill you are looking to master. + +### Where to learn more + +If you want to learn more about empathy and communication so you can level up your career, check out these resources: + + * [Communicating with empathy][7] course by Sharon Steed + * [_Deliberate practice: Your pathway to growth and mastery_][8] by Habits at Work + * [_Want to be more empathetic? Avoid these 7 responses_][9] by Laura Click + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/core-skills-tech-career + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI (Two hands holding a resume with computer, clock, and desk chair ) +[2]: https://medium.com/better-humans/cognitive-bias-cheat-sheet-55a472476b18 +[3]: https://www.penguinrandomhouse.com/books/44330/mindset-by-carol-s-dweck-phd/ +[4]: https://dev.to/laurieontech/how-architecture-improved-my-coding-skills-21e +[5]: https://www.reachsolutions.co.uk/sites/default/files/2019-07/Reach%20Solutions%20The%20Empathy%20Delusion%20V2.pdf +[6]: https://en.wikipedia.org/wiki/Impostor_syndrome +[7]: https://www.lynda.com/Business-Skills-tutorials/Communicating-Empathy/534584-2.html +[8]: https://habitsatwork.com/blog/deliberate-practice +[9]: https://medium.com/@lauraclick/want-to-be-more-empathetic-avoid-these-7-responses-21bb52d5d2ad From 2b4527bfead026ac27f2deb235ba9ad3a3fd5505 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 01:00:03 +0800 Subject: [PATCH 0273/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=20It?= =?UTF-8?q?=E2=80=99s=20the=20end=20for=20Windows=20Server=202008=20suppor?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200116 It-s the end for Windows Server 2008 support.md --- ...the end for Windows Server 2008 support.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/talk/20200116 It-s the end for Windows Server 2008 support.md diff --git a/sources/talk/20200116 It-s the end for Windows Server 2008 support.md b/sources/talk/20200116 It-s the end for Windows Server 2008 support.md new file mode 100644 index 0000000000..35e25fc844 --- /dev/null +++ b/sources/talk/20200116 It-s the end for Windows Server 2008 support.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (It’s the end for Windows Server 2008 support) +[#]: via: (https://www.networkworld.com/article/3513980/it-s-the-end-for-windows-server-2008-support.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +It’s the end for Windows Server 2008 support +====== +Microsoft recommends migrating Server 2008 workloads to Azure cloud services while enterprises modernize their apps for Windows Server 2016 or 2019 deployments. +PaulFleet / Getty Images / Microsoft + +This week's Patch Tuesday marked the end of the line for both Windows 7 and Windows Server 2008 (and 2008 R2). No more fixes will be issued for the two aged operating systems, unless you purchase a pricey extended service license. + +On the Windows 7 front, Microsoft has done a good job getting Windows 10 deployed through its aggressive (perhaps too aggressive) upgrade program. According to StatCounter, Windows 10 now accounts for 65% of the [worldwide desktop Windows market share][1], and Windows 7 is down to 27%. + +**RELATED:** [What to know before upgrading to Windows Server 2019][2] + +But while Windows 7 has gotten all the attention, Server 2008 actually has a larger share of holdouts, and in some ways, its end-of-life milestone is more significant. At last July’s Inspire show, a Microsoft executive said in an interview with cloud storage provider and Microsoft partner Carbonite that [60% of its current Windows Server][3] installed base was running Server 2008, accounting for 24 million instances.  + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +“There are a lot [of customers sticking with Server 2008],” says analyst Tim Crawford of research and advisory firm [AVOA][5]. “You could categorize them into those that either a) use functions specific to WS2008, and b) those that use a version of an application that is only compatible with WS2008. Upgrading is often easier said than done. Especially if the application is a custom app with lots of tentacles.” + +Server 2008 is based on the Windows Vista codebase, which should be reason alone to jettison it. But Windows Server 2016 and Windows Server 2019 are built on Windows 10, which means apps heavily dependent on the OS ecosystem might be hard to move since the internals are so different. + +“I do work with folks that are still running Windows Server 2008. They understand the ramifications of EOL for support. But most are in a predicament where they aren’t able to move the applications for a number of reasons, including application compatibility, location, etc.," Crawford says. + +For those apps that are challenging to move, he recommends isolating the system as much as possible to protect it, and putting in a plan to do what is needed to the applications to prepare them for movement as quickly as possible. + +Microsoft offers and recommends [Azure migration][6], so Server 2008 apps can [run in an Azure instance][7] while they are modernized for Server 2019 and then deployed on premises. + +Migration should be the paramount effort, because if you are running Server 2008 then you're using hardware that's at least eight years old and potentially 12 years old. That’s ancient in technology terms, and if nothing else, the hardware is going to fail. + +One of the headaches for admins is you cannot migrate Server 2008 directly to 2016 or 2019. You have to upgrade to Server 2012 as an intermediate step. So you are better off biting the bullet and migrating the apps to 2019 rather than spending time on two OS migrations. + +Microsoft has provided [resources][8] for Server 2008 users, including a migration guide and help moving to Azure. + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3513980/it-s-the-end-for-windows-server-2008-support.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://gs.statcounter.com/os-version-market-share/windows/desktop/worldwide#monthly-201807-201908 +[2]: https://www.networkworld.com/article/3512020/what-to-know-before-upgrading-from-windows-server-2016-to-server-2019.html +[3]: https://www.carbonite.com/blog/article/2019/07/schuster-azure-migration-and-office-365-top-partner-opportunities +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://avoa.com/ +[6]: https://cloudblogs.microsoft.com/windowsserver/2019/12/17/protect-workloads-still-running-on-windows-server-2008-and-2008-r2/ +[7]: https://www.networkworld.com/article/3300165/microsoft-lures-win-server-2008-users-toward-azure.html +[8]: https://www.microsoft.com/en-us/cloud-platform/windows-server-2008 +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world From b35d90fb14062f4e2edd1e14f7bdd701e57ca236 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 17 Jan 2020 08:46:04 +0800 Subject: [PATCH 0274/3057] translated --- ...eep your email in sync with OfflineIMAP.md | 79 ------------------- ...eep your email in sync with OfflineIMAP.md | 77 ++++++++++++++++++ 2 files changed, 77 insertions(+), 79 deletions(-) delete mode 100644 sources/tech/20200113 Keep your email in sync with OfflineIMAP.md create mode 100644 translated/tech/20200113 Keep your email in sync with OfflineIMAP.md diff --git a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md deleted file mode 100644 index e4e1f1ba94..0000000000 --- a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md +++ /dev/null @@ -1,79 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Keep your email in sync with OfflineIMAP) -[#]: via: (https://opensource.com/article/20/1/sync-email-offlineimap) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Keep your email in sync with OfflineIMAP -====== -Mirroring your email to a local folder is the first step in taming your -message pileup. Learn how in the third article in our series on 20 ways -to be more productive with open source in 2020. -![email or newsletters via inbox and browser][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Sync your email locally with OfflineIMAP - -I have a love/hate relationship with email. I love the way it allows me to communicate with people all over the world. But, like many of you, I get a lot of mail, much of it from lists as well as spammers, advertisers, and the like. And it builds up. - -![The OfflineIMAP "blinkenlights" UI][2] - -Almost all the tools I've tried (outside of the big mail providers) that work really well with large amounts of mail have one thing in common: they all rely on a local copy of your mail stored in [Maildir][3] format. And the most useful tool for that is [OfflineIMAP][4]. OfflineIMAP is a Python script that mirrors IMAP mailboxes to a local Maildir folder tree. I use it to create a local copy of my mail and keep it in sync. Most Linux distributions include it, and it is available via Python's pip package manager. - -The sample minimal configuration file is a good template to start with; begin by copying it to **~/.offlineimaprc**. Mine looks something like this: - - -``` -[general] -accounts = LocalSync -ui=Quiet -autorefresh=30 - -[Account LocalSync] -localrepository = LocalMail -remoterepository = MirrorIMAP - -[Repository MirrorIMAP] -type = IMAP -remotehost = my.mail.server -remoteuser = myusername -remotepass = mypassword -auth_mechanisms = LOGIN -createfolder = true -ssl = yes -sslcacertfile = OS-DEFAULT - -[Repository LocalMail] -type = Maildir -localfolders = ~/Maildir -sep = . -createfolder = true -``` - -What my configuration does is define two repositories: the remote IMAP server and the local Maildir folder. There is also the **Account** that tells OfflineIMAP what to sync when it runs. You can define multiple accounts linked to different repositories. This allows you to copy from one IMAP server to another as a backup, in addition to making a copy locally. - -The first run of OfflineIMAP will take a while if you have a lot of mail. But once it is done, future runs take a _lot_ less time. You can also run OfflineIMAP as a cron job (my preference) or as a daemon constantly syncing between repositories. The documentation covers all of this, as well as advanced configuration options for things like Gmail. - -Now that my mail is copied locally, there is a whole range of tools I can work with to speed up searching, filing, and managing mail. And I'll talk about that tomorrow. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/sync-email-offlineimap - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) -[2]: https://opensource.com/sites/default/files/uploads/productivity_3-1.png (The OfflineIMAP "blinkenlights" UI) -[3]: https://en.wikipedia.org/wiki/Maildir -[4]: http://www.offlineimap.org/ diff --git a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md b/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md new file mode 100644 index 0000000000..c5b20565ad --- /dev/null +++ b/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keep your email in sync with OfflineIMAP) +[#]: via: (https://opensource.com/article/20/1/sync-email-offlineimap) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 OfflineIMAP 同步邮件 +====== +将邮件镜像保存到本地是整理消息的第一步。在我们的 20 个使用开源提升生产力的系列的第三篇文章中了解该如何做。 +![email or newsletters via inbox and browser][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 OfflineIMAP 在本地同步你的邮件 + +我与邮件之间存在爱恨交织的关系。我喜欢它让我与世界各地的人交流的方式。但是,像你们中的许多人一样,我收到过很多邮件,许多是来自列表中的人,但也有很多垃圾邮件、广告等。这些积累了很多。 + +![The OfflineIMAP "blinkenlights" UI][2] + +我尝试过的大多数工具(除了大型提供商外)都可以很好地处理大量邮件,它们都有一个共同点:它们都依赖于以 [Maildir][3] 格式存储的本地邮件副本。这其中最有用的是 [OfflineIMAP][4]。OfflineIMAP 是将 IMAP 邮箱镜像到本地 Maildir 文件夹树的 Python 脚本。我用它来创建邮件的本地副本并使其保持同步。大多数 Linux 发行版都包含它,并且可以通过 Python 的 pip 包管理器获得。 + +示例的最小配置文件是一个很好的模板。首先将其复制到 **~/.offlineimaprc**。我的看起来像这样: + + +``` +[general] +accounts = LocalSync +ui=Quiet +autorefresh=30 + +[Account LocalSync] +localrepository = LocalMail +remoterepository = MirrorIMAP + +[Repository MirrorIMAP] +type = IMAP +remotehost = my.mail.server +remoteuser = myusername +remotepass = mypassword +auth_mechanisms = LOGIN +createfolder = true +ssl = yes +sslcacertfile = OS-DEFAULT + +[Repository LocalMail] +type = Maildir +localfolders = ~/Maildir +sep = . +createfolder = true +``` + +我的配置要做的是定义两个仓库:远程 IMAP 服务器和本地 Maildir 文件夹。还有一个**帐户**,告诉 OfflineIMAP 运行时要同步什么。你可以定义链接到不同仓库的多个帐户。除了本地复制外,这还允许你从一台 IMAP 服务器复制到另一台作为备份。 + +如果你有很多邮件,那么首次运行 OfflineIMAP 将花费一些时间。但是完成后,下次会花_少得多_的时间。你也可以将 CoffeeIMAP 作为 cron 任务(我的偏好)或作为守护程序在仓库之间不断进行同步。文档涵盖了所有这些内容以及 Gmail 等高级配置选项。 + +现在,我的邮件已在本地复制,并有多种工具用来加快搜索、归档和管理邮件的速度。我明天再说。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-email-offlineimap + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) +[2]: https://opensource.com/sites/default/files/uploads/productivity_3-1.png (The OfflineIMAP "blinkenlights" UI) +[3]: https://en.wikipedia.org/wiki/Maildir +[4]: http://www.offlineimap.org/ From 9dfc0a080c560f1cd4bbf5d2173c69d6c356f8f8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 17 Jan 2020 09:28:45 +0800 Subject: [PATCH 0275/3057] translating --- ... Organize and sync your calendar with khal and vdirsyncer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md index b78ad493af..effad6fb4e 100644 --- a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md +++ b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f04ac3c25fd61823705aac4b076cd41ee56527a7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 17 Jan 2020 10:45:51 +0800 Subject: [PATCH 0276/3057] Rename sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md to sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md --- ... into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md (100%) diff --git a/sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md similarity index 100% rename from sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md rename to sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md From c13b2636adb22867839ef49e7608fac6516f1915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 17 Jan 2020 21:24:37 +0800 Subject: [PATCH 0277/3057] Translated --- ...5 How to Add Border Around Text in GIMP.md | 139 ------------------ ...5 How to Add Border Around Text in GIMP.md | 139 ++++++++++++++++++ 2 files changed, 139 insertions(+), 139 deletions(-) delete mode 100644 sources/tech/20191215 How to Add Border Around Text in GIMP.md create mode 100644 translated/tech/20191215 How to Add Border Around Text in GIMP.md diff --git a/sources/tech/20191215 How to Add Border Around Text in GIMP.md b/sources/tech/20191215 How to Add Border Around Text in GIMP.md deleted file mode 100644 index 0b2e3858f2..0000000000 --- a/sources/tech/20191215 How to Add Border Around Text in GIMP.md +++ /dev/null @@ -1,139 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Add Border Around Text in GIMP) -[#]: via: (https://itsfoss.com/gimp-text-outline/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Add Border Around Text in GIMP -====== - -This simple tutorial explains the steps to outline text in [GIMP][1]. The text outline helps you highlight text against background of other color. - -![Outlined Text created in GIMP][2] - -Let’s see how can you add a border around your text. - -### Adding text outline in GIMP - -The entire procedure can be described in these easy steps: - - * Create your text and copy its outlined path - * Add a new transparent layer and add the outlined path to this layer - * Change the size of the outline, add a different color to it - - - -That’s all. Don’t worry, I am going to show each steps in detail with proper screenshots. By following this tutorial, you should be able to add outline to text even if you never used GIMP before. - -Just make sure that you have [GIMP installed on Linux][3] or whatever operating system you are using. - -This tutorial has been performed with GIMP 2.10 version. - -#### Step 1: Create your primary text and copy its outline - -Open GIMP and create a new file by going to the top menu->File->New. You can also use Ctrl+N keyboard shortcut. - -![Create New File][4] - -You can select the size of your canvas here. You may also choose if you want white background or a transparent background. It is under the Advanced Options->Color profile. - -I have chosen the default white background. It can be changed later. - -Now select the Text tool from the toolbox in the left sidebar. - -![Adding text in GIMP][5] - -Write the text you want. You can change the font, size and alignment of the text as per your choice. I have kept the default left alignment of the text for this article. - -I have deliberately chose a light color for the text so that it is difficult to read. I’ll add a darker outline to this light text in this tutorial. - -![Text added in GIMP][6] - -When you are done writing your text, right click the text box and select **Path from Text**. - -![Right click on the text box and select ‘Path from Text’][7] - -#### Step 2: Add a transparent layer with the text outline - -Now, go to the top menu, go to Layer and add a new layer. - -![Use Shift+Ctrl+N to add a new layer][8] - -Make sure to add the new layer as transparent. You can give it a suitable name like ‘outline for text’. Click OK to add this transparent layer. - -![Add a transparent layer][9] - -Go to the menu again and this time go to **Select** and click **From path**. You’ll see that your text has been highlighted. - -![Go to Select and choose From Path][10] - -Basically, you just created a transparent layer that has the same text (but transparent) as your original text. What you need to do now is to increase the size of the text on this layer. - -#### Step 3: Adding the text outline by increasing its size and changing its color - -To do that, go to Select in menu once again and this time choose Grow. This will allow you to grow the size of the text on the transparent layer. - -![Grow the selection on the additional layer][11] - -Grow it by 5 or 10 pixel or whatever you prefer. - -![Grow it by 5 or 10 pixel][12] - -What you need to do now is to fill this enlarged selection with a choice of your color. Since my original text is of light color, I am going to use back color for the outline here. - -**Select your main image layer** if it’s not already selected. The layers are visible at the right sidebar. Then go to the toolbox and select the bucket fill tool. Select the desired color you want for the outline. - -Now use the tool to fill black color to your selection. Mind that you fill the outer outline of the text, not the text itself. - -![Fill the outline of the text with a different color][13] - -You are pretty much done here. Use Ctrl+Shift+A to de-select your current selection. - -![Outline added to the text][14] - -So now you have successfully added outline to your text in GIMP. It is on white background and if you want a transparent background, just delete the background layer from the layer menu in the right sidebar. - -![Remove the white background layer if you want a transparent background][15] - -If you are happy with the result, save the file as PNG file (to keep transparent background) or whichever file format you prefer. - -**Did you make it work?** - -That’s it. That’s all you need to do to add a text outline in GIMP. - -I hope you find this GIMP tutorial helpful. You may want to check out another [simple tutorial about adding a watermark in GIMP][16]. - -If you have questions or suggestions, please feel free to leave a comment below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gimp-text-outline/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://www.gimp.org/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outlined_text_GIMP.png?ssl=1 -[3]: https://itsfoss.com/gimp-2-10-release/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/create_outline_text_gimp_1.jpeg?ssl=1 -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_2.jpg?ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp-3.jpg?ssl=1 -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_4.jpg?ssl=1 -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_5.jpg?ssl=1 -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_6.jpg?ssl=1 -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_7.jpg?ssl=1 -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_8.jpg?ssl=1 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_9.jpg?ssl=1 -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_10.jpg?ssl=1 -[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_11.jpg?ssl=1 -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_12.jpg?ssl=1 -[16]: https://itsfoss.com/add-watermark-gimp-linux/ diff --git a/translated/tech/20191215 How to Add Border Around Text in GIMP.md b/translated/tech/20191215 How to Add Border Around Text in GIMP.md new file mode 100644 index 0000000000..651a53fffb --- /dev/null +++ b/translated/tech/20191215 How to Add Border Around Text in GIMP.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Add Border Around Text in GIMP) +[#]: via: (https://itsfoss.com/gimp-text-outline/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 GIMP 中如何在文本周围添加边框 +====== + +这个简单的教程阐明了在 [GIMP][1] 中显示文本的轮廓的步骤。文本轮廓帮助你在其它颜色下高亮显示文本。 + +![Outlined Text created in GIMP][2] + +让我们看看如何在你的文本周围添加一个边框。 + +### 在 GIMP 中添加文本轮廓 + +整个过程可以用这些简单的步骤描述: + + * 创建文本,并复制它的轮廓路径 + * 添加一层新的透明层,并添加轮廓路径到透明层中 + * 更改轮廓的大小,给它添加一种不同的颜色 + + + +这就是全部的东西。不用担心,我将使用适当地截图详细的展示每个步骤。按照这个教程,你应该能够为文本添加轮廓,即使你在此之前从未使用过 GIMP 。 + +仅需要确保你已经 [在 Linux 上安装 GIMP][3] 或者你正在使用的任何操作。 + +这篇教程在 GIMP 2.10 版本下演示。 + +#### 步骤 1: 创建你的主要文本,并复制它的轮廓 + +打开 GIMP ,并通过转到 菜单 -> 文件 -> 新建 来创建一个新的文件。你应该可以使用 Ctrl+N 键盘快捷键。 + +![Create New File][4] + +你可以在这里选择画布的大小。你也可以选择要白色背景或一种透明背景。它在 高级选项 -> 颜色 配置文件下。 + +我选择默认的白色背景。它在以后能够更改。 + +现在从左边栏的工具箱中选择文本工具。 + +![Adding text in GIMP][5] + +写你想的文本。你可以根据你的选择以更改文本的字体,大小和对齐方式。我保持这篇文章的文本的默认左对齐。 + +我故意为文本选择一种浅色,以便难于阅读。在这篇教程中我将添加一个深色轮廓到这个浅色的文本。 + +![Text added in GIMP][6] + +当你写完文本后,右键文本框并选择 **文本的路径** 。 + +![Right click on the text box and select ‘Path from Text’][7] + +#### 步骤 2: 添加一个带有文本轮廓的透明层 + +现在,转到顶部菜单,转到 层 ,并添加一个新层。 + +![Use Shift+Ctrl+N to add a new layer][8] + +确保添加新层为透明的。你可以给它一个合适的名称,像 ‘文本大纲’。单击确定来添加这个透明层。 + +![Add a transparent layer][9] + +再次转到菜单,这次转到 **选择** ,并单击 **来自路径** 。你将看到你的文本应该被高亮显示。 + +![Go to Select and choose From Path][10] + +总的来说,你只创建一个透明层,它有像你的原文一样相同的文本(但是透明)。现在你需要做的是在这个层上增加文本的大小。 + +#### 步骤· 3: 通过增加它的大小和更改它的颜色来添加文本轮廓 + +为此,再次在菜单中转到 选择 ,这次选择 增加。这将允许增大透明层上的文本的大小。 + +![Grow the selection on the additional layer][11] + +以 5 或 10 像素增加,或者你喜欢的任意像素。 + +![Grow it by 5 or 10 pixel][12] + +你选择需要做是使用一种你选择的颜色来填充这个扩大的选择区。因为我的原文是浅色,在这里我将为轮廓使用背景色。 + +如果尚未选择的话,先 **选择你的主图像层** 。这些层在右侧栏中可视。然后转到工具箱并选择油漆桶工具。为你的轮廓选择想要的颜色。 + +选择使用该工具来填充黑色到你的选择区。记住。你填充文本外部的轮廓,而不是文本本身。 + +![Fill the outline of the text with a different color][13] + +在这里你完成了很多。使用 Ctrl+Shift+A 来取消你当前的选择区。 + +![Outline added to the text][14] + +如此,你现在已经在 GIMP 中成功地添加轮廓到你的文本。它是在白色背景中,如果你想要一个透明背景,只需要在右侧栏的图层菜单中删除背景层。 + +![Remove the white background layer if you want a transparent background][15] + +如果你对结果感到满意,保存文件未 PNG 文件(来保留透明背景),或你喜欢的任何文件格式。 + +**你使它工作了吗?** + +就这样。这就是你在 GIMP 中为添加一个文本轮廓而需要做的全部工作。 + +我希望你发现这个 GIMP 教程有帮助。你可能想查看另一个 [关于在 GIMP 中添加一个水印的简单教程][16]。 + +如果你有问题或建议,请在下面自由留言。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gimp-text-outline/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outlined_text_GIMP.png?ssl=1 +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/create_outline_text_gimp_1.jpeg?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_2.jpg?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp-3.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_4.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_5.jpg?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_6.jpg?ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_7.jpg?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_8.jpg?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_9.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_10.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_11.jpg?ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_12.jpg?ssl=1 +[16]: https://itsfoss.com/add-watermark-gimp-linux/ From bb536cf07e09b0fc01e3d6b4b8f76df2aa7c06c8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:56:02 +0800 Subject: [PATCH 0278/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200118=203=20?= =?UTF-8?q?Methods=20to=20Install=20the=20Latest=20PHP=207=20Package=20on?= =?UTF-8?q?=20CentOS/RHEL=207=20and=20CentOS/RHEL=206?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md --- ...kage on CentOS-RHEL 7 and CentOS-RHEL 6.md | 227 ++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md diff --git a/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md b/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md new file mode 100644 index 0000000000..09b2f4ca73 --- /dev/null +++ b/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6) +[#]: via: (https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6 +====== + +PHP is the most popular open-source general-purpose scripting language and is widely used for web development. + +It’s part of the LAMP stack application suite and is used to create dynamic websites. + +Popular CMS applications WordPress, Joomla and Drupal are developed in PHP language. + +These applications require PHP 7 for their installation and configuration. + +PHP 7 loads your web application faster and consumes less server resources. + +By default the CentOS/RHEL 6 operating system provides PHP 5.3 in their official repository and CentOS/RHEL 7 provides PHP 5.4. + +In this article we will show you how to install the latest version of PHP on CentOS/RHEL 7 and CentOS/RHEL 6 systems. + +This can be done by adding the necessary **[additional third-party RPM repository][1]** to the system. + +### Method-1 : How to Install PHP 7 on CentOS 6/7 Using the Software Collections Repository (SCL) + +The SCL repository is now maintained by a CentOS SIG, which rebuilds the Red Hat Software Collections and also provides some additional packages of their own. + +It contains newer versions of various programs that can be installed alongside existing older packages and invoked by using the scl command. + +Run the following **[yum command][2]** to install Software Collections Repository (SCL) on CentOS + +``` +# yum install centos-release-scl +``` + +Run the following command to verify the PHP 7 version available in the scl repository. + +``` +# yum --disablerepo="*" --enablerepo="centos-sclo-rh" list *php + +Loaded plugins: fastestmirror, langpacks +Loading mirror speeds from cached hostfile +centos-sclo-rh: centos.mirrors.estointernet.in +Available Packages +php54-php.x86_64 5.4.40-4.el7 centos-sclo-rh +php55-php.x86_64 5.5.21-5.el7 centos-sclo-rh +rh-php70-php.x86_64 7.0.27-2.el7 centos-sclo-rh +rh-php71-php.x86_64 7.1.30-2.el7 centos-sclo-rh +rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh +``` + +Run the command below to install the PHP 7.2 on your system from scl. + +``` +# yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php +``` + +If you need to install additional modules for PHP 7.2, you can install them by running the command format below. For instance, you can install the **“gd”** and **“pdo”** packages by executing the command below. + +``` +# yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php-gd rh-php72-php-pdo +``` + +### Method-1a : How to Install PHP 7 on RHEL 7 Using the Software Collections Repository (SCL) + +For Red Hat 7, enable the following repositories to install the latest PHP 7 package. + +``` +# sudo subscription-manager repos --enable rhel-7-server-extras-rpms +# sudo subscription-manager repos --enable rhel-7-server-optional-rpms +# sudo subscription-manager repos --enable rhel-server-rhscl-7-rpms +``` + +Run the command below to search the available PHP 7 version from the RHSCL repository. + +``` +# yum search rh-php* +``` + +You can easily install PHP 7.3 on the RHEL 7 machine by running the command below from the RHSCL repository. + +``` +# yum install rh-php73 +``` + +### Method-2 : How to Install PHP 7 on CentOS 6/7 Using the Remi Repository + +The **[Remi repository][3]** stores and maintains the latest version of PHP packages with a large collection of libraries, extensions and tools. Some of them are back-ported from Fedora and EPEL. + +This is a CentOS community-recognized repository and doesn’t modify or affect any underlying packages. + +As a prerequisite, this installs the **[EPEL repository][4]** if it is not already installed on your system. + +You can easily find the available version of the PHP 7 package from the Remy repository because it adds a separate repo to each version. You can view them using the **[ls command][5]**. + +``` +# ls -lh /etc/yum.repos.d/remi-php* + +-rw-r--r--. 1 root root 456 Sep 6 01:31 /etc/yum.repos.d/remi-php54.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php70.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php71.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php72.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php73.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php74.repo +``` + +You can easily install PHP 7.4 on the CentOS 6/7 systems by running the command below from the remi repository. + +``` +# yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo +``` + +### Method-2a : How to Install PHP 7 on RHEL 7 Using the Remi Reposiotry + +For Red Hat 7, install the following repositories to install the latest PHP 7 package. + +To install EPEL Repository on RHEL 7 + +``` +# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm +``` + +To install Remi Repository on RHEL 7 + +``` +# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm +``` + +To enable the optional RPMS repository. + +``` +# subscription-manager repos --enable=rhel-7-server-optional-rpms +``` + +You can easily install PHP 7.4 on the RHEL 7 systems by running the below command from the remi repository. + +``` +# yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo +``` + +To verify the PHP 7 installation, run the following command + +``` +# php -v + +PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS ) +Copyright (c) The PHP Group +Zend Engine v3.4.0, Copyright (c) Zend Technologies +``` + +### Method-3 : How to Install PHP 7 on CentOS 6/7 Using the IUS Community Repository + +IUS Community is a CentOS Community Approved third-party RPM repository which contains latest upstream versions of PHP, Python, MySQL, etc.., packages for Enterprise Linux (RHEL & CentOS) 5, 6 & 7. + +**[IUS Community Repository][6]** have dependency with EPEL Repository so we have to install EPEL repository prior to IUS repository installation. Follow the below steps to install & enable EPEL & IUS Community Repository to RPM systems and install the packages. + +EPEL package is included in the CentOS Extras repository and enabled by default so, we can install this by running below command. + +``` +# yum install epel-release +``` + +Download IUS Community Repository Shell script + +``` +# curl 'https://setup.ius.io/' -o setup-ius.sh + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed +100 1914 100 1914 0 0 6563 0 --:--:-- --:--:-- --:--:-- 133k +``` + +Install/Enable IUS Community Repository. + +``` +# sh setup-ius.sh +``` + +Run the following command to check available PHP 7 version in the IUS repository. + +``` +# yum --disablerepo="*" --enablerepo="ius" list *php7* + +Loaded plugins: fastestmirror, langpacks +Loading mirror speeds from cached hostfile +Available Packages +mod_php71u.x86_64 7.1.33-1.el7.ius ius +mod_php72u.x86_64 7.2.26-1.el7.ius ius +mod_php73.x86_64 7.3.13-1.el7.ius ius +php71u-bcmath.x86_64 7.1.33-1.el7.ius ius +php71u-cli.x86_64 7.1.33-1.el7.ius ius +php71u-common.x86_64 7.1.33-1.el7.ius ius +php71u-dba.x86_64 7.1.33-1.el7.ius ius +php71u-dbg.x86_64 7.1.33-1.el7.ius ius +php71u-devel.x86_64 7.1.33-1.el7.ius ius +php71u-embedded.x86_64 7.1.33-1.el7.ius ius +``` + +You can easily install PHP 7.3 on the CentOS 6/7 systems by running the command below from the IUS Community repository. + +``` +# yum --disablerepo="*" --enablerepo="ius" install php73-common php73-cli php73-gd php73-gd php73-mysqlnd php73-ldap php73-soap php73-mbstring +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/8-additional-thirdparty-yum-repositories-centos-rhel-fedora-linux/ +[2]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[3]: https://www.2daygeek.com/install-enable-remi-repository-on-centos-rhel-fedora-linux/ +[4]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-oracle-linux/ +[5]: https://www.2daygeek.com/linux-unix-ls-command-display-directory-contents/ +[6]: https://www.2daygeek.com/install-enable-ius-community-repository-on-rhel-centos/ From 86cf00ad6506bc9ae7f7d99dc8e0db768ac2a28d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:56:34 +0800 Subject: [PATCH 0279/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Fedo?= =?UTF-8?q?ra=20CoreOS=20out=20of=20preview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Fedora CoreOS out of preview.md --- .../20200117 Fedora CoreOS out of preview.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20200117 Fedora CoreOS out of preview.md diff --git a/sources/tech/20200117 Fedora CoreOS out of preview.md b/sources/tech/20200117 Fedora CoreOS out of preview.md new file mode 100644 index 0000000000..d7a1393cde --- /dev/null +++ b/sources/tech/20200117 Fedora CoreOS out of preview.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora CoreOS out of preview) +[#]: via: (https://fedoramagazine.org/fedora-coreos-out-of-preview/) +[#]: author: (bgilbert https://fedoramagazine.org/author/bgilbert/) + +Fedora CoreOS out of preview +====== + +![The Fedora CoreOS logo on a gray background.][1] + +The Fedora CoreOS team is pleased to announce that Fedora CoreOS is now [available for general use][2]. + +Fedora CoreOS is a new Fedora Edition built specifically for running containerized workloads securely and at scale. It’s the successor to both [Fedora Atomic Host][3] and [CoreOS Container Linux][4] and is part of our effort to explore new ways of assembling and updating an OS. Fedora CoreOS combines the provisioning tools and automatic update model of Container Linux with the packaging technology, OCI support, and SELinux security of Atomic Host.  For more on the Fedora CoreOS philosophy, goals, and design, see the [announcement of the preview release][5]. + +Some highlights of the current Fedora CoreOS release: + + * [Automatic updates][6], with staged deployments and phased rollouts + * Built from Fedora 31, featuring: + * Linux 5.4 + * systemd 243 + * Ignition 2.1 + * OCI and Docker Container support via Podman 1.7 and Moby 18.09 + * cgroups v1 enabled by default for broader compatibility; cgroups v2 available via configuration + + + +Fedora CoreOS is available on a variety of platforms: + + * Bare metal, QEMU, OpenStack, and VMware + * Images available in all public AWS regions + * Downloadable cloud images for Alibaba, AWS, Azure, and GCP + * Can run live from RAM via ISO and PXE (netboot) images + + + +Fedora CoreOS is under active development.  Planned future enhancements include: + + * Addition of the _next_ release stream for extended testing of upcoming Fedora releases. + * Support for additional cloud and virtualization platforms, and processor architectures other than _x86_64_. + * Closer integration with Kubernetes distributions, including [OKD][7]. + * [Aggregate statistics collection][8]. + * Additional [documentation][9]. + + + +### Where do I get it? + +To try out the new release, head over to the [download page][10] to get OS images or cloud image IDs.  Then use the [quick start guide][11] to get a machine running quickly. + +### How do I get involved? + +It’s easy!  You can report bugs and missing features to the [issue tracker][12]. You can also discuss Fedora CoreOS in [Fedora Discourse][13], the [development mailing list][14], in _#fedora-coreos_ on Freenode, or at our [weekly IRC meetings][15]. + +### Are there stability guarantees? + +In general, the Fedora Project does not make any guarantees around stability.  While Fedora CoreOS strives for a high level of stability, this can be challenging to achieve in the rapidly evolving Linux and container ecosystems.  We’ve found that the incremental, exploratory, forward-looking development required for Fedora CoreOS — which is also a cornerstone of the Fedora Project as a whole — is difficult to reconcile with the iron-clad stability guarantee that ideally exists when automatically updating systems. + +We’ll continue to do our best not to break existing systems over time, and to give users the tools to manage the impact of any regressions.  Nevertheless, automatic updates may produce regressions or breaking changes for some use cases. You should make your own decisions about where and how to run Fedora CoreOS based on your risk tolerance, operational needs, and experience with the OS.  We will continue to announce any major planned or unplanned breakage to the [coreos-status mailing list][16], along with recommended mitigations. + +### How do I migrate from CoreOS Container Linux? + +Container Linux machines cannot be migrated in place to Fedora CoreOS.  We recommend [writing a new Fedora CoreOS Config][11] to provision Fedora CoreOS machines.  Fedora CoreOS Configs are similar to Container Linux Configs, and must be passed through the Fedora CoreOS Config Transpiler to produce an Ignition config for provisioning a Fedora CoreOS machine. + +Whether you’re currently provisioning your Container Linux machines using a Container Linux Config, handwritten Ignition config, or cloud-config, you’ll need to adjust your configs for differences between Container Linux and Fedora CoreOS.  For example, on Fedora CoreOS network configuration is performed with [NetworkManager key files][17] instead of _systemd-networkd_, and time synchronization is performed by _chrony_ rather than _systemd-timesyncd_.  Initial migration documentation will be [available soon][9] and a skeleton list of differences between the two OSes is available in [this issue][18]. + +CoreOS Container Linux will be maintained for a few more months, and then will be declared end-of-life.  We’ll announce the exact end-of-life date later this month. + +### How do I migrate from Fedora Atomic Host? + +Fedora Atomic Host has already reached end-of-life, and you should migrate to Fedora CoreOS as soon as possible.  We do not recommend in-place migration of Atomic Host machines to Fedora CoreOS. Instead, we recommend [writing a Fedora CoreOS Config][11] and using it to provision new Fedora CoreOS machines.  As with CoreOS Container Linux, you’ll need to adjust your existing cloud-configs for differences between Fedora Atomic Host and Fedora CoreOS. + +Welcome to Fedora CoreOS.  Deploy it, launch your apps, and let us know what you think! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-coreos-out-of-preview/ + +作者:[bgilbert][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/bgilbert/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/introducing-fedora-coreos-816x345.png +[2]: https://getfedora.org/coreos/ +[3]: https://www.projectatomic.io/ +[4]: https://coreos.com/os/docs/latest/ +[5]: https://fedoramagazine.org/introducing-fedora-coreos/ +[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/auto-updates/ +[7]: https://www.okd.io/ +[8]: https://github.com/coreos/fedora-coreos-pinger/ +[9]: https://docs.fedoraproject.org/en-US/fedora-coreos/ +[10]: https://getfedora.org/coreos/download/ +[11]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ +[12]: https://github.com/coreos/fedora-coreos-tracker/issues +[13]: https://discussion.fedoraproject.org/c/server/coreos +[14]: https://lists.fedoraproject.org/archives/list/coreos@lists.fedoraproject.org/ +[15]: https://github.com/coreos/fedora-coreos-tracker#meetings +[16]: https://lists.fedoraproject.org/archives/list/coreos-status@lists.fedoraproject.org/ +[17]: https://developer.gnome.org/NetworkManager/stable/nm-settings-keyfile.html +[18]: https://github.com/coreos/fedora-coreos-tracker/issues/159 From fd50af186aec8e3b1fe58a37b07c847cdad76626 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:57:15 +0800 Subject: [PATCH 0280/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200118=20Zori?= =?UTF-8?q?n=20Grid=20Lets=20You=20Remotely=20Manage=20Multiple=20Zorin=20?= =?UTF-8?q?OS=20Computers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md --- ...tely Manage Multiple Zorin OS Computers.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md diff --git a/sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md b/sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md new file mode 100644 index 0000000000..184b68d84e --- /dev/null +++ b/sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers) +[#]: via: (https://itsfoss.com/zorin-grid/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers +====== + +One of the major hurdles institutes face is in managing and updating multiple Linux systems from a central point. + +Well, Zorin OS has come up with a new cloud-based tool that will help you manage multiple computers running Zorin OS from one single interface. You can update the systems, install apps and configuration all systems remotely using this tool called [Zorin Grid][1]. + +### Zorin Grid: Manage a fleet of Zorin OS computers remotely + +![][2] + +**Zorin Grid is a tool that makes it simple to set up, manage, and secure a fleet of Zorin OS-powered computers in businesses, schools, and organizations.** + +When it comes to managing Linux distributions (here, Zorin OS) on a multitude of systems for an organization – it is quite time-consuming. + +If it will be easier to manage Linux systems, more organizations will be interested to switch using Linux just like the [Italian city Vicenza replaced Windows by Zorin OS][3]. + +For the very same reason, the Zorin team decided to create ‘**Zorin Grid**‘ with the help of which every school, enterprises, organizations, and businesses will be able to easily manage their Zorin OS-powered machines. + +### Zorin Grid features + +![Zorin Grid Features][4] + +You might have guessed what it is capable of – but let me highlight the key features of Zorin Grid as per its official webpage: + + * Install and Remove Apps + * Set software update and security patch policies + * Monitor computer status + * Enforce security policies + * Keep track of software and hardware inventory + * Set desktop settings + * Organize computers into groups (for teams and departments) + * Role-based access control and audit logging + + + +In addition to these, you will be able to do a couple more things using the Zorin Grid service. But, it looks like most of the essential tasks will be covered by Zorin Grid. + +### How does Zorin Grid work? + +![][5] + +Zorin Grid is a cloud based software as a service. Zorin will be charging a monthly subscription fee for each computer managed by Zorin Grid in an organization. + +You’ll have to install the Zorin Grid client on all the systems that you want to manage. Since it is cloud-based, you can manage all the Zorin systems on your grid from a web browser by logging into you Zorin Grid account. + +You choose how to configure the computers once and the Zorin Grid applies the same configuration to all or specific computers in your organization. + +The price has not been finalized. [Artyom Zorin][6], **CEO of Zorin Group, told It’s FOSS** that schools and non-profit organizations will get Zorin Grid for a reduced pricing. + +While client-side software for Zorin Grid will be open source, the Zorin Grid server won’t be open source initially. Releasing it under an open source license is _tentatively_ on their roadmap. + +Artyom also told that they **plan to support other Linux distributions starting with Ubuntu and Ubuntu-based distros** after launching Zorin Grid for Zorin OS systems this summer. + +In case you decide to migrate from Windows to Zorin OS for your organization or business, you will find a [useful migration guide][7] by the Zorin OS team to help you switch to Linux. + +[Zorin Grid][1] + +**Wrapping Up** + +Let me summarize all the important points about Zorin Grid: + + * Zorin Grid is an upcoming cloud based service that lets you manage multiple Zorin OS systems. + * It’s a premium service that charges for each computer used. The pricing is not determined yet. + * Educational institutes and non-profit organizations can get Zorin Grid for a reduced pricing. + * Initially it can only handle Zorin OS. Other Ubuntu-based distributions are on the road-map but there is no definite timeline for that. + * The service should be available in the summer 2020. + * Zorin Grid server won’t be open source initially. + + + +Zorin Grid looks to be an impressive premium tool for organizations or businesses that want to use Linux while also being able to maintain their systems easily. + +Personally, I wouldn’t mind paying for the service if it makes deploying and using Linux easier, in general. + +Of course, it does not support every Linux distro as of yet – but it is indeed a promising service to keep an eye out for. + +What do you think about it? Do you know of a better alternative to Zorin Grid? Do share your views in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zorin-grid/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://zorinos.com/grid/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/zorin-grid-dashboard.png?ssl=1 +[3]: https://itsfoss.com/vicenza-windows-zorin/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/zorin_grid_features.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/zorin-os-computers.jpg?ssl=1 +[6]: https://itsfoss.com/zorin-os-interview/ +[7]: https://zorinos.com/help/switch-your-organization-to-zorin-os/ From b00a27d56a436d40fadb088a4a451e02043fb09b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:58:02 +0800 Subject: [PATCH 0281/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Get?= =?UTF-8?q?=20started=20with=20this=20open=20source=20to-do=20list=20manag?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Get started with this open source to-do list manager.md --- ...ith this open source to-do list manager.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20200117 Get started with this open source to-do list manager.md diff --git a/sources/tech/20200117 Get started with this open source to-do list manager.md b/sources/tech/20200117 Get started with this open source to-do list manager.md new file mode 100644 index 0000000000..57c9061179 --- /dev/null +++ b/sources/tech/20200117 Get started with this open source to-do list manager.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with this open source to-do list manager) +[#]: via: (https://opensource.com/article/20/1/open-source-to-do-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Get started with this open source to-do list manager +====== +Todo is a powerful way to keep track of your task list. Learn how to use +it in the seventh in our series on 20 ways to be more productive with +open source in 2020. +![Team checklist][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Track your tasks with todo + +Tasks and to-do lists are very near and dear to my heart. I'm a big fan of productivity (so much so that I do a [podcast][2] about it) and try all sorts of different applications. I've even [given presentations][3] and [written articles][4] about them. So it only makes sense that, when I talk about being productive, task and to-do list tools are certain to come up. + +![Getting fancy with Todo.txt][5] + +In all honesty, for being simple, cross-platform, and easily synchronized, you cannot go wrong with [todo.txt][6]. It is one of the two to-do list and task management apps that I keep coming back to over and over again (the other is [Org mode][7]). And what keeps me coming back is that it is simple, portable, understandable, and has many great add-ons that don't break it if one machine has them and the others don't. And since it is a Bash shell script, I have never found a system that cannot support it. + +#### Set up todo.txt + +First things first, you need to install the base shell script and copy the default configuration file to the **~/.todo** directory: + + +``` +git clone +cd todo.txt-cli +make +sudo make install +mkdir ~/.todo +cp todo.cfg ~/.todo/config +``` + +Next, set up the configuration file. I like to uncomment the color settings at this point, but the only thing that must be set up right away is the **TODO_DIR** variable: + + +``` +`export TODO_DIR="$HOME/.todo"` +``` + +#### Add to-do's + +To add your first to-do item, simply type **todo.sh add <NewTodo>**, and it will be added. This will also create three files in **$HOME/.todo/**: todo.txt, done.txt, and reports.txt. + +After adding a few items, run **todo.sh ls** to see your to-do list. + +![Basic todo.txt list][8] + +#### Manage your tasks + +You can improve it a little by prioritizing the items. To add a priority to an item, run **todo.sh pri # A**. The number is the number of the task on the list, and the letter "A" is the priority. You can set the priority as anything from A to Z since that's how it will get sorted. + +To complete a task, run **todo.sh do #** to mark the item done and move the item to done.txt. Running **todo.sh report** will write a count of done and not done items to reports.txt. + +The file format used for all three files is well documented, so you can make changes with your text editor of choice. The basic format of todo.txt is: + + +``` +`(Priority) YYYY-MM-DD Task` +``` + +The date indicates the due date of a task, if one is set. When editing the file manually, just put an "x" in front of the task to mark it as done. Running **todo.sh archive** will move these items to done.txt, and you can work in that text file and archive the done items when you have time. + +#### Set up recurring tasks + +I have a lot of recurring tasks that I need to schedule every day/week/month. + +![Recurring tasks with the ice_recur add-on][9] + +This is where todo.txt's flexibility comes in. By using [add-ons][10] in **~/.todo.actions.d/**, you can add commands and extend the functionality of the base todo.sh. The add-ons are basically scripts that implement specific commands. For recurring tasks, the plugin [ice_recur][11] should fit the bill. By following the instructions on the page, you can set up tasks to recur in a very flexible manner. + +![Todour on MacOS][12] + +There are a lot of add-ons in the directory, including syncing to some cloud services. There are also links to desktop and mobile apps, so you can keep your to-do list with you on the go. + +I've only scratched the surface of todo's functionality, so take some time to dig in and see how powerful this tool is! It really helps me keep on task every day. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-to-do-list + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) +[2]: https://productivityalchemy.com/ +[3]: https://www.slideshare.net/AllThingsOpen/getting-to-done-on-the-command-line +[4]: https://opensource.com/article/18/2/getting-to-done-agile-linux-command-line +[5]: https://opensource.com/sites/default/files/uploads/productivity_7-1.png +[6]: http://todotxt.org/ +[7]: https://orgmode.org/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_7-2.png (Basic todo.txt list) +[9]: https://opensource.com/sites/default/files/uploads/productivity_7-3.png (Recurring tasks with the ice_recur add-on) +[10]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory +[11]: https://github.com/rlpowell/todo-text-stuff +[12]: https://opensource.com/sites/default/files/uploads/productivity_7-4.png (Todour on MacOS) From 5d1f78aba0ab8cab11efaba9dac85b2e6c47efc8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:58:42 +0800 Subject: [PATCH 0282/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Use?= =?UTF-8?q?=20this=20Python=20script=20to=20find=20bugs=20in=20your=20Over?= =?UTF-8?q?cloud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md --- ...n script to find bugs in your Overcloud.md | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md diff --git a/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md new file mode 100644 index 0000000000..ee167e6f78 --- /dev/null +++ b/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this Python script to find bugs in your Overcloud) +[#]: via: (https://opensource.com/article/20/1/logtool-root-cause-identification) +[#]: author: (Arkady Shtempler https://opensource.com/users/ashtempl) + +Use this Python script to find bugs in your Overcloud +====== +LogTool is a set of Python scripts that helps you investigate root +causes for problems in Overcloud nodes. +![Searching for code][1] + +OpenStack stores and manages a bunch of log files on its Overcloud nodes and Undercloud host. Therefore, it's not easy to use OSP log files to investigate a problem you're having, especially when you don't even know what could have caused the problem. + +If that's your situation, [LogTool][2] makes your life much easier! It saves you the time and work it would otherwise take to investigate the root cause manually. Based on a fuzzy string matching algorithm, LogTool provides all the unique error and warning messages that have occurred in the past. You can export these messages for a particular time period, such as 10 minutes ago, an hour ago, a day ago, and so on, based on timestamp in the log. + +LogTool is a set of Python scripts, and its main module, **PyTool.py**, is executed on the Undercloud host. Some operation modes use additional scripts that are executed directly on Overcloud nodes, such as exporting  errors and warnings from Overcloud logs. + +LogTool supports Python 2 and 3, and you can change the working directory according to your needs: [LogTool_Python2][3] or [LogTool_Python3][4]. + +### Operation modes + +#### 1\. Export errors and warnings from Overcloud logs + +This mode is used to extract all unique **ERROR** and **WARNING** messages from Overcloud nodes that took place in the past. As the user, you're prompted to provide the "since time" and debug level to be used for extraction of errors or warnings. For example, if something went wrong in the last 10 minutes, you're be able to extract error and warning messages for just that time period. + +This operation mode generates a directory containing a result file for each Overcloud node. A result file is a simple text file that is compressed (***.gz**) to reduce the time needed to download it from the Overcloud node. To convert a compressed file to a regular text file, you can use [zcat][5] or a similar tool. Also, some versions of Vi and any recent version of Emacs both support reading compressed data. The result file is divided into sections and contains a table of contents at the bottom. + +There are two kinds of log files LogTool detects on the fly: _Standard_ and _Not Standard_. In _Standard_, each log line has a known and defined structure: timestamp, debug level, msg, and so on. In _Not Standard_, the log's structure is unknown; it could be a third party's logs, for example. In the table of contents, you find a "Section name --> Line number" per section, for example: + + * **Raw Data - extracted Errors/Warnings from standard OSP logs since:** This section contains all extracted Error/Warning messages as-is without any modifications or changes. These messages are the raw data LogTool uses for fuzzy matching analysis. + * **Statistics - Number of Errors/Warnings per standard OSP log since:** In this section, you find the amount of Errors and Warnings per Standard log file. This may help you understand potential components used to search for the root cause of your issue. + * **Statistics - Unique messages, per STANDARD OSP log file since:** This section addresses unique Error and Warning messages since a timestamp you provide. For more details about each unique Error or Warning, search for the same message in the Raw Data section. + * **Statistics - Unique messages per NON STANDARD log file, since any time:** This section contains the unique messages in nonstandard log files. Unfortunately, LogTool cannot handle these log files in the same manner as Standard Log files; therefore, the "since time" you provide on extraction will be ignored, and you'll see all of the unique Errors/Warnings messages ever created. So first, scroll down to the table of contents at the bottom of the result file and review its sections—use the line indexes in the table of contents to jump to the relevant sections, where numbers 3, 4, and 5 are most important. + + + +#### 2\. Download all logs from Overcloud nodes + +Logs from all Overcloud nodes are compressed and downloaded to a local directory on your Undercloud host. + +#### 3\. Grep for a string in all Overcloud logs + +This mode "greps" (searches) a string provided by the user on all Overcloud logs. For example, you might want to see all logged messages for a specific request ID, such as the request ID for a "Create VM" that has failed. + +#### 4\. Check current CPU,RAM and Disk on Overcloud + +This mode displays the current CPU, RAM, and disk info on each Overcloud node. + +#### 5\. Execute user's script + +This enables users to run their own scripts on Overcloud nodes. For instance, say an Overcloud deployment failed, so you need to execute the same procedure on each Controller node to fix that. You can implement a "work around" script and to run it on Controllers using this mode. + +#### 6\. Download relevant logs only, by given timestamp + +This mode downloads only the Overcloud logs with _"Last Modified" > "given by user timestamp."_ For example, if you got an error 10 minutes ago, old log files won't be relevant, so downloading them is unnecessary. In addition, you can't (or shouldn't)  attach large files in some bug reporting tools, so this mode might help with making bug reports. + +#### 7\. Export errors and warnings from Undercloud logs + +This is the same as mode #1 above, but for Undercloud logs. + +#### 8\. Check Unhealthy dockers on the Overcloud + +This mode is used to search for unhealthy Dockers on nodes. + +#### 9\. Download OSP logs and run LogTool locally + +This mode allows you to download OSP logs from Jenkins or Log Storage (for example, **cougar11.scl.lab.tlv.redhat.com**) and to analyze the downloaded logs locally. + +#### 10\. Analyze deployment log on the Undercloud + +This mode may help you understand what went wrong during Overcloud or Undercloud deployment. Deployment logs are generated when the **\--log** option is used, for example, inside the **overcloud_deploy.sh** script; the problem is that such logs are not "friendly," and it's hard to understand what went wrong, especially when verbosity is set to **vv** or more, as this makes the log unreadable with a bunch of data inside it. This mode provides some details about all failed tasks. + +#### 11\. Analyze Gerrit(Zuul) failed gate logs + +This mode is used to analyze Gerrit(Zuul) log files. It automatically downloads all files from a remote Gerrit gate (HTTP download) and analyzes all files locally. + +### Installation + +LogTool is available on GitHub. Clone it to your Undercloud host with: + + +``` +`git clone https://github.com/zahlabut/LogTool.git` +``` + +Some external Python modules are also used by the tool: + +#### Paramiko + +This SSH module is usually installed on Undercloud by default. Use the following command to verify whether it's installed: + + +``` +`ls -a /usr/lib/python2.7/site-packages | grep paramiko` +``` + +If you need to install the module, on your Undercloud, execute the following commands: + + +``` +sudo easy_install pip +sudo pip install paramiko==2.1.1 +``` + +#### BeautifulSoup + +This HTML parser module is used only in modes where log files are downloaded using HTTP. It's used to parse the Artifacts HTML page to get all of the links in it. To install BeautifulSoup, enter this command: + + +``` +`pip install beautifulsoup4` +``` + +You can also use the [requirements.txt][6] file to install all the required modules by executing: + + +``` +`pip install -r requirements.txt` +``` + +### Configuration + +All required parameters are set directly inside the **PyTool.py** script. The defaults are: + + +``` +overcloud_logs_dir = '/var/log/containers' +overcloud_ssh_user = 'heat-admin' +overcloud_ssh_key = '/home/stack/.ssh/id_rsa' +undercloud_logs_dir ='/var/log/containers' +source_rc_file_path='/home/stack/' +``` + +### Usage + +This tool is interactive, so to start it, just enter: + + +``` +cd LogTool +python PyTool.py +``` + +### Troubleshooting LogTool + +Two log files are created on runtime: Error.log and Runtime.log*.* Please add the contents of both in the description of the issue you'd like to open. + +### Limitations + +LogTool is hardcoded to handle files up to 500 MB. + +### LogTool_Python3 script + +Get it at [github.com/zahlabut/LogTool][2] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/logtool-root-cause-identification + +作者:[Arkady Shtempler][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ashtempl +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://github.com/zahlabut/LogTool +[3]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python2 +[4]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python3 +[5]: https://opensource.com/article/19/2/getting-started-cat-command +[6]: https://github.com/zahlabut/LogTool/blob/master/LogTool_Python3/requirements.txt From 8b97dedd6fa2bb676afe4c3cc6df2e4717afc7c6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:59:30 +0800 Subject: [PATCH 0283/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20C=20?= =?UTF-8?q?vs.=20Rust:=20Which=20to=20choose=20for=20programming=20hardwar?= =?UTF-8?q?e=20abstractions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md --- ...e for programming hardware abstractions.md | 509 ++++++++++++++++++ 1 file changed, 509 insertions(+) create mode 100644 sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md diff --git a/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md new file mode 100644 index 0000000000..acb58aaf6d --- /dev/null +++ b/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -0,0 +1,509 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (C vs. Rust: Which to choose for programming hardware abstractions) +[#]: via: (https://opensource.com/article/20/1/c-vs-rust-abstractions) +[#]: author: (Dan Pittman https://opensource.com/users/dan-pittman) + +C vs. Rust: Which to choose for programming hardware abstractions +====== +Using type-level programming in Rust can make hardware abstractions +safer. +![Tools illustration][1] + +Rust is an increasingly popular programming language positioned to be the best choice for hardware interfaces. It's often compared to C for its level of abstraction. This article explains how Rust can handle bitwise operations in a number of ways and offers a solution that provides both safety and ease of use. + +Language | Origin | Official description | Overview +---|---|---|--- +C | 1972 | C is a general-purpose programming language which features economy of expression, modern control flow and data structures, and a rich set of operators. (Source: [CS Fundamentals][2]) | C is [an] imperative language and designed to compile in a relatively straightforward manner which provides low-level access to the memory. (Source: [W3schools.in][3]) +Rust | 2010 | A language empowering everyone to build reliable and efficient software (Source: [Rust website][4]) | Rust is a multi-paradigm system programming language focused on safety, especially safe concurrency. (Source: [Wikipedia][5]) + +### Bitwise operation over register values in C + +In the world of systems programming, where you may find yourself writing hardware drivers or interacting directly with memory-mapped devices, interaction is almost always done through memory-mapped registers provided by the hardware. You typically interact with these things through bitwise operations on some fixed-width numeric type. + +For instance, imagine an 8-bit register with three fields: + + +``` ++----------+------+-----------+---------+ +| (unused) | Kind | Interrupt | Enabled | ++----------+------+-----------+---------+ +   5-7       2-4        1          0 +``` + +The number below the field name prescribes the bits used by that field in the register. To enable this register, you would write the value **1**, represented in binary as **0000_0001**, to set the enabled field's bit. Often, though, you also have an existing configuration in the register that you don't want to disturb. Say you want to enable interrupts on the device but also want to be sure the device remains enabled. To do that, you must combine the Interrupt field's value with the Enabled field's value. You would do that with bitwise operations: + + +``` +`1 | (1 << 1)` +``` + +This gives you the binary value **0000_0011** by **or**-ing 1 with 2, which you get by shifting 1 left by 1. You can write this to your register, leaving it enabled but also enabling interrupts. + +This is a lot to keep in your head, especially when you're dealing with potentially hundreds of registers for a complete system. In practice, you do this with mnemonics which track a field's position in a register and how wide the field is—i.e., _what's its upper bound?_ + +Here's an example of one of these mnemonics. They are C macros that replace their occurrences with the code on the right-hand side. This is the shorthand for the register laid out above. The left-hand side of the **&** puts you in position for that field, and the right-hand side limits you to only that field's bits: + + +``` +#define REG_ENABLED_FIELD(x) (x << 0) & 1 +#define REG_INTERRUPT_FIELD(x) (x << 1) & 2 +#define REG_KIND_FIELD(x) (x << 2) & (7 << 2) +``` + +You'd then use these to abstract over the derivation of a register's value with something like: + + +``` +void set_reg_val(reg* u8, val u8); + +fn enable_reg_with_interrupt(reg* u8) { +    set_reg_val(reg, REG_ENABLED_FIELD(1) | REG_INTERRUPT_FIELD(1)); +} +``` + +This is the state of the art. In fact, this is how the bulk of drivers appear in the Linux kernel. + +Is there a better way? Consider the boon to safety and expressibility if the type system was borne out of research on modern programming languages. That is, what could you do with a richer, more expressive type system to make this process safer and more tenable? + +### Bitwise operation over register values in Rust + +Continuing with the register above as an example: + + +``` ++----------+------+-----------+---------+ +| (unused) | Kind | Interrupt | Enabled | ++----------+------+-----------+---------+ +   5-7       2-4        1          0 +``` + +How might you want to express such a thing in Rust types? + +You'll start in a similar way, by defining constants for each field's _offset_—that is, how far it is from the least significant bit—and its mask. A _mask_ is a value whose binary representation can be used to update or read the field from inside the register: + + +``` +const ENABLED_MASK: u8 = 1; +const ENABLED_OFFSET: u8 = 0; + +const INTERRUPT_MASK: u8 = 2; +const INTERRUPT_OFFSET: u8 = 1; + +const KIND_MASK: u8 = 7 << 2; +const KIND_OFFSET: u8 = 2; +``` + +Next, you'll declare a field type and do your operations to convert a given value into its position-relevant value for use inside the register: + + +``` +struct Field { +    value: u8, +} + +impl Field { +    fn new(mask: u8, offset: u8, val: u8) -> Self { +        Field { +            value: (val << offset) & mask, +        } +    } +} +``` + +Finally, you'll use a **Register** type, which wraps around a numeric type that matches the width of your register. **Register** has an **update** function that updates the register with the given field: + + +``` +struct Register(u8); + +impl Register { +    fn update(&mut self, val: Field) { +        self.0 = self.0 | field.value; +    } +} + +fn enable_register(&mut reg) { +    reg.update(Field::new(ENABLED_MASK, ENABLED_OFFSET, 1)); +} +``` + +With Rust, you can use data structures to represent fields, attach them to specific registers, and provide concise and sensible ergonomics while interacting with the hardware. This example uses the most basic facilities provided by Rust; regardless, the added structure alleviates some of the density from the C example above. Now a field is a named thing, not a number derived from shadowy bitwise operators, and registers are types with state—one extra layer of abstraction over the hardware. + +### A Rust implementation for ease of use + +The first rewrite in Rust is nice, but it's not ideal. You have to remember to bring the mask and offset, and you're calculating them ad hoc, by hand, which is error-prone. Humans aren't great at precise and repetitive tasks—we tend to get tired or lose focus, and this leads to mistakes. Transcribing the masks and offsets by hand, one register at a time, will almost certainly end badly. This is the kind of task best left to a machine. + +Second, thinking more structurally: What if there were a way to have the field's type carry the mask and offset information? What if you could catch mistakes in your implementation for how you access and interact with hardware registers at compile time instead of discovering them at runtime? Perhaps you can lean on one of the strategies commonly used to suss out issues at compile time, like types. + +You can modify the earlier example by using [**typenum**][6], a library that provides numbers and arithmetic at the type level. Here, you'll parameterize the **Field** type with its mask and offset, making it available for any instance of **Field** without having to include it at the call site: + + +``` +#[macro_use] +extern crate typenum; + +use core::marker::PhantomData; + +use typenum::*; + +// Now we'll add Mask and Offset to Field's type +struct Field<Mask: Unsigned, Offset: Unsigned> { +    value: u8, +    _mask: PhantomData<Mask>, +    _offset: PhantomData<Offset>, +} + +// We can use type aliases to give meaningful names to +// our fields (and not have to remember their offsets and masks). +type RegEnabled = Field<U1, U0>; +type RegInterrupt = Field<U2, U1>; +type RegKind = Field<op!(U7 << U2), U2>; +``` + +Now, when revisiting **Field**'s constructor, you can elide the mask and offset parameters because the type contains that information: + + +``` +impl<Mask: Unsigned, Offset: Unsigned> Field<Mask, Offset> { +    fn new(val: u8) -> Self { +        Field { +            value: (val << Offset::U8) & Mask::U8, +            _mask: PhantomData, +            _offset: PhantomData, +        } +    } +} + +// And to enable our register... +fn enable_register(&mut reg) { +    reg.update(RegEnabled::new(1)); +} +``` + +It looks pretty good, but… what happens when you make a mistake regarding whether a given value will _fit_ into a field? Consider a simple typo where you put **10** instead of **1**: + + +``` +fn enable_register(&mut reg) { +    reg.update(RegEnabled::new(10)); +} +``` + +In the code above, what is the expected outcome? Well, the code will set that enabled bit to 0 because **10 & 1 = 0**. That's unfortunate; it would be nice to know whether a value you're trying to write into a field will fit into the field before attempting a write. As a matter of fact, I'd consider lopping off the high bits of an errant field value _undefined behavior_ (gasps). + +### Using Rust with safety in mind + +How can you check that a field's value fits in its prescribed position in a general way? More type-level numbers! + +You can add a **Width** parameter to **Field** and use it to verify that a given value can fit into the field: + + +``` +struct Field<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> { +    value: u8, +    _mask: PhantomData<Mask>, +    _offset: PhantomData<Offset>, +    _width: PhantomData<Width>, +} + +type RegEnabled = Field<U1,U1, U0>; +type RegInterrupt = Field<U1, U2, U1>; +type RegKind = Field<U3, op!(U7 << U2), U2>; + +impl<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> Field<Width, Mask, Offset> { +    fn new(val: u8) -> Option<Self> { +        if val <= (1 << Width::U8) - 1 { +            Some(Field { +                value: (val << Offset::U8) & Mask::U8, +                _mask: PhantomData, +                _offset: PhantomData, +                _width: PhantomData, +            }) +        } else { +            None +        } +    } +} +``` + +Now you can construct a **Field** only if the given value fits! Otherwise, you have **None**, which signals that an error has occurred, rather than lopping off the high bits of the value and silently writing an unexpected value. + +Note, though, this will raise an error at runtime. However, we knew the value we wanted to write beforehand, remember? Given that, we can teach the compiler to reject entirely a program which has an invalid field value—we don’t have to wait until we run it! + +This time, you'll add a _trait bound_ (the **where** clause) to a new realization of new, called **new_checked**, that asks the incoming value to be less than or equal to the maximum possible value a field with the given **Width** can hold: + + +``` +struct Field<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> { +    value: u8, +    _mask: PhantomData<Mask>, +    _offset: PhantomData<Offset>, +    _width: PhantomData<Width>, +} + +type RegEnabled = Field<U1, U1, U0>; +type RegInterrupt = Field<U1, U2, U1>; +type RegKind = Field<U3, op!(U7 << U2), U2>; + +impl<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> Field<Width, Mask, Offset> { +    const fn new_checked<V: Unsigned>() -> Self +    where +        V: IsLessOrEqual<op!((U1 << Width) - U1), Output = True>, +    { +        Field { +            value: (V::U8 << Offset::U8) & Mask::U8, +            _mask: PhantomData, +            _offset: PhantomData, +            _width: PhantomData, +        } +    } +} +``` + +Only numbers for which this property holds has an implementation of this trait, so if you use a number that does not fit, it will fail to compile. Take a look! + + +``` +fn enable_register(&mut reg) { +    reg.update(RegEnabled::new_checked::<U10>()); +} +12 |     reg.update(RegEnabled::new_checked::<U10>()); +   |                           ^^^^^^^^^^^^^^^^ expected struct `typenum::B0`, found struct `typenum::B1` +   | +   = note: expected type `typenum::B0` +           found type `typenum::B1` +``` + +**new_checked** will fail to produce a program that has an errant too-high value for a field. Your typo won't blow up at runtime because you could never have gotten an artifact to run. + +You're nearing Peak Rust in terms of how safe you can make memory-mapped hardware interactions. However, what you wrote back in the first example in C was far more succinct than the type parameter salad you ended up with. Is doing such a thing even tractable when you're talking about potentially hundreds or even thousands of registers? + +### Just right with Rust: both safe and accessible + +Earlier, I called out calculating masks by hand as being problematic, but I just did that same problematic thing—albeit at the type level. While using such an approach is nice, getting to the point when you can write any code requires quite a bit of boilerplate and manual transcription (I'm talking about the type synonyms here). + +Our team wanted something like the [TockOS mmio registers][7], but one that would generate typesafe implementations with the least amount of manual transcription possible. The result we came up with is a macro that generates the necessary boilerplate to get a Tock-like API plus type-based bounds checking. To use it, write down some information about a register, its fields, their width and offsets, and optional [enum][8]-like values (should you want to give "meaning" to the possible values a field can have): + + +``` +register! { +    // The register's name +    Status, +    // The type which represents the whole register. +    u8, +    // The register's mode, ReadOnly, ReadWrite, or WriteOnly. +    RW, +    // And the fields in this register. +    Fields [ +        On    WIDTH(U1) OFFSET(U0), +        Dead  WIDTH(U1) OFFSET(U1), +        Color WIDTH(U3) OFFSET(U2) [ +            Red    = U1, +            Blue   = U2, +            Green  = U3, +            Yellow = U4 +        ] +    ] +} +``` + +From this, you can generate register and field types like the previous example where the indices—the **Width**, **Mask**, and **Offset**—are derived from the values input in the **WIDTH** and **OFFSET** sections of a field's definition. Also, notice that all of these numbers are **typenums**; they're going to go directly into your **Field** definitions! + +The generated code provides namespaces for registers and their associated fields through the name given for the register and the fields. That's a mouthful; here's what it looks like: + + +``` +mod Status { +    struct Register(u8); +    mod On { +        struct Field; // There is of course more to this definition +    } +    mod Dead { +        struct Field; +    } +    mod Color { +        struct Field; +        pub const Red: Field = Field::<U1>new(); +        // &c. +    } +} +``` + +The generated API contains the nominally expected read and write primitives to get at the raw register value, but it also has ways to get a single field's value, do collective actions, and find out if any (or all) of a collection of bits is set. You can read the documentation on the [complete generated API][9]. + +### Kicking the tires + +What does it look like to use these definitions for a real device? Will the code be littered with type parameters, obscuring any real logic from view? + +No! By using type synonyms and type inference, you effectively never have to think about the type-level part of the program at all. You get to interact with the hardware in a straightforward way and get those bounds-related assurances automatically. + +Here's an example of a [UART][10] register block. I'll skip the declaration of the registers themselves, as that would be too much to include here. Instead, it starts with a register "block" then helps the compiler know how to look up the registers from a pointer to the head of the block. We do that by implementing **Deref** and **DerefMut**: + + +``` +#[repr(C)] +pub struct UartBlock { +    rx: UartRX::Register, +    _padding1: [u32; 15], +    tx: UartTX::Register, +    _padding2: [u32; 15], +    control1: UartControl1::Register, +} + +pub struct Regs { +    addr: usize, +} + +impl Deref for Regs { +    type Target = UartBlock; + +    fn deref(&self) -> &UartBlock { +        unsafe { &*(self.addr as *const UartBlock) } +    } +} + +impl DerefMut for Regs { +    fn deref_mut(&mut self) -> &mut UartBlock { +        unsafe { &mut *(self.addr as *mut UartBlock) } +    } +} +``` + +Once this is in place, using these registers is as simple as **read()** and **modify()**: + + +``` +fn main() { +    // A pretend register block. +    let mut x = [0_u32; 33]; + +    let mut regs = Regs { +        // Some shenanigans to get at `x` as though it were a +        // pointer. Normally you'd be given some address like +        // `0xDEADBEEF` over which you'd instantiate a `Regs`. +        addr: &mut x as *mut [u32; 33] as usize, +    }; + +    assert_eq!(regs.rx.read(), 0); + +    regs.control1 +        .modify(UartControl1::Enable::Set + UartControl1::RecvReadyInterrupt::Set); + +    // The first bit and the 10th bit should be set. +    assert_eq!(regs.control1.read(), 0b_10_0000_0001); +} +``` + +When we're working with runtime values we use **Option** like we saw earlier. Here I'm using **unwrap**, but in a real program with unknown inputs, you'd probably want to check that you got a **Some** back from that new call:[1][11],[2][12] + + +``` +fn main() { +    // A pretend register block. +    let mut x = [0_u32; 33]; + +    let mut regs = Regs { +        // Some shenanigans to get at `x` as though it were a +        // pointer. Normally you'd be given some address like +        // `0xDEADBEEF` over which you'd instantiate a `Regs`. +        addr: &mut x as *mut [u32; 33] as usize, +    }; + +    let input = regs.rx.get_field(UartRX::Data::Field::Read).unwrap(); +    regs.tx.modify(UartTX::Data::Field::new(input).unwrap()); +} +``` + +### Decoding failure conditions + +Depending on your personal pain threshold, you may have noticed that the errors are nearly unintelligible. Take a look at a not-so-subtle reminder of what I'm talking about: + + +``` +error[E0271]: type mismatch resolving `<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B1>, typenum::B0>, typenum::B0> as typenum::IsLessOrEqual<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B1>, typenum::B0>>>::Output == typenum::B1` +  --> src/main.rs:12:5 +   | +12 |     less_than_ten::<U20>(); +   |     ^^^^^^^^^^^^^^^^^^^^ expected struct `typenum::B0`, found struct `typenum::B1` +   | +   = note: expected type `typenum::B0` +       found type `typenum::B1` +``` + +The **expected typenum::B0 found typenum::B1** part kind of makes sense, but what on earth is the **typenum::UInt<typenum::UInt, typenum::UInt…** nonsense? Well, **typenum** represents numbers as binary [cons][13] cells! Errors like this make it hard, especially when you have several of these type-level numbers confined to tight quarters, to know which number it's talking about. Unless, of course, it's second nature for you to translate baroque binary representations to decimal ones. + +After the **U100**th time attempting to decipher any meaning from this mess, a teammate got Mad As Hell And Wasn't Going To Take It Anymore and made a little utility, **tnfilt**, to parse the meaning out from the misery that is namespaced binary cons cells. **tnfilt** takes the cons cell-style notation and replaces it with sensible decimal numbers. We imagine that others will face similar difficulties, so we shared [**tnfilt**][14]. You can use it like this: + + +``` +`$ cargo build 2>&1 | tnfilt` +``` + +It transforms the output above into something like this: + + +``` +`error[E0271]: type mismatch resolving `>::Output == typenum::B1`` +``` + +Now _that_ makes sense! + +### In conclusion + +Memory-mapped registers are used ubiquitously when interacting with hardware from software, and there are myriad ways to portray those interactions, each of which has a different place on the spectra of ease-of-use and safety. We found that the use of type-level programming to get compile-time checking on memory-mapped register interactions gave us the necessary information to make safer software. That code is available in the **[bounded-registers][15] crate** (Rust package). + +Our team started out right at the edge of the more-safe side of that safety spectrum and then tried to figure out how to move the ease-of-use slider closer to the easy end. From those ambitions, **bounded-registers** was born, and we use it anytime we encounter memory-mapped devices in our adventures at Auxon. + +* * * + + 1. Technically, a read from a register field, by definition, will only give a value within the prescribed bounds, but none of us lives in a pure world, and you never know what's going to happen when external systems come into play. You're at the behest of the Hardware Gods here, so instead of forcing you into a "might panic" situation, it gives you the **Option** to handle a "This Should Never Happen" case. + + 2. **get_field** looks a little weird. I'm looking at the **Field::Read** part, specifically. **Field** is a type, and you need an instance of that type to pass to **get_field**. A cleaner API might be something like: + + +``` +`regs.rx.get_field::();` +``` + +But remember that **Field** is a type synonym that has fixed indices for width, offset, etc. To be able to parameterize **get_field** like this, you'd need higher-kinded types. + + + + +* * * + +_This originally appeared on the [Auxon Engineering blog][16] and is edited and republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/c-vs-rust-abstractions + +作者:[Dan Pittman][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dan-pittman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl (Tools illustration) +[2]: https://cs-fundamentals.com/c-programming/history-of-c-programming-language.php +[3]: https://www.w3schools.in/c-tutorial/history-of-c/ +[4]: https://www.rust-lang.org/ +[5]: https://en.wikipedia.org/wiki/Rust_(programming_language) +[6]: https://docs.rs/crate/typenum +[7]: https://docs.rs/tock-registers/0.3.0/tock_registers/ +[8]: https://en.wikipedia.org/wiki/Enumerated_type +[9]: https://github.com/auxoncorp/bounded-registers#the-register-api +[10]: https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter +[11]: tmp.shpxgDsodx#1 +[12]: tmp.shpxgDsodx#2 +[13]: https://en.wikipedia.org/wiki/Cons +[14]: https://github.com/auxoncorp/tnfilt +[15]: https://crates.io/crates/bounded-registers +[16]: https://blog.auxon.io/2019/10/25/type-level-registers/ From 781008b82c9500bfc398c01cb4fa8c3a369a8570 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 01:00:57 +0800 Subject: [PATCH 0284/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Lock?= =?UTF-8?q?ing=20and=20unlocking=20accounts=20on=20Linux=20systems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Locking and unlocking accounts on Linux systems.md --- ...and unlocking accounts on Linux systems.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 sources/tech/20200117 Locking and unlocking accounts on Linux systems.md diff --git a/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md b/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md new file mode 100644 index 0000000000..c1cb3a7be1 --- /dev/null +++ b/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Locking and unlocking accounts on Linux systems) +[#]: via: (https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Locking and unlocking accounts on Linux systems +====== +There are times when locking a Linux user account is necessary and times when you need to reverse that action. Here are commands for managing account access and what's behind them. +SQBack / Getty Images + +If you are administering a [Linux][1] system, there will likely be times that you need to lock an account. Maybe someone is changing positions and their continued need for the account is under question; maybe there’s reason to believe that access to the account has been compromised. In any event, knowing how to lock an account and how to unlock it should it be needed again is something you need to be able to do. + +One important thing to keep in mind is that there are multiple ways to lock an account, and they don't all have the same effect. If the account user is accessing an account using public/private keys instead of a password, some commands you might use to block access to an account will not be effective. + +### Locking an account using the passwd command + +One of the simplest ways to lock an account is with the **passwd -l** command. For example: + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +$ sudo passwd -l tadpole +``` + +The effect of this command is to insert an exclamation point as the first character in the encrypted password field in the /etc/shadow file. This is enough to keep the password from working. What previously looked like this (note the first character): + +``` +$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: +``` + +will look like this: + +``` +!$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: +``` + +On his next login attempt (should there be one), tadpole would probably try his password numerous times and not gain access. You, on the other hand, would be able to check the status of his account with a command like this (-S = status): + +``` +$ sudo passwd -S tadpole +tadpole L 10/15/2019 0 99999 7 -1 +``` + +The "L" in the second field tells you that the account is locked. Before the account was locked, it would have been a "P". An "NP" would mean that no password was set. + +**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][3] ]** + +The **usermod -L** command would have the same effect (inserting the exclamation character to disable use of the password). + +One of the benefits of locking an account in this way is that it's very easy to unlock the account when and if needed. Just reverse the change by removing the added exclamation point with a text editor or, better yet, by using the **passwd -u** command. + +``` +$ sudo passwd -u tadpole +passwd: password expiry information changed. +``` + +The problem with this approach is that, if the user is accessing his or her account with public/private keys, this change will not block their use. + +### Locking accounts with the chage command + +Another way to lock a user account is to the the **chage** command that helps manage account expiration dates. + +``` +$ sudu chage -E0 tadpole +$ sudo passwd -S tadpole +tadpole P 10/15/2019 0 99999 7 -1 +``` + +The **chage** command is going to make a subtle change to the /etc/shadow file. The eighth field in that colon-separated file (shown below) will be set to zero (previously empty) and this means the account is essentially expired. The **chage** command tracks the number of days between password changes, but also provides account expiration information when this option is used. A zero in the eiighth field would mean that the account expires a day after January 1, 1970, but also simply locks it when a command like that shown above is used. + +``` +$ sudo grep tadpole /etc/shadow | fold +tadpole:$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPC +nXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::0: + ^ + | + +--- days until expiration +``` + +To reverse this change, you can simply remove the 0 that was placed in the /etc/shadow entry for the user with a command like this: + +``` +% sudo chage -E-1 tadpole +``` + +Once an account is expired in this way, even passwordless [SSH][4] will not provide access. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[4]: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 2234eb35ff0c53a48acc2b65843d97fbe27b7493 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 12:35:15 +0800 Subject: [PATCH 0285/3057] PRF @geekpi --- ... across multiple devices with Syncthing.md | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md b/translated/tech/20200111 Sync files across multiple devices with Syncthing.md index e4bc076533..2243ad50cd 100644 --- a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md +++ b/translated/tech/20200111 Sync files across multiple devices with Syncthing.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Sync files across multiple devices with Syncthing) @@ -9,14 +9,16 @@ 使用 Syncthing 在多个设备间同步文件 ====== -2020 年,在我们的 20 个使用开源提升生产力的系列文章中,首先了解如何使用 Syncthing 同步文件。 -![Files in a folder][1] + +> 2020 年,在我们的 20 个使用开源提升生产力的系列文章中,首先了解如何使用 Syncthing 同步文件。 + +![](https://img.linux.net.cn/data/attachment/album/202001/18/123416rebvs7sjwm6c889y.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 Synthing 同步文件 -置新机器很麻烦。我们都有在机器之间复制的“标准设置”。多年来,我使用了很多方法来使它们在计算机之间同步。在过去(这会告诉你我年纪有多大了),曾经是软盘、然后是 Zip 磁盘、U 盘、SCP、Rsync、Dropbox、ownCloud,你想到的都试过。但这些似乎对我都不够好。 +设置新机器很麻烦。我们都有在机器之间复制的“标准设置”。多年来,我使用了很多方法来使它们在计算机之间同步。在过去(这会告诉你我年纪有多大了),曾经是软盘、然后是 Zip 磁盘、U 盘、SCP、Rsync、Dropbox、ownCloud,你想到的都试过。但这些似乎对我都不够好。 然后我偶然发现了 [Syncthing][2]。 @@ -28,19 +30,19 @@ Syncthing 可在 Linux、MacOS、Windows 和多种 BSD 中使用。还有一个 ![Installing Syncthing on Ubuntu][4] -首次启动 Syncthing 时,它将启动 Web 浏览器以配置守护程序。第一台计算机上没有太多要做,但是这是一个很好的机会来介绍一下用户界面 (UI)。最重要的是在右上方的 **Actions** 菜单下的 “System ID”。 +首次启动 Syncthing 时,它将启动 Web 浏览器以配置守护程序。第一台计算机上没有太多要做,但是这是一个很好的机会来介绍一下用户界面 (UI)。最重要的是在右上方的 “Actions” 菜单下的 “System ID”。 ![Machine ID][5] -设置第一台计算机后,请在第二台计算机上重复安装。在 UI 中,右下方将显示一个按钮,名为 **Add Remote Device**。单击按钮,你将会看到一个要求输入**设备 ID 和设备名**的框。从第一台计算机上复制并粘贴**设备 ID**,然后单击 **Save**。 +设置第一台计算机后,请在第二台计算机上重复安装。在 UI 中,右下方将显示一个按钮,名为 “Add Remote Device”。单击该按钮,你将会看到一个要求输入 “Device ID and a Name” 的框。从第一台计算机上复制并粘贴 “Device ID”,然后单击 “Save”。 -你应该会在第一台上看到一个请求添加第二台的弹出窗口。接受后,新机器将显示在第一台机器的右下角。与第二台计算机共享默认目录。单击 **Default Folder**,然后单击 **Edit** 按钮。弹出窗口的顶部有四个链接。单击 **Sharing**,然后选择第二台计算机。单击 **Save**,然后查看第二台计算机。你会看到一个接受共享目录的提示。接受后,它将开始在两台计算机之间同步文件。 +你应该会在第一台上看到一个请求添加第二台的弹出窗口。接受后,新机器将显示在第一台机器的右下角。与第二台计算机共享默认目录。单击 “Default Folder”,然后单击 “Edit” 按钮。弹出窗口的顶部有四个链接。单击 “Sharing”,然后选择第二台计算机。单击 “Save”,然后查看第二台计算机。你会看到一个接受共享目录的提示。接受后,它将开始在两台计算机之间同步文件。 ![Sharing a directory in Syncthing][6] -测试从一台计算机上复制文件到默认目录(**/your/home/Share**)。它应该很快会在另一台上出现。 +测试从一台计算机上复制文件到默认目录(“/你的家目录/Share”)。它应该很快会在另一台上出现。 -你可以根据需要添加任意数量的目录,这非常方便。如你在第一张图中所看到的,我有一个用于保存配置的 **myconfigs** 文件夹。当我买了一台新机器时,我只需安装 Syncthing,如果我在一台机器上调整了配置,我不必更新所有,它会自动更新。 +你可以根据需要添加任意数量的目录,这非常方便。如你在第一张图中所看到的,我有一个用于保存配置的 `myconfigs` 文件夹。当我买了一台新机器时,我只需安装 Syncthing,如果我在一台机器上调整了配置,我不必更新所有,它会自动更新。 -------------------------------------------------------------------------------- @@ -49,7 +51,7 @@ via: https://opensource.com/article/20/1/sync-files-syncthing 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ef8e0ebf7a2b749fd3e47ef75bc1b5d4bb5e1be5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 12:36:06 +0800 Subject: [PATCH 0286/3057] PUB @geekpi https://linux.cn/article-11793-1.html --- ...00111 Sync files across multiple devices with Syncthing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200111 Sync files across multiple devices with Syncthing.md (98%) diff --git a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md b/published/20200111 Sync files across multiple devices with Syncthing.md similarity index 98% rename from translated/tech/20200111 Sync files across multiple devices with Syncthing.md rename to published/20200111 Sync files across multiple devices with Syncthing.md index 2243ad50cd..65959e3d59 100644 --- a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md +++ b/published/20200111 Sync files across multiple devices with Syncthing.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11793-1.html) [#]: subject: (Sync files across multiple devices with Syncthing) [#]: via: (https://opensource.com/article/20/1/sync-files-syncthing) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From 446be1c237a9e0e5ea44f880ad023d0e635c4fb9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 18 Jan 2020 12:36:58 +0800 Subject: [PATCH 0287/3057] Rename sources/tech/20200116 4 core skills to level-up your tech career in 2020.md to sources/talk/20200116 4 core skills to level-up your tech career in 2020.md --- ...20200116 4 core skills to level-up your tech career in 2020.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200116 4 core skills to level-up your tech career in 2020.md (100%) diff --git a/sources/tech/20200116 4 core skills to level-up your tech career in 2020.md b/sources/talk/20200116 4 core skills to level-up your tech career in 2020.md similarity index 100% rename from sources/tech/20200116 4 core skills to level-up your tech career in 2020.md rename to sources/talk/20200116 4 core skills to level-up your tech career in 2020.md From 3e3dad7524c140fa74a7f572b71412701cc35b9e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 18 Jan 2020 12:38:46 +0800 Subject: [PATCH 0288/3057] Rename sources/talk/20200116 It-s the end for Windows Server 2008 support.md to sources/news/20200116 It-s the end for Windows Server 2008 support.md --- .../20200116 It-s the end for Windows Server 2008 support.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => news}/20200116 It-s the end for Windows Server 2008 support.md (100%) diff --git a/sources/talk/20200116 It-s the end for Windows Server 2008 support.md b/sources/news/20200116 It-s the end for Windows Server 2008 support.md similarity index 100% rename from sources/talk/20200116 It-s the end for Windows Server 2008 support.md rename to sources/news/20200116 It-s the end for Windows Server 2008 support.md From 15d6a8a8ad27a9019abeccbb61c433435576f1c4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 18 Jan 2020 13:00:32 +0800 Subject: [PATCH 0289/3057] Rename sources/tech/20200117 Fedora CoreOS out of preview.md to sources/news/20200117 Fedora CoreOS out of preview.md --- sources/{tech => news}/20200117 Fedora CoreOS out of preview.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200117 Fedora CoreOS out of preview.md (100%) diff --git a/sources/tech/20200117 Fedora CoreOS out of preview.md b/sources/news/20200117 Fedora CoreOS out of preview.md similarity index 100% rename from sources/tech/20200117 Fedora CoreOS out of preview.md rename to sources/news/20200117 Fedora CoreOS out of preview.md From bd087a133ae0d631f277f5074940ce5fc4e0f2a5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 13:21:23 +0800 Subject: [PATCH 0290/3057] PRF @wxy --- .../tech/20190406 Run a server with Git.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/translated/tech/20190406 Run a server with Git.md b/translated/tech/20190406 Run a server with Git.md index c52295591e..6757473b58 100644 --- a/translated/tech/20190406 Run a server with Git.md +++ b/translated/tech/20190406 Run a server with Git.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Run a server with Git) @@ -10,37 +10,37 @@ 使用 Git 来管理 Git 服务器 ====== -> 借助 Gitolite,你可以使用 Git 来管理 Git 服务器。在我们的系列中了解这些鲜为人知的 Git 用途。 +> 借助 Gitolite,你可以使用 Git 来管理 Git 服务器。在我们的系列文章中了解这些鲜为人知的 Git 用途。 -![computer servers processing data][1] +![](https://img.linux.net.cn/data/attachment/album/202001/18/132045yrr1pb9n497tfbiy.png) -正如我在系列文章中演示的那样,[Git][2] 除了跟踪源代码外,还可以做很多事情。信不信由你,Git 甚至可以管理你的 Git 服务器,因此你可以或多或少地使用 Git 本身运行 Git 服务器。 +正如我在系列文章中演示的那样,[Git][2] 除了跟踪源代码外,还可以做很多事情。信不信由你,Git 甚至可以管理你的 Git 服务器,因此你可以或多或少地使用 Git 本身来运行 Git 服务器。 -当然,这涉及除日常使用 Git 之外的许多组件,其中最重要的是 [Gitolite][3],该后端应用程序可以管理你使用 Git 的每个细小的配置。Gitolite 的优点在于,由于它使用 Git 作为其前端接口,因此很容易将 Git 服务器管理集成到其他基于 Git 的工作流中。Gitolite 可以精确控制谁可以访问你服务器上的特定存储库以及他们具有哪些权限。你可以使用常规的 Linux 系统工具自行管理此类事务,但是如果在六个用户中只有一个或两个以上的仓库,则需要大量的工作。 +当然,这涉及除日常使用 Git 之外的许多组件,其中最重要的是 [Gitolite][3],该后端应用程序可以管理你使用 Git 的每个细微的配置。Gitolite 的优点在于,由于它使用 Git 作为其前端接口,因此很容易将 Git 服务器管理集成到其他基于 Git 的工作流中。Gitolite 可以精确控制谁可以访问你服务器上的特定存储库以及他们具有哪些权限。你可以使用常规的 Linux 系统工具自行管理此类事务,但是如果有好几个用户和不止一两个仓库,则需要大量的工作。 Gitolite 的开发人员做了艰苦的工作,使你可以轻松地为许多用户提供对你的 Git 服务器的访问权,而又不让他们访问你的整个环境 —— 而这一切,你可以使用 Git 来完成全部工作。 -Gitolite 并`不是` 图形化的管理员和用户面板。优秀的 [Gitea][4] 项目可提供这种经验,但是本文重点介绍 Gitolite 的简单优雅和令人舒适的熟悉感。 +Gitolite 并**不是**图形化的管理员和用户面板。优秀的 [Gitea][4] 项目可提供这种体验,但是本文重点介绍 Gitolite 的简单优雅和令人舒适的熟悉感。 ### 安装 Gitolite -假设你的 Git 服务器运行 Linux,则可以使用包管理器安装 Gitolite(在 CentOS 和 RHEL 上为 `yum`,在 Debian 和 Ubuntu 上为 `apt`,在 OpenSUSE 上为 `zypper` 等)。例如,在 RHEL 上: +假设你的 Git 服务器运行在 Linux 上,则可以使用包管理器安装 Gitolite(在 CentOS 和 RHEL 上为 `yum`,在 Debian 和 Ubuntu 上为 `apt`,在 OpenSUSE 上为 `zypper` 等)。例如,在 RHEL 上: ``` $ sudo yum install gitolite3 ``` -许多发行版的存储库仍提供的是旧版本的 Gitolite,但当前版本为版本 3。 +许多发行版的存储库提供的仍是旧版本的 Gitolite,但最新版本为版本 3。 你必须具有对服务器的无密码 SSH 访问权限。如果愿意,你可以使用密码登录服务器,但是 Gitolite 依赖于 SSH 密钥,因此必须配置使用密钥登录的选项。如果你不知道如何配置服务器以进行无密码 SSH 访问,请首先学习如何进行操作(Steve Ovens 的 Ansible 文章的[设置 SSH 密钥身份验证][5]部分对此进行了很好的说明)。这是加强服务器管理的安全以及运行 Gitolite 的重要组成部分。 ### 配置 Git 用户 -如果没有 Gitolite,则如果某人请求访问你在服务器上托管的 Git 存储库,则必须向该人提供用户帐户。Git 提供了一个特殊的外壳,即 `git-shell`,这是一个仅执行 Git 任务的特别特定的 shell。这可以让你有个只能通过非常受限的 Shell 环境的过滤器来访问服务器的用户。 +如果没有 Gitolite,则如果某人请求访问你在服务器上托管的 Git 存储库时,则必须向该人提供用户帐户。Git 提供了一个特殊的外壳,即 `git-shell`,这是一个仅执行 Git 任务的特别的特定 shell。这可以让你有个只能通过非常受限的 Shell 环境来过滤访问你的服务器的用户。 -该解决方案可行,但通常意味着用户可以访问服务器上的所有存储库,除非你具有用于组权限的良好模式,并在创建新存储库时严格保持这些权限。这种方式还需要在系统级别进行大量手动配置,这通常是为特定级别的系统管理员保留的区域,而不一定是通常负责 Git 存储库的人员。 +这个解决方案是一个办法,但通常意味着用户可以访问服务器上的所有存储库,除非你具有用于组权限的良好模式,并在创建新存储库时严格遵循这些权限。这种方式还需要在系统级别进行大量手动配置,这通常是只有特定级别的系统管理员才能做的工作,而不一定是通常负责 Git 存储库的人员。 -Gitolite 通过为需要访问任何存储库的每个人指定一个用户名来完全回避此问题。 默认情况下,用户名是 `git`,并且由于 Gitolite 的文档假定使用的是它,因此在学习该工具时保留它是一个很好的默认设置。对于曾经使用过 GitLab 或 GitHub 或任何其他 Git 托管服务的人来说,这也是一个众所周知的约定。 +Gitolite 通过为需要访问任何存储库的每个人指定一个用户名来完全回避此问题。默认情况下,该用户名是 `git`,并且由于 Gitolite 的文档中假定使用的是它,因此在学习该工具时保留它是一个很好的默认设置。对于曾经使用过 GitLab 或 GitHub 或任何其他 Git 托管服务的人来说,这也是一个众所周知的约定。 Gitolite 将此用户称为**托管用户**。在服务器上创建一个帐户以充当托管用户(我习惯使用 `git`,因为这是惯例): @@ -48,7 +48,7 @@ Gitolite 将此用户称为**托管用户**。在服务器上创建一个帐户 $ sudo adduser --create-home git ``` -为了控制该 `git` 用户帐户,该帐户必须具有属于你的有效 SSH 公钥。你应该已经进行了设置,因此复制你的公钥(**不是你的私钥**)添加到 `git` 用户的家目录中: +为了控制该 `git` 用户帐户,该帐户必须具有属于你的有效 SSH 公钥。你应该已经进行了设置,因此复制你的公钥(**而不是你的私钥**)添加到 `git` 用户的家目录中: ``` $ sudo cp ~/.ssh/id_ed25519.pub /home/git/ @@ -62,11 +62,11 @@ $ sudo su - git $ gitolite setup --pubkey id_ed25519.pub ``` -安装脚本运行后,`git` 的家用户目录将有一个 `repository` 目录,该目录(目前)包含文件 `git-admin.git` 和 `testing.git`。这就是该服务器所需的全部设置,现在请登出 `git` 用户。 +安装脚本运行后,`git` 的家用户目录将有一个 `repository` 目录,该目录(目前)包含存储库 `git-admin.git` 和 `testing.git`。这就是该服务器所需的全部设置,现在请登出 `git` 用户。 ### 使用 Gitolite -管理 Gitolite 就是编辑 Git 存储库中的文本文件,尤其是 `gitolite-admin.git`。你不会通过 SSH 进入服务器来进行 Git 管理,并且 Gitolite 也建议你不要这样尝试。你和你的用户存储在 Gitolite 服务器上的存储库是个**裸**存储库,因此最好不要使用它们。 +管理 Gitolite 就是编辑 Git 存储库中的文本文件,尤其是 `gitolite-admin.git` 中的。你不会通过 SSH 进入服务器来进行 Git 管理,并且 Gitolite 也建议你不要这样尝试。在 Gitolite 服务器上存储你和你的用户的存储库是个**裸**存储库,因此最好不要使用它们。 ``` $ git clone git@example.com:gitolite-admin.git gitolite-admin.git @@ -76,7 +76,7 @@ conf keydir ``` -该存储库中的 `conf` 目录包含一个名为 `gitolite.conf` 的文件。在文本编辑器中打开它,或使用`cat`查看其内容: +该存储库中的 `conf` 目录包含一个名为 `gitolite.conf` 的文件。在文本编辑器中打开它,或使用 `cat` 查看其内容: ``` repo gitolite-admin @@ -86,15 +86,15 @@ repo testing RW+ = @all ``` -你可能对该配置文件的功能有所了解:`gitolite-admin` 代表此存储库,并且 `id_ed25519` 密钥的所有者具有读取、写入和 Git 管理权限。换句话说,不是将用户映射到普通的本地 Unix 用户(因为所有用户都使用 `git` 用户托管用户身份),而是将用户映射到 `keydir` 目录中列出的 SSH 密钥。 +你可能对该配置文件的功能有所了解:`gitolite-admin` 代表此存储库,并且 `id_ed25519` 密钥的所有者具有读取、写入和管理 Git 的权限。换句话说,不是将用户映射到普通的本地 Unix 用户(因为所有用户都使用 `git` 用户托管用户身份),而是将用户映射到 `keydir` 目录中列出的 SSH 密钥。 `testing.git` 存储库使用特殊组符号为访问服务器的每个人提供了全部权限。 #### 添加用户 -如果要向 Git 服务器添加一个名为 `alice` 的用户,Alice 必须向你发送她的 SSH 公钥。Gitolite 使用 `.pub` 扩展名左边的任何内容作为该 Git 用户的标识符。不要使用默认的密钥名称值,而是给密钥指定一个指示密钥所有者的名称。如果用户有多个密钥(例如,一个用于笔记本电脑,一个用于台式机),则可以使用子目录来避免文件名冲突。例如,Alice 在笔记本电脑上使用的密钥可能是默认的 `id_rsa.pub`,因此将其重命名为`alice.pub` 或类似名称(或让用户根据其计算机上的本地用户帐户来命名密钥),然后将其放入 `gitolite-admin.git/keydir/work/laptop/` 目录中。如果她从她的桌面发送了另一个密钥,命名为 `alice.pub`(与上一个相同),然后将其添加到 `keydir/home/desktop/` 中。另一个密钥可能放到 `keydir/home/desktop/` 中,依此类推。Gitolite 递归地在 `keydir` 中搜索与存储库“用户”匹配的 `.pub` 文件,并将所有匹配项视为相同的身份。 +如果要向 Git 服务器添加一个名为 `alice` 的用户,Alice 必须向你发送她的 SSH 公钥。Gitolite 使用文件名的 `.pub` 扩展名左边的任何内容作为该 Git 用户的标识符。不要使用默认的密钥名称值,而是给密钥指定一个指示密钥所有者的名称。如果用户有多个密钥(例如,一个用于笔记本电脑,一个用于台式机),则可以使用子目录来避免文件名冲突。例如,Alice 在笔记本电脑上使用的密钥可能是默认的 `id_rsa.pub`,因此将其重命名为`alice.pub` 或类似名称(或让用户根据其计算机上的本地用户帐户来命名密钥),然后将其放入 `gitolite-admin.git/keydir/work/laptop/` 目录中。如果她从她的桌面计算机发送了另一个密钥,命名为 `alice.pub`(与上一个相同),然后将其添加到 `keydir/home/desktop/` 中。另一个密钥可能放到 `keydir/home/desktop/` 中,依此类推。Gitolite 递归地在 `keydir` 中搜索与存储库“用户”相匹配的 `.pub` 文件,并将所有匹配项视为相同的身份。 -当你将密钥添加到 `keydir` 目录时,必须将它们提交回服务器。这是一件很容易忘记的事情,这里有一个使用自动化的 Git 应用程序(例如 [Sparkleshare] [7])的真正的理由,因此任何更改都将立即提交给你的 Gitolite 管理员。第一次忘记提交和推送,在浪费了三个小时的时间以及用户的故障排除时间之后,你会发现 Gitolite 是使用 Sparkleshare 的完美理由。 +当你将密钥添加到 `keydir` 目录时,必须将它们提交回服务器。这是一件很容易忘记的事情,这里有一个使用自动化的 Git 应用程序(例如 [Sparkleshare][7])的真正的理由,因此任何更改都将立即提交给你的 Gitolite 管理员。第一次忘记提交和推送,在浪费了三个小时的你和你的用户的故障排除时间之后,你会发现 Gitolite 是使用 Sparkleshare 的完美理由。 ``` $ git add keydir @@ -106,10 +106,10 @@ $ git push origin HEAD #### 设置权限 -与用户一样,目录权限和组也是从你可能习惯的的常规 Unix 工具中抽象出来的(或可从在线信息查找)。在`gitolite-admin.git/conf` 目录中的 `gitolite.conf` 文件中授予对项目的权限。权限分为四个级别: +与用户一样,目录权限和组也是从你可能习惯的的常规 Unix 工具中抽象出来的(或可从在线信息查找)。在 `gitolite-admin.git/conf` 目录中的 `gitolite.conf` 文件中授予对项目的权限。权限分为四个级别: * `R` 允许只读。在存储库上具有 `R` 权限的用户可以克隆它,仅此而已。 -* `RW` 允许用户执行分支的快进推送、创建新分支和创建新标签。对于大多数用户来说,这个或多或少感觉就像一个“普通”的 Git 存储库。 +* `RW` 允许用户执行分支的快进推送、创建新分支和创建新标签。对于大多数用户来说,这个基本上就像是一个“普通”的 Git 存储库。 * `RW+` 允许可能具有破坏性的 Git 动作。用户可以执行常规的快进推送、回滚推送、变基以及删除分支和标签。你可能想要或不希望将其授予项目中的所有贡献者。 * `-` 明确拒绝访问存储库。这与未在存储库的配置中列出的用户相同。 @@ -126,7 +126,7 @@ repo widgets RW+ = alice ``` -现在,Alice(也仅 Alice 一个人)就可以克隆该存储库: +现在,Alice(也仅有 Alice 一个人)可以克隆该存储库: ``` [alice]$ git clone git@example.com:widgets.git @@ -188,7 +188,7 @@ repo foo/CREATOR/[a-z]..* R = READERS ``` -第一行定义了一组用户:该组称为 `@managers`,其中包含用户 `alice` 和 `bob`。下一行设置了通配符允许创建尚不存在的存储库,放在名为 `foo` 的目录下的创建存储库的用户名的子目录中。例如: +第一行定义了一组用户:该组称为 `@managers`,其中包含用户 `alice` 和 `bob`。下一行设置了通配符允许创建尚不存在的存储库,放在名为 `foo` 的目录下的创建该存储库的用户名的子目录中。例如: ``` [alice]$ git clone git@example.com:foo/alice/cool-app.git @@ -197,11 +197,11 @@ Initialized empty Git repository in /home/git/repositories/foo/alice/cool-app.gi warning: You appear to have cloned an empty repository. ``` -野生仓库的创建者可以使用一些机制来定义谁可以读取和写入其存储库,但是他们是被限定范围的。在大多数情况下,Gitolite 假定由一组特定的用户来管理项目权限。一种解决方案是使用 Git 挂钩授予所有用户对 `gitolite-admin` 的访问权限,以要求管理者批准将更改合并到 master 分支中。 +野生仓库的创建者可以使用一些机制来定义谁可以读取和写入其存储库,但是他们是有范围限定的。在大多数情况下,Gitolite 假定由一组特定的用户来管理项目权限。一种解决方案是使用 Git 挂钩来授予所有用户对 `gitolite-admin` 的访问权限,以要求管理者批准将更改合并到 master 分支中。 ### 了解更多 -Gitolite 具有比此介绍性文章涵盖的更多功能,因此请尝试一下。其[文档][8]非常出色,一旦你通读了它,就可以自定义 Gitolite 服务器,以向用户提供你喜欢的任何级别的控制。Gitolite 是一种维护成本低、简单的系统,你可以安装、设置它,然后基本上就可以将其忘却。 +Gitolite 具有比此介绍性文章所涵盖的更多功能,因此请尝试一下。其[文档][8]非常出色,一旦你通读了它,就可以自定义 Gitolite 服务器,以向用户提供你喜欢的任何级别的控制。Gitolite 是一种维护成本低、简单的系统,你可以安装、设置它,然后基本上就可以将其忘却。 -------------------------------------------------------------------------------- @@ -210,7 +210,7 @@ via: https://opensource.com/article/19/4/server-administration-git 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a6df20006ffebc44cc5259d41b245508297ec6e3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 13:22:03 +0800 Subject: [PATCH 0291/3057] PUB @wxy https://linux.cn/article-11795-1.html --- .../tech => published}/20190406 Run a server with Git.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190406 Run a server with Git.md (99%) diff --git a/translated/tech/20190406 Run a server with Git.md b/published/20190406 Run a server with Git.md similarity index 99% rename from translated/tech/20190406 Run a server with Git.md rename to published/20190406 Run a server with Git.md index 6757473b58..ee4497eb51 100644 --- a/translated/tech/20190406 Run a server with Git.md +++ b/published/20190406 Run a server with Git.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11795-1.html) [#]: subject: (Run a server with Git) [#]: via: (https://opensource.com/article/19/4/server-administration-git) [#]: author: (Seth Kenlon https://opensource.com/users/seth/users/seth) From e398777b8a662598fb7ebca0fbd17ea7f44704d4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 14:13:54 +0800 Subject: [PATCH 0292/3057] PRF @geekpi --- ...uration management of multiple machines.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md b/translated/tech/20200112 Use Stow for configuration management of multiple machines.md index 1a31d9728a..b5f2787038 100644 --- a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md +++ b/translated/tech/20200112 Use Stow for configuration management of multiple machines.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use Stow for configuration management of multiple machines) @@ -9,30 +9,31 @@ 使用 Stow 管理多台机器配置 ====== -2020 年,在我们的 20 个使用开源提升生产力的系列文章中,让我们了解如何使用 Stow 跨机器管理配置。 -![A person programming][1] +> 2020 年,在我们的 20 个使用开源提升生产力的系列文章中,让我们了解如何使用 Stow 跨机器管理配置。 + +![](https://img.linux.net.cn/data/attachment/album/202001/18/141330jdcjalqzjal84a03.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 Stow 管理符号链接 -昨天,我解释了如何使用 [Syncthing][2] 在多台计算机上保持文件同步。但是,这只是我用来保持配置一致性的工具之一。还有另一个简单的工具 [Stow][3]。 +昨天,我解释了如何使用 [Syncthing][2] 在多台计算机上保持文件同步。但是,这只是我用来保持配置一致性的工具之一。还有另一个表面上看起来更简单的工具:[Stow][3]。 ![Stow help screen][4] Stow 管理符号链接。默认情况下,它会链接目录到上一级目录。还有设置源和目标目录的选项,但我通常不使用它们。 -正如我在 Syncthing 的[文章][5] 中提到的,我使用 Syncthing 来保持 **myconfigs** 目录在我所有的计算机上一致。**myconfigs** 目录下面有多个子目录。每个子目录包含我经常使用的应用之一的配置文件。 +正如我在 Syncthing 的[文章][5] 中提到的,我使用 Syncthing 来保持 `myconfigs` 目录在我所有的计算机上一致。`myconfigs` 目录下面有多个子目录。每个子目录包含我经常使用的应用之一的配置文件。 ![myconfigs directory][6] -在每台计算机上,我进入 **myconfigs** 目录,并运行 **stow -S <目录名称>** 以将目录中的文件符号链接到我的家目录。例如,在**vim** 目录下,我有 **.vimrc** 和 **.vim** 目录。在每台机器上,我运行 **stow -S vim** 来创建符号链接 **~/.vimrc** 和 **~/.vim**。当我在一台计算机上更改 Vim 配置时,它会应用到我的所有机器上。 +在每台计算机上,我进入 `myconfigs` 目录,并运行 `stow -S <目录名称>` 以将目录中的文件符号链接到我的家目录。例如,在 `vim` 目录下,我有 `.vimrc` 和 `.vim` 目录。在每台机器上,我运行 `stow -S vim` 来创建符号链接 `~/.vimrc` 和 `~/.vim`。当我在一台计算机上更改 Vim 配置时,它会应用到我的所有机器上。 -然而,有时候,我需要一些特定于机器的配置,这就是为什么我有如 **msmtp-personal** 和 **msmtp-elastic**(我的雇主)这样的目录。由于我的 **msmtp** SMTP 客户端需要知道要中继的电子邮件服务器,并且每个服务器都有不同的设置和凭据,我会使用 **-D** 标志来取消链接,接着链接另外一个。 +然而,有时候,我需要一些特定于机器的配置,这就是为什么我有如 `msmtp-personal` 和 `msmtp-elastic`(我的雇主)这样的目录。由于我的 `msmtp` SMTP 客户端需要知道要中继电子邮件服务器,并且每个服务器都有不同的设置和凭据,我会使用 `-D` 标志来取消链接,接着链接另外一个。 ![Unstow one, stow the other][7] -有时我要给配置添加文件。为此,有一个 **-R** 选项来”重新链接“。例如,我喜欢在图形化 Vim 中使用一种与控制台不同的特定字体。除了标准 **.vimrc** 文件,**.gvimrc** 文件能让我设置特定于图形化版本的选项。当我第一次设置它时,我移动 **~/.gvimrc** 到 **~/myconfigs/vim** 中,然后运行 **stow -R vim**,它取消链接并重新链接该目录中的所有内容。 +有时我要给配置添加文件。为此,有一个 `-R` 选项来“重新链接”。例如,我喜欢在图形化 Vim 中使用一种与控制台不同的特定字体。除了标准 `.vimrc` 文件,`.gvimrc` 文件能让我设置特定于图形化版本的选项。当我第一次设置它时,我移动 `~/.gvimrc` 到 `~/myconfigs/vim` 中,然后运行 `stow -R vim`,它取消链接并重新链接该目录中的所有内容。 Stow 让我使用一个简单的命令行在多种配置之间切换,并且,结合 Syncthing,我可以确保无论我身在何处或在哪里进行更改,我都有我喜欢的工具的设置。 @@ -43,7 +44,7 @@ via: https://opensource.com/article/20/1/configuration-management-stow 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -53,6 +54,6 @@ via: https://opensource.com/article/20/1/configuration-management-stow [2]: https://syncthing.net/ [3]: https://www.gnu.org/software/stow/ [4]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png (Stow help screen) -[5]: https://opensource.com/article/20/1/20-productivity-tools-syncthing +[5]: https://linux.cn/article-11793-1.html [6]: https://opensource.com/sites/default/files/uploads/productivity_2-2.png (myconfigs directory) [7]: https://opensource.com/sites/default/files/uploads/productivity_2-3.png (Unstow one, stow the other) From cb49ce7ca75d28e0d1dd0b1b05d285bef9b2be41 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 14:15:01 +0800 Subject: [PATCH 0293/3057] PUB @geekpi https://linux.cn/article-11796-1.html --- ... Stow for configuration management of multiple machines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200112 Use Stow for configuration management of multiple machines.md (98%) diff --git a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md b/published/20200112 Use Stow for configuration management of multiple machines.md similarity index 98% rename from translated/tech/20200112 Use Stow for configuration management of multiple machines.md rename to published/20200112 Use Stow for configuration management of multiple machines.md index b5f2787038..cf673d3e6b 100644 --- a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md +++ b/published/20200112 Use Stow for configuration management of multiple machines.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11796-1.html) [#]: subject: (Use Stow for configuration management of multiple machines) [#]: via: (https://opensource.com/article/20/1/configuration-management-stow) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From 4ef0a6f655251fe0cb483c119544ce53e8e21154 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 21:34:11 +0800 Subject: [PATCH 0294/3057] APL --- sources/tech/20200115 6 handy Bash scripts for Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200115 6 handy Bash scripts for Git.md b/sources/tech/20200115 6 handy Bash scripts for Git.md index 03464a840b..2e6754c875 100644 --- a/sources/tech/20200115 6 handy Bash scripts for Git.md +++ b/sources/tech/20200115 6 handy Bash scripts for Git.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8263ccb879a268addb36401e1be9fe6d4c52266c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 21:58:30 +0800 Subject: [PATCH 0295/3057] TSL --- .../20200115 6 handy Bash scripts for Git.md | 524 ------------------ .../20200115 6 handy Bash scripts for Git.md | 510 +++++++++++++++++ 2 files changed, 510 insertions(+), 524 deletions(-) delete mode 100644 sources/tech/20200115 6 handy Bash scripts for Git.md create mode 100644 translated/tech/20200115 6 handy Bash scripts for Git.md diff --git a/sources/tech/20200115 6 handy Bash scripts for Git.md b/sources/tech/20200115 6 handy Bash scripts for Git.md deleted file mode 100644 index 2e6754c875..0000000000 --- a/sources/tech/20200115 6 handy Bash scripts for Git.md +++ /dev/null @@ -1,524 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 handy Bash scripts for Git) -[#]: via: (https://opensource.com/article/20/1/bash-scripts-git) -[#]: author: (Bob Peterson https://opensource.com/users/bobpeterson) - -6 handy Bash scripts for Git -====== -These six Bash scripts will make your life easier when you're working -with Git repositories. -![Digital hand surrounding by objects, bike, light bulb, graphs][1] - -I wrote a bunch of Bash scripts that make my life easier when I'm working with Git repositories. Many of my colleagues say there's no need; that everything I need to do can be done with Git commands. While that may be true, I find the scripts infinitely more convenient than trying to figure out the appropriate Git command to do what I want. - -### 1\. gitlog - -**gitlog** prints an abbreviated list of current patches against the master version. It prints them from oldest to newest and shows the author and description, with **H** for **HEAD**, **^** for **HEAD^**, **2** for **HEAD~2,** and so forth. For example: - - -``` -$ gitlog -\-----------------------[ recovery25 ]----------------------- -(snip) -11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors -10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode - 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops - 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite - 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing - 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency - 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite - 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite - 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation - 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops - ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq - H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time -``` - -If I want to see what patches are on a different branch, I can specify an alternate branch: - - -``` -`$ gitlog recovery24` -``` - -### 2\. gitlog.id - -**gitlog.id** just prints the patch SHA1 IDs: - - -``` -$ gitlog.id -\-----------------------[ recovery25 ]----------------------- -56908eeb6940 2ca4a6b628a1 fc64ad5d99fe 02031a00a251 f6f38da7dd18 d8546e8f0023 fc3cc1f98f6b 12c3e0cb3523 76cce178b134 6fc1dce3ab9c 1b681ab074ca 26fed8de719b 802ff51a5670 49f67a512d8c f04f20193bbb 5f6afe809d23 2030521dc70e dada79b3be94 9b19a1e08161 78a035041d3e f03da011cae2 0d2b2e068fcd 2449976aa133 57dfb5e12ccd 53abedfdcf72 6fbdda3474b3 49544a547188 187032f7a63c 6f75dae23d93 95fc2a261b00 ebfb14ded191 f653ee9e414a 0e2911cb8111 73968b76e2e3 8a3e4cb5e92c a5f2da803b5b 7c9ef68388ed 71ca19d0cba8 340d27a33895 9b3c4e6efb10 d2e8c22be39b 9563e31f8bfd ebac7a38036c f703a3c27874 a3e86d2ef30e da3c604755b0 4525c2f5b46f a06a5b7dea02 8ba93c796d5c e8b5ff851bb9 -``` - -Again, it assumes the current branch, but I can specify a different branch if I want. - -### 3\. gitlog.id2 - -**gitlog.id2** is the same as **gitlog.id** but without the branch line at the top. This is handy for cherry-picking all patches from one branch to the current branch: - - -``` -$ # create a new branch -$ git branch --track origin/master -$ # check out the new branch I just created -$ git checkout recovery26 -$ # cherry-pick all patches from the old branch to the new one -$ for i in `gitlog.id2 recovery25` ; do git cherry-pick $i ;done -``` - -### 4\. gitlog.grep - -**gitlog.grep** greps for a string within that collection of patches. For example, if I find a bug and want to fix the patch that has a reference to function **inode_go_sync**, I simply do: - - -``` -$ gitlog.grep inode_go_sync -\-----------------------[ recovery25 - 50 patches ]----------------------- -(snip) -11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors -10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode - 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops -152:-static void inode_go_sync(struct gfs2_glock *gl) -153:+static int inode_go_sync(struct gfs2_glock *gl) -163:@@ -296,6 +302,7 @@ static void inode_go_sync(struct gfs2_glock *gl) - 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite - 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing - 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency - 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite - 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite - 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation - 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops - ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq - H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time -``` - -So, now I know that patch **HEAD~9** is the one that needs fixing. I use **git rebase -i HEAD~10** to edit patch 9, **git commit -a --amend**, then **git rebase --continue** to make the necessary adjustments. - -### 5\. gitbranchcmp3 - -**gitbranchcmp3** lets me compare my current branch to another branch, so I can compare older versions of patches to my newer versions and quickly see what's changed and what hasn't. It generates a compare script (that uses the KDE tool [Kompare][2], which works on GNOME3, as well) to compare the patches that aren't quite the same. If there are no differences other than line numbers, it prints **[SAME]**. If there are only comment differences, it prints **[same]** (in lower case). For example: - - -``` -$ gitbranchcmp3 recovery24 -Branch recovery24 has 47 patches -Branch recovery25 has 50 patches - -(snip) -38 87eb6901607a 340d27a33895 [same] gfs2: drain the ail2 list after io errors -39 90fefb577a26 9b3c4e6efb10 [same] gfs2: clean up iopen glock mess in gfs2_create_inode -40 ba3ae06b8b0e d2e8c22be39b [same] gfs2: Do proper error checking for go_sync family of glops -41 2ab662294329 9563e31f8bfd [SAME] gfs2: use page_offset in gfs2_page_mkwrite -42 0adc6d817b7a ebac7a38036c [SAME] gfs2: don't use buffer_heads in gfs2_allocate_page_backing -43 55ef1f8d0be8 f703a3c27874 [SAME] gfs2: Improve mmap write vs. punch_hole consistency -44 de57c2f72570 a3e86d2ef30e [SAME] gfs2: Multi-block allocations in gfs2_page_mkwrite -45 7c5305fbd68a da3c604755b0 [SAME] gfs2: Fix end-of-file handling in gfs2_page_mkwrite -46 162524005151 4525c2f5b46f [SAME] Rafael Aquini's slab instrumentation -47              a06a5b7dea02 [    ] GFS2: Add go_get_holdtime to gl_ops -48              8ba93c796d5c [    ] gfs2: introduce new function remaining_hold_time and use it in dq -49              e8b5ff851bb9 [    ] gfs2: Allow rgrps to have a minimum hold time - -Missing from recovery25: -The missing: -Compare script generated at: /tmp/compare_mismatches.sh -``` - -### 6\. gitlog.find - -Finally, I have **gitlog.find**, a script to help me identify where the upstream versions of my patches are and each patch's current status. It does this by matching the patch description. It also generates a compare script (again, using Kompare) to compare the current patch to the upstream counterpart: - - -``` -$ gitlog.find -\-----------------------[ recovery25 - 50 patches ]----------------------- -(snip) -11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors -lo 5bcb9be74b2a Bob Peterson     gfs2: drain the ail2 list after io errors -10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode -fn 2c47c1be51fb Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode - 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops -lo feb7ea639472 Bob Peterson     gfs2: Do proper error checking for go_sync family of glops - 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite -ms f3915f83e84c Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite - 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing -ms 35af80aef99b Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing - 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency -fn 39c3a948ecf6 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency - 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite -fn f53056c43063 Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite - 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite -fn 184b4e60853d Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite - 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation -   Not found upstream - 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops -   Not found upstream - ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq -   Not found upstream - H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time -   Not found upstream -Compare script generated: /tmp/compare_upstream.sh -``` - -The patches are shown on two lines, the first of which is your current patch, followed by the corresponding upstream patch, and a 2-character abbreviation to indicate its upstream status: - - * **lo** means the patch is in the local upstream Git repo only (i.e., not pushed upstream yet). - * **ms** means the patch is in Linus Torvald's master branch. - * **fn** means the patch is pushed to my "for-next" development branch, intended for the next upstream merge window. - - - -Some of my scripts make assumptions based on how I normally work with Git. For example, when searching for upstream patches, it uses my well-known Git tree's location. So, you will need to adjust or improve them to suit your conditions. The **gitlog.find** script is designed to locate [GFS2][3] and [DLM][4] patches only, so unless you're a GFS2 developer, you will want to customize it to the components that interest you. - -### Source code - -Here is the source for these scripts. - -#### 1\. gitlog - - -``` -#!/bin/bash -branch=$1 - -if test "x$branch" = x; then -    branch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi - -patches=0 -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` -for i in $LIST; do patches=$(echo $patches + 1 | bc);done - -if [[ $branch =~ .*for-next.* ]] -then -    start=HEAD -#    start=origin/for-next -else -    start=origin/master -fi - -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -/usr/bin/echo "-----------------------[" $branch "]-----------------------" -patches=$(echo $patches - 1 | bc); -for i in $LIST; do -    if [ $patches -eq 1 ]; then -        cnt=" ^" -    elif [ $patches -eq 0 ]; then -        cnt=" H" -    else -        if [ $patches -lt 10 ]; then -            cnt=" $patches" -        else -            cnt="$patches" -        fi -    fi -    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s %n" $i -    patches=$(echo $patches - 1 | bc) -done -#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" $tracking..$branch -#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" ^origin/master ^linux-gfs2/for-next $branch -``` - -#### 2\. gitlog.id - - -``` -#!/bin/bash -branch=$1 - -if test "x$branch" = x; then -    branch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi - -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -/usr/bin/echo "-----------------------[" $branch "]-----------------------" -git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' -``` - -#### 3\. gitlog.id2 - - -``` -#!/bin/bash -branch=$1 - -if test "x$branch" = x; then -    branch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi - -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` -git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' -``` - -#### 4\. gitlog.grep - - -``` -#!/bin/bash -param1=$1 -param2=$2 - -if test "x$param2" = x; then -    branch=`git branch -a | grep "*" | cut -d ' ' -f2` -    string=$param1 -else -    branch=$param1 -    string=$param2 -fi - -patches=0 -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` -for i in $LIST; do patches=$(echo $patches + 1 | bc);done -/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" -patches=$(echo $patches - 1 | bc); -for i in $LIST; do -    if [ $patches -eq 1 ]; then -        cnt=" ^" -    elif [ $patches -eq 0 ]; then -        cnt=" H" -    else -        if [ $patches -lt 10 ]; then -            cnt=" $patches" -        else -            cnt="$patches" -        fi -    fi -    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i -    /usr/bin/git show --pretty=email --patch-with-stat $i | grep -n "$string" -    patches=$(echo $patches - 1 | bc) -done -``` - -#### 5\. gitbranchcmp3 - - -``` -#!/bin/bash -# -# gitbranchcmp3 <old branch> [<new_branch>] -# -oldbranch=$1 -newbranch=$2 -script=/tmp/compare_mismatches.sh - -/usr/bin/rm -f $script -echo "#!/bin/bash" > $script -/usr/bin/chmod 755 $script -echo "# Generated by gitbranchcmp3.sh" >> $script -echo "# Run this script to compare the mismatched patches" >> $script -echo " " >> $script -echo "function compare_them()" >> $script -echo "{"  >> $script -echo "    git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script -echo "    git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script -echo "    kompare /tmp/gronk1 /tmp/gronk2" >> $script -echo "}" >> $script -echo " " >> $script - -if test "x$newbranch" = x; then -    newbranch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi - -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -declare -a oldsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$oldbranch | cut -d ' ' -f1 |paste -s -d ' '`) -declare -a newsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$newbranch | cut -d ' ' -f1 |paste -s -d ' '`) - -#echo "old: " $oldsha1s -oldcount=${#oldsha1s[@]} -echo "Branch $oldbranch has $oldcount patches" -oldcount=$(echo $oldcount - 1 | bc) -#for o in `seq 0 ${#oldsha1s[@]}`; do -#    echo -n ${oldsha1s[$o]} " " -#    desc=`git show $i | head -5 | tail -1|cut -b5-` -#done - -#echo "new: " $newsha1s -newcount=${#newsha1s[@]} -echo "Branch $newbranch has $newcount patches" -newcount=$(echo $newcount - 1 | bc) -#for o in `seq 0 ${#newsha1s[@]}`; do -#    echo -n ${newsha1s[$o]} " " -#    desc=`git show $i | head -5 | tail -1|cut -b5-` -#done -echo - -for new in `seq 0 $newcount`; do -    newsha=${newsha1s[$new]} -    newdesc=`git show $newsha | head -5 | tail -1|cut -b5-` -    oldsha="            " -    same="[    ]" -    for old in `seq 0 $oldcount`; do -        if test "${oldsha1s[$old]}" = "match"; then -            continue; -        fi -        olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` -        if test "$olddesc" = "$newdesc" ; then -            oldsha=${oldsha1s[$old]} -            #echo $oldsha -            git show $oldsha |tail -n +2 |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk1 -            git show $newsha |tail -n +2 |grep -v "index.*\\.\\." |grep -v "@@"  > /tmp/gronk2 -            diff /tmp/gronk1 /tmp/gronk2 &> /dev/null -            if [ $? -eq 0 ] ;then -# No differences -                same="[SAME]" -                oldsha1s[$old]="match" -                break -            fi -            git show $oldsha |sed -n '/diff/,$p' |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk1 -            git show $newsha |sed -n '/diff/,$p' |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk2 -            diff /tmp/gronk1 /tmp/gronk2 &> /dev/null -            if [ $? -eq 0 ] ;then -# Differences in comments only -                same="[same]" -                oldsha1s[$old]="match" -                break -            fi -            oldsha1s[$old]="match" -            echo "compare_them $oldsha $newsha" >> $script -        fi -    done -    echo "$new $oldsha $newsha $same $newdesc" -done - -echo -echo "Missing from $newbranch:" -the_missing="" -# Now run through the olds we haven't matched up -for old in `seq 0 $oldcount`; do -    if test ${oldsha1s[$old]} != "match"; then -        olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` -        echo "${oldsha1s[$old]} $olddesc" -        the_missing=`echo "$the_missing ${oldsha1s[$old]}"` -    fi -done - -echo "The missing: " $the_missing -echo "Compare script generated at: $script" -#git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' -``` - -#### 6\. gitlog.find - - -``` -#!/bin/bash -# -# Find the upstream equivalent patch -# -# gitlog.find -# -cwd=$PWD -param1=$1 -ubranch=$2 -patches=0 -script=/tmp/compare_upstream.sh -echo "#!/bin/bash" > $script -/usr/bin/chmod 755 $script -echo "# Generated by gitbranchcmp3.sh" >> $script -echo "# Run this script to compare the mismatched patches" >> $script -echo " " >> $script -echo "function compare_them()" >> $script -echo "{"  >> $script -echo "    cwd=$PWD" >> $script -echo "    git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script -echo "    cd ~/linux.git/fs/gfs2" >> $script -echo "    git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script -echo "    cd $cwd" >> $script -echo "    kompare /tmp/gronk1 /tmp/gronk2" >> $script -echo "}" >> $script -echo " " >> $script - -#echo "Gathering upstream patch info. Please wait." -branch=`git branch -a | grep "*" | cut -d ' ' -f2` -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -cd ~/linux.git -if test "X${ubranch}" = "X"; then -    ubranch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi -utracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` -# -# gather a list of gfs2 patches from master just in case we can't find it -# -#git log --abbrev-commit --pretty=format:"   %h %<|(32)%an %s" master |grep -i -e "gfs2" -e "dlm" > /tmp/gronk -git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/gfs2/ > /tmp/gronk.gfs2 -# ms = in Linus's master -git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/dlm/ > /tmp/gronk.dlm - -cd $cwd -LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` -for i in $LIST; do patches=$(echo $patches + 1 | bc);done -/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" -patches=$(echo $patches - 1 | bc); -for i in $LIST; do -    if [ $patches -eq 1 ]; then -        cnt=" ^" -    elif [ $patches -eq 0 ]; then -        cnt=" H" -    else -        if [ $patches -lt 10 ]; then -            cnt=" $patches" -        else -            cnt="$patches" -        fi -    fi -    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i -    desc=`/usr/bin/git show --abbrev-commit -s --pretty=format:"%s" $i` -    cd ~/linux.git -    cmp=1 -    up_eq=`git log --reverse --abbrev-commit --pretty=format:"lo %h %<|(32)%an %s" $utracking..$ubranch | grep "$desc"` -# lo = in local for-next -    if test "X$up_eq" = "X"; then -        up_eq=`git log --reverse --abbrev-commit --pretty=format:"fn %h %<|(32)%an %s" master..$utracking | grep "$desc"` -# fn = in for-next for next merge window -        if test "X$up_eq" = "X"; then -            up_eq=`grep "$desc" /tmp/gronk.gfs2` -            if test "X$up_eq" = "X"; then -                up_eq=`grep "$desc" /tmp/gronk.dlm` -                if test "X$up_eq" = "X"; then -                    up_eq="   Not found upstream" -                    cmp=0 -                fi -            fi -        fi -    fi -    echo "$up_eq" -    if [ $cmp -eq 1 ] ; then -        UP_SHA1=`echo $up_eq|cut -d' ' -f2` -        echo "compare_them $UP_SHA1 $i" >> $script -    fi -    cd $cwd -    patches=$(echo $patches - 1 | bc) -done -echo "Compare script generated: $script" -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/bash-scripts-git - -作者:[Bob Peterson][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bobpeterson -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) -[2]: https://kde.org/applications/development/org.kde.kompare -[3]: https://en.wikipedia.org/wiki/GFS2 -[4]: https://en.wikipedia.org/wiki/Distributed_lock_manager diff --git a/translated/tech/20200115 6 handy Bash scripts for Git.md b/translated/tech/20200115 6 handy Bash scripts for Git.md new file mode 100644 index 0000000000..93a0d97796 --- /dev/null +++ b/translated/tech/20200115 6 handy Bash scripts for Git.md @@ -0,0 +1,510 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 handy Bash scripts for Git) +[#]: via: (https://opensource.com/article/20/1/bash-scripts-git) +[#]: author: (Bob Peterson https://opensource.com/users/bobpeterson) + +6 个方便的 Git 脚本 +====== + +> 当使用 Git 存储库时,这六个 Bash 脚本将使你的生活更轻松。 + +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +我编写了许多 Bash 脚本,这些脚本使我在使用 Git 存储库时工作更加轻松。我的许多同事说没有必要;我所做的一切都可以用 Git 命令完成。虽然这可能是正确的,但我发现脚本远比尝试找出适当的 Git 命令来执行我想要的操作更加方便。 + +### 1、gitlog + +`gitlog` 打印针对 master 分支的当前补丁的简短列表。它从最旧到最新打印它们,并显示作者和描述,其中 `H` 代表 `HEAD`,`^` 代表 `HEAD^`,`2` 代表 `HEAD~2`,依此类推。例如: + +``` +$ gitlog +-----------------------[ recovery25 ]----------------------- +(snip) +11 340d27a33895 Bob Peterson gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson gfs2: Do proper error checking for go_sync family of glops + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson Rafael Aquini's slab instrumentation + 2 a06a5b7dea02 Bob Peterson GFS2: Add go_get_holdtime to gl_ops + ^ 8ba93c796d5c Bob Peterson gfs2: introduce new function remaining_hold_time and use it in dq + H e8b5ff851bb9 Bob Peterson gfs2: Allow rgrps to have a minimum hold time +``` + +如果我想查看其他分支上有哪些补丁,可以指定一个替代分支: + +``` +$ gitlog recovery24 +``` + +### 2、gitlog.id + +`gitlog.id` 只是打印出补丁的 SHA1 ID: + +``` +$ gitlog.id +-----------------------[ recovery25 ]----------------------- +56908eeb6940 2ca4a6b628a1 fc64ad5d99fe 02031a00a251 f6f38da7dd18 d8546e8f0023 fc3cc1f98f6b 12c3e0cb3523 76cce178b134 6fc1dce3ab9c 1b681ab074ca 26fed8de719b 802ff51a5670 49f67a512d8c f04f20193bbb 5f6afe809d23 2030521dc70e dada79b3be94 9b19a1e08161 78a035041d3e f03da011cae2 0d2b2e068fcd 2449976aa133 57dfb5e12ccd 53abedfdcf72 6fbdda3474b3 49544a547188 187032f7a63c 6f75dae23d93 95fc2a261b00 ebfb14ded191 f653ee9e414a 0e2911cb8111 73968b76e2e3 8a3e4cb5e92c a5f2da803b5b 7c9ef68388ed 71ca19d0cba8 340d27a33895 9b3c4e6efb10 d2e8c22be39b 9563e31f8bfd ebac7a38036c f703a3c27874 a3e86d2ef30e da3c604755b0 4525c2f5b46f a06a5b7dea02 8ba93c796d5c e8b5ff851bb9 +``` + +同样,它假定是当前分支,但是如果需要,我可以指定其他分支。 + +### 3、gitlog.id2 + +`gitlog.id2` 与 `gitlog.id` 相同,但顶部没有显示分支的行。这对于从一个分支挑选所有补丁到当前分支很方便: + +``` +$ # 创建一个新分支 +$ git branch --track origin/master +$ # 检出刚刚创建的新分支 +$ git checkout recovery26 +$ # 从旧的分支挑选所有补丁到新分支 +$ for i in `gitlog.id2 recovery25` ; do git cherry-pick $i ;done +``` + +### 4、gitlog.grep + +`gitlog.grep` 会在该补丁集合中寻找一个字符串。例如,如果我发现一个错误并想修复引用了函数 `inode_go_sync` 的补丁,我可以简单地执行以下操作: + +``` +$ gitlog.grep inode_go_sync +-----------------------[ recovery25 - 50 patches ]----------------------- +(snip) +11 340d27a33895 Bob Peterson gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson gfs2: Do proper error checking for go_sync family of glops +152:-static void inode_go_sync(struct gfs2_glock *gl) +153:+static int inode_go_sync(struct gfs2_glock *gl) +163:@@ -296,6 +302,7 @@ static void inode_go_sync(struct gfs2_glock *gl) + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson Rafael Aquini's slab instrumentation + 2 a06a5b7dea02 Bob Peterson GFS2: Add go_get_holdtime to gl_ops + ^ 8ba93c796d5c Bob Peterson gfs2: introduce new function remaining_hold_time and use it in dq + H e8b5ff851bb9 Bob Peterson gfs2: Allow rgrps to have a minimum hold time +``` + +因此,现在我知道补丁 `HEAD~9` 是需要修复的补丁。我使用 `git rebase -i HEAD~10` 编辑补丁 9,`git commit -a --amend`,然后 `git rebase --continue` 以进行必要的调整。 + +### 5、gitbranchcmp3 + +`gitbranchcmp3` 使我可以将当前分支与另一个分支进行比较,因此我可以将较旧版本的补丁与我的较新版本进行比较,并快速查看已更改和未更改的内容。它生成一个比较脚本(使用了 KDE 工具 [Kompare][2],该工具也可在 GNOME3 上使用)以比较不太相同的补丁。如果除行号外没有其他差异,则打印 `[SAME]`。如果仅存在注释差异,则打印 `[same]`(小写)。例如: + +``` +$ gitbranchcmp3 recovery24 +Branch recovery24 has 47 patches +Branch recovery25 has 50 patches + +(snip) +38 87eb6901607a 340d27a33895 [same] gfs2: drain the ail2 list after io errors +39 90fefb577a26 9b3c4e6efb10 [same] gfs2: clean up iopen glock mess in gfs2_create_inode +40 ba3ae06b8b0e d2e8c22be39b [same] gfs2: Do proper error checking for go_sync family of glops +41 2ab662294329 9563e31f8bfd [SAME] gfs2: use page_offset in gfs2_page_mkwrite +42 0adc6d817b7a ebac7a38036c [SAME] gfs2: don't use buffer_heads in gfs2_allocate_page_backing +43 55ef1f8d0be8 f703a3c27874 [SAME] gfs2: Improve mmap write vs. punch_hole consistency +44 de57c2f72570 a3e86d2ef30e [SAME] gfs2: Multi-block allocations in gfs2_page_mkwrite +45 7c5305fbd68a da3c604755b0 [SAME] gfs2: Fix end-of-file handling in gfs2_page_mkwrite +46 162524005151 4525c2f5b46f [SAME] Rafael Aquini's slab instrumentation +47 a06a5b7dea02 [ ] GFS2: Add go_get_holdtime to gl_ops +48 8ba93c796d5c [ ] gfs2: introduce new function remaining_hold_time and use it in dq +49 e8b5ff851bb9 [ ] gfs2: Allow rgrps to have a minimum hold time + +Missing from recovery25: +The missing: +Compare script generated at: /tmp/compare_mismatches.sh +``` + +### 6、gitlog.find + +最后,我有一个 `gitlog.find` 脚本,可以帮助我识别补丁程序的上游版本在哪里以及每个补丁程序的当前状态。它通过匹配补丁说明来实现。它还会生成一个比较脚本(再次使用了 Kompare),以将当前补丁与上游对应补丁进行比较: + +``` +$ gitlog.find +-----------------------[ recovery25 - 50 patches ]----------------------- +(snip) +11 340d27a33895 Bob Peterson gfs2: drain the ail2 list after io errors +lo 5bcb9be74b2a Bob Peterson gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson gfs2: clean up iopen glock mess in gfs2_create_inode +fn 2c47c1be51fb Bob Peterson gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson gfs2: Do proper error checking for go_sync family of glops +lo feb7ea639472 Bob Peterson gfs2: Do proper error checking for go_sync family of glops + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite +ms f3915f83e84c Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing +ms 35af80aef99b Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency +fn 39c3a948ecf6 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite +fn f53056c43063 Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite +fn 184b4e60853d Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson Rafael Aquini's slab instrumentation + Not found upstream + 2 a06a5b7dea02 Bob Peterson GFS2: Add go_get_holdtime to gl_ops + Not found upstream + ^ 8ba93c796d5c Bob Peterson gfs2: introduce new function remaining_hold_time and use it in dq + Not found upstream + H e8b5ff851bb9 Bob Peterson gfs2: Allow rgrps to have a minimum hold time + Not found upstream +Compare script generated: /tmp/compare_upstream.sh +``` + +补丁显示为两行,第一行是你当前的修补程序,然后是相应的上游补丁,以及 2 个字符的缩写,以指示其上游状态: + +* `lo` 表示补丁仅在本地(`local`)上游 Git 存储库中(即尚未推送到上游)。 +* `ms` 表示补丁位于 Linus Torvald 的主(`master`)分支中。 +* `fn` 意味着补丁被推送到我的 “for-next” 开发分支,用于下一个上游合并窗口。 +   +我的一些脚本根据我通常使用 Git 的方式做出假设。例如,当搜索上游补丁时,它使用我众所周知的 Git 树的位置。因此,你需要调整或改进它们以适合你的条件。`gitlog.find` 脚本旨在仅定位 [GFS2][3] 和 [DLM][4] 补丁,因此,除非你是 GFS2 开发人员,否则你需要针对你感兴趣的组件对其进行自定义。 + +### 源代码 + +以下是这些脚本的源代码。 + +#### 1、gitlog + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then + branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +patches=0 +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done + +if [[ $branch =~ .*for-next.* ]] +then + start=HEAD +# start=origin/for-next +else + start=origin/master +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +/usr/bin/echo "-----------------------[" $branch "]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do + if [ $patches -eq 1 ]; then + cnt=" ^" + elif [ $patches -eq 0 ]; then + cnt=" H" + else + if [ $patches -lt 10 ]; then + cnt=" $patches" + else + cnt="$patches" + fi + fi + /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s %n" $i + patches=$(echo $patches - 1 | bc) +done +#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" $tracking..$branch +#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" ^origin/master ^linux-gfs2/for-next $branch +``` + +#### 2、gitlog.id + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then + branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +/usr/bin/echo "-----------------------[" $branch "]-----------------------" +git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 3、gitlog.id2 + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then + branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` +git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 4、gitlog.grep + +``` +#!/bin/bash +param1=$1 +param2=$2 + +if test "x$param2" = x; then + branch=`git branch -a | grep "*" | cut -d ' ' -f2` + string=$param1 +else + branch=$param1 + string=$param2 +fi + +patches=0 +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done +/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do + if [ $patches -eq 1 ]; then + cnt=" ^" + elif [ $patches -eq 0 ]; then + cnt=" H" + else + if [ $patches -lt 10 ]; then + cnt=" $patches" + else + cnt="$patches" + fi + fi + /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i + /usr/bin/git show --pretty=email --patch-with-stat $i | grep -n "$string" + patches=$(echo $patches - 1 | bc) +done +``` + +#### 5、gitbranchcmp3 + +``` +#!/bin/bash +# +# gitbranchcmp3 [] +# +oldbranch=$1 +newbranch=$2 +script=/tmp/compare_mismatches.sh + +/usr/bin/rm -f $script +echo "#!/bin/bash" > $script +/usr/bin/chmod 755 $script +echo "# Generated by gitbranchcmp3.sh" >> $script +echo "# Run this script to compare the mismatched patches" >> $script +echo " " >> $script +echo "function compare_them()" >> $script +echo "{" >> $script +echo " git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script +echo " git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script +echo " kompare /tmp/gronk1 /tmp/gronk2" >> $script +echo "}" >> $script +echo " " >> $script + +if test "x$newbranch" = x; then + newbranch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +declare -a oldsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$oldbranch | cut -d ' ' -f1 |paste -s -d ' '`) +declare -a newsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$newbranch | cut -d ' ' -f1 |paste -s -d ' '`) + +#echo "old: " $oldsha1s +oldcount=${#oldsha1s[@]} +echo "Branch $oldbranch has $oldcount patches" +oldcount=$(echo $oldcount - 1 | bc) +#for o in `seq 0 ${#oldsha1s[@]}`; do +# echo -n ${oldsha1s[$o]} " " +# desc=`git show $i | head -5 | tail -1|cut -b5-` +#done + +#echo "new: " $newsha1s +newcount=${#newsha1s[@]} +echo "Branch $newbranch has $newcount patches" +newcount=$(echo $newcount - 1 | bc) +#for o in `seq 0 ${#newsha1s[@]}`; do +# echo -n ${newsha1s[$o]} " " +# desc=`git show $i | head -5 | tail -1|cut -b5-` +#done +echo + +for new in `seq 0 $newcount`; do + newsha=${newsha1s[$new]} + newdesc=`git show $newsha | head -5 | tail -1|cut -b5-` + oldsha=" " + same="[ ]" + for old in `seq 0 $oldcount`; do + if test "${oldsha1s[$old]}" = "match"; then + continue; + fi + olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` + if test "$olddesc" = "$newdesc" ; then + oldsha=${oldsha1s[$old]} + #echo $oldsha + git show $oldsha |tail -n +2 |grep -v "index.*\.\." |grep -v "@@" > /tmp/gronk1 + git show $newsha |tail -n +2 |grep -v "index.*\.\." |grep -v "@@" > /tmp/gronk2 + diff /tmp/gronk1 /tmp/gronk2 &> /dev/null + if [ $? -eq 0 ] ;then +# No differences + same="[SAME]" + oldsha1s[$old]="match" + break + fi + git show $oldsha |sed -n '/diff/,$p' |grep -v "index.*\.\." |grep -v "@@" > /tmp/gronk1 + git show $newsha |sed -n '/diff/,$p' |grep -v "index.*\.\." |grep -v "@@" > /tmp/gronk2 + diff /tmp/gronk1 /tmp/gronk2 &> /dev/null + if [ $? -eq 0 ] ;then +# Differences in comments only + same="[same]" + oldsha1s[$old]="match" + break + fi + oldsha1s[$old]="match" + echo "compare_them $oldsha $newsha" >> $script + fi + done + echo "$new $oldsha $newsha $same $newdesc" +done + +echo +echo "Missing from $newbranch:" +the_missing="" +# Now run through the olds we haven't matched up +for old in `seq 0 $oldcount`; do + if test ${oldsha1s[$old]} != "match"; then + olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` + echo "${oldsha1s[$old]} $olddesc" + the_missing=`echo "$the_missing ${oldsha1s[$old]}"` + fi +done + +echo "The missing: " $the_missing +echo "Compare script generated at: $script" +#git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 6、gitlog.find + +``` +#!/bin/bash +# +# Find the upstream equivalent patch +# +# gitlog.find +# +cwd=$PWD +param1=$1 +ubranch=$2 +patches=0 +script=/tmp/compare_upstream.sh +echo "#!/bin/bash" > $script +/usr/bin/chmod 755 $script +echo "# Generated by gitbranchcmp3.sh" >> $script +echo "# Run this script to compare the mismatched patches" >> $script +echo " " >> $script +echo "function compare_them()" >> $script +echo "{" >> $script +echo " cwd=$PWD" >> $script +echo " git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script +echo " cd ~/linux.git/fs/gfs2" >> $script +echo " git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script +echo " cd $cwd" >> $script +echo " kompare /tmp/gronk1 /tmp/gronk2" >> $script +echo "}" >> $script +echo " " >> $script + +#echo "Gathering upstream patch info. Please wait." +branch=`git branch -a | grep "*" | cut -d ' ' -f2` +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +cd ~/linux.git +if test "X${ubranch}" = "X"; then + ubranch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi +utracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` +# +# gather a list of gfs2 patches from master just in case we can't find it +# +#git log --abbrev-commit --pretty=format:" %h %<|(32)%an %s" master |grep -i -e "gfs2" -e "dlm" > /tmp/gronk +git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/gfs2/ > /tmp/gronk.gfs2 +# ms = in Linus's master +git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/dlm/ > /tmp/gronk.dlm + +cd $cwd +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done +/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do + if [ $patches -eq 1 ]; then + cnt=" ^" + elif [ $patches -eq 0 ]; then + cnt=" H" + else + if [ $patches -lt 10 ]; then + cnt=" $patches" + else + cnt="$patches" + fi + fi + /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i + desc=`/usr/bin/git show --abbrev-commit -s --pretty=format:"%s" $i` + cd ~/linux.git + cmp=1 + up_eq=`git log --reverse --abbrev-commit --pretty=format:"lo %h %<|(32)%an %s" $utracking..$ubranch | grep "$desc"` +# lo = in local for-next + if test "X$up_eq" = "X"; then + up_eq=`git log --reverse --abbrev-commit --pretty=format:"fn %h %<|(32)%an %s" master..$utracking | grep "$desc"` +# fn = in for-next for next merge window + if test "X$up_eq" = "X"; then + up_eq=`grep "$desc" /tmp/gronk.gfs2` + if test "X$up_eq" = "X"; then + up_eq=`grep "$desc" /tmp/gronk.dlm` + if test "X$up_eq" = "X"; then + up_eq=" Not found upstream" + cmp=0 + fi + fi + fi + fi + echo "$up_eq" + if [ $cmp -eq 1 ] ; then + UP_SHA1=`echo $up_eq|cut -d' ' -f2` + echo "compare_them $UP_SHA1 $i" >> $script + fi + cd $cwd + patches=$(echo $patches - 1 | bc) +done +echo "Compare script generated: $script" +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/bash-scripts-git + +作者:[Bob Peterson][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bobpeterson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://kde.org/applications/development/org.kde.kompare +[3]: https://en.wikipedia.org/wiki/GFS2 +[4]: https://en.wikipedia.org/wiki/Distributed_lock_manager From f417dd688f7a2eae53239063f13f34e4e0aec9c0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 22:08:00 +0800 Subject: [PATCH 0296/3057] APL --- ...- A Bash function to maintain Python virtual environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md index 0a1192bccf..51fbc31785 100644 --- a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md +++ b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0d2a3db0f353c6d00d8ec85eb80fa75498552907 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 22:21:41 +0800 Subject: [PATCH 0297/3057] TSL --- ...to maintain Python virtual environments.md | 303 ------------------ ...to maintain Python virtual environments.md | 296 +++++++++++++++++ 2 files changed, 296 insertions(+), 303 deletions(-) delete mode 100644 sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md create mode 100644 translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md diff --git a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md deleted file mode 100644 index 51fbc31785..0000000000 --- a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md +++ /dev/null @@ -1,303 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (setV: A Bash function to maintain Python virtual environments) -[#]: via: (https://opensource.com/article/20/1/setv-bash-function) -[#]: author: (Sachin Patil https://opensource.com/users/psachin) - -setV: A Bash function to maintain Python virtual environments -====== -Get to know setV, a lightweight Python virtual environment manager and -alternative to virtualenvwrapper. -![Coding on a computer][1] - -For more than a year, [setV][2] has been hidden away within my [bash_scripts][3] project, but it's time for it to become public. setV is a Bash function I use as an alternative to [virtualenvwrapper][4]. It provides basic features that enable you to do things such as: - - * Use Python 3 by default - * Create a new virtual environment - * Create a new virtual environment using a custom Python path with **-p** (or **\--python**) - * Delete an existing virtual environment - * List all existing virtual environment - * Use Tab completion (in case you don't remember the virtual environment name) - - - -### Installation - -To install setV, download the script: - - -``` -`curl https://gitlab.com/psachin/setV/raw/master/install.sh` -``` - -Review the script, and then run it: - - -``` -`sh ./install.sh` -``` - -When you install setV, the installation script asks you to source **~/.bashrc** or **~/.bash_profile**. Be sure to do that. - -### Usage - -The basic command is **setv**. - -#### Create a virtual environment: - - -``` -setv --new rango  # setv -n rango - -# Or using a custom Python binary path -setv --new --python /opt/python/python3 rango  # setv -n -p /opt/python/python3 rango -``` - -#### Activate an existing environment: - - -``` -setv VIRTUAL_ENVIRONMENT_NAME - -# For example -setv rango -``` - -#### List all virtual environments: - - -``` -setv --list -# or -setv [TAB] [TAB] -``` - -#### Delete a virtual environment: - - -``` -`setv --delete rango` -``` - -#### Switch to another virtual environment: - - -``` -# Assuming you are in 'rango', switch to 'tango' using -setv tango -``` - -#### Tab Completion - -If you don't fully remember the virtual environment's name, Bash-like Tab completion works for virtual environment names. - -### Get involved - -setV is open source under the GNU [GPLv3][5], and contributions are welcome. To learn more, visit the Contribute section of setV's [README][6] in its GitLab repository. - -### The setV script - - -``` -#!/usr/bin/env bash -# setV - A Lightweight Python virtual environment manager. -# Author: Sachin (psachin) <[iclcoolster@gmail.com][7]> -# Author's URL: -# -# License: GNU GPL v3, See LICENSE file -# -# Configure(Optional): -# Set `SETV_VIRTUAL_DIR_PATH` value to your virtual environments -# directory-path. By default it is set to '~/virtualenvs/' -# -# Usage: -# Manual install: Added below line to your .bashrc or any local rc script(): -# --- -# source /path/to/virtual.sh -# --- -# -# Now you can 'activate' the virtual environment by typing -# $ setv <YOUR VIRTUAL ENVIRONMENT NAME> -# -# For example: -# $ setv rango -# -# or type: -# setv [TAB] [TAB]  (to list all virtual envs) -# -# To list all your virtual environments: -# $ setv --list -# -# To create new virtual environment: -# $ setv --new new_virtualenv_name -# -# To delete existing virtual environment: -# $ setv --delete existing_virtualenv_name -# -# To deactivate, type: -# $ deactivate - -# Path to virtual environment directory -SETV_VIRTUAL_DIR_PATH="$HOME/virtualenvs/" -# Default python version to use. This decides whether to use `virtualenv` or `python3 -m venv` -SETV_PYTHON_VERSION=3  # Defaults to Python3 -SETV_PY_PATH=$(which python${SETV_PYTHON_VERSION}) - -function _setvcomplete_() -{ -    # Bash-autocompletion. -    # This ensures Tab-auto-completions work for virtual environment names. -    local cmd="${1##*/}" # to handle command(s). -                         # Not necessary as such. 'setv' is the only command - -    local word=${COMP_WORDS[COMP_CWORD]} # Words thats being completed -    local xpat='${word}'                 # Filter pattern. Include -                                         # only words in variable '$names' -    local names=$(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') # Virtual environment names - -    COMPREPLY=($(compgen -W "$names" -X "$xpat" -- "$word")) # compgen generates the results -} - -function _setv_help_() { -    # Echo help/usage message -    echo "Usage: setv [OPTIONS] [NAME]" -    echo Positional argument: -    echo -e "NAME                       Activate virtual env." -    echo Optional arguments: -    echo -e "-l, --list                 List all Virtual Envs." -    echo -e "-n, --new NAME             Create a new Python Virtual Env." -    echo -e "-d, --delete NAME          Delete existing Python Virtual Env." -    echo -e "-p, --python PATH          Python binary path." -} - -function _setv_custom_python_path() -{ -    if [ -f "${1}" ]; -    then -        if [ "`expr $1 : '.*python\\([2,3]\\)'`" = "3" ]; -        then -            SETV_PYTHON_VERSION=3 -        else -            SETV_PYTHON_VERSION=2 -        fi -        SETV_PY_PATH=${1} -        _setv_create $2 -    else -        echo "Error: Path ${1} does not exist!" -    fi -} - -function _setv_create() -{ -    # Creates new virtual environment if ran with -n|--new flag -    if [ -z ${1} ]; -    then -        echo "You need to pass virtual environment name" -        _setv_help_ -    else -        echo "Creating new virtual environment with the name: $1" - -        if [ ${SETV_PYTHON_VERSION} -eq 3 ]; -        then -            ${SETV_PY_PATH} -m venv ${SETV_VIRTUAL_DIR_PATH}${1} -        else -            virtualenv -p ${SETV_PY_PATH} ${SETV_VIRTUAL_DIR_PATH}${1} -        fi - -        echo "You can now activate the Python virtual environment by typing: setv ${1}" -    fi -} - -function _setv_delete() -{ -    # Deletes virtual environment if ran with -d|--delete flag -    # TODO: Refactor -    if [ -z ${1} ]; -    then -        echo "You need to pass virtual environment name" -        _setv_help_ -    else -        if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; -        then -            read -p "Really delete this virtual environment(Y/N)? " yes_no -            case $yes_no in -                Y|y) rm -rvf ${SETV_VIRTUAL_DIR_PATH}${1};; -                N|n) echo "Leaving the virtual environment as it is.";; -                *) echo "You need to enter either Y/y or N/n" -            esac -        else -            echo "Error: No virtual environment found by the name: ${1}" -        fi -    fi -} - -function _setv_list() -{ -    # Lists all virtual environments if ran with -l|--list flag -    echo -e "List of virtual environments you have under ${SETV_VIRTUAL_DIR_PATH}:\n" -    for virt in $(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') -    do -        echo ${virt} -    done -} - -function setv() { -    # Main function -    if [ $# -eq 0 ]; -    then -        _setv_help_ -    elif [ $# -le 3 ]; -    then -        case "${1}" in -            -n|--new) _setv_create ${2};; -            -d|--delete) _setv_delete ${2};; -            -l|--list) _setv_list;; -            *) if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; -               then -                   # Activate the virtual environment -                   source ${SETV_VIRTUAL_DIR_PATH}${1}/bin/activate -               else -                   # Else throw an error message -                   echo "Sorry, you don't have any virtual environment with the name: ${1}" -                   _setv_help_ -               fi -               ;; -        esac -    elif [ $# -le 5 ]; -    then -        case "${2}" in -            -p|--python) _setv_custom_python_path ${3} ${4};; -            *) _setv_help_;; -        esac -    fi -} - -# Calls bash-complete. The compgen command accepts most of the same -# options that complete does but it generates results rather than just -# storing the rules for future use. -complete  -F _setvcomplete_ setv -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/setv-bash-function - -作者:[Sachin Patil][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/psachin -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) -[2]: https://gitlab.com/psachin/setV -[3]: https://github.com/psachin/bash_scripts -[4]: https://virtualenvwrapper.readthedocs.org/ -[5]: https://gitlab.com/psachin/setV/blob/master/LICENSE -[6]: https://gitlab.com/psachin/setV/blob/master/ReadMe.org -[7]: mailto:iclcoolster@gmail.com diff --git a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md new file mode 100644 index 0000000000..75dcec4367 --- /dev/null +++ b/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -0,0 +1,296 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (setV: A Bash function to maintain Python virtual environments) +[#]: via: (https://opensource.com/article/20/1/setv-bash-function) +[#]: author: (Sachin Patil https://opensource.com/users/psachin) + +setV:一个管理 Python 虚拟环境的 Bash 函数 +====== + +> 了解一下 setV,它是轻量级的 Python 虚拟环境管理器,是 virtualenvwrapper 的替代产品。 + +![Coding on a computer][1] + +这一年多来,[setV] [2] 悄悄隐藏在我的 [bash_scripts][3] 项目中,但现在是时候该公开了。setV 是一个 Bash 函数,我可以用它代替 [virtualenvwrapper][4]。它提供了使你能够执行以下操作的基本功能: + +* 默认使用 Python 3 +* 创建一个新的虚拟环境 +* 使用带有 `-p`(或 `--python`)的自定义 Python 路径来创建新的虚拟环境 +* 删除现有的虚拟环境 +* 列出所有现有的虚拟环境 +* 使用制表符补全(以防你忘记虚拟环境名称) + +### 安装 + +要安装 setV,请下载该脚本: + +``` +curl https://gitlab.com/psachin/setV/raw/master/install.sh +``` + +审核一下脚本,然后运行它: + +``` +sh ./install.sh +``` + +当安装 setV 时,安装脚本会询问你要嵌入到 `~/.bashrc` 还是 `~/.bash_profile`,根据你的喜好选择一个。 + +### 用法 + +基本的命令格式是 `setv`。 + +#### 创建虚拟环境 + +``` +setv --new rango  # setv -n rango + +# 或使用定制的 Python 路径 +setv --new --python /opt/python/python3 rango  # setv -n -p /opt/python/python3 rango +``` + +#### 激活已有的虚拟环境 + +``` +setv VIRTUAL_ENVIRONMENT_NAME +``` + +``` +# 示例 +setv rango +``` + +#### 列出所有的虚拟环境 + +``` +setv --list +# 或 +setv [TAB] [TAB] +``` + +#### 删除虚拟环境 + +``` +setv --delete rango +``` + +#### 切换到另外一个虚拟环境 + +``` +# 假设你现在在 'rango',切换到 'tango' +setv tango +``` + +#### 制表符补完 + +如果你不完全记得虚拟环境的名称,则 Bash 式的制表符补全也可以适用于虚拟环境名称。 + +### 参与其中 + +setV 在 GNU [GPLv3][5]下开源,欢迎贡献。要了解更多信息,请访问它的 GitLab 存储库中的 setV 的 [README][6] 的贡献部分。 + +### setV 脚本 + +``` +#!/usr/bin/env bash +# setV - A Lightweight Python virtual environment manager. +# Author: Sachin (psachin) +# Author's URL: https://psachin.gitlab.io/about +# +# License: GNU GPL v3, See LICENSE file +# +# Configure(Optional): +# Set `SETV_VIRTUAL_DIR_PATH` value to your virtual environments +# directory-path. By default it is set to '~/virtualenvs/' +# +# Usage: +# Manual install: Added below line to your .bashrc or any local rc script(): +# --- +# source /path/to/virtual.sh +# --- +# +# Now you can 'activate' the virtual environment by typing +# $ setv +# +# For example: +# $ setv rango +# +# or type: +# setv [TAB] [TAB] (to list all virtual envs) +# +# To list all your virtual environments: +# $ setv --list +# +# To create new virtual environment: +# $ setv --new new_virtualenv_name +# +# To delete existing virtual environment: +# $ setv --delete existing_virtualenv_name +# +# To deactivate, type: +# $ deactivate + +# Path to virtual environment directory +SETV_VIRTUAL_DIR_PATH="$HOME/virtualenvs/" +# Default python version to use. This decides whether to use `virtualenv` or `python3 -m venv` +SETV_PYTHON_VERSION=3 # Defaults to Python3 +SETV_PY_PATH=$(which python${SETV_PYTHON_VERSION}) + +function _setvcomplete_() +{ + # Bash-autocompletion. + # This ensures Tab-auto-completions work for virtual environment names. + local cmd="${1##*/}" # to handle command(s). + # Not necessary as such. 'setv' is the only command + + local word=${COMP_WORDS[COMP_CWORD]} # Words thats being completed + local xpat='${word}' # Filter pattern. Include + # only words in variable '$names' + local names=$(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') # Virtual environment names + + COMPREPLY=($(compgen -W "$names" -X "$xpat" -- "$word")) # compgen generates the results +} + +function _setv_help_() { + # Echo help/usage message + echo "Usage: setv [OPTIONS] [NAME]" + echo Positional argument: + echo -e "NAME Activate virtual env." + echo Optional arguments: + echo -e "-l, --list List all Virtual Envs." + echo -e "-n, --new NAME Create a new Python Virtual Env." + echo -e "-d, --delete NAME Delete existing Python Virtual Env." + echo -e "-p, --python PATH Python binary path." +} + +function _setv_custom_python_path() +{ + if [ -f "${1}" ]; + then + if [ "`expr $1 : '.*python\([2,3]\)'`" = "3" ]; + then + SETV_PYTHON_VERSION=3 + else + SETV_PYTHON_VERSION=2 + fi + SETV_PY_PATH=${1} + _setv_create $2 + else + echo "Error: Path ${1} does not exist!" + fi +} + +function _setv_create() +{ + # Creates new virtual environment if ran with -n|--new flag + if [ -z ${1} ]; + then + echo "You need to pass virtual environment name" + _setv_help_ + else + echo "Creating new virtual environment with the name: $1" + + if [ ${SETV_PYTHON_VERSION} -eq 3 ]; + then + ${SETV_PY_PATH} -m venv ${SETV_VIRTUAL_DIR_PATH}${1} + else + virtualenv -p ${SETV_PY_PATH} ${SETV_VIRTUAL_DIR_PATH}${1} + fi + + echo "You can now activate the Python virtual environment by typing: setv ${1}" + fi +} + +function _setv_delete() +{ + # Deletes virtual environment if ran with -d|--delete flag + # TODO: Refactor + if [ -z ${1} ]; + then + echo "You need to pass virtual environment name" + _setv_help_ + else + if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; + then + read -p "Really delete this virtual environment(Y/N)? " yes_no + case $yes_no in + Y|y) rm -rvf ${SETV_VIRTUAL_DIR_PATH}${1};; + N|n) echo "Leaving the virtual environment as it is.";; + *) echo "You need to enter either Y/y or N/n" + esac + else + echo "Error: No virtual environment found by the name: ${1}" + fi + fi +} + +function _setv_list() +{ + # Lists all virtual environments if ran with -l|--list flag + echo -e "List of virtual environments you have under ${SETV_VIRTUAL_DIR_PATH}:\n" + for virt in $(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') + do + echo ${virt} + done +} + +function setv() { + # Main function + if [ $# -eq 0 ]; + then + _setv_help_ + elif [ $# -le 3 ]; + then + case "${1}" in + -n|--new) _setv_create ${2};; + -d|--delete) _setv_delete ${2};; + -l|--list) _setv_list;; + *) if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; + then + # Activate the virtual environment + source ${SETV_VIRTUAL_DIR_PATH}${1}/bin/activate + else + # Else throw an error message + echo "Sorry, you don't have any virtual environment with the name: ${1}" + _setv_help_ + fi + ;; + esac + elif [ $# -le 5 ]; + then + case "${2}" in + -p|--python) _setv_custom_python_path ${3} ${4};; + *) _setv_help_;; + esac + fi +} + +# Calls bash-complete. The compgen command accepts most of the same +# options that complete does but it generates results rather than just +# storing the rules for future use. +complete -F _setvcomplete_ setv +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/setv-bash-function + +作者:[Sachin Patil][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/psachin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://gitlab.com/psachin/setV +[3]: https://github.com/psachin/bash_scripts +[4]: https://virtualenvwrapper.readthedocs.org/ +[5]: https://gitlab.com/psachin/setV/blob/master/LICENSE +[6]: https://gitlab.com/psachin/setV/blob/master/ReadMe.org +[7]: mailto:iclcoolster@gmail.com From 8e7f65331684bf2add20ba1b17715cf4cbd5f270 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 22:46:00 +0800 Subject: [PATCH 0298/3057] =?UTF-8?q?=E6=B8=85=E9=99=A4=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nimal vision, and more open source news.md | 93 ---------- ...u Cinnamon Distribution is Finally Here.md | 85 --------- ...l gets better, and more industry trends.md | 65 ------- ...n fellows from Africa, and more updates.md | 75 -------- ...bernetes etcd, and more industry trends.md | 63 ------- ...ed- Here-s What-s New and How to Get it.md | 165 ------------------ ... of microbes, and more open source news.md | 76 -------- ...the end for Windows Server 2008 support.md | 71 -------- 8 files changed, 693 deletions(-) delete mode 100644 sources/news/20191207 New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news.md delete mode 100644 sources/news/20191209 First Ever Release of Ubuntu Cinnamon Distribution is Finally Here.md delete mode 100644 sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md delete mode 100644 sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md delete mode 100644 sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md delete mode 100644 sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md delete mode 100644 sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md delete mode 100644 sources/news/20200116 It-s the end for Windows Server 2008 support.md diff --git a/sources/news/20191207 New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news.md b/sources/news/20191207 New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news.md deleted file mode 100644 index 93297c4cad..0000000000 --- a/sources/news/20191207 New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news.md +++ /dev/null @@ -1,93 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news) -[#]: via: (https://opensource.com/article/19/12/news-december-7) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we take a look an open source election auditing tool, new open source from Alibaba and Netflix, mimicking animal vision, and more! - -### Alibaba and Netflix share machine learning and data science software - -Two companies at the forefront of machine learning and data science have just released some of their tools under open source licenses. - -Chinese ecommerce giant Alibaba just [open sourced the algorithm libraries][2] for its Alink platform. The algorithms "are essential to support machine learning tasks such as online product recommendations and smart customer services." According to Jia Yangqing, president of Alibaba Cloud, Alink is a good fit for "developers seeking big data and machine-learning tools." You can find the source code for Alink (which is under an Apache 2.0 license) [on GitHub][3], with documentation in both Chinese and English. - -Not to be outdone, streaming service Netflix just released its [Metaflow Python library][4] under an Apache 2.0 license. Metaflow enables data scientists to "see early on whether a prototyped model would fail in production, allowing them to fix whatever the issue was". It also works with a number of Python data science libraries, like SciKit Learn, Pytorch, and Tensorflow. You can grab Metaflow's code from [its GitHub repository][5] or learn more about it at the [Metaflow website][6]. - -### Open source software to mimic animal vision - -Have you ever wondered how your dog or cat sees the world? Thanks to work by researchers at the University of Exeter in the UK and Australia's University of Queensland, you can find out. The team just released [software that allows humans to see the world as animals do][7]. - -Called micaToolbox, the software can interpret digital photos and process images of various environments by mimicking the limitations of animal vision. Anyone with a camera, a computer, or smartphone can use the software without knowing how to code. But micaToolbox isn't just a novelty. It's a serious scientific tool that can help "help biologists better understand a variety of animal behaviors, including mating systems, distance-dependent signalling and mimicry." And, according to researcher Jolyon Troscianko, the software can help identify "how an animal's camouflage works so that we can manage our land to protect certain species." - -You can [download micaBox][8] or [browse its source code][9] on GitHub. - -### New tool for post-election auditing - -More and more aspects of our lives and institutions are being automated. With that comes an increased danger of systems breaking down or malicious someones tampering with those systems. Open source gives us an opportunity to look at exactly how the automation works. - -Elections, in particular, are increasingly vulnerable. To combat election tampering, the US Cybersecurity and Infrastructure Security Agency (CISA) has joined forces with the non-profit organization VotingWorks to create a [web-based application for auditing ballots][10]. - -Called Arlo, the application is designed to ensure that "elections are secure, resilient, and transparent," said CISA's director Chris Krebs. Arlo works with a range of automated voting systems to help "officials compare audited votes to tabulated votes, and providing monitoring & reporting capabilities." Arlo was used to verify the results of recent state and local elections and is being further field-tested in the states of Georgia, Michigan, Missouri, Ohio, Pennsylvania, and Virginia. - -Arlo's source code, released under an AGPL-3.0 license, is [available on GitHub][11]. - -### Royal Navy debuts open source application development kit - -Consistency across user interfaces is key to a successful set of applications and services. The UK's Royal Navy understands the importance of this and has released the [open source NELSON standards toolkit][12] to help its developers and suppliers "save time and give users a consistent experience." - -Named after the legendary British admiral, NELSON is intended to "maintain high visual consistency and user-experience quality across the different applications developed or subcontracted by the Royal Navy." The toolkit consists of a set of components including visual styles, typographic elements, forms, elements like buttons and checkboxes, and notifications. - -NELSON has its own [GitHub repository][13], from which the Royal Navy encourages developers to make pull requests. - -#### In other news - - * [Council group plans for open source revenues and benefits platform][14] - * [Introducing Nebula, the open source global overlay network from Slack][15] - * [webOS Open Source Edition 2.0 keeps Palm's spirit alive in cars and IoT][16] - * [Duke University Introduces an Open Source Tool as an Alternative to a Monolithic LMS][17] - * [Open Source Technology Could Be a Boon to Farmers][18] - - - -_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/news-december-7 - -作者:[Scott Nesbitt][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/scottnesbitt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://www.zdnet.com/article/alibaba-cloud-publishes-machine-learning-algorithm-on-github/ -[3]: https://github.com/alibaba/alink -[4]: https://www.zdnet.com/article/netflix-our-metaflow-python-library-for-faster-data-science-is-now-open-source/ -[5]: https://github.com/Netflix/metaflow -[6]: https://metaflow.org/ -[7]: https://www.upi.com/Science_News/2019/12/03/Novel-software-helps-scientists-see-what-animals-see/5961575389734/ -[8]: http://www.empiricalimaging.com/download/micatoolbox/ -[9]: https://github.com/troscianko/micaToolbox -[10]: https://www.zdnet.com/article/cisa-and-votingworks-release-open-source-post-election-auditing-tool/ -[11]: https://github.com/votingworks/arlo -[12]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/open-source-royal-navy -[13]: https://github.com/Royal-Navy/standards-toolkit -[14]: https://www.ukauthority.com/articles/council-group-plans-for-open-source-revenues-and-benefits/ -[15]: https://slack.engineering/introducing-nebula-the-open-source-global-overlay-network-from-slack-884110a5579 -[16]: https://www.slashgear.com/webos-open-source-edition-2-0-keeps-palms-spirit-alive-in-cars-and-iot-25601309/ -[17]: https://iblnews.org/duke-university-introduces-an-open-source-tool-as-an-alternative-to-a-monolithic-lms/ -[18]: https://civileats.com/2019/12/02/open-source-technology-could-be-a-boon-to-farmers/ diff --git a/sources/news/20191209 First Ever Release of Ubuntu Cinnamon Distribution is Finally Here.md b/sources/news/20191209 First Ever Release of Ubuntu Cinnamon Distribution is Finally Here.md deleted file mode 100644 index 09af65568d..0000000000 --- a/sources/news/20191209 First Ever Release of Ubuntu Cinnamon Distribution is Finally Here.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (First Ever Release of Ubuntu Cinnamon Distribution is Finally Here!) -[#]: via: (https://itsfoss.com/ubuntu-cinnamon/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -First Ever Release of Ubuntu Cinnamon Distribution is Finally Here! -====== - -_**Brief: Ubuntu Cinnamon is a new distribution that utilizes Linux Mint’s Cinnamon desktop environment on top of Ubuntu code base. It’s first stable release is based on Ubuntu 19.10 Eoan Ermine.**_ - -[Cinnamon][1] is Linux Mint’s flagship desktop environment. Like [MATE desktop][2], Cinnamon is also a product of dissatisfaction with GNOME 3. With the GNOME Classic like user interface and relatively lower hardware requirements, Cinnamon soon gathered a dedicated userbase. - -Like any other desktop environment out there, you can [install Cinnamon on Ubuntu][3] and other distributions. - -Installing multiple [desktop environments][4] (DE) is not a difficult task but it often leads to conflicts (with other DE’s elements) and may not always provide the best experience. This is why major Linux distributions separate spins/flavors with various popular desktop environments. - -[Ubuntu also has various official flavors][5] featuring [KDE][6] (Kubuntu), [LXQt][7] (Lubuntu), Xfce (Xubuntu), Budgie ([Ubuntu Budgie][8]) etc. Cinnamon was not in this list but Ubuntu Cinnamon Remix project is trying to change that. - -### Ubuntu Cinnamon distribution - -![Ubuntu Cinnamon Desktop Screenshot][9] - -[Ubuntu Cinnamon][10] (website under construction) is a new Linux distribution that brings Cinnamon desktop to Ubuntu distribution. Joshua Peisach is the lead developer for the project and he is being helped by other volunteer contributors. The ex-developer of the now discontinued Ubuntu GNOME project and some members from Ubuntu team are also advising the team to help with the development. - -![Ubuntu Cinnamon Remix Screeenshot 1][11] - -Do note that Ubuntu Cinnamon is not an official flavor of Ubuntu. They are trying to get the flavorship but I think that will take a few more releases. - -The first stable release of Ubuntu Cinnamon is based on [Ubuntu 19.10 Eoan Ermine][12]. It uses Calamares installer from Lubuntu and features Cinnamon desktop version 4.0.10. Naturally, it uses Nemo file manager and LightDM. - -It supports EFI and UEFI and only comes with 64-bit support. - -You’ll get your regular goodies like LibreOffice, Firefox and some GNOME software and games. You can of course install more applications as per your need. - -### Download and install Ubuntu Cinnamon - -Do note that this is the first ever release of Ubuntu Cinnamon and the developers are not that experienced at this moment. - -If you don’t like troubleshooting, don’t use it on your main system. I expect this release to have a few bugs and issues which will be fixed eventually as more users test it out. - -You can download Ubuntu Cinnamon ISO from Sourceforge website: - -[Download Ubuntu Cinnamon][13] - -### What next from here? - -The dev team has a few improvements planned for the 20.04 release. The changes are mostly on the cosmetics though. There will be new GRUB and Plymouth theme, layout application and welcome screen. - -I downloaded it and tried it in a live session. Here’s what this distribution looks like: - -[Subscribe to our YouTube channel for more Linux videos][14] - -Meanwhile, if you manage to try it on your own, why not share your experience in the comments? If you use Linux Mint, will you switch to Ubuntu Cinnamon in near future? What are your overall opinion about this new project? Do share it in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ubuntu-cinnamon/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment) -[2]: https://mate-desktop.org/ -[3]: https://itsfoss.com/install-cinnamon-on-ubuntu/ -[4]: https://itsfoss.com/best-linux-desktop-environments/ -[5]: https://itsfoss.com/which-ubuntu-install/ -[6]: https://kde.org/ -[7]: https://lxqt.org/ -[8]: https://itsfoss.com/ubuntu-budgie-18-review/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/ubuntu_cinnamon_distribution_screenshot.jpg?ssl=1 -[10]: https://ubuntucinnamon.org/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/ubuntu_cinnamon_remix_screeenshot_1.jpg?ssl=1 -[12]: https://itsfoss.com/ubuntu-19-10-released/ -[13]: https://sourceforge.net/projects/ubuntu-cinnamon-remix/ -[14]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 diff --git a/sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md b/sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md deleted file mode 100644 index 81b00a0ec9..0000000000 --- a/sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (KubeCon gets bigger, the kernel gets better, and more industry trends) -[#]: via: (https://opensource.com/article/19/12/kubecon-bigger-kernel-better-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -KubeCon gets bigger, the kernel gets better, and more industry trends -====== -A weekly look at open source community, market, and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [KubeCon showed Kubernetes is big, but is it a Unicorn?][2] - -> It’s hard to remember now but there was a time when Kubernetes was a distant No. 3 in terms of container orchestrators being used in the market. It’s also eye opening to now realize that [the firms][3] that hatched the two platforms that [towered over][4] Kubernetes have had to completely re-jigger their business models under the Kubernetes onslaught. -> -> And full credit to the CNCF for attempting to diffuse some of that attention from Kubernetes by spending the vast majority of the KubeCon opening keynote address touting some of the nearly two dozen graduated, incubating, and sandbox projects it also hosts. But, it was really the Big K that stole the show. - -**The impact:** Open source is way more than the source code; governance is a big deal and can be the difference between longevity and irrelevance. Gathering, organizing, and maintaining humans is an entirely different skill set than doing the same for bits, but can have just as big an influence on the success of a project. - -## [Report: Kubernetes use on the rise][5] - -> At the same time, the Datadog report notes that container churn rates are approximately 10 times higher in orchestrated environments. Churn rates in container environments that lack an orchestration platform such as Kubernetes have increased in the last year as well. The average container lifespan at a typical company running infrastructure without orchestration is about two days, down from about six days in mid-2018. In 19% of those environments not running orchestration, the average container lifetime exceeded 30 days. That compares to only 3% of organizations running containers longer than 30 days in Kubernetes environments, according to the report’s findings. - -**The impact**: If your containers aren't churning, you're probably not getting the full benefit of the technology you've adopted. - -## [Upcoming Linux 5.5 kernel improves live patching, scheduling][6] - -> A new WFX Wi-Fi driver for the Silicon Labs WF200 ASIC transceiver is coming to Linux kernel 5.5. This particular wireless transceiver is geared toward low-power IoT devices and uses a 2.4 GHz 802.11b/g/n radio optimized for low power RF performance in crowded RF environments. This new driver can interface via both Serial Peripheral Interface (SPI) and Secure Digital Input Output (SDIO). - -**The impact**: The kernel's continued relevance is a direct result of the never-ending grind to keep being where people need it to be (i.e. basically everywhere). - -## [DigitalOcean Currents: December 2019][7] - -> In that spirit, this fall’s installment of our seasonal Currents report is dedicated to open source for the second year running. We surveyed more than 5800 developers around the world on the overall health and direction of the open source community. When we last checked in with the community in [2018][8], more than half of developers reported contributing to open source projects, and most felt the community was healthy and growing. - -**The impact**: While the good news outweighs the bad, there are a couple of things to keep an eye on: namely, making open source more inclusive and mitigating potential negative impact of big money. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/kubecon-bigger-kernel-better-more-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.sdxcentral.com/articles/opinion-editorial/kubecon-showed-kubernetes-is-big-but-is-it-a-unicorn/2019/11/ -[3]: https://www.sdxcentral.com/articles/news/docker-unloads-enterprise-biz-to-mirantis/2019/11/ -[4]: https://www.sdxcentral.com/articles/news/mesosphere-is-now-d2iq-and-kubernetes-is-its-game/2019/08/ -[5]: https://containerjournal.com/topics/container-ecosystems/report-kubernetes-use-on-the-rise/ -[6]: https://thenewstack.io/upcoming-linux-5-5-kernel-improves-live-patching-scheduling/ -[7]: https://blog.digitalocean.com/digitalocean-currents-december-2019/ -[8]: https://www.digitalocean.com/currents/october-2018/ diff --git a/sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md b/sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md deleted file mode 100644 index 85aef63325..0000000000 --- a/sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates) -[#]: via: (https://opensource.com/article/19/12/python-news-december) -[#]: author: (Christian Heimes https://opensource.com/users/christian-heimes) - -Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates -====== -Find out what's going on in the Python community in December. -![Python in a coffee cup.][1] - -The Python Software Foundation (PSF) is a nonprofit organization behind the Python programming language. I am fortunate to be a PSF Fellow (honorable member for life,) a Python core developer, and the liaison between my company, Red Hat, and the PSF. Part of that liaison work is providing updates on what’s happening in the Python community. Here’s a look at what we have going on in December. - -### Upcoming events - -A significant part of the Python community is its in-person events. These events are where users and contributors intermingle and learn together. Here are the big announcements of upcoming opportunities to connect. - -#### PyCon US 2020 - -[PyCon US][2] is by far the largest annual Python event. The next PyCon is April 15-23, 2020, in Pittsburgh. The call for proposals is open to all until December 20, 2019. I’m planning to attend PyCon for the conference and its [famous post-con sprints][3]. - -#### EuroPython - -EuroPython is the largest Python conference in Europe with about 1,000 attendees in the last years. [EP20][4] will be held in Dublin, Ireland, July 20-26, 2020. As a liaison for Red Hat, I’m proud to say that Red Hat sponsored EP18 in Edinburgh and donated the sponsoring tickets to Women Who Code Scotland. - -#### PyData - -[PyData][5] is a separate nonprofit related to the Python community through a focus on data science. They host many international events throughout the year, with upcoming events in [Austin, Texas][6], and [Warsaw, Poland][7] before the end of the year. - -### New PSF fellows from Africa - -The PSF promotes a few members to fellow every quarter. Yesterday, twelve new PSF fellows were [announced][8]. - -I’d like to highlight the four new fellows from Ghana, who are also the organizers of the first pan-African [PyCon Africa][9], which took place in August 2019 in Accra, Ghana. The Python community in Africa is growing at an amazing speed. PyCon Africa 2020 will be in Accra again, and I’m planning to spend my summer vacation there. - -### Annual release cycle for Python - -Python used to release a new major version about every 18 months. This timeline will change with the Python 3.9 release. With [PEP 602,][10] a new major version of Python will be released annually in October. The new cadence means fewer changes between releases and more predictable release dates. October was chosen to align with Linux distribution releases such as Fedora. Miro Hrončok from the Python maintenance team joined the discussion and has helped to find a convenient release date for us; for more details, please see . - -### Steering council election - -The Python Steering Council governs the development of Python. It was established after [Guido van Rossum stepped down][11] as benevolent dictator for life. Python core developers elect a new steering council for every major Python release. For the upcoming term, nine candidates were nominated for five seats on the council (with Guido being nominated, but [withdrawing][12]). See for all the details. Election results are expected to be announced mid-December. - -That covers what’s new in the Python community for December. Stay tuned for more updates in the future and mark your calendars for the conferences mentioned above. - -So you have a great business idea for a wonderful IT product or service, and you want to build your... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/python-news-december - -作者:[Christian Heimes][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/christian-heimes -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) -[2]: https://us.pycon.org/2020/ -[3]: https://opensource.com/article/19/5/pycon-developer-sprints -[4]: https://www.europython-society.org/post/188741002380/europython-2020-venue-and-location-selected -[5]: https://pydata.org/ -[6]: https://pydata.org/austin2019/ -[7]: https://pydata.org/warsaw2019/ -[8]: https://pyfound.blogspot.com/2019/11/python-software-foundation-fellow.html -[9]: https://africa.pycon.org/ -[10]: https://www.python.org/dev/peps/pep-0602/ -[11]: https://opensource.com/article/19/6/command-line-heroes-python -[12]: https://discuss.python.org/t/steering-council-nomination-guido-van-rossum-2020-term/2657/11 diff --git a/sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md b/sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md deleted file mode 100644 index 198d4f8292..0000000000 --- a/sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md +++ /dev/null @@ -1,63 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (2020 technology must haves, a guide to Kubernetes etcd, and more industry trends) -[#]: via: (https://opensource.com/article/19/12/gartner-ectd-and-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -2020 technology must haves, a guide to Kubernetes etcd, and more industry trends -====== -A weekly look at open source community, market, and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Gartner's top 10 infrastructure and operations trends for 2020][2] - -> “The vast majority of organisations that do not adopt a shared self-service platform approach will find that their DevOps initiatives simply do not scale,” said Winser. "Adopting a shared platform approach enables product teams to draw from an I&O digital toolbox of possibilities, while benefiting from high standards of governance and efficiency needed for scale." - -**The impact**: The breakneck change of technology development and adoption will not slow down next year, as the things you've been reading about for the last two years become things you have to figure out to deal with every day. - -## [A guide to Kubernetes etcd: All you need to know to set up etcd clusters][3] - -> Etcd is a distributed reliable key-value store which is simple, fast and secure. It acts like a backend service discovery and database, runs on different servers in Kubernetes clusters at the same time to monitor changes in clusters and to store state/configuration data that should to be accessed by a Kubernetes master or clusters. Additionally, etcd allows Kubernetes master to support discovery service so that deployed application can declare their availability for inclusion in service. - -**The impact**: This is actually way more than I needed to know about setting up etcd clusters, but now I have a mental model of what that could look like, and you can too. - -## [How the open source model could fuel the future of digital marketing][4] - -> In other words, the broad adoption of open source culture has the power to completely invert the traditional marketing funnel. In the future, prospective customers could be first introduced to “late funnel” materials and then buy into the broader narrative — a complete reversal of how traditional marketing approaches decision-makers today. - -**The impact**: The SEO on this cuts two ways: It can introduce uninitiated marketing people to open source and uninitiated technical people to the ways that technology actually gets adopted. Neat! - -## [Kubernetes integrates interoperability, storage, waits on sidecars][5] - -> In a [recent interview][6], Lachlan Evenson, and was also a lead on the Kubernetes 1.16 release, said sidecar containers was one of the features that team was a “little disappointed” it could not include in their release. -> -> Guinevere Saenger, software engineer at GitHub and lead for the 1.17 release team, explained that sidecar containers gained increased focus “about a month ago,” and that its implementation “changes the pod spec, so this is a change that affects a lot of areas and needs to be handled with care.” She noted that it did move closer to completion and “will again be prioritized for 1.18.” - -**The impact**: You can read between the lines to understand a lot more about the Kubernetes sausage-making process. It's got governance, tradeoffs, themes, and timeframes; all the stuff that is often invisible to consumers of a project. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/gartner-ectd-and-more-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.information-age.com/gartner-top-10-infrastructure-and-operations-trends-2020-123486509/ -[3]: https://superuser.openstack.org/articles/a-guide-to-kubernetes-etcd-all-you-need-to-know-to-set-up-etcd-clusters/ -[4]: https://www.forbes.com/sites/forbescommunicationscouncil/2019/11/19/how-the-open-source-model-could-fuel-the-future-of-digital-marketing/#71b602fb20a5 -[5]: https://www.sdxcentral.com/articles/news/kubernetes-integrates-interoperability-storage-waits-on-sidecars/2019/12/ -[6]: https://kubernetes.io/blog/2019/12/06/when-youre-in-the-release-team-youre-family-the-kubernetes-1.16-release-interview/ diff --git a/sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md b/sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md deleted file mode 100644 index 507915626b..0000000000 --- a/sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md +++ /dev/null @@ -1,165 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Mint 19.3 “Tricia” Released: Here’s What’s New and How to Get it) -[#]: via: (https://itsfoss.com/linux-mint-19-3/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Linux Mint 19.3 “Tricia” Released: Here’s What’s New and How to Get it -====== - -_**Linux Mint 19.3 “Tricia” has been released. See what’s new in it and learn how to upgrade to Linux Mint 19.3.**_ - -The Linux Mint team finally announced the release of Linux Mint 19.3 codenamed ‘Tricia’ with useful feature additions along with a ton of improvements under-the-hood. - -This is a point release based on the latest **Ubuntu 18.04.3** and it comes packed with the **Linux kernel 5.0**. - -I downloaded and quickly tested the edition featuring the [Cinnamon 4.4][1] desktop environment. You may also try the Xfce or MATE edition of Linux Mint 19.3. - -### Linux Mint 19.3: What’s New? - -![Linux Mint 19 3 Desktop][2] - -While being an LTS release that will be supported until 2023 – it brings in a couple of useful features and improvements. Let me highlight some of them for you. - -#### System Reports - -![][3] - -Right after installing Linux Mint 19.3 (or upgrading it), you will notice a warning icon on the right side of the panel (taskbar). - -When you click on it, you should be displayed a list of potential issues that you can take care of to ensure the best out of Linux Mint experience. - -For starters, it will suggest that you should create a root password, install a language pack, or update software packages – in the form of a warning. This is particularly useful to make sure that you perform important actions even after following the first set of steps on the welcome screen. - -#### Improved Language Settings - -Along with the ability to install/set a language, you will also get the ability to change the time format. - -So, the language settings are now more useful than ever before. - -#### HiDPI Support - -As a result of [HiDPI][4] support, the system tray icons will look crisp and overall, you should get a pleasant user experience on a high-res display. - -#### New Applications - -![Linux Mint Drawing App][5] - -With the new release, you will n longer find “**GIMP**” pre-installed. - -Even though GIMP is a powerful utility, they decided to add a simpler “**Drawing**” app to let users to easily crop/resize images while being able to tweak it a little. - -Also, **Gnote** replaces **Tomboy** as the default note-taking application on Linux Mint 19.3 - -In addition to both these replacements, Celluloid video player has also been added instead of Xplayer. In case you did not know, Celluloid happens to be one of the [best open source video players][6] for Linux. - -#### Cinnamon 4.4 Desktop - -![Cinnamon 4 4 Desktop][7] - -In my case, the new Cinnamon 4.4 desktop experience introduces a couple of new abilities like adjusting/tweaking the panel zones individually as you can see in the screenshot above. - -#### Other Improvements - -There are several other improvements including more customizability options in the file manager and so on. - -You can read more about the detailed changes in the [official release notes][8]. - -[Subscribe to our YouTube channel for more Linux videos][9] - -### Linux Mint 19 vs 19.1 vs 19.2 vs 19.3: What’s the difference? - -You probably already know that Linux Mint releases are based on Ubuntu long term support releases. Linux Mint 19 series is based on Ubuntu 18.04 LTS. - -Ubuntu LTS releases get ‘point releases’ on the interval of a few months. Point release basically consists of bug fixes and security updates that have been pushed since the last release of the LTS version. This is similar to the Service Pack concept in Windows XP if you remember it. - -If you are going to download Ubuntu 18.04 which was released in April 2018 in 2019, you’ll get Ubuntu 18.04.2. The ISO image of 18.04.2 will consist of 18.04 and the bug fixes and security updates applied till 18.04.2. Imagine if there were no point releases, then right after [installing Ubuntu 18.04][10], you’ll have to install a few gigabytes of system updates. Not very convenient, right? - -But Linux Mint has it slightly different. Linux Mint has a major release based on Ubuntu LTS release and then it has three minor releases based on Ubuntu LTS point releases. - -Mint 19 was based on Ubuntu 18.04, 19.1 was based on 18.04.1 and Mint 19.2 is based on Ubuntu 18.04.2. Similarly, Mint 19.3 is based on Ubuntu 18.04.3. It is worth noting that all Mint 19.x releases are long term support releases and will get security updates till 2023. - -Now, if you are using Ubuntu 18.04 and keep your system updated, you’ll automatically get updated to 18.04.1, 18.04.2 etc. That’s not the case in Linux Mint. - -Linux Mint minor releases also consist of _feature changes_ along with bug fixes and security updates and this is the reason why updating Linux Mint 19 won’t automatically put you on 19.1. - -Linux Mint gives you the option if you want the new features or not. For example, Mint 19.3 has Cinnamon 4.4 and several other visual changes. If you are happy with the existing features, you can stay on Mint 19.2. You’ll still get the necessary security and maintenance updates on Mint 19.2 till 2023. - -Now that you understand the concept of minor releases and want the latest minor release, let’s see how to upgrade to Mint 19.3. - -### Linux Mint 19.3: How to Upgrade? - -No matter whether you have Linux Mint 19.1 or 19, you can follow these steps to [upgrade Linux Mint version][11]. - -**Note**: _You should consider making a system snapshot (just in case) for backup. In addition, the Linux Mint team advises you to disable the screensaver and upgrade Cinnamon spices (if installed) from the System settings._ - -![][12] - - 1. Launch the Update Manager. - 2. Now, refresh it to load up the latest available updates (or you can change the mirror if you want). - 3. Once done, simply click on the Edit button to find “**Upgrade to Linux Mint 19.3 Tricia**” button similar to the image above. - 4. Finally, just follow the on-screen instructions to easily update it. - - - -Based on your internet connection, it should take anything between a couple of minutes to 30 minutes. - -### Don’t see Mint 19.3 update yet? Here’s what you can do - -If you don’t see the option to upgrade to Linux Mint 19.3 Tricia, don’t lose hope. Here are a couple of things you can do. - -#### **Step 1: Make sure to use mint-upgrade-info version 1.1.3** - -Make sure that mint-upgrade-info is updated to version 1.1.3. You can try the install command that will update it to a newer version (if there is any). - -``` -sudo apt install mint-upgrade-info -``` - -#### **Step 2: Switch to default software sources** - -Chances are that you are using a mirror closer to you to get faster software downloads. But this could cause a problem as the mirrors might not have the new upgrade info yet. - -Go to Software Source and change the sources to default. Now run the update manager again and see if Mint 19.3 upgrade is available. - -### Download Linux Mint 19.3 ‘Tricia’ - -If you want to perform a fresh install, you can easily download the latest available version from the official download page (depending on what edition you want). - -You will also find multiple mirrors available to download the ISOs – feel free to try the nearest mirror for potentially faster download. - -[Linux Mint 19.3][13] - -**Wrapping Up** - -Have you tried Linux Mint 19.3 yet? Let me know your thoughts in the comments down below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/linux-mint-19-3/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://github.com/linuxmint/cinnamon/releases/tag/4.4.0 -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-19-3-desktop.jpg?ssl=1 -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-system-report.jpg?ssl=1 -[4]: https://wiki.archlinux.org/index.php/HiDPI -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-drawing-app.jpg?ssl=1 -[6]: https://itsfoss.com/video-players-linux/ -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/cinnamon-4-4-desktop.jpg?ssl=1 -[8]: https://linuxmint.com/rel_tricia_cinnamon.php -[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[10]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ -[11]: https://itsfoss.com/upgrade-linux-mint-version/ -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/mintupgrade.png?ssl=1 -[13]: https://linuxmint.com/download.php diff --git a/sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md b/sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md deleted file mode 100644 index 3cf9d05097..0000000000 --- a/sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Eliminating gender bias in open source software development, a database of microbes, and more open source news) -[#]: via: (https://opensource.com/article/19/12/news-december-21) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Eliminating gender bias in open source software development, a database of microbes, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we take a look at eliminating gender bias in open source software development, an open source database of microbes, an open source index for cooperatives, and more! - -### Eliminating gender bias from open source development - -It's a sad fact that certain groups, among them women, are woefully underrepresented in open source projects. It's like a bug in the open source development process. Fortunately, there are initiatives to make that under representation a thing of the past. A study out of Oregon State University (OSU) intends to resolve the issue of the lack of women in open source development by "[finding these bugs and proposing redesigns around them][2], leading to more gender-inclusive tools used by software developers." - -The study will look at tools commonly used in open source development — including Eclipse, GitHub, and Hudson — to determine if they "significantly discourage newcomers, especially women, from joining OSS projects." According to Igor Steinmacher, one of the principal investigators of the study, the study will examine "how people use tools because the 'bugs' may be embedded in how the tool was designed, which may place people with different cognitive styles at a disadvantage." - -The developers of the tools being studied will walk through their software and answer questions based on specific personas. The researchers at OSU will suggest ways to redesign the software to eliminate gender bias and will "create a list of best practices for fixing gender-bias bugs in both products and processes." - -### Canadian university compiles open source microbial database - -What do you do when you have a vast amount of data but no way to effectively search and build upon it? You turn it into a database, of course. That's what researchers at Simon Fraser University in British Columbia, along with collaborators from around the globe, did with [information about chemical compounds created by bacteria and fungi][3]. Called the Natural Products Atlas, the database "holds information on nearly 25,000 natural compounds and serves as a knowledge base and repository for the global scientific community." - -Licensed under a Creative Commons Attribution 4.0 International License, the Natural Products Atlas "holds information on nearly 25,000 natural compounds and serves as a knowledge base and repository for the global scientific community." The [website for the Natural Products Atlas][4] hosts the database also includes a number of visualization tools and is fully searchable. - -Roger Linington, an associate professor at SFU who spearheaded the creation of the database, said that having "all the available data in one place and in a standardized format means we can now index natural compounds for anyone to freely access and learn more about." - -### Open source index for cooperatives - -Europe has long been a hotbed of both open source development and open source adoption. While European governments strongly advocate open source, non profits have been following suit. One of those is Cooperatives Europe, which is developing "[open source software to allow users to index co-op information and resources in a standardised way][5]." - -The idea behind the software, called Coop Starter, reinforces the [essential freedoms of free software][6]: it's intended to provide "education, training and information. The software may be used and repurposed by the public for their own needs and on their own infrastructure." Anyone can use it "to reference existing material on co-operative entrepreneurship" and can contribute "by sharing resources and information." - -The [code for Coop Starter][7], along with a related WordPress plugin, is available from Cooperative Europe's GitLab repository. - -#### In other news - - * [Nancy recognised as France’s top digital free and collaborative public service][8] - * [Open Source and AI: Ready for primetime in government?][9] - * [Open Software Means Kinder Science][10] - * [New Open-Source CoE to be launched by Wipro and Oman’s Ministry of Tech & Communication][11] - - - -_Thanks, as always, to Opensource.com staff members and [Correspondents][12] for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/news-december-21 - -作者:[Scott Nesbitt][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/scottnesbitt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://techxplore.com/news/2019-12-professors-gender-biased-bugs-open-source-software.html -[3]: https://www.sfu.ca/sfunews/stories/2019/12/sfu-global-collaboration-creates-world-s-first-open-source-datab.html -[4]: https://www.npatlas.org/joomla/ -[5]: https://www.thenews.coop/144412/sector/regional-organisations/cooperatives-europe-builds-open-source-index-for-the-co-op-movement/ -[6]: https://www.gnu.org/philosophy/free-sw.en.html -[7]: https://git.happy-dev.fr/startinblox/applications/coop-starter -[8]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/territoire-numerique-libre -[9]: https://federalnewsnetwork.com/commentary/2019/12/open-source-and-ai-ready-for-primetime-in-government/ -[10]: https://blogs.scientificamerican.com/observations/open-software-means-kinder-science/ -[11]: https://www.indianweb2.com/2019/12/11/new-open-source-coe-to-be-launched-by-wipro-and-omans-ministry-of-tech-communication/ -[12]: https://opensource.com/correspondent-program diff --git a/sources/news/20200116 It-s the end for Windows Server 2008 support.md b/sources/news/20200116 It-s the end for Windows Server 2008 support.md deleted file mode 100644 index 35e25fc844..0000000000 --- a/sources/news/20200116 It-s the end for Windows Server 2008 support.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (It’s the end for Windows Server 2008 support) -[#]: via: (https://www.networkworld.com/article/3513980/it-s-the-end-for-windows-server-2008-support.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -It’s the end for Windows Server 2008 support -====== -Microsoft recommends migrating Server 2008 workloads to Azure cloud services while enterprises modernize their apps for Windows Server 2016 or 2019 deployments. -PaulFleet / Getty Images / Microsoft - -This week's Patch Tuesday marked the end of the line for both Windows 7 and Windows Server 2008 (and 2008 R2). No more fixes will be issued for the two aged operating systems, unless you purchase a pricey extended service license. - -On the Windows 7 front, Microsoft has done a good job getting Windows 10 deployed through its aggressive (perhaps too aggressive) upgrade program. According to StatCounter, Windows 10 now accounts for 65% of the [worldwide desktop Windows market share][1], and Windows 7 is down to 27%. - -**RELATED:** [What to know before upgrading to Windows Server 2019][2] - -But while Windows 7 has gotten all the attention, Server 2008 actually has a larger share of holdouts, and in some ways, its end-of-life milestone is more significant. At last July’s Inspire show, a Microsoft executive said in an interview with cloud storage provider and Microsoft partner Carbonite that [60% of its current Windows Server][3] installed base was running Server 2008, accounting for 24 million instances.  - -[][4] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][4] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -“There are a lot [of customers sticking with Server 2008],” says analyst Tim Crawford of research and advisory firm [AVOA][5]. “You could categorize them into those that either a) use functions specific to WS2008, and b) those that use a version of an application that is only compatible with WS2008. Upgrading is often easier said than done. Especially if the application is a custom app with lots of tentacles.” - -Server 2008 is based on the Windows Vista codebase, which should be reason alone to jettison it. But Windows Server 2016 and Windows Server 2019 are built on Windows 10, which means apps heavily dependent on the OS ecosystem might be hard to move since the internals are so different. - -“I do work with folks that are still running Windows Server 2008. They understand the ramifications of EOL for support. But most are in a predicament where they aren’t able to move the applications for a number of reasons, including application compatibility, location, etc.," Crawford says. - -For those apps that are challenging to move, he recommends isolating the system as much as possible to protect it, and putting in a plan to do what is needed to the applications to prepare them for movement as quickly as possible. - -Microsoft offers and recommends [Azure migration][6], so Server 2008 apps can [run in an Azure instance][7] while they are modernized for Server 2019 and then deployed on premises. - -Migration should be the paramount effort, because if you are running Server 2008 then you're using hardware that's at least eight years old and potentially 12 years old. That’s ancient in technology terms, and if nothing else, the hardware is going to fail. - -One of the headaches for admins is you cannot migrate Server 2008 directly to 2016 or 2019. You have to upgrade to Server 2012 as an intermediate step. So you are better off biting the bullet and migrating the apps to 2019 rather than spending time on two OS migrations. - -Microsoft has provided [resources][8] for Server 2008 users, including a migration guide and help moving to Azure. - -Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3513980/it-s-the-end-for-windows-server-2008-support.html - -作者:[Andy Patrizio][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Andy-Patrizio/ -[b]: https://github.com/lujun9972 -[1]: https://gs.statcounter.com/os-version-market-share/windows/desktop/worldwide#monthly-201807-201908 -[2]: https://www.networkworld.com/article/3512020/what-to-know-before-upgrading-from-windows-server-2016-to-server-2019.html -[3]: https://www.carbonite.com/blog/article/2019/07/schuster-azure-migration-and-office-365-top-partner-opportunities -[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[5]: https://avoa.com/ -[6]: https://cloudblogs.microsoft.com/windowsserver/2019/12/17/protect-workloads-still-running-on-windows-server-2008-and-2008-r2/ -[7]: https://www.networkworld.com/article/3300165/microsoft-lures-win-server-2008-users-toward-azure.html -[8]: https://www.microsoft.com/en-us/cloud-platform/windows-server-2008 -[9]: https://www.facebook.com/NetworkWorld/ -[10]: https://www.linkedin.com/company/network-world From 3110b8c5f73f00656dafcc0f942a27ac70908a62 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 22:58:47 +0800 Subject: [PATCH 0299/3057] =?UTF-8?q?=E6=B8=85=E9=99=A4=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...y Banning Linux Gamers on Battlefield V.md | 86 ------------------- 1 file changed, 86 deletions(-) delete mode 100644 sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md diff --git a/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md b/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md deleted file mode 100644 index b0818e5fe8..0000000000 --- a/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (fuzheng1998) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Shocking! EA is Permanently Banning Linux Gamers on Battlefield V) -[#]: via: (https://itsfoss.com/ea-banning-linux-gamers/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Shocking! EA is Permanently Banning Linux Gamers on Battlefield V -====== - -Only when I thought that [EA][1] as a game company might be getting better after [its decision to make its games available on Steam][2] – but it looks like that isn’t the case. - -In a [Reddit thread][3], a lot of Linux players seem to complain about getting banned by FairFight (which is the server-side anti-cheat engine used for BF V) just because they chose to play Battlefield V (BF V) on [Linux using Wine][4]. - -![][5] - -### Is this a widespread issue? - -Unfortunately, it seems to be the case with a number of Linux players using Wine to play Battlefield V on Linux. - -You can also find users on [Lutris Gaming forums][6] and [Battlefield forums][7] talking about it. - -Of course, the userbase on Linux playing Battlefield V isn’t huge – but it still matters, right? - -### What’s exactly the issue here? - -It looks like EA’s anti-cheat tech considers [DXVK][8] (Vulkan-based implementation of DirectX which tries to solve compatibility issues) as cheating. - -So, basically, the compatibility layer that is being utilized to make it possible to run Battlefield V is being detected as a modified file through which you’re “**potentially**” cheating. - -![Battlefield V on Lutris][9] - -Even though this could be an innocent problem for the anti-cheat engine but EA does not seem to acknowledge that at all. - -Here’s what they respond with when one of the players wrote an email to EA in order to lift the ban: - -> After thoroughly investigating your account and concern, we found that your account was actioned correctly and will not remove this sanction from your account. - -Also, with all this going on, [Lutris Gaming][10] seems to be quite furious on EA’s behavior with the permanent bans: - -> It has come to our attention that several Battlefield 5 players have recently been banned for playing on Linux, and that EA has chosen not to revert these wrongful punishments. Due to this, we advise to refrain from playing any multiplayer games published by [@EA][11] in the future. -> -> — Lutris Gaming (@LutrisGaming) [January 2, 2020][12] - -### Not just Battlefield V, it’s the same with Destiny 2 - -As pointed by a Redditor in the same thread, Bungie also happens to consider Wine as an emulator (which is against their policy) and has banned players on Linux a while back. - -### EA needs to address the issue - -_We have reached out to EA for a comment on the issue_. _And, we’re still waiting for a response._ - -I shall update the article if we have an official response from EA. However, considering Blizzard as an example, they should actually work on fixing the issue and [reverse the bans on players using Linux][13]. - -I know that BF V does not offer native Linux support – but supporting the compatibility layer and not considering it as cheating would allow Linux users to experience the game which they rightfully own (or considering to purchase). - -What are your thoughts on this? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ea-banning-linux-gamers/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.ea.com/ -[2]: https://thenextweb.com/gaming/2019/10/29/ea-games-are-coming-back-to-steam-but-you-still-need-origin/ -[3]: https://www.reddit.com/r/linux/comments/ej3q2p/ea_is_permanently_banning_linux_players_on/ -[4]: https://itsfoss.com/install-latest-wine/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/reddit-thread-ea.jpg?ssl=1 -[6]: https://forums.lutris.net/t/ea-banning-dxvk-on-battlefield-v/7810 -[7]: https://forums.battlefield.com/en-us/discussion/197938/ea-banning-dxvk-on-battlefield-v-play-linux -[8]: https://github.com/doitsujin/dxvk -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/battlefield-v-lutris-gaming.png?ssl=1 -[10]: https://lutris.net/ -[11]: https://twitter.com/EA?ref_src=twsrc%5Etfw -[12]: https://twitter.com/LutrisGaming/status/1212827248430059520?ref_src=twsrc%5Etfw -[13]: https://www.altchar.com/game-news/blizzard-unbans-overwatch-players-who-used-linux-os-agF9y0G2gWjn From ed7a5bf514fc73328748904a1462dea75044319a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 23:17:36 +0800 Subject: [PATCH 0300/3057] PRF --- .../tech/20200115 6 handy Bash scripts for Git.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/translated/tech/20200115 6 handy Bash scripts for Git.md b/translated/tech/20200115 6 handy Bash scripts for Git.md index 93a0d97796..c79d228fad 100644 --- a/translated/tech/20200115 6 handy Bash scripts for Git.md +++ b/translated/tech/20200115 6 handy Bash scripts for Git.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (6 handy Bash scripts for Git) @@ -12,9 +12,9 @@ > 当使用 Git 存储库时,这六个 Bash 脚本将使你的生活更轻松。 -![Digital hand surrounding by objects, bike, light bulb, graphs][1] +![](https://img.linux.net.cn/data/attachment/album/202001/18/231713jegbk8fyek798gxb.jpg) -我编写了许多 Bash 脚本,这些脚本使我在使用 Git 存储库时工作更加轻松。我的许多同事说没有必要;我所做的一切都可以用 Git 命令完成。虽然这可能是正确的,但我发现脚本远比尝试找出适当的 Git 命令来执行我想要的操作更加方便。 +我编写了许多 Bash 脚本,这些脚本使我在使用 Git 存储库时工作更加轻松。我的许多同事说没有必要:我所做的一切都可以用 Git 命令完成。虽然这可能是正确的,但我发现脚本远比尝试找出适当的 Git 命令来执行我想要的操作更加方便。 ### 1、gitlog @@ -126,7 +126,7 @@ Compare script generated at: /tmp/compare_mismatches.sh ### 6、gitlog.find -最后,我有一个 `gitlog.find` 脚本,可以帮助我识别补丁程序的上游版本在哪里以及每个补丁程序的当前状态。它通过匹配补丁说明来实现。它还会生成一个比较脚本(再次使用了 Kompare),以将当前补丁与上游对应补丁进行比较: +最后,我有一个 `gitlog.find` 脚本,可以帮助我识别补丁程序的上游版本在哪里以及每个补丁的当前状态。它通过匹配补丁说明来实现。它还会生成一个比较脚本(再次使用了 Kompare),以将当前补丁与上游对应补丁进行比较: ``` $ gitlog.find @@ -498,7 +498,7 @@ via: https://opensource.com/article/20/1/bash-scripts-git 作者:[Bob Peterson][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6f7dce0842a80c0bc4ecc5ad05d9cd88a1e9fec5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 23:18:26 +0800 Subject: [PATCH 0301/3057] PUB @wxy https://linux.cn/article-11797-1.html --- .../20200115 6 handy Bash scripts for Git.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200115 6 handy Bash scripts for Git.md (99%) diff --git a/translated/tech/20200115 6 handy Bash scripts for Git.md b/published/20200115 6 handy Bash scripts for Git.md similarity index 99% rename from translated/tech/20200115 6 handy Bash scripts for Git.md rename to published/20200115 6 handy Bash scripts for Git.md index c79d228fad..8a43bb3220 100644 --- a/translated/tech/20200115 6 handy Bash scripts for Git.md +++ b/published/20200115 6 handy Bash scripts for Git.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11797-1.html) [#]: subject: (6 handy Bash scripts for Git) [#]: via: (https://opensource.com/article/20/1/bash-scripts-git) [#]: author: (Bob Peterson https://opensource.com/users/bobpeterson) From 0e3c0feb1c1378f28c860c26ad6cfcf949245c25 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 19 Jan 2020 00:57:46 +0800 Subject: [PATCH 0302/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200119=20How?= =?UTF-8?q?=20to=20Set=20or=20Change=20Timezone=20in=20Ubuntu=20Linux=20[B?= =?UTF-8?q?eginner=E2=80=99s=20Tip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md --- ...imezone in Ubuntu Linux -Beginner-s Tip.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md diff --git a/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md b/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md new file mode 100644 index 0000000000..869e8b1d79 --- /dev/null +++ b/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Set or Change Timezone in Ubuntu Linux [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/change-timezone-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Set or Change Timezone in Ubuntu Linux [Beginner’s Tip] +====== + +[When you install Ubuntu][1], it asks you to set timezone. If you chose a wrong timezone or if you have moved to some other part of the world, you can easily change it later. + +### How to change Timezone in Ubuntu and other Linux distributions + +There are two ways to change the timezone in Ubuntu. You can use the graphical settings or use the timedatectl command in the terminal. You may also change the /etc/timezone file directly but I won’t advise that. + +I’ll show you both graphical and terminal way in this beginner’s tutorial: + + * [Change timezone in Ubuntu via GUI][2] (suitable for desktop users) + * [Change timezone in Ubuntu via command line][3] (works for both desktop and servers) + + + +![][4] + +#### Method 1: Change Ubuntu timezone via terminal + +[Ubuntu][5] or any other distributions using systemd can use the timedatectl command to set timezone in Linux terminal. + +You can check the current date and timezone setting using timedatectl command without any option: + +``` +[email protected]:~$ timedatectl + Local time: Sat 2020-01-18 17:39:52 IST + Universal time: Sat 2020-01-18 12:09:52 UTC + RTC time: Sat 2020-01-18 12:09:52 + Time zone: Asia/Kolkata (IST, +0530) + System clock synchronized: yes +systemd-timesyncd.service active: yes + RTC in local TZ: no +``` + +As you can see in the output above, my system uses Asia/Kolkata. It also tells me that it is 5:30 hours ahead of GMT. + +To set a timezone in Linux, you need to know the exact timezone. You must use the correct format of the timezone (which is Continent/City). + +To get the timezone list, use the _list-timezones_ option of _timedatectl_ command: + +``` +timedatectl list-timezones +``` + +It will show you a huge list of the available time zones. + +![Timezones List][6] + +You can use the up and down arrow or PgUp and PgDown key to move between the pages. + +You may also grep the output and search for your timezone. For example, if you are looking for time zones in Europe, you may use: + +``` +timedatectl list-timezones | grep -i europe +``` + +Let’s say you want to set the timezone to Paris. The timezone value to be used here is Europe/Paris: + +``` +timedatectl set-timezone Europe/Paris +``` + +It won’t show any success message but the timezone is changed instantly. You don’t need to restart or log out. + +Keep in mind that though you don’t need to become root user and use sudo with the command but your account still need to have admin rights in order to change the timezone. + +You can verify the changed time and timezone by using the [date command][7]: + +``` +[email protected]:~$ date +Sat Jan 18 13:56:26 CET 2020 +``` + +#### Method 2: Change Ubuntu timezone via GUI + +Press the super key (Windows key) and search for Settings: + +![Applications Menu Settings][8] + +Scroll down a little and look for Details in the left sidebar: + +![Go to Settings -> Details][9] + +In Details, you’ll fine Date & Time in the left sidebar. Here, you should turn off Automatic Time Zone option (if it is enabled) and then click on the Time Zone: + +![In Details -> Date & Time, turn off the Automatic Time Zone][10] + +When you click the Time Zone, it will open an interactive map and you can click on the geographical location of your choice and close the window. + +![Select a timezone][11] + +You don’t have to do anything other than closing this map after selecting the new timezone. No need to logout or [shutdown Ubuntu][12]. + +I hope this quick tutorial helped you to change timezone in Ubuntu and other Linux distributions. If you have questions or suggestions, please let me know. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/change-timezone-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-ubuntu/ +[2]: tmp.bHvVztzy6d#change-timezone-gui +[3]: tmp.bHvVztzy6d#change-timezone-command-line +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/Ubuntu_Change-_Time_Zone.png?ssl=1 +[5]: https://ubuntu.com/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/timezones_in_ubuntu.jpg?ssl=1 +[7]: https://linuxhandbook.com/date-command/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/settings_detail_ubuntu.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu.jpg?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu_2.jpg?ssl=1 +[12]: https://itsfoss.com/schedule-shutdown-ubuntu/ From 94cca4d8c50ad967d844c8bab80319d6899aabca Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 19 Jan 2020 00:58:31 +0800 Subject: [PATCH 0303/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200118=20Keep?= =?UTF-8?q?=20a=20journal=20of=20your=20activities=20with=20this=20Python?= =?UTF-8?q?=20program?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200118 Keep a journal of your activities with this Python program.md --- ...our activities with this Python program.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20200118 Keep a journal of your activities with this Python program.md diff --git a/sources/tech/20200118 Keep a journal of your activities with this Python program.md b/sources/tech/20200118 Keep a journal of your activities with this Python program.md new file mode 100644 index 0000000000..b5d3cf93a4 --- /dev/null +++ b/sources/tech/20200118 Keep a journal of your activities with this Python program.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keep a journal of your activities with this Python program) +[#]: via: (https://opensource.com/article/20/1/python-journal) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Keep a journal of your activities with this Python program +====== +Jrnl creates a searchable, timestamped, exportable, and (if you want) +encrypted log of your daily activities. Learn more in the eighth in our +series on 20 ways to be more productive with open source in 2020. +![Writing in a notebook][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Journaling with jrnl + +At my workplace, many of us post an "end of day" status to Slack before we leave for the day. With a lot of projects going on and a global team, it is a pretty good way to share what you got done, what isn't done, and what you need help with. But some days are so busy, so hectic that I can't remember what I did. And this is where journaling comes in. + +![jrnl][2] + +It's pretty easy to keep a text editor open and just add a line when you do something. But it can be challenging to go back and figure out when you make a particular note or pull out related lines quickly and easily. Fortunately, [jrnl][3] is here to help. + +Jrnl allows you to enter a quick entry from your command line, search past entries, and export to rich text formats like HTML and Markdown. You can have multiple journals, meaning you can keep your work entries separated from private ones. It stores entries as plain text, so even if jrnl stops working, you have your data. + +Since jrnl is a Python program, the easiest way to install it is with **pip3 install jrnl**; this will make sure you get the latest and greatest version. On its first run, it will ask some questions, and then you are good to go. + +![jrnl's first run][4] + +Now, whenever you need to make a note or log work, simply type **jrnl <some text>,** and it will be logged with a timestamp to the default file. You can search for entries on a specific date with **jrnl -on YYYY-MM-DD**, entries since a date with **jrnl -from YYYY-MM-DD**, and entries up to a specific date with **jrnl -to YYYY-MM-DD**. Search terms can be combined with the **-and** parameter, allowing for searches like **jrnl -from 2019-01-01 -and -to 2019-12-31**. + +You can also edit entries in the journal with the **\--edit** command-line flag. Before you do, set up your default editor for entries by editing the file **~/.config/jrnl/jrnl.yaml**. This is also where you can specify what files to use for journals, what special character to use for tags, and a few other options. Right now, the important thing is to set the editor. I use Vim, and jrnl's documentation has some [helpful hints][5] for using other editors like VSCode and Sublime Text. + +![Example jrnl config file][6] + +Jrnl can also encrypt journal files. By setting the global **encrypt** variable, you'll tell jrnl to encrypt all the journals you have defined. Encryption can also be set per file by adding **encrypt: true** to the definition in the configuration file. + + +``` +journals: +  default: ~/journals/journal.txt +  work: ~/journals/work.txt +  private: +    journal: ~/journals/private.txt +    encrypt: true +``` + +If a journal isn't already encrypted, you will be prompted for the password on any actions for that journal. The journal file will be stored encrypted on disk and safe from prying eyes. [The jrnl documentation][7] has a lot more information on how it works, what ciphers it uses, and so on. + +![Encrypted jrnl file][8] + +Journaling helps me remember what I did when and find it later when I need it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/python-journal + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook) +[2]: https://opensource.com/sites/default/files/uploads/productivity_8-1.png (jrnl) +[3]: https://jrnl.sh/ +[4]: https://opensource.com/sites/default/files/uploads/productivity_8-2.png (jrnl's first run) +[5]: https://jrnl.sh/recipes/#external-editors +[6]: https://opensource.com/sites/default/files/uploads/productivity_8-3.png (Example jrnl config file) +[7]: https://jrnl.sh/encryption/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_8-4.png (Encrypted jrnl file) From 26cbf9dc4e88111b8126a8c313d4319938d84988 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 19 Jan 2020 00:58:58 +0800 Subject: [PATCH 0304/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200118=207=20?= =?UTF-8?q?things=20I=20learned=20from=20starting=20an=20open=20source=20p?= =?UTF-8?q?roject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200118 7 things I learned from starting an open source project.md --- ...ed from starting an open source project.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20200118 7 things I learned from starting an open source project.md diff --git a/sources/tech/20200118 7 things I learned from starting an open source project.md b/sources/tech/20200118 7 things I learned from starting an open source project.md new file mode 100644 index 0000000000..4742064f15 --- /dev/null +++ b/sources/tech/20200118 7 things I learned from starting an open source project.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 things I learned from starting an open source project) +[#]: via: (https://opensource.com/article/20/1/open-source-project) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +7 things I learned from starting an open source project +====== +It's not really about project mechanics at all. +![Stickers from all different open source projects and communities][1] + +I'm currently involved—heavily involved—in [Enarx][2], an open source (of course!) project to support running sensitive workloads on untrusted hosts. I've had involvement in various open source projects over the years, but this is the first for which I'm one of the founders. We're at the stage now where we've got a fair amount of code, quite a lot of documentation, a logo, and (important!) stickers. The project will hopefully be included in a Linux Foundation group—the [Confidential Computing Consortium][3]—so things are going very well indeed. + +I thought it might be useful to reflect on some of the things we did to get things going. To be clear, Enarx is a particular type of project, one that we believe has commercial and enterprise applications. It's also not mature yet, and we'll have hurdles and challenges along the way. What's more, the route we've taken won't be right for all projects, but hopefully, there's enough here to give a few pointers to other projects or people considering starting one up. + +The first thing I'd say is that there's lots of help to be had out there. I'd start with Opensource.com, where you'll find [lots of guidance][4]. I'll follow up by saying that, however much of it you follow, you'll still get things wrong. That said, here's my list of things to consider when starting an open source project. + +### 1\. Aim for critical mass + +I'm very lucky to work at the amazing [Red Hat][5], where everything we do is open source and where we take open source and community very seriously. I've heard it called a "critical mass" company—in order to get something taken seriously, you need to get enough people interested in it that it's difficult to ignore. Enarx's two co-founders—Nathaniel McCallum and I—are both very enthusiastic about the project and have spent a lot of time gaining sponsors within the organisation (you know who you are, and we thank you—we also know we haven't done a good enough job with you on all occasions!) and "selling" it to engineers to get them interested enough that it was difficult to stop. + +Some projects just bobble along with one or two contributors, but if you want to attract people and attention, getting a good set of people together who can get momentum going is a must. + +### 2\. Create a demo + +If you want to get people involved, a demo is great. It doesn't necessarily need to be polished, but it does need to show that what you're doing is possible and that you know what you're doing. For early demos, you may be talking about command-line output; that's fine if what you're providing isn't a user interface (UI) product. Being able to talk about what you're doing and convey both your passion and the importance of the project is a great boon. People like to be able to _see_ or _experience_ something, and it's much easier to communicate your enthusiasm if they have something real that expresses that. + +### 3\. Choose a license + +Once you have code and it's open source, you want other people to be able to contribute. This may seem like an unimportant step, but selecting an appropriate open source licence[1][6] will allow other people to contribute on well-understood and defined terms, making it easier for them to be involved—and for the organisations for which they work to allow them to do so. + +### 4\. Get documentation + +You might think that developer documentation is the most important to get out there—otherwise, how will other people get involved in coding? I disagree, at least to start with. For a small project, you can probably scale to a few more people just by explaining what the code does, what it should do, and what's missing. However, if there's no documentation available to explain what it's for and how it's going to help people, then why would anyone bother even looking at it? + +This doesn't need to be polished marketing copy, and it doesn't need to be serious, but it does need to convey to people why they should care. It's also going to help you with the first point I mentioned, attaining critical mass, as being able to point to documentation, use cases, and the rest will help convince people that you've thought through the _point_ of your project. We've used a GitHub wiki as our main documentation hub, and we try to update it with new information as we generate it. This is an area, to be clear, where we could do better. But at least we know that. + +### 5\. Be visible + +People aren't going to find out about you unless you're visible. We were incredibly lucky in that the Confidential Computing Consortium was formed just as we were beginning to get to a level of critical mass, and we immediately had a platform to increase our exposure. We have a [Twitter account][7], I publish articles on [my blog][8], and at Opensource.com, we've been lucky enough to have the chance to publish on Red Hat's [now + Next][9] blog, I've done interviews with the press, and we speak at conferences wherever and whenever we can. + +We're very lucky to have these opportunities, and it's clear that not all these approaches are appropriate for all projects, but make use of what you can: the more that people know about you, the more people can contribute. + +### 6\. Be welcoming + +Let's assume that people have found out about you: what's next? Well, they're hopefully going to want to get involved. If they don't feel welcome, then any involvement they have will taper off quickly. Yes, you need documentation (and, after a while, technical documentation, no matter what I said above), but you also need ways for contributors to talk to you and for them to feel that they are valued. We have [Gitter channels][10], and our daily standups are open to anyone who wants to join. Recently, someone opened an issue on our [issues database][11], and during the conversation on that thread, it transpired that our daily standup time doesn't work for them (given their time zone), so we're going to ensure that at least once a week it _does_, and we've assured them that we'll accommodate them. + +### 7\. Work with people you like + +I really, really enjoy meeting and working with the members of the Enarx project team. We get on well, we joke, we laugh, and we share a common aim: to make Enarx successful. I'm a firm believer in doing things you enjoy, where possible. Particularly in the early stages of a project, you need people who are enthusiastic and enjoy working closely together—even if they're geographically separated by thousands of kilometres.[2][12] If they don't get on, there's a decent chance that your and their enthusiasm for the project will falter, that the momentum will be lost, and that the project will end up failing. You won't always get the chance to choose those with whom you work, but if you can, then choose people you like and get on with. + +### Conclusion: People + +I didn't realise it when I started writing this article, but it's not really about project mechanics at all: it's about people. If you read back, you'll find the importance of people visible in every tip, even the one about choosing a license. Open source projects aren't really about code: they're about people, how they share, how they work together, and how they interact. + +I'm certain that your experience of open source projects will vary, and I'd be very surprised if everyone agrees about the top seven things you should do for project success. Arguably, Enarx _isn't_ a success yet, and I shouldn't be giving advice at this stage of our maturity. But when I think back to all of the open source projects that I can think of that _are_ successful, people feature strongly, and I don't think that's a surprise at all. + +* * * + + 1. Or "license," if you're from the US. + 2. Or, in fact, miles. + + + +* * * + +_This article originally appeared on [Alice, Eve, and Bob – a security blog][13] and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-project + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/stickers-osdc-lead.png?itok=2RNn132b (Stickers from all different open source projects and communities) +[2]: https://enarx.io/ +[3]: https://confidentialcomputing.io/ +[4]: https://opensource.com/article/20/1/getting-started-open-source +[5]: https://redhat.com/ +[6]: tmp.3liT27tUaE#1 +[7]: https://twitter.com/enarxproject +[8]: https://aliceevebob.com/ +[9]: https://next.redhat.com/ +[10]: https://gitter.im/enarx/ +[11]: https://github.com/enarx/enarx/issues +[12]: tmp.3liT27tUaE#2 +[13]: https://aliceevebob.com/2019/12/17/7-tips-for-kicking-off-an-open-source-project/ From e27da301f1cb0afdfa8d1ca0c484cf9d83256811 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 19 Jan 2020 07:04:39 +0800 Subject: [PATCH 0305/3057] Rename sources/tech/20200118 7 things I learned from starting an open source project.md to sources/talk/20200118 7 things I learned from starting an open source project.md --- ...118 7 things I learned from starting an open source project.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200118 7 things I learned from starting an open source project.md (100%) diff --git a/sources/tech/20200118 7 things I learned from starting an open source project.md b/sources/talk/20200118 7 things I learned from starting an open source project.md similarity index 100% rename from sources/tech/20200118 7 things I learned from starting an open source project.md rename to sources/talk/20200118 7 things I learned from starting an open source project.md From c52b867edbce1029d543eab3b0bf1605a8afc09d Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 19 Jan 2020 08:54:22 +0800 Subject: [PATCH 0306/3057] translating --- ...200114 Organize your email with Notmuch.md | 111 ------------------ ...200114 Organize your email with Notmuch.md | 109 +++++++++++++++++ 2 files changed, 109 insertions(+), 111 deletions(-) delete mode 100644 sources/tech/20200114 Organize your email with Notmuch.md create mode 100644 translated/tech/20200114 Organize your email with Notmuch.md diff --git a/sources/tech/20200114 Organize your email with Notmuch.md b/sources/tech/20200114 Organize your email with Notmuch.md deleted file mode 100644 index c9d5cac441..0000000000 --- a/sources/tech/20200114 Organize your email with Notmuch.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Organize your email with Notmuch) -[#]: via: (https://opensource.com/article/20/1/organize-email-notmuch) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Organize your email with Notmuch -====== -Notmuch indexes, tags, and sorts your email. Learn how to use it in the -fourth article in our series on 20 ways to be more productive with open -source in 2020. -![Filing cabinet for organization][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Index your email with Notmuch - -Yesterday, I talked about how I use OfflineIMAP to [sync my mail][2] to my local machine. Today, I'll talk about how I preprocess all that mail before I read it. - -![Notmuch][3] - -[Maildir][4] is probably one of the most useful mail storage formats out there. And there are a LOT of tools to help with managing your mail. The one I keep coming back to is a little program called [Notmuch][5] that indexes, tags, and searches mail messages. And there are several programs that work with Notmuch to make it even easier to handle a large amount of mail. - -Most Linux distributions include Notmuch, and you can also get it for MacOS. Windows users can access it through Windows Subsystem for Linux ([WSL][6]), but it may require some additional tweaks. - -![Notmuch's first run][7] - -On Notmuch's very first run, it will ask you some questions and create a **.notmuch-config** file in your home directory. Next, index and tag all your mail by running **notmuch new**. You can verify it with **notmuch search tag:new**; this will find all messages with the "new" tag. That's probably a lot of mail since Notmuch uses the "new" tag to indicate messages that are new to it, so you'll want to clean that up. - -Run **notmuch search tag:unread** to find any unread messages; that should result in quite a lot less mail. To remove the "new" tag from messages you've already seen, run **notmuch tag -new not tag:unread**, which will search for all messages without the "unread" tag and remove the "new" tag from them. Now when you run **notmuch search tag:new**, it should show only the unread mail messages. - -Tagging messages in bulk is probably more useful, though, since manually updating tags at every run can be really tedious. The **\--batch** command-line option tells Notmuch to read multiple lines of commands and execute them. There is also the **\--input=filename** option, which reads commands from a file and applies them. I have a file called **tagmail.notmuch** that I use to add tags to mail that is "new"; it looks something like this: - - -``` -# Manage sent, spam, and trash folders --unread -new folder:Trash --unread -new folder:Spam --unread -new folder:Sent - -# Note mail sent specifically to me (excluding bug mail) -+to-me to:kevin at sonney.com and tag:new and not tag:to-me - -# And note all mail sent from me -+sent from:kevin at sonney.com and tag:new and not tag:sent - -# Remove the new tag from messages --new tag:new -``` - -I can then run **notmuch tag --input=tagmail.notmuch** to bulk-process my mail messages after running **notmuch new**, and then I can search on those tags as well. - -Notmuch also supports running pre- and post-new hooks. These scripts, stored in **Maildir/.notmuch/hooks**, define actions to run before (pre-new) and after (post-new) to index new mail with **notmuch new**. In yesterday's article, I talked about using [OfflineIMAP][8] to sync mail from my IMAP server. It's very easy to run it from the "pre-new" hook: - - -``` -#!/bin/bash -# Remove the new tag from messages that are still tagged as new -notmuch tag -new tag:new - -# Sync mail messages -offlineimap -a LocalSync -u quiet -``` - -You can also use the Python application [afew][9], which interfaces with the Notmuch database, to tag things like _Mailing List_ and _Spam_ for you. You can run afew from the post-new hook in a similar way: - - -``` -#!/bin/bash -# tag with my custom tags -notmuch tag --input=~/tagmail.notmuch - -# Run afew to tag new mail -afew -t -n -``` - -I recommend that when using afew to tag messages, you do NOT use the **[ListMailsFilter]** since some mail handlers add obscure or downright junk List-ID headers to mail messages (I'm looking at you, Google). - -![alot email client][10] - -At this point, any mail reader that supports Notmuch or Maildir can work with my email. I'll sometimes use [alot][11], a Notmuch-specific client, to read mail at the console, but it's not as fancy as some other mail readers. - -In the coming days, I'll show you some other mail clients that will likely integrate with tools you already use. In the meantime, check out some of the other tools that work with Maildir mailboxes—you might find a hidden gem I've not tried yet. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/organize-email-notmuch - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) -[2]: https://opensource.com/article/20/1/sync-email-offlineimap -[3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch) -[4]: https://en.wikipedia.org/wiki/Maildir -[5]: https://notmuchmail.org/ -[6]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 -[7]: https://opensource.com/sites/default/files/uploads/productivity_4-2.png (Notmuch's first run) -[8]: http://www.offlineimap.org/ -[9]: https://afew.readthedocs.io/en/latest/index.html -[10]: https://opensource.com/sites/default/files/uploads/productivity_4-3.png (alot email client) -[11]: https://github.com/pazz/alot diff --git a/translated/tech/20200114 Organize your email with Notmuch.md b/translated/tech/20200114 Organize your email with Notmuch.md new file mode 100644 index 0000000000..1d81905ea3 --- /dev/null +++ b/translated/tech/20200114 Organize your email with Notmuch.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organize your email with Notmuch) +[#]: via: (https://opensource.com/article/20/1/organize-email-notmuch) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Notmuch 组织你的邮件 +====== +Notmuch 索引、标记和排序电子邮件。在我们的 20 个使用开源提升生产力的系列的第四篇文章中了解该如何使用。 +![Filing cabinet for organization][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 用 Notmuch 为你的邮件建立索引 + +昨天,我谈到了如何使用 OfflineIMAP [将我的邮件同步][2]到本地计算机。今天,我将讨论如何在阅读之前预处理所有邮件。 + +![Notmuch][3] + +[Maildir][4] 可能是最有用的邮件存储格式之一。有很多工具可以帮助你管理邮件。我经常使用一个名为 [Notmuch][5] 的小程序,它能索引、标记和搜索邮件。Notmuch 配合其他几个程序一起使用可以使处理大量邮件更加容易。 + +大多数 Linux 发行版都包含 Notmuch,你也可以在 MacOS 上获得它。Windows 用户可以通过 Linux 的 Windows 子系统([WSL][6])访问它,但可能需要进行一些其他调整。 + +![Notmuch's first run][7] + +Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 **.notmuch-config** 文件。接下来,运行 **notmuch new** 来索引并标记所有邮件。你可以使用 **notmuch search tag:new** 进行验证,它会找到所有带有 “new” 标签的消息。这可能会有很多邮件,因为 Notmuch 使用 “new” 标签来指示新邮件,因此你需要对其进行清理。 + +运行 **notmuch search tag:unread** 来查找未读消息,这会减少很多邮件。要从你已阅读的消息中删除 “new” 标签,请运行 **notmuch tag -new not tag:unread**,它将搜索所有没有 “unread” 标签的消息,并从其中删除 “new” 标签。现在,当你运行 **notmuch search tag:new**时,它将仅显示未读邮件。 + +但是,批量标记消息可能更有用,因为在每次运行时手动更新标记可能非常繁琐。**\--batch** 命令行选项告诉 Notmuch 读取多行命令并执行它们。还有一个 **\--input=filename** 选项,该选项从文件中读取命令并应用它们。我有一个名为 **tagmail.notmuch** 的文件,用于给”新“邮件添加标签;它看起来像这样: + + +``` +# Manage sent, spam, and trash folders +-unread -new folder:Trash +-unread -new folder:Spam +-unread -new folder:Sent + +# Note mail sent specifically to me (excluding bug mail) ++to-me to:kevin at sonney.com and tag:new and not tag:to-me + +# And note all mail sent from me ++sent from:kevin at sonney.com and tag:new and not tag:sent + +# Remove the new tag from messages +-new tag:new +``` + +我可以在运行 **notmuch new** 后运行 **notmuch tag --input=tagmail.notmuch** 批量处理我的邮件,之后我也可以搜索这些标签。 + +Notmuch 还支持 pre-new 和 post-new 钩子。这些脚本存放在 **Maildir/.notmuch/hooks** 中,它们定义了在使用 **notmuch new** 索引新邮件之前(pre-new)和之后(post-new)要做的操作。在昨天的文章中,我谈到了使用 [OfflineIMAP][8] 同步来自 IMAP 服务器的邮件。从 “pre-new” 钩子运行它非常容易: + + +``` +#!/bin/bash +# Remove the new tag from messages that are still tagged as new +notmuch tag -new tag:new + +# Sync mail messages +offlineimap -a LocalSync -u quiet +``` + +你还可以使用可以操作 Notmuch 数据库的 Python 应用 [afew][9],来为你标记_邮件列表_和_垃圾邮件_。你可以用类似的方法在 post-new 钩子中使用 afew: + + +``` +#!/bin/bash +# tag with my custom tags +notmuch tag --input=~/tagmail.notmuch + +# Run afew to tag new mail +afew -t -n +``` + +我建议你在使用 afew 标记邮件时,不要使用 **[ListMailsFilter]**,因为某些邮件处理程序会在邮件中添加模糊或者完全的垃圾列表中的标头(我说的是你 Google)。 + +![alot email client][10] + +此时,任何支持 Notmuch 或 Maildir 的邮件阅读器都可以读取我的邮件。有时,我会使用 [alot][11](一个 Notmuch 特定的客户端)在控制台中阅读邮件,但是它不像其他邮件阅读器那么美观。 + +在接下来的几天,我将向你展示其他一些邮件客户端,它们可能会与你在使用的工具集成在一起。同时,请查看可与 Maildir 邮箱一起使用的其他工具。你可能会发现我没发现的好东西。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/organize-email-notmuch + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) +[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch) +[4]: https://en.wikipedia.org/wiki/Maildir +[5]: https://notmuchmail.org/ +[6]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[7]: https://opensource.com/sites/default/files/uploads/productivity_4-2.png (Notmuch's first run) +[8]: http://www.offlineimap.org/ +[9]: https://afew.readthedocs.io/en/latest/index.html +[10]: https://opensource.com/sites/default/files/uploads/productivity_4-3.png (alot email client) +[11]: https://github.com/pazz/alot From 9b2aa6fc5869e0d256883e7cf42a82d6d62e5674 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 19 Jan 2020 08:59:27 +0800 Subject: [PATCH 0307/3057] translating --- ...0117 Get started with this open source to-do list manager.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200117 Get started with this open source to-do list manager.md b/sources/tech/20200117 Get started with this open source to-do list manager.md index 57c9061179..210c8508c1 100644 --- a/sources/tech/20200117 Get started with this open source to-do list manager.md +++ b/sources/tech/20200117 Get started with this open source to-do list manager.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ac5b0e57ab0f259edc65b86d9e9c1da2795d1a5c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 15:51:25 +0800 Subject: [PATCH 0308/3057] APL --- ...st- Which to choose for programming hardware abstractions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index acb58aaf6d..b8a72997df 100644 --- a/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 63edd7a8ea87041ff5e5bf2a9b9b6e5cb17ac387 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 17:16:09 +0800 Subject: [PATCH 0309/3057] PART 1 --- ...e for programming hardware abstractions.md | 87 +++++++++---------- 1 file changed, 42 insertions(+), 45 deletions(-) rename {sources => translated}/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md (67%) diff --git a/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md similarity index 67% rename from sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md rename to translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index b8a72997df..a7aecd1397 100644 --- a/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -7,25 +7,25 @@ [#]: via: (https://opensource.com/article/20/1/c-vs-rust-abstractions) [#]: author: (Dan Pittman https://opensource.com/users/dan-pittman) -C vs. Rust: Which to choose for programming hardware abstractions +C 还是 Rust:选择哪个用于编程硬件抽象 ====== -Using type-level programming in Rust can make hardware abstractions -safer. + +> 在 Rust 中使用类型级编程可以使硬件抽象更加安全。 + ![Tools illustration][1] -Rust is an increasingly popular programming language positioned to be the best choice for hardware interfaces. It's often compared to C for its level of abstraction. This article explains how Rust can handle bitwise operations in a number of ways and offers a solution that provides both safety and ease of use. +Rust 是一种日益流行的编程语言,被视为硬件接口的最佳选择。通常会将其与 C 的抽象级别进行比较。本文介绍了 Rust 如何以多种方式处理按位运算,并提供了既安全又易于使用的解决方案。 -Language | Origin | Official description | Overview +语言 | 源自 | 官方说明 | 总览 ---|---|---|--- -C | 1972 | C is a general-purpose programming language which features economy of expression, modern control flow and data structures, and a rich set of operators. (Source: [CS Fundamentals][2]) | C is [an] imperative language and designed to compile in a relatively straightforward manner which provides low-level access to the memory. (Source: [W3schools.in][3]) -Rust | 2010 | A language empowering everyone to build reliable and efficient software (Source: [Rust website][4]) | Rust is a multi-paradigm system programming language focused on safety, especially safe concurrency. (Source: [Wikipedia][5]) +C | 1972 年 | C 是一种通用编程语言,具有表达式简约、现代的控制流和数据结构,以及丰富的运算符集等特点。(来源:[CS 基础知识] [2])| C 是(一种)命令式语言,旨在以相对简单的方式进行编译,从而提供对内存的低级访问。(来源:[W3schools.in] [3]) +Rust | 2010 年 | 一种使所有人都能构建可靠、高效的软件的语言(来源:[Rust 网站] [4])| Rust 是一种专注于安全性(尤其是安全并发性)的多范式系统编程语言。(来源:[维基百科] [5]) -### Bitwise operation over register values in C +### 在 C 中对寄存器值进行按位运算 -In the world of systems programming, where you may find yourself writing hardware drivers or interacting directly with memory-mapped devices, interaction is almost always done through memory-mapped registers provided by the hardware. You typically interact with these things through bitwise operations on some fixed-width numeric type. - -For instance, imagine an 8-bit register with three fields: +在系统编程领域,你可能经常需要编写硬件驱动程序或直接与内存映射的设备进行交互,而这些交互几乎总是通过硬件提供的内存映射的寄存器来完成的。通常,你通过对某些固定宽度的数字类型进行按位运算来与这些寄存器进行交互。 +例如,假设一个具有三个字段的 8 位寄存器: ``` +----------+------+-----------+---------+ @@ -34,28 +34,25 @@ For instance, imagine an 8-bit register with three fields:    5-7       2-4        1          0 ``` -The number below the field name prescribes the bits used by that field in the register. To enable this register, you would write the value **1**, represented in binary as **0000_0001**, to set the enabled field's bit. Often, though, you also have an existing configuration in the register that you don't want to disturb. Say you want to enable interrupts on the device but also want to be sure the device remains enabled. To do that, you must combine the Interrupt field's value with the Enabled field's value. You would do that with bitwise operations: - +字段名称下方的数字规定了该字段在寄存器中使用的位。要启用该寄存器,你将写入值 `1`(以二进制表示为`0000_0001`)来设置 `Enabled` 字段的位。但是,通常情况下,你也不想干扰寄存器中的现有配置。假设你要在设备上启用中断功能,但也要确保设备保持启用状态。为此,必须将 `Interrupt` 字段的值与 `Enabled` 字段的值结合起来。你可以通过按位操作来做到这一点: ``` -`1 | (1 << 1)` +1 | (1 << 1) ``` -This gives you the binary value **0000_0011** by **or**-ing 1 with 2, which you get by shifting 1 left by 1. You can write this to your register, leaving it enabled but also enabling interrupts. +通过将 1 和 2(左移 `1` 一位得到)进行“或”运算得到二进制值 `0000_0011` 。你可以将其写入寄存器,使其保持启用状态,但也允许中断。 -This is a lot to keep in your head, especially when you're dealing with potentially hundreds of registers for a complete system. In practice, you do this with mnemonics which track a field's position in a register and how wide the field is—i.e., _what's its upper bound?_ - -Here's an example of one of these mnemonics. They are C macros that replace their occurrences with the code on the right-hand side. This is the shorthand for the register laid out above. The left-hand side of the **&** puts you in position for that field, and the right-hand side limits you to only that field's bits: +有很多事情要记住,特别是当你要为一个完整的系统处理可能有数百个之多的寄存器时。实际上,你可以使用助记符来执行此操作,助记符可跟踪字段在寄存器中的位置以及字段的宽度(即它的上边界是什么?) +这是这些助记符之一的示例。它们是 C 语言的宏,用右侧的代码替换它们的出现的地方。这是上面列出的寄存器的简写。`&` 的左侧是该字段的位置,而右侧则限制该字段的位: ``` -#define REG_ENABLED_FIELD(x) (x << 0) & 1 -#define REG_INTERRUPT_FIELD(x) (x << 1) & 2 -#define REG_KIND_FIELD(x) (x << 2) & (7 << 2) +#define REG_ENABLED_FIELD(x) (x << 0) & 1 +#define REG_INTERRUPT_FIELD(x) (x << 1) & 2 +#define REG_KIND_FIELD(x) (x << 2) & (7 << 2) ``` -You'd then use these to abstract over the derivation of a register's value with something like: - +然后,你将使用这些通过类似以下方式来抽象化寄存器值的操作: ``` void set_reg_val(reg* u8, val u8); @@ -65,9 +62,9 @@ fn enable_reg_with_interrupt(reg* u8) { } ``` -This is the state of the art. In fact, this is how the bulk of drivers appear in the Linux kernel. +这就是现在的做法。实际上,这就是大多数驱动程序出现在 Linux 内核中的方式。 -Is there a better way? Consider the boon to safety and expressibility if the type system was borne out of research on modern programming languages. That is, what could you do with a richer, more expressive type system to make this process safer and more tenable? +有没有更好的办法?如果能够基于对现代编程语言研究得出新的类型系统,就可能能够获得安全性和可表达性的好处。也就是说,如何使用更丰富、更具表现力的类型系统来使此过程更安全、更持久? ### Bitwise operation over register values in Rust @@ -114,7 +111,7 @@ impl Field { } ``` -Finally, you'll use a **Register** type, which wraps around a numeric type that matches the width of your register. **Register** has an **update** function that updates the register with the given field: +Finally, you'll use a `Register` type, which wraps around a numeric type that matches the width of your register. `Register` has an `update` function that updates the register with the given field: ``` @@ -139,7 +136,7 @@ The first rewrite in Rust is nice, but it's not ideal. You have to remember to b Second, thinking more structurally: What if there were a way to have the field's type carry the mask and offset information? What if you could catch mistakes in your implementation for how you access and interact with hardware registers at compile time instead of discovering them at runtime? Perhaps you can lean on one of the strategies commonly used to suss out issues at compile time, like types. -You can modify the earlier example by using [**typenum**][6], a library that provides numbers and arithmetic at the type level. Here, you'll parameterize the **Field** type with its mask and offset, making it available for any instance of **Field** without having to include it at the call site: +You can modify the earlier example by using [`typenum`][6], a library that provides numbers and arithmetic at the type level. Here, you'll parameterize the `Field` type with its mask and offset, making it available for any instance of `Field` without having to include it at the call site: ``` @@ -164,7 +161,7 @@ type RegInterrupt = Field<U2, U1>; type RegKind = Field<op!(U7 << U2), U2>; ``` -Now, when revisiting **Field**'s constructor, you can elide the mask and offset parameters because the type contains that information: +Now, when revisiting `Field`'s constructor, you can elide the mask and offset parameters because the type contains that information: ``` @@ -184,7 +181,7 @@ fn enable_register(&mut reg) { } ``` -It looks pretty good, but… what happens when you make a mistake regarding whether a given value will _fit_ into a field? Consider a simple typo where you put **10** instead of **1**: +It looks pretty good, but… what happens when you make a mistake regarding whether a given value will _fit_ into a field? Consider a simple typo where you put `10` instead of `1`: ``` @@ -193,13 +190,13 @@ fn enable_register(&mut reg) { } ``` -In the code above, what is the expected outcome? Well, the code will set that enabled bit to 0 because **10 & 1 = 0**. That's unfortunate; it would be nice to know whether a value you're trying to write into a field will fit into the field before attempting a write. As a matter of fact, I'd consider lopping off the high bits of an errant field value _undefined behavior_ (gasps). +In the code above, what is the expected outcome? Well, the code will set that enabled bit to 0 because `10 & 1 = 0`. That's unfortunate; it would be nice to know whether a value you're trying to write into a field will fit into the field before attempting a write. As a matter of fact, I'd consider lopping off the high bits of an errant field value _undefined behavior_ (gasps). ### Using Rust with safety in mind How can you check that a field's value fits in its prescribed position in a general way? More type-level numbers! -You can add a **Width** parameter to **Field** and use it to verify that a given value can fit into the field: +You can add a `Width` parameter to `Field` and use it to verify that a given value can fit into the field: ``` @@ -230,11 +227,11 @@ impl<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> Field<Width, Ma } ``` -Now you can construct a **Field** only if the given value fits! Otherwise, you have **None**, which signals that an error has occurred, rather than lopping off the high bits of the value and silently writing an unexpected value. +Now you can construct a `Field` only if the given value fits! Otherwise, you have `None`, which signals that an error has occurred, rather than lopping off the high bits of the value and silently writing an unexpected value. Note, though, this will raise an error at runtime. However, we knew the value we wanted to write beforehand, remember? Given that, we can teach the compiler to reject entirely a program which has an invalid field value—we don’t have to wait until we run it! -This time, you'll add a _trait bound_ (the **where** clause) to a new realization of new, called **new_checked**, that asks the incoming value to be less than or equal to the maximum possible value a field with the given **Width** can hold: +This time, you'll add a _trait bound_ (the `where` clause) to a new realization of new, called `new_checked`, that asks the incoming value to be less than or equal to the maximum possible value a field with the given `Width` can hold: ``` @@ -278,7 +275,7 @@ fn enable_register(&mut reg) {            found type `typenum::B1` ``` -**new_checked** will fail to produce a program that has an errant too-high value for a field. Your typo won't blow up at runtime because you could never have gotten an artifact to run. +`new_checked` will fail to produce a program that has an errant too-high value for a field. Your typo won't blow up at runtime because you could never have gotten an artifact to run. You're nearing Peak Rust in terms of how safe you can make memory-mapped hardware interactions. However, what you wrote back in the first example in C was far more succinct than the type parameter salad you ended up with. Is doing such a thing even tractable when you're talking about potentially hundreds or even thousands of registers? @@ -311,7 +308,7 @@ register! { } ``` -From this, you can generate register and field types like the previous example where the indices—the **Width**, **Mask**, and **Offset**—are derived from the values input in the **WIDTH** and **OFFSET** sections of a field's definition. Also, notice that all of these numbers are **typenums**; they're going to go directly into your **Field** definitions! +From this, you can generate register and field types like the previous example where the indices—the `Width`, `Mask`, and `Offset`—are derived from the values input in the `WIDTH` and `OFFSET` sections of a field's definition. Also, notice that all of these numbers are `typenums`; they're going to go directly into your `Field` definitions! The generated code provides namespaces for registers and their associated fields through the name given for the register and the fields. That's a mouthful; here's what it looks like: @@ -341,7 +338,7 @@ What does it look like to use these definitions for a real device? Will the code No! By using type synonyms and type inference, you effectively never have to think about the type-level part of the program at all. You get to interact with the hardware in a straightforward way and get those bounds-related assurances automatically. -Here's an example of a [UART][10] register block. I'll skip the declaration of the registers themselves, as that would be too much to include here. Instead, it starts with a register "block" then helps the compiler know how to look up the registers from a pointer to the head of the block. We do that by implementing **Deref** and **DerefMut**: +Here's an example of a [UART][10] register block. I'll skip the declaration of the registers themselves, as that would be too much to include here. Instead, it starts with a register "block" then helps the compiler know how to look up the registers from a pointer to the head of the block. We do that by implementing `Deref` and `DerefMut`: ``` @@ -373,7 +370,7 @@ impl DerefMut for Regs { } ``` -Once this is in place, using these registers is as simple as **read()** and **modify()**: +Once this is in place, using these registers is as simple as `read()` and `modify()`: ``` @@ -398,7 +395,7 @@ fn main() { } ``` -When we're working with runtime values we use **Option** like we saw earlier. Here I'm using **unwrap**, but in a real program with unknown inputs, you'd probably want to check that you got a **Some** back from that new call:[1][11],[2][12] +When we're working with runtime values we use `Option` like we saw earlier. Here I'm using `unwrap`, but in a real program with unknown inputs, you'd probably want to check that you got a `Some` back from that new call:[1][11],[2][12] ``` @@ -434,9 +431,9 @@ error[E0271]: type mismatch resolving `<typenum::UInt<typenum::UInt<typ        found type `typenum::B1` ``` -The **expected typenum::B0 found typenum::B1** part kind of makes sense, but what on earth is the **typenum::UInt<typenum::UInt, typenum::UInt…** nonsense? Well, **typenum** represents numbers as binary [cons][13] cells! Errors like this make it hard, especially when you have several of these type-level numbers confined to tight quarters, to know which number it's talking about. Unless, of course, it's second nature for you to translate baroque binary representations to decimal ones. +The `expected typenum::B0 found typenum::B1` part kind of makes sense, but what on earth is the `typenum::UInt<typenum::UInt, typenum::UInt…` nonsense? Well, `typenum` represents numbers as binary [cons][13] cells! Errors like this make it hard, especially when you have several of these type-level numbers confined to tight quarters, to know which number it's talking about. Unless, of course, it's second nature for you to translate baroque binary representations to decimal ones. -After the **U100**th time attempting to decipher any meaning from this mess, a teammate got Mad As Hell And Wasn't Going To Take It Anymore and made a little utility, **tnfilt**, to parse the meaning out from the misery that is namespaced binary cons cells. **tnfilt** takes the cons cell-style notation and replaces it with sensible decimal numbers. We imagine that others will face similar difficulties, so we shared [**tnfilt**][14]. You can use it like this: +After the `U100`th time attempting to decipher any meaning from this mess, a teammate got Mad As Hell And Wasn't Going To Take It Anymore and made a little utility, `tnfilt`, to parse the meaning out from the misery that is namespaced binary cons cells. `tnfilt` takes the cons cell-style notation and replaces it with sensible decimal numbers. We imagine that others will face similar difficulties, so we shared [`tnfilt`][14]. You can use it like this: ``` @@ -454,22 +451,22 @@ Now _that_ makes sense! ### In conclusion -Memory-mapped registers are used ubiquitously when interacting with hardware from software, and there are myriad ways to portray those interactions, each of which has a different place on the spectra of ease-of-use and safety. We found that the use of type-level programming to get compile-time checking on memory-mapped register interactions gave us the necessary information to make safer software. That code is available in the **[bounded-registers][15] crate** (Rust package). +Memory-mapped registers are used ubiquitously when interacting with hardware from software, and there are myriad ways to portray those interactions, each of which has a different place on the spectra of ease-of-use and safety. We found that the use of type-level programming to get compile-time checking on memory-mapped register interactions gave us the necessary information to make safer software. That code is available in the `[bounded-registers][15] crate` (Rust package). -Our team started out right at the edge of the more-safe side of that safety spectrum and then tried to figure out how to move the ease-of-use slider closer to the easy end. From those ambitions, **bounded-registers** was born, and we use it anytime we encounter memory-mapped devices in our adventures at Auxon. +Our team started out right at the edge of the more-safe side of that safety spectrum and then tried to figure out how to move the ease-of-use slider closer to the easy end. From those ambitions, `bounded-registers` was born, and we use it anytime we encounter memory-mapped devices in our adventures at Auxon. * * * - 1. Technically, a read from a register field, by definition, will only give a value within the prescribed bounds, but none of us lives in a pure world, and you never know what's going to happen when external systems come into play. You're at the behest of the Hardware Gods here, so instead of forcing you into a "might panic" situation, it gives you the **Option** to handle a "This Should Never Happen" case. + 1. Technically, a read from a register field, by definition, will only give a value within the prescribed bounds, but none of us lives in a pure world, and you never know what's going to happen when external systems come into play. You're at the behest of the Hardware Gods here, so instead of forcing you into a "might panic" situation, it gives you the `Option` to handle a "This Should Never Happen" case. - 2. **get_field** looks a little weird. I'm looking at the **Field::Read** part, specifically. **Field** is a type, and you need an instance of that type to pass to **get_field**. A cleaner API might be something like: + 2. `get_field` looks a little weird. I'm looking at the `Field::Read` part, specifically. `Field` is a type, and you need an instance of that type to pass to `get_field`. A cleaner API might be something like: ``` `regs.rx.get_field::();` ``` -But remember that **Field** is a type synonym that has fixed indices for width, offset, etc. To be able to parameterize **get_field** like this, you'd need higher-kinded types. +But remember that `Field` is a type synonym that has fixed indices for width, offset, etc. To be able to parameterize `get_field` like this, you'd need higher-kinded types. From 231f5085971e304cf3ec05e0f5688cbcba1044eb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 17:28:59 +0800 Subject: [PATCH 0310/3057] PART 2 --- ...e for programming hardware abstractions.md | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index a7aecd1397..5e5d33f4a7 100644 --- a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -21,7 +21,7 @@ Rust 是一种日益流行的编程语言,被视为硬件接口的最佳选择 C | 1972 年 | C 是一种通用编程语言,具有表达式简约、现代的控制流和数据结构,以及丰富的运算符集等特点。(来源:[CS 基础知识] [2])| C 是(一种)命令式语言,旨在以相对简单的方式进行编译,从而提供对内存的低级访问。(来源:[W3schools.in] [3]) Rust | 2010 年 | 一种使所有人都能构建可靠、高效的软件的语言(来源:[Rust 网站] [4])| Rust 是一种专注于安全性(尤其是安全并发性)的多范式系统编程语言。(来源:[维基百科] [5]) -### 在 C 中对寄存器值进行按位运算 +### 在 C 语言中对寄存器值进行按位运算 在系统编程领域,你可能经常需要编写硬件驱动程序或直接与内存映射的设备进行交互,而这些交互几乎总是通过硬件提供的内存映射的寄存器来完成的。通常,你通过对某些固定宽度的数字类型进行按位运算来与这些寄存器进行交互。 @@ -66,10 +66,9 @@ fn enable_reg_with_interrupt(reg* u8) { 有没有更好的办法?如果能够基于对现代编程语言研究得出新的类型系统,就可能能够获得安全性和可表达性的好处。也就是说,如何使用更丰富、更具表现力的类型系统来使此过程更安全、更持久? -### Bitwise operation over register values in Rust - -Continuing with the register above as an example: +### 在 Rust 语言中对寄存器值进行按位运算 +继续用上面的寄存器作为例子: ``` +----------+------+-----------+---------+ @@ -78,10 +77,9 @@ Continuing with the register above as an example:    5-7       2-4        1          0 ``` -How might you want to express such a thing in Rust types? - -You'll start in a similar way, by defining constants for each field's _offset_—that is, how far it is from the least significant bit—and its mask. A _mask_ is a value whose binary representation can be used to update or read the field from inside the register: +你可能想如何用 Rust 类型来表示它? +你将以类似的方式开始,为每个字段的*偏移*定义常量(即,距最低有效位有多远)及其掩码。*掩码*是一个值,其二进制表示形式可用于更新或读取寄存器内部的字段: ``` const ENABLED_MASK: u8 = 1; @@ -90,45 +88,43 @@ const ENABLED_OFFSET: u8 = 0; const INTERRUPT_MASK: u8 = 2; const INTERRUPT_OFFSET: u8 = 1; -const KIND_MASK: u8 = 7 << 2; +const KIND_MASK: u8 = 7 << 2; const KIND_OFFSET: u8 = 2; ``` -Next, you'll declare a field type and do your operations to convert a given value into its position-relevant value for use inside the register: - +接下来,你将声明一个 `Field` 类型,并进行操作以将给定值转换为与其位置相关的值以供在寄存器内使用: ``` struct Field { -    value: u8, + value: u8, } impl Field { -    fn new(mask: u8, offset: u8, val: u8) -> Self { -        Field { -            value: (val << offset) & mask, -        } -    } + fn new(mask: u8, offset: u8, val: u8) -> Self { + Field { + value: (val << offset) & mask, + } + } } ``` -Finally, you'll use a `Register` type, which wraps around a numeric type that matches the width of your register. `Register` has an `update` function that updates the register with the given field: - +最后,你将使用一个 `Register` 类型,该类型会封装一个与你的寄存器宽度匹配的数字类型。 `Register` 具有 `update` 函数,可使用给定字段来更新寄存器: ``` struct Register(u8); impl Register { -    fn update(&mut self, val: Field) { -        self.0 = self.0 | field.value; -    } + fn update(&mut self, val: Field) { + self.0 = self.0 | field.value; + } } -fn enable_register(&mut reg) { -    reg.update(Field::new(ENABLED_MASK, ENABLED_OFFSET, 1)); +fn enable_register(&mut reg) { + reg.update(Field::new(ENABLED_MASK, ENABLED_OFFSET, 1)); } ``` -With Rust, you can use data structures to represent fields, attach them to specific registers, and provide concise and sensible ergonomics while interacting with the hardware. This example uses the most basic facilities provided by Rust; regardless, the added structure alleviates some of the density from the C example above. Now a field is a named thing, not a number derived from shadowy bitwise operators, and registers are types with state—one extra layer of abstraction over the hardware. +使用 Rust,你可以使用数据结构来表示字段,将它们附加到特定的寄存器,并在与硬件交互时提供简洁明了的人机工程学。这个例子使用了 Rust 提供的最基本的功能。无论如何,添加的结构都会减轻上述 C 示例中的某些密度。现在,字段是个已命名的事物,而不是从模糊的按位运算符派生而来的数字,并且寄存器是具有状态的类型 —— 这在硬件上多了一层抽象。 ### A Rust implementation for ease of use From 2bc97881fa69499253c6258973c0ca6cf709742e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 22:44:12 +0800 Subject: [PATCH 0311/3057] PART 3 --- ...e for programming hardware abstractions.md | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index 5e5d33f4a7..fc7077f3c2 100644 --- a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -126,14 +126,13 @@ fn enable_register(&mut reg) { 使用 Rust,你可以使用数据结构来表示字段,将它们附加到特定的寄存器,并在与硬件交互时提供简洁明了的人机工程学。这个例子使用了 Rust 提供的最基本的功能。无论如何,添加的结构都会减轻上述 C 示例中的某些密度。现在,字段是个已命名的事物,而不是从模糊的按位运算符派生而来的数字,并且寄存器是具有状态的类型 —— 这在硬件上多了一层抽象。 -### A Rust implementation for ease of use +### 一个易用的 Rust 实现 -The first rewrite in Rust is nice, but it's not ideal. You have to remember to bring the mask and offset, and you're calculating them ad hoc, by hand, which is error-prone. Humans aren't great at precise and repetitive tasks—we tend to get tired or lose focus, and this leads to mistakes. Transcribing the masks and offsets by hand, one register at a time, will almost certainly end badly. This is the kind of task best left to a machine. +用 Rust 重写的第一个版本很好,但是并不理想。你必须记住要带上掩码和偏移量,并且要手工进行临时计算,这容易出错。人类不擅长精确且重复的任务 —— 我们往往会感到疲劳或失去专注力,这会导致错误。一次一个寄存器地手动记录掩码和偏移量几乎可以肯定会很糟糕。这是最好留给机器的任务。 -Second, thinking more structurally: What if there were a way to have the field's type carry the mask and offset information? What if you could catch mistakes in your implementation for how you access and interact with hardware registers at compile time instead of discovering them at runtime? Perhaps you can lean on one of the strategies commonly used to suss out issues at compile time, like types. - -You can modify the earlier example by using [`typenum`][6], a library that provides numbers and arithmetic at the type level. Here, you'll parameterize the `Field` type with its mask and offset, making it available for any instance of `Field` without having to include it at the call site: +其次,从结构上进行思考:如果有一种方法可以让字段的类型携带掩码和偏移信息呢?如果你要在访问硬件寄存器并与之交互的实现过程中就能发现错误,而不是在运行时才发现,该怎么办?也许你可以依靠一种通常用于在编译时解决问题的策略,例如类型。 +你可以使用 [typenum][6] 来修改前面的示例,该库在类型级别提供数字和算术。在这里,你将使用掩码和偏移量对 `Field` 类型进行参数化,使其可用于任何 `Field` 实例,而不必在调用站点中将其包括在内: ``` #[macro_use] @@ -144,49 +143,47 @@ use core::marker::PhantomData; use typenum::*; // Now we'll add Mask and Offset to Field's type -struct Field<Mask: Unsigned, Offset: Unsigned> { -    value: u8, -    _mask: PhantomData<Mask>, -    _offset: PhantomData<Offset>, +struct Field { + value: u8, + _mask: PhantomData, + _offset: PhantomData, } // We can use type aliases to give meaningful names to // our fields (and not have to remember their offsets and masks). -type RegEnabled = Field<U1, U0>; -type RegInterrupt = Field<U2, U1>; -type RegKind = Field<op!(U7 << U2), U2>; +type RegEnabled = Field; +type RegInterrupt = Field; +type RegKind = Field; ``` -Now, when revisiting `Field`'s constructor, you can elide the mask and offset parameters because the type contains that information: - +现在,当重新访问 `Field` 的构造函数时,你可以忽略掩码和偏移量参数,因为类型中包含该信息: ``` -impl<Mask: Unsigned, Offset: Unsigned> Field<Mask, Offset> { -    fn new(val: u8) -> Self { -        Field { -            value: (val << Offset::U8) & Mask::U8, -            _mask: PhantomData, -            _offset: PhantomData, -        } -    } +impl Field { + fn new(val: u8) -> Self { + Field { + value: (val << Offset::U8) & Mask::U8, + _mask: PhantomData, + _offset: PhantomData, + } + } } // And to enable our register... -fn enable_register(&mut reg) { -    reg.update(RegEnabled::new(1)); +fn enable_register(&mut reg) { + reg.update(RegEnabled::new(1)); } ``` -It looks pretty good, but… what happens when you make a mistake regarding whether a given value will _fit_ into a field? Consider a simple typo where you put `10` instead of `1`: - +看起来不错,但是……如果你对给定的值是否*适合*某个字段犯了错误,会发生什么?考虑一个简单的输入错误,你在其中放置了 `10` 而不是 `1`: ``` -fn enable_register(&mut reg) { +fn enable_register(&mut reg) {     reg.update(RegEnabled::new(10)); } ``` -In the code above, what is the expected outcome? Well, the code will set that enabled bit to 0 because `10 & 1 = 0`. That's unfortunate; it would be nice to know whether a value you're trying to write into a field will fit into the field before attempting a write. As a matter of fact, I'd consider lopping off the high bits of an errant field value _undefined behavior_ (gasps). +在上面的代码中,预期结果是什么?好吧,代码会将启用位设置为 0,因为 `10&1 = 0`。那真不幸;最好在尝试写入之前知道你要写入字段的值是否适合该字段。事实上,我会考虑放弃错误字段值的高位*未定义行为*(喘气)。 ### Using Rust with safety in mind From 1f56218e8532407316f6d3658916f9fd0947e80a Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sun, 19 Jan 2020 23:05:01 +0800 Subject: [PATCH 0312/3057] Translated. --- ...4 ways to volunteer this holiday season.md | 67 ----------------- ... ways to volunteder this holiday season.md | 71 +++++++++++++++++++ 2 files changed, 71 insertions(+), 67 deletions(-) delete mode 100644 sources/tech/20191220 4 ways to volunteer this holiday season.md create mode 100644 translated/tech/20191220 4 ways to volunteder this holiday season.md diff --git a/sources/tech/20191220 4 ways to volunteer this holiday season.md b/sources/tech/20191220 4 ways to volunteer this holiday season.md deleted file mode 100644 index e90a48cebc..0000000000 --- a/sources/tech/20191220 4 ways to volunteer this holiday season.md +++ /dev/null @@ -1,67 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 ways to volunteer this holiday season) -[#]: via: (https://opensource.com/article/19/12/ways-volunteer) -[#]: author: (John Jones https://opensource.com/users/johnjones4) - -4 ways to volunteer this holiday season -====== -Looking to spread some holiday cheer? Donate your talents to open source -organizations that help communities in need. -![Gift box opens with colors coming out][1] - -Social impact happens when leaders deploy individuals and resources to make positive change, but many social efforts are lacking technology resources that are up to the task of serving these change-makers. However, there are organizations helping to accelerate tech for good by connecting developers who want to make a change with communities and nonprofits who desperately need better technology. These organizations often serve specific audiences and recruit specific kinds of technologists, but they all share a common thread: open source. - -As developers, we all seek to participate in the open source community for a variety of reasons. Some participate for professional development, some participate so that they may collaborate with a vast, impressive network of technologists, and others participate because they know their contributions are necessary for the success of a project. Why not also volunteer your talents as a developer to an effort that needs them, and contribute to open source all at the same time? The organizations below are prime examples of how you can do that. - -### Code for America - -Code for America is an example of how government can still be by the people and for the people in the digital age. Through its Brigade Network, the organization has cultivated a national alliance of volunteer programmers, data scientists, concerned citizens, and designers organized in cities all over the United States. These local affiliates host regular meet-ups which are open to the community to both pitch new projects to the group and collaborate on ongoing efforts. To match volunteers with projects, the brigades’ websites often list the specific skills needed for a project such as data analysis, content creation, and JavaScript. While the brigades focus on local issues, shared experiences like natural disasters can foster collaboration. For example, a multi-brigade effort from the New Orleans, Houston, and Tampa Bay teams developed a hurricane response website that can be quickly adapted to different cities when disaster strikes. - -To get involved, visit Code for America’s [website][2] for a list of its over 70 brigades, and a path for individuals to start their own if there is not one already in their community. - -### Code for Change - -Code for Change shows that social impact can start even in high school. A group of high school coders in Indianapolis started their own club to give back to local organizations by creating open source software solutions to issues in their community. Code for Change encourages local organizations to reach out with a project idea, and the student group steps in to develop a completely free and open source solution. The group has developed projects such as "Sapphire," which optimized volunteer management systems for a local refugee organization, and a Civil Rights Commission complaint form that makes it easier for citizens to voice their concerns online. - -For more information on how to create a Code for Change chapter in your own community, [visit their website][3]. - -### Python for Good/Ruby for Good - -Python for Good and Ruby for Good are twin annual events in Portland, Oregon and Fairfax, Virginia, that bring people together to develop and program solutions for those respective communities. Over a weekend, individuals get together to hear pitches from local nonprofits and tackle their issues by building open source solutions. In 2017, Ruby For Good participants created "Justice for Juniors," which mentors and tutors current and formerly incarcerated youths to integrate them back into the community. Participants have also created "Diaperbase," an inventory management system that has been used by diaper banks all over the United States. One of the main objectives of these events is to bring organizations and people from seemingly different industries and mindsets to come together for a common good. Companies can sponsor the events, nonprofits can submit project ideas, and people of all skill levels can register to attend the event and contribute. Through their bicoastal efforts, Ruby for Good and Python for Good are living up to their motto of "making the world gooder." - -[Ruby for Good][4] is held in the summer and hosted on George Mason’s campus in Fairfax, Virginia. - -### Social Coder - -UK-based Ed Guiness created Social Coder to bring together volunteers and charities to create and use open source projects for nonprofits across six continents. Social Coder actively recruits a network of skilled IT volunteers from all over the world and matches them to charities and nonprofits registered through Social Coder. Projects can range from simple website updates to entire mobile app development. - -For example, PHASE Worldwide, a small non-governmental association supporting efforts in Nepal, got access to key support and expertise leveraging open source technology because of Social Coder. - -While a bulk of the charities already partnered with Social Coder are based in the UK, organizations in other countries are welcome. Through their website, individuals can register to work on social software projects and connect with organizations and charities seeking their help. - -Individuals interested in volunteering with Social Coder can sign up [here][5]. - -The four-day-long siege of a Nairobi mall ended Tuesday with a death toll of more than 60 people –... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/ways-volunteer - -作者:[John Jones][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/johnjones4 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) -[2]: https://brigade.codeforamerica.org/ -[3]: http://codeforchange.herokuapp.com/ -[4]: https://rubyforgood.org/ -[5]: https://socialcoder.org/Home/Programmer diff --git a/translated/tech/20191220 4 ways to volunteder this holiday season.md b/translated/tech/20191220 4 ways to volunteder this holiday season.md new file mode 100644 index 0000000000..47ba22d002 --- /dev/null +++ b/translated/tech/20191220 4 ways to volunteder this holiday season.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways to volunteer this holiday season) +[#]: via: (https://opensource.com/article/19/12/ways-volunteer) +[#]: author: (John Jones https://opensource.com/users/johnjones4) + +假期志愿服务的4种方式 +====== +想要洒播些节日的快乐吗?为开源组织做贡献,帮助有需要的社区。 +![Gift box opens with colors coming out][1] + + +当领导者们配置人员和资源以做出积极改变时,就会产生社会影响。但是,许多社会努力都缺乏能够为这些改变者提供服务的技术资源。然而,有些组织通过将想要做出改变的开发人员与迫切需要更好技术的社区和非营利组织联系起来,来促进技术进步。这些组织通常为特定的受众提供服务,并招募特定种类的技术人员,它们有一个共同点:开源。 + +作为开发人员,我们出于各种原因试图加入开源社区。有些是为了专业发展,有些是为了能够与广阔的网络上令人印象深刻的技术人员合作,还有其他人则是因为他们清楚自己的贡献对于项目的成功的必要性。为什么不将你作为开发人员的才华投入到需要它的地方,而同时又为开源组织做贡献呢?以下组织是实现此目标的一些主要事例。 + + + +### Code for America + +Code for America 是在数字时代,政府如何依靠人民为人民服务的一个例子。通过其Brigade Network,该组织在美国各个城市中组织了一个由志愿程序员,数据科学家,相关公民和设计师组成的全国联盟。这些本地分支机构定期举行聚会,向社区开放。这样既可以向小组推出新项目,又可以协调正在进行的工作。为了使志愿者与项目相匹配,各网站经常列出项目所需的特定技能,例如数据分析,内容创建和JavaScript。同时,Brigade网站也会关注当地问题,分享自然灾害等共同经验,这些都可以促进成员之间的合作。例如,新奥尔良,休斯敦和坦帕湾团队合作开发了一个飓风响应网站,当灾难发生时,该网站可以快速响应不同的城市灾难情况。 + +想要加入该组织,请访问 [网站][2] 获取70 多个 Brigade 的清单,以及个人加入组织的指南。 + +### Code for Change + +Code for Change 显示了即使在高中时期,也可以为社会做贡献。印第安纳波利斯的一群高中编码员成立了自己的俱乐部,他们通过创建针对社区问题的开源软件解决方案来回馈当地组织。 Code for Change 鼓励当地组织提出项目构想,学生团体加入并开发完全免费和开源的解决方案。该小组已经开发了诸如“蓝宝石”之类的项目,该项目优化了当地难民组织的志愿者管理系统,并建立了民权委员会的投诉表格,方便公民就他们所关心的问题在网上发表意见。 + +有关如何在你自己的社区中创建 Code for Change,[访问他们的网站][3]. + +### Python for Good/Ruby for Good + +Python for Good and Ruby for Good 是在俄勒冈州波特兰市和弗吉尼亚州费尔法克斯市举办的双年展活动,该活动将人们聚集在一起,为各自的社区开发和制定解决方案。 + +在周末,人们聚在一起聆听当地非营利组织的建议,并通过构建开源解决方案来解决他们的问题。 2017年,Ruby For Good参与者创建了“ Justice for Juniors”,该计划指导当前和以前被监禁的年轻人,并将他们重新融入社区。参与者还创建了“ Diaperbase”,这是一种库存管理系统,已被美国各地的尿布银行使用。这些活动的主要目标之一是将看似不同的行业和思维方式的组织和个人聚集在一起,以谋求共同利益。公司可以赞助活动,非营利组织可以提交项目构想,各种技能的人都可以注册参加活动并做出贡献。通过两岸(美国大西洋和太平洋东西海岸)的努力,Ruby for Good 和Python for Good 一直恪守“使世界变得更好”的座右铭。 + +[Ruby for Good][4] 在夏天举行,举办地点在弗吉尼亚州费尔法克斯的乔治•梅森(George Mason)大学。 + +### Social Coder + +英国的Ed Guiness创建了Social Coder,将志愿者和慈善机构召集在一起,为六大洲的非营利组织创建和使用开源项目。 Social Coder积极招募来自世界各地的熟练IT志愿者,并将其与通过Social Coder注册的慈善机构和非营利组织进行匹配。项目范围从简单的网站更新到整个移动应用程序的开发。 + +例如,PHASE Worldwide 是一个在尼泊尔支持工作的小型非政府组织,因为Social Coder,它获得了利用开源技术的关键支持和专业知识。 + +有许多慈善机构已经与英国的Social Coder进行了合作,也欢迎其它国家的组织加入。通过他们的网站,个人可以注册为社会软件项目工作,找到寻求帮助的组织和慈善机构。 + + +对 Social Coder 的志愿服务感兴趣的个人可以 [在此][5]注册. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ways-volunteer + +作者:[John Jones][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/johnjones4 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://brigade.codeforamerica.org/ +[3]: http://codeforchange.herokuapp.com/ +[4]: https://rubyforgood.org/ +[5]: https://socialcoder.org/Home/Programmer From 9b3ab30118e7bfb61003533ac15df19a7b29e2e6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 23:05:38 +0800 Subject: [PATCH 0313/3057] PRF @robsean --- ...5 How to Add Border Around Text in GIMP.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/tech/20191215 How to Add Border Around Text in GIMP.md b/translated/tech/20191215 How to Add Border Around Text in GIMP.md index 651a53fffb..6a4e57b0c5 100644 --- a/translated/tech/20191215 How to Add Border Around Text in GIMP.md +++ b/translated/tech/20191215 How to Add Border Around Text in GIMP.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Add Border Around Text in GIMP) @@ -10,7 +10,9 @@ 在 GIMP 中如何在文本周围添加边框 ====== -这个简单的教程阐明了在 [GIMP][1] 中显示文本的轮廓的步骤。文本轮廓帮助你在其它颜色下高亮显示文本。 +![](https://img.linux.net.cn/data/attachment/album/202001/19/230506fzkyktqglfcyzkuh.jpg) + +这个简单的教程介绍了在 [GIMP][1] 中显示文本的轮廓的步骤。文本轮廓可以帮助你在其它颜色下高亮显示该文本。 ![Outlined Text created in GIMP][2] @@ -20,25 +22,23 @@ 整个过程可以用这些简单的步骤描述: - * 创建文本,并复制它的轮廓路径 - * 添加一层新的透明层,并添加轮廓路径到透明层中 - * 更改轮廓的大小,给它添加一种不同的颜色 - - +* 创建文本,并复制它的轮廓路径 +* 添加一层新的透明层,并添加轮廓路径到透明层中 +* 更改轮廓的大小,给它添加一种不同的颜色 这就是全部的东西。不用担心,我将使用适当地截图详细的展示每个步骤。按照这个教程,你应该能够为文本添加轮廓,即使你在此之前从未使用过 GIMP 。 -仅需要确保你已经 [在 Linux 上安装 GIMP][3] 或者你正在使用的任何操作。 +仅需要确保你已经 [在 Linux 上安装 GIMP][3],或者也可以使用的其它任何操作系统。 这篇教程在 GIMP 2.10 版本下演示。 #### 步骤 1: 创建你的主要文本,并复制它的轮廓 -打开 GIMP ,并通过转到 菜单 -> 文件 -> 新建 来创建一个新的文件。你应该可以使用 Ctrl+N 键盘快捷键。 +打开 GIMP ,并通过转到 “菜单 -> 文件 -> 新建” 来创建一个新的文件。你应该可以使用 `Ctrl+N` 键盘快捷键。 ![Create New File][4] -你可以在这里选择画布的大小。你也可以选择要白色背景或一种透明背景。它在 高级选项 -> 颜色 配置文件下。 +你可以在这里选择画布的大小。你也可以选择要白色背景或一种透明背景。它在 “高级选项 -> 颜色” 配置文件下。 我选择默认的白色背景。它在以后能够更改。 @@ -46,35 +46,35 @@ ![Adding text in GIMP][5] -写你想的文本。你可以根据你的选择以更改文本的字体,大小和对齐方式。我保持这篇文章的文本的默认左对齐。 +写你想要的文本。你可以根据你的选择以更改文本的字体、大小和对齐方式。我保持这篇文章的文本的默认左对齐。 我故意为文本选择一种浅色,以便难于阅读。在这篇教程中我将添加一个深色轮廓到这个浅色的文本。 ![Text added in GIMP][6] -当你写完文本后,右键文本框并选择 **文本的路径** 。 +当你写完文本后,右键文本框并选择 “文本的路径” 。 ![Right click on the text box and select ‘Path from Text’][7] #### 步骤 2: 添加一个带有文本轮廓的透明层 -现在,转到顶部菜单,转到 层 ,并添加一个新层。 +现在,转到顶部菜单,转到“层”,并添加一个新层。 ![Use Shift+Ctrl+N to add a new layer][8] -确保添加新层为透明的。你可以给它一个合适的名称,像 ‘文本大纲’。单击确定来添加这个透明层。 +确保添加新层为透明的。你可以给它一个合适的名称,像“文本大纲”。单击确定来添加这个透明层。 ![Add a transparent layer][9] -再次转到菜单,这次转到 **选择** ,并单击 **来自路径** 。你将看到你的文本应该被高亮显示。 +再次转到菜单,这次转到 “选择” ,并单击 “来自路径” 。你将看到你的文本应该被高亮显示。 ![Go to Select and choose From Path][10] -总的来说,你只创建一个透明层,它有像你的原文一样相同的文本(但是透明)。现在你需要做的是在这个层上增加文本的大小。 +总的来说,你只创建了一个透明层,它有像你的原文一样相同的文本(但是透明)。现在你需要做的是在这个层上增加文本的大小。 -#### 步骤· 3: 通过增加它的大小和更改它的颜色来添加文本轮廓 +#### 步骤 3: 通过增加它的大小和更改它的颜色来添加文本轮廓 -为此,再次在菜单中转到 选择 ,这次选择 增加。这将允许增大透明层上的文本的大小。 +为此,再次在菜单中转到 “选择” ,这次选择 “增加”。这将允许增大透明层上的文本的大小。 ![Grow the selection on the additional layer][11] @@ -84,13 +84,13 @@ 你选择需要做是使用一种你选择的颜色来填充这个扩大的选择区。因为我的原文是浅色,在这里我将为轮廓使用背景色。 -如果尚未选择的话,先 **选择你的主图像层** 。这些层在右侧栏中可视。然后转到工具箱并选择油漆桶工具。为你的轮廓选择想要的颜色。 +如果尚未选择的话,先选择你的主图像层。这些层在右侧栏中可视。然后转到工具箱并选择油漆桶工具。为你的轮廓选择想要的颜色。 选择使用该工具来填充黑色到你的选择区。记住。你填充文本外部的轮廓,而不是文本本身。 ![Fill the outline of the text with a different color][13] -在这里你完成了很多。使用 Ctrl+Shift+A 来取消你当前的选择区。 +在这里你完成了很多。使用 `Ctrl+Shift+A` 来取消你当前的选择区。 ![Outline added to the text][14] @@ -100,7 +100,7 @@ 如果你对结果感到满意,保存文件未 PNG 文件(来保留透明背景),或你喜欢的任何文件格式。 -**你使它工作了吗?** +### 你使它工作了吗? 就这样。这就是你在 GIMP 中为添加一个文本轮廓而需要做的全部工作。 @@ -115,7 +115,7 @@ via: https://itsfoss.com/gimp-text-outline/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0565e2556c4f4ad7b64ccee9d334fae8911bcc82 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 23:06:27 +0800 Subject: [PATCH 0314/3057] PUB @robsean https://linux.cn/article-11799-1.html --- .../20191215 How to Add Border Around Text in GIMP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191215 How to Add Border Around Text in GIMP.md (98%) diff --git a/translated/tech/20191215 How to Add Border Around Text in GIMP.md b/published/20191215 How to Add Border Around Text in GIMP.md similarity index 98% rename from translated/tech/20191215 How to Add Border Around Text in GIMP.md rename to published/20191215 How to Add Border Around Text in GIMP.md index 6a4e57b0c5..6a59c6ac66 100644 --- a/translated/tech/20191215 How to Add Border Around Text in GIMP.md +++ b/published/20191215 How to Add Border Around Text in GIMP.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11799-1.html) [#]: subject: (How to Add Border Around Text in GIMP) [#]: via: (https://itsfoss.com/gimp-text-outline/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From b0427c217698982c4c67ec281dcfc9256e0b8097 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 19 Jan 2020 23:13:19 +0800 Subject: [PATCH 0315/3057] Rename 20191220 4 ways to volunteder this holiday season.md to 20191220 4 ways to volunteer this holiday season.md --- ...son.md => 20191220 4 ways to volunteer this holiday season.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/tech/{20191220 4 ways to volunteder this holiday season.md => 20191220 4 ways to volunteer this holiday season.md} (100%) diff --git a/translated/tech/20191220 4 ways to volunteder this holiday season.md b/translated/tech/20191220 4 ways to volunteer this holiday season.md similarity index 100% rename from translated/tech/20191220 4 ways to volunteder this holiday season.md rename to translated/tech/20191220 4 ways to volunteer this holiday season.md From ed5fa9bcbaa64923c7b5a073d4d4d791ddd69ef2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 23:43:30 +0800 Subject: [PATCH 0316/3057] PRF @wxy --- ...nction to maintain Python virtual environments.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md index 75dcec4367..38d003cfa2 100644 --- a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md +++ b/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (setV: A Bash function to maintain Python virtual environments) @@ -10,11 +10,11 @@ setV:一个管理 Python 虚拟环境的 Bash 函数 ====== -> 了解一下 setV,它是轻量级的 Python 虚拟环境管理器,是 virtualenvwrapper 的替代产品。 +> 了解一下 setV,它是一个轻量级的 Python 虚拟环境管理器,是 virtualenvwrapper 的替代产品。 -![Coding on a computer][1] +![](https://img.linux.net.cn/data/attachment/album/202001/19/234306tvvg5ffwakrzr5vv.jpg) -这一年多来,[setV] [2] 悄悄隐藏在我的 [bash_scripts][3] 项目中,但现在是时候该公开了。setV 是一个 Bash 函数,我可以用它代替 [virtualenvwrapper][4]。它提供了使你能够执行以下操作的基本功能: +这一年多来,我的 [bash_scripts][3] 项目中悄悄隐藏这 [setV][2],但现在是时候该公开了。setV 是一个 Bash 函数,我可以用它代替 [virtualenvwrapper][4]。它提供了使你能够执行以下操作的基本功能: * 默认使用 Python 3 * 创建一个新的虚拟环境 @@ -37,7 +37,7 @@ curl https://gitlab.com/psachin/setV/raw/master/install.sh sh ./install.sh ``` -当安装 setV 时,安装脚本会询问你要嵌入到 `~/.bashrc` 还是 `~/.bash_profile`,根据你的喜好选择一个。 +当安装 setV 时,安装脚本会要求你引入(`source`)一下 `~/.bashrc` 或 `~/.bash_profile` 的配置,根据你的喜好选择一个。 ### 用法 @@ -281,7 +281,7 @@ via: https://opensource.com/article/20/1/setv-bash-function 作者:[Sachin Patil][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0bacb6b8c11c1fdba116c892524924fa7ee7fc15 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 23:43:56 +0800 Subject: [PATCH 0317/3057] PUB @wxy https://linux.cn/article-11800-1.html --- ...A Bash function to maintain Python virtual environments.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200113 setV- A Bash function to maintain Python virtual environments.md (99%) diff --git a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/published/20200113 setV- A Bash function to maintain Python virtual environments.md similarity index 99% rename from translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md rename to published/20200113 setV- A Bash function to maintain Python virtual environments.md index 38d003cfa2..45e4beaf52 100644 --- a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md +++ b/published/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11800-1.html) [#]: subject: (setV: A Bash function to maintain Python virtual environments) [#]: via: (https://opensource.com/article/20/1/setv-bash-function) [#]: author: (Sachin Patil https://opensource.com/users/psachin) From e4b485d5b8bc22d41f664be5567e8b4a67ce71ac Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 20 Jan 2020 00:52:18 +0800 Subject: [PATCH 0318/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200119=20Open?= =?UTF-8?q?=20source=20fights=20cancer,=20Tesla=20adopts=20Coreboot,=20Ube?= =?UTF-8?q?r=20and=20Lyft=20release=20open=20source=20machine=20learning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md --- ...ft release open source machine learning.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md diff --git a/sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md b/sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md new file mode 100644 index 0000000000..90b5c18537 --- /dev/null +++ b/sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning) +[#]: via: (https://opensource.com/article/20/1/news-january-19) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning +====== +Catch up on the biggest open source headlines from the past two weeks. +![Weekly news roundup with TV][1] + +In this edition of our open source news roundup, we take a look machine learning tools from Uber and Lyft, open source software to fight cancer, saving students money with open textbooks, and more! + +### Uber and Lyft release machine learning tools + +It's hard to a growing company these days that doesn't take advantage of machine learning to streamline its business and make sense of the data it amasses. Ridesharing companies, which gather massive amounts of data, have enthusiastically embraced the promise of machine learning. Two of the biggest players in the ridesharing sector have made some of their machine learning code open source. + +Uber recently [released the source code][2] for its Manifold tool for debugging machine learning models. According to Uber software engineer Lezhi Li, Manifold will "benefit the machine learning (ML) community by providing interpretability and debuggability for ML workflows." If you're interested, you can browse Manifold's source code [on GitHub][3]. + +Lyft has also upped its open source stakes by releasing Flyte. Flyte, whose source code is [available on GitHub][4], manages machine learning pipelines and "is an essential backbone to (Lyft's) operations." Lyft has been using it to train AI models and process data "across pricing, logistics, mapping, and autonomous projects." + +### Software to detect cancer cells + +In a study recently published in _Nature Biotechnology_, a team of medical researchers from around the world announced [new open source software][5] that "could make it easier to create personalised cancer treatment plans." + +The software assesses "the proportion of cancerous cells in a tumour sample" and can help clinicians "judge the accuracy of computer predictions and establish benchmarks" across tumor samples. Maxime Tarabichi, one of the lead authors of [the study][6], said that the software "provides a foundation which will hopefully become a much-needed, unbiased, gold-standard benchmarking tool for assessing models that aim to characterise a tumour’s genetic diversity." + +### University of Regina saves students over $1 million with open textbooks + +If rising tuition costs weren't enough to send university student spiralling into debt, the high prices of textbooks can deepen the crater in their bank accounts. To help ease that financial pain, many universities turn to open textbooks. One of those schools is the University of Regina. By offering open text books, the university [expects to save a huge amount for students][7] over the next five years. + +The expected savings are in the region of $1.5 million (CAD), or around $1.1 million USD (at the time of writing). The textbooks, according to a report by radio station CKOM, are "provided free for (students) and they can be printed off or used as e-books." Students aren't getting inferior-quality textbooks, though. Nilgun Onder of the University of Regina said that the "textbooks and other open education resources the university published are all peer-reviewed resources. In other words, they are reliable and credible." + +### Tesla adopts Coreboot + +Much of the software driving (no pun intended) the electric vehicles made by Tesla Motors is open source. So it's not surprising to learn that the company has [adopted Coreboot][8] "as part of their electric vehicle computer systems." + +Coreboot was developed as a replacement for proprietary BIOS and is used to boot hardware and the Linux kernel. The code, which is in [Tesla's GitHub repository][9], "is from Tesla Motors and Samsung," according to Phoronix. Samsung, in case you're wondering, makes the chip on which Tesla's self-driving software runs. + +#### In other news + + * [Arduino launches new modular platform for IoT development][10] + * [SUSE and Karunya Institute of Technology and Sciences collaborate to enhance cloud and open source learning][11] + * [How open-source code could help us survive natural disasters][12] + * [The hottest thing in robotics is an open source project you've never heard of][13] + + + +_Thanks, as always, to Opensource.com staff members and moderators for their help this week. Make sure to check out [our event calendar][14], to see what's happening next week in open source._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/news-january-19 + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://venturebeat.com/2020/01/07/uber-open-sources-manifold-a-visual-tool-for-debugging-ai-models/ +[3]: https://github.com/uber/manifold +[4]: https://github.com/lyft/flyte +[5]: https://www.cbronline.com/industry/healthcare/open-source-cancer-cells/ +[6]: https://www.nature.com/articles/s41587-019-0364-z +[7]: https://www.ckom.com/2020/01/07/open-source-program-to-save-u-of-r-students-1-5m/ +[8]: https://www.phoronix.com/scan.php?page=news_item&px=Tesla-Uses-Coreboot +[9]: https://github.com/teslamotors/coreboot +[10]: https://techcrunch.com/2020/01/07/arduino-launches-a-new-modular-platform-for-iot-development/ +[11]: https://www.crn.in/news/suse-and-karunya-institute-of-technology-and-sciences-collaborate-to-enhance-cloud-and-open-source-learning/ +[12]: https://qz.com/1784867/open-source-data-could-help-save-lives-during-natural-disasters/ +[13]: https://www.techrepublic.com/article/the-hottest-thing-in-robotics-is-an-open-source-project-youve-never-heard-of/ +[14]: https://opensource.com/resources/conferences-and-events-monthly From 88fee6a70e2880ae72b19f57f360b5189bf7fda8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 20 Jan 2020 00:52:50 +0800 Subject: [PATCH 0319/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200119=20One?= =?UTF-8?q?=20open=20source=20chat=20tool=20to=20rule=20them=20all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200119 One open source chat tool to rule them all.md --- ... open source chat tool to rule them all.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20200119 One open source chat tool to rule them all.md diff --git a/sources/tech/20200119 One open source chat tool to rule them all.md b/sources/tech/20200119 One open source chat tool to rule them all.md new file mode 100644 index 0000000000..963b7246d0 --- /dev/null +++ b/sources/tech/20200119 One open source chat tool to rule them all.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (One open source chat tool to rule them all) +[#]: via: (https://opensource.com/article/20/1/open-source-chat-tool) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +One open source chat tool to rule them all +====== +BitlBee brings multiple chat applications into a single interface. Find +out how to set up and use BitlBee in the ninth in our series on 20 ways +to be more productive with open source in 2020. +![Person using a laptop][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Bring all your chats into one interface with BitlBee + +Instant messaging and chat have become a staple of the online world. And if you are like me, you probably have about five or six different apps running to talk to your friends, co-workers, and others. It really is a pain to keep up with it all. Thankfully, you can use one app (OK, two apps) to consolidate a lot of those chats into a single point. + +![BitlBee on XChat][2] + +[BitlBee][3] is an application that you run as a service that can bridge a standard IRC client with a whole bunch of messaging services. And since it is essentially an IRC server, you have a wealth of clients to choose from. + +BitlBee is included with almost all Linux distributions. Installing on Ubuntu (my Linux desktop of choice) goes something like this: + + +``` +`sudo apt install bitlbee-libpurple` +``` + +On  other distributions, the name of the package may be slightly different, but a search for _bitlbee_ should reveal your options. + +You'll notice I use the libpurple version of BitlBee. This version allows me to use all the protocols available in the [libpurple][4] instant messaging library, which was originally developed for [Pidgin][5]. + +Once the package is installed, the service should start automatically. Now, using an IRC client ([XChat][6] in these pictures), I can connect to the service on port 6667 (the standard IRC port). + +![Initial BitlBee connection][7] + +You will be automatically connected to the control channel **&bitlbee**. This channel is unique to you—every person gets their own on multi-user systems. This is where you can configure the services. + +The full documentation is available at any time by typing **help** in the control channel. Explore here, then register an account on the server with the **register** command. + + +``` +`register ` +``` + +Now, any configuration changes you make on the server—IM accounts, settings, etc.—will be saved when you type **save**. Whenever you connect, use **identify <mypassword>** to connect to your account and load all those settings. + +![purple settings][8] + +The command **help purple** will show you all the available protocols that libpurple provides. For example, I've installed the [**telegram-purple**][9] package, which adds the ability to connect to Telegram. I can add an account by using my phone number with the **account add** command. + + +``` +`account add telegram +15555555` +``` + +BitlBee will show that it has added the account. You can list your accounts with **account list**. Since I only have one account, I can log into it with **account 0 on**, and it will go through the Telegram login process, list all my friends and chats, and I am good to go. + +But what about Slack, one of the most common chat systems out there? Well, you can install the [**slack-libpurple**][10] plugin, and do the same for Slack. If you aren't comfortable compiling and installing things, this may not be for you. + +Follow the instructions on the plugin page, and after you have installed it, restart the BitlBee service. Now when you run **help purple**, Slack should be listed. Adding a Slack account happens the same as with all the other protocols. + + +``` +account add slack [ksonney@myslack.slack.com][11] +account 1 set password my_legcay_API_token +account 1 on +``` + +And what do you know? You're connected to Slack, and you can add the Slack channels you're interested in with the **chat add** command. For example: + + +``` +`chat add 1 happyparty` +``` + +adds the Slack channel happyparty as the local channel #happyparty. You can use the standard IRC **/join** command to access the channel now. Pretty cool. + +BitlBee and an IRC client help me keep (most of) my chats and instant messages in a single place and reduces my distractions because I no longer have to find and switch to whichever app just pinged me. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-chat-tool + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/sites/default/files/uploads/productivity_9-1.png (BitlBee on XChat) +[3]: https://www.bitlbee.org/ +[4]: https://developer.pidgin.im/wiki/WhatIsLibpurple +[5]: http://pidgin.im/ +[6]: http://xchat.org/ +[7]: https://opensource.com/sites/default/files/uploads/productivity_9-2.png (Initial BitlBee connection) +[8]: https://opensource.com/sites/default/files/uploads/productivity_9-3.png (purple settings) +[9]: https://github.com/majn/telegram-purple +[10]: https://github.com/dylex/slack-libpurple +[11]: mailto:ksonney@myslack.slack.com From 0646f033893b79df7806385a8d2e28a03b7495c7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 20 Jan 2020 00:53:17 +0800 Subject: [PATCH 0320/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200119=20What?= =?UTF-8?q?'s=20your=20favorite=20Linux=20terminal=20trick=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200119 What-s your favorite Linux terminal trick.md --- ...at-s your favorite Linux terminal trick.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20200119 What-s your favorite Linux terminal trick.md diff --git a/sources/tech/20200119 What-s your favorite Linux terminal trick.md b/sources/tech/20200119 What-s your favorite Linux terminal trick.md new file mode 100644 index 0000000000..d830c65072 --- /dev/null +++ b/sources/tech/20200119 What-s your favorite Linux terminal trick.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's your favorite Linux terminal trick?) +[#]: via: (https://opensource.com/article/20/1/linux-terminal-trick) +[#]: author: (Opensource.com https://opensource.com/users/admin) + +What's your favorite Linux terminal trick? +====== +Take our poll or tell us about your favorite terminal trick. Is it a +nifty productivity shortcut or a fun Easter egg? +![Terminal command prompt on orange background][1] + +The beginning of a new year is always a great time to evaluate new ways to become more efficient. Many people try out new productivity tools or figure out how to optimize their most mundane processes. One area to assess is the terminal. Especially in the world of open source, there are tons of ways to make life at the terminal more efficient (and fun!) with shortcuts and commands.  + +  + +We asked our writers about their favorite terminal trick. They shared their time-saving tips and even a fun terminal Easter egg. Will you adopt one of these keyboard shortcuts or command line hacks? Do you have a favorite you'd like to share? Tell us about it by taking our poll or leaving a comment.  + +  + +"I couldn't choose a favorite; I use all three of these daily:  + + * **Ctrl + L** to clear screen (instead of typing "clear"). + * **sudo !!** to run previous command with sudo privileges.  + * **grep -Ev '^#|^$' <file>** will display file content without comments or empty lines." + + + +—Mars Toktonaliev + +  + +"For me, if I'm in a terminal text editor and I want to make it go away so I can quickly do something else, I background it with **Ctrl + Z**, do whatever I need to do, and then bring it back with **fg**. I will also sometimes do the same thing with **top** or **htop.** I can background it, and bring it back anytime I want to check current performance. I don't see backgrounding and foregrounding done in the wild very often, and it can really enhance multitasking on the terminal." + +—Jay LaCroix + +  + +"Because I tend to do much of the same things at the terminal on a given day, two things are constants in my day: + + * **Ctrl + R** to reverse search my Bash history for a command that I have already run and wish to do so again + * Caret substitution is the best as I often do things like **sudo dnf** **search <package name>** then if I find a suitable package that way I then do **^search^install** to rerun the command replacing the search with install. + + + +Sure these things are basic but so time-saving for me." + +—Steve Morris + +  + +"My cool terminal trick isn't something I do in the terminal, but _which terminal_ I use. Sometimes I just want the feeling of using an Apple II, or an old amber-on-black terminal. That's when I fire up Cool Retro Term. Screenshots are on the [website][2]." + +—Jim Hall + +  + +"Probably **ssh -X** to run graphical programs on other machines. Copy/pasting (on some terminal emulators, like gnome-terminal) C-S c and C-S v. I'm not sure if this counts (as it goes graphical in the interesting part, but starts with **ssh**). Most recently I had a need to log in to another machine but have my kids be able to follow along on the bigger screen from my laptop. This [link][3] showed me something I'd never before seen: mirroring the active session from another computer screen on my laptop over the local network (x11vnc -desktop) and being able to control it from both machines at the same time." + +—Kyle R. Conway + +  + +"You can install **Install 'sl' $ sudo apt install sl** or **$ sudo dnf install sl**, and when the command **sl** is entered at the Bash prompt a text-based steam locomotive moves across the display." + +—Don Watkins + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/linux-terminal-trick + +作者:[Opensource.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/admin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) +[2]: https://github.com/Swordfish90/cool-retro-term +[3]: https://elinux.org/Screen_Casting_on_a_Raspberry_Pi From cc2a5ebb16adcdc39f0fa544ab57d30037c51f11 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 20 Jan 2020 11:10:33 +0800 Subject: [PATCH 0321/3057] translated --- ... your calendar with khal and vdirsyncer.md | 108 ------------------ ... your calendar with khal and vdirsyncer.md | 105 +++++++++++++++++ 2 files changed, 105 insertions(+), 108 deletions(-) delete mode 100644 sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md create mode 100644 translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md diff --git a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md deleted file mode 100644 index effad6fb4e..0000000000 --- a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md +++ /dev/null @@ -1,108 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Organize and sync your calendar with khal and vdirsyncer) -[#]: via: (https://opensource.com/article/20/1/open-source-calendar) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Organize and sync your calendar with khal and vdirsyncer -====== -Keeping and sharing a calendar can be a pain. Learn how to make it -easier in the fifth article in our series on 20 ways to be more -productive with open source in 2020. -![Calendar close up snapshot][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Keep track of your schedule with khal and vdirsyncer - -Calendars are a _pain_ to deal with, and finding good tooling is always hard. But I've made some progress since last year when I listed calendaring as [one of my "fails."][2] - -The most difficult thing about calendars today is that now they almost always need to be shared online in some way. The two most popular online calendars are Google Calendar and Microsoft Outlook/Exchange. Both are used heavily in corporate environments, which means my calendar has to support one or both options. - -![khal calendar][3] - -[Khal][4] is a console-based calendar that reads and writes VCalendar files. It's fairly easy to configure, but it does not support syncing with other applications. - -Fortunately, khal works with [vdirsyncer][5], a nifty command-line program that can synchronize online calendars (and contacts, which I'll talk about in a separate article) to your local drive. And yes, this includes uploading new events, too. - -![vdirsyncer][6] - -Vdirsyncer is a Python 3 program, and it can be installed via your package manager or pip. It can synchronize CalDAV, VCalendar/iCalendar, Google Calendar, and local files in a directory. Since I use Google Calendar, I'll use that as an example, although it is not the easiest thing to set up. - -Setting vdirsyncer up for Google is [well-documented][7], so I won't go into the nuts and bolts here. The important thing is to make sure your sync pairs are set up in a way that sets Google Calendar as the "winner" for conflict resolution. That is, if there are two updates to the same event, it needs to know which one takes precedence. Do so with something like this: - - -``` -[general] -status_path = "~/.calendars/status" - -[pair personal_sync] -a = "personal" -b = "personallocal" -collections = ["from a", "from b"] -conflict_resolution = "a wins" -metadata = ["color"] - -[storage personal] -type = "google_calendar" -token_file = "~/.vdirsyncer/google_calendar_token" -client_id = "google_client_id" -client_secret = "google_client_secret" - -[storage personallocal] -type = "filesystem" -path = "~/.calendars/Personal" -fileext = ".ics" -``` - -After the first sync of vdirsyncer, you will end up with a series of directories in the storage path. Each will contain several files, one for each entry in the calendar. The next step is to get them into khal. Start by running **khal configure** to do the initial setup. - -![Configuring khal][8] - -Now, running **khal interactive** will bring up the display shown at the beginning of this article. Typing **n** will bring up the New Event dialog. One small thing to note here: the calendars are named to match the directories that vdirsyncer creates, but you can change the khal config file to give them clearer names. Adding colors to entries based on which calendar they're on will also help you identify which is which on the list: - - -``` -[calendars] -[[personal]] -path = ~/.calendars/Personal/kevin@sonney.com/ -color = light magenta -[[holidays]] -path = ~/.calendars/Personal/cln2stbjc4hmgrrcd5i62ua0ctp6utbg5pr2sor1dhimsp31e8n6errfctm6abj3dtmg@virtual/ -color = light blue -[[birthdays]] -path = ~/.calendars/Personal/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual/ -color = brown -``` - -Now when you run **khal interactive**, each calendar will be colored to distinguish it from the others, and when you add a new entry, it will have a more descriptive name. - -![Adding a new calendar entry][9] - -The setup is a little tricky, but once it's done, khal with vdirsyncer gives you an easy way to manage calendar events and keep them in sync with your online services. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/open-source-calendar - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) -[2]: https://opensource.com/article/19/1/productivity-tool-wish-list -[3]: https://opensource.com/sites/default/files/uploads/productivity_5-1.png (khal calendar) -[4]: https://khal.readthedocs.io/en/v0.9.2/index.html -[5]: https://github.com/pimutils/vdirsyncer -[6]: https://opensource.com/sites/default/files/uploads/productivity_5-2.png (vdirsyncer) -[7]: https://vdirsyncer.pimutils.org/en/stable/config.html#google -[8]: https://opensource.com/sites/default/files/uploads/productivity_5-3.png (Configuring khal) -[9]: https://opensource.com/sites/default/files/uploads/productivity_5-4.png (Adding a new calendar entry) diff --git a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md new file mode 100644 index 0000000000..a84fc3c917 --- /dev/null +++ b/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organize and sync your calendar with khal and vdirsyncer) +[#]: via: (https://opensource.com/article/20/1/open-source-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 khal 和 vdirsyncer 组织和同步你的日历 +====== +保存和共享日历可能会有点麻烦。在我们的 20 个使用开源提升生产力的系列的第五篇文章中了解如何让它更简单。 +![Calendar close up snapshot][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 khal 和 vdirsyncer 跟踪你的日程 + +处理日历很_麻烦_,要找到好的工具总是很困难的。但是自从我去年将日历列为[我的“失败“之一][2]以来,我已经取得了一些进步。 + +目前使用日历最困难的是一直需要以某种方式在线共享。两种最受欢迎的在线日历是 Google Calendar 和 Microsoft Outlook/Exchange。两者都在公司环境中大量使用,这意味着我的日历必须支持其中之一或者两个。 + +![khal calendar][3] + +[Khal][4] 是基于控制台的日历,可以读取和写入 VCalendar 文件。它配置相当容易,但是不支持与其他应用同步。 + +幸运的是,khal 能与 [vdirsyncer][5] 一起使用,它是一个漂亮的命令行程序,可以将在线日历(和联系人,我将在另一篇文章中讨论)同步到本地磁盘。是的,它还可以上传新事件。 + +![vdirsyncer][6] + +Vdirsyncer 是个 Python 3 程序,可以通过软件包管理器或 pip 安装。它可以同步 CalDAV、VCalendar/iCalendar、Google Calendar 和目录中的本地文件。由于我使用 Google Calendar,尽管这不是最简单的设置,我也将以它为例。 + +在 vdirsyncer 中设置 Google Calendar 是[有文档参考的][7],所以这里我不再赘述。重要的是确保同步对设置将 Google Calendar 设置为冲突解决的”赢家“。也就是说,如果同一事件有两个更新,那么需要知道哪个更新优先。类似这样做: + + +``` +[general] +status_path = "~/.calendars/status" + +[pair personal_sync] +a = "personal" +b = "personallocal" +collections = ["from a", "from b"] +conflict_resolution = "a wins" +metadata = ["color"] + +[storage personal] +type = "google_calendar" +token_file = "~/.vdirsyncer/google_calendar_token" +client_id = "google_client_id" +client_secret = "google_client_secret" + +[storage personallocal] +type = "filesystem" +path = "~/.calendars/Personal" +fileext = ".ics" +``` + +在第一次 vdirsyncer 同步之后,你将在存储路径中看到一系列目录。每个文件夹都将包含多个文件,日历中的每个事件都是一个文件。下一步是导入 khal。首先运行 **khal configure** 进行初始设置。 + +![Configuring khal][8] + +现在,运行 **khal interactive** 将显示本文开头的界面。输入 **n** 将打开“新事件”对话框。这里要注意的一件事:日历的名称与 vdirsyncer 创建的目录匹配,但是你可以更改 khal 配置文件来指定更清晰的名称。根据条目所在的日历向条目添加颜色还可以帮助你确定日历内容: + + +``` +[calendars] +[[personal]] +path = ~/.calendars/Personal/kevin@sonney.com/ +color = light magenta +[[holidays]] +path = ~/.calendars/Personal/cln2stbjc4hmgrrcd5i62ua0ctp6utbg5pr2sor1dhimsp31e8n6errfctm6abj3dtmg@virtual/ +color = light blue +[[birthdays]] +path = ~/.calendars/Personal/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual/ +color = brown +``` + +现在,当你运行 **khal interactive** 时,每个日历将被着色以区别于其他日历,并且当你添加新条目时,它将有更具描述性的名称。 + +![Adding a new calendar entry][9] + +设置有些麻烦,但是完成后,khal 和 vdirsyncer 可以一起为你提供一种简便的方法来管理日历事件并使它们与你的在线服务保持同步。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-calendar + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://opensource.com/article/19/1/productivity-tool-wish-list +[3]: https://opensource.com/sites/default/files/uploads/productivity_5-1.png (khal calendar) +[4]: https://khal.readthedocs.io/en/v0.9.2/index.html +[5]: https://github.com/pimutils/vdirsyncer +[6]: https://opensource.com/sites/default/files/uploads/productivity_5-2.png (vdirsyncer) +[7]: https://vdirsyncer.pimutils.org/en/stable/config.html#google +[8]: https://opensource.com/sites/default/files/uploads/productivity_5-3.png (Configuring khal) From 56eae89c17262f6f04ec722f5a1bf65d4e03f6c7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 20 Jan 2020 11:13:53 +0800 Subject: [PATCH 0322/3057] translating --- ...eep a journal of your activities with this Python program.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200118 Keep a journal of your activities with this Python program.md b/sources/tech/20200118 Keep a journal of your activities with this Python program.md index b5d3cf93a4..bfa79a8893 100644 --- a/sources/tech/20200118 Keep a journal of your activities with this Python program.md +++ b/sources/tech/20200118 Keep a journal of your activities with this Python program.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 753deb532516cda8d4850990ae5aa527547f52b6 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 20 Jan 2020 20:55:31 +0800 Subject: [PATCH 0323/3057] translating --- ...117 Use this Python script to find bugs in your Overcloud.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md index ee167e6f78..5f19f114b4 100644 --- a/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md +++ b/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d07fdf73b2854b65aa8ccfb1d1440c506d9dd22b Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 20 Jan 2020 21:06:37 +0800 Subject: [PATCH 0324/3057] translating --- .../20191227 Top CI-CD resources to set you up for success.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191227 Top CI-CD resources to set you up for success.md b/sources/tech/20191227 Top CI-CD resources to set you up for success.md index 77d2391a5d..d3da7c4d09 100644 --- a/sources/tech/20191227 Top CI-CD resources to set you up for success.md +++ b/sources/tech/20191227 Top CI-CD resources to set you up for success.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d3515333456a10c646bacf17e589238f318871ed Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 20 Jan 2020 21:18:39 +0800 Subject: [PATCH 0325/3057] translating --- ...nto Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md index 68ede9acfa..a4d3cf9510 100644 --- a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md +++ b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 83bbc1f6c15055c19201079e2815ddf305a7b9f6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 20 Jan 2020 21:29:12 +0800 Subject: [PATCH 0326/3057] Rename sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md to sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md --- ...oreboot, Uber and Lyft release open source machine learning.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md (100%) diff --git a/sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md b/sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md similarity index 100% rename from sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md rename to sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md From 4ed6ab3f94245e674639c886748661d821f9cef1 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 20 Jan 2020 21:52:17 +0800 Subject: [PATCH 0327/3057] translating --- ...nto Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md index 68ede9acfa..a2bca0089f 100644 --- a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md +++ b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5845e14467093912b9f002183b4ad6198ce899fe Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 20 Jan 2020 21:56:18 +0800 Subject: [PATCH 0328/3057] translating --- .../20191227 Top CI-CD resources to set you up for success.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191227 Top CI-CD resources to set you up for success.md b/sources/tech/20191227 Top CI-CD resources to set you up for success.md index 77d2391a5d..d3da7c4d09 100644 --- a/sources/tech/20191227 Top CI-CD resources to set you up for success.md +++ b/sources/tech/20191227 Top CI-CD resources to set you up for success.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From da2a26b7ada53ddc46d4ac0aed1245559b0104df Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 20 Jan 2020 22:38:07 +0800 Subject: [PATCH 0329/3057] PRF @Morisun029 --- ...4 ways to volunteer this holiday season.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/translated/tech/20191220 4 ways to volunteer this holiday season.md b/translated/tech/20191220 4 ways to volunteer this holiday season.md index 47ba22d002..7da97feaf3 100644 --- a/translated/tech/20191220 4 ways to volunteer this holiday season.md +++ b/translated/tech/20191220 4 ways to volunteer this holiday season.md @@ -1,54 +1,52 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 ways to volunteer this holiday season) [#]: via: (https://opensource.com/article/19/12/ways-volunteer) [#]: author: (John Jones https://opensource.com/users/johnjones4) -假期志愿服务的4种方式 +假期志愿服务的 4 种方式 ====== -想要洒播些节日的快乐吗?为开源组织做贡献,帮助有需要的社区。 -![Gift box opens with colors coming out][1] +> 想要洒播些节日的快乐吗?为开源组织做贡献,帮助有需要的社区。 + +![](https://img.linux.net.cn/data/attachment/album/202001/20/223730f7983z8atxp1tf4l.jpg) 当领导者们配置人员和资源以做出积极改变时,就会产生社会影响。但是,许多社会努力都缺乏能够为这些改变者提供服务的技术资源。然而,有些组织通过将想要做出改变的开发人员与迫切需要更好技术的社区和非营利组织联系起来,来促进技术进步。这些组织通常为特定的受众提供服务,并招募特定种类的技术人员,它们有一个共同点:开源。 作为开发人员,我们出于各种原因试图加入开源社区。有些是为了专业发展,有些是为了能够与广阔的网络上令人印象深刻的技术人员合作,还有其他人则是因为他们清楚自己的贡献对于项目的成功的必要性。为什么不将你作为开发人员的才华投入到需要它的地方,而同时又为开源组织做贡献呢?以下组织是实现此目标的一些主要事例。 - - ### Code for America -Code for America 是在数字时代,政府如何依靠人民为人民服务的一个例子。通过其Brigade Network,该组织在美国各个城市中组织了一个由志愿程序员,数据科学家,相关公民和设计师组成的全国联盟。这些本地分支机构定期举行聚会,向社区开放。这样既可以向小组推出新项目,又可以协调正在进行的工作。为了使志愿者与项目相匹配,各网站经常列出项目所需的特定技能,例如数据分析,内容创建和JavaScript。同时,Brigade网站也会关注当地问题,分享自然灾害等共同经验,这些都可以促进成员之间的合作。例如,新奥尔良,休斯敦和坦帕湾团队合作开发了一个飓风响应网站,当灾难发生时,该网站可以快速响应不同的城市灾难情况。 +“Code for America” 是在数字时代,政府如何依靠人民为人民服务的一个例子。通过其 Brigade Network,该组织在美国各个城市中组织了一个由志愿程序员、数据科学家、相关公民和设计师组成的全国联盟。这些本地分支机构定期举行聚会,向社区开放。这样既可以向小组推出新项目,又可以协调正在进行的工作。为了使志愿者与项目相匹配,该网站经常列出项目所需的特定技能,例如数据分析、内容创建和JavaScript。同时,Brigade 网站也会关注当地问题,分享自然灾害等共同经验,这些都可以促进成员之间的合作。例如,新奥尔良、休斯敦和坦帕湾团队合作开发了一个飓风响应网站,当灾难发生时,该网站可以快速响应不同的城市灾难情况。 -想要加入该组织,请访问 [网站][2] 获取70 多个 Brigade 的清单,以及个人加入组织的指南。 +想要加入该组织,请访问 [该网站][2] 获取 70 多个 Brigade 的清单,以及个人加入组织的指南。 ### Code for Change -Code for Change 显示了即使在高中时期,也可以为社会做贡献。印第安纳波利斯的一群高中编码员成立了自己的俱乐部,他们通过创建针对社区问题的开源软件解决方案来回馈当地组织。 Code for Change 鼓励当地组织提出项目构想,学生团体加入并开发完全免费和开源的解决方案。该小组已经开发了诸如“蓝宝石”之类的项目,该项目优化了当地难民组织的志愿者管理系统,并建立了民权委员会的投诉表格,方便公民就他们所关心的问题在网上发表意见。 +“Code for Change” 显示了即使在高中时期,也可以为社会做贡献。印第安纳波利斯的一群高中开发爱好者成立了自己的俱乐部,他们通过创建针对社区问题的开源软件解决方案来回馈当地组织。“Code for Change” 鼓励当地组织提出项目构想,学生团体加入并开发完全自由和开源的解决方案。该小组已经开发了诸如“蓝宝石”之类的项目,该项目优化了当地难民组织的志愿者管理系统,并建立了民权委员会的投诉表格,方便公民就他们所关心的问题在网上发表意见。 -有关如何在你自己的社区中创建 Code for Change,[访问他们的网站][3]. +有关如何在你自己的社区中创建 “Code for Change”,[访问他们的网站][3]。 ### Python for Good/Ruby for Good -Python for Good and Ruby for Good 是在俄勒冈州波特兰市和弗吉尼亚州费尔法克斯市举办的双年展活动,该活动将人们聚集在一起,为各自的社区开发和制定解决方案。 +“Python for Good” 和 “Ruby for Good” 是在俄勒冈州波特兰市和弗吉尼亚州费尔法克斯市举办的双年展活动,该活动将人们聚集在一起,为各自的社区开发和制定解决方案。 -在周末,人们聚在一起聆听当地非营利组织的建议,并通过构建开源解决方案来解决他们的问题。 2017年,Ruby For Good参与者创建了“ Justice for Juniors”,该计划指导当前和以前被监禁的年轻人,并将他们重新融入社区。参与者还创建了“ Diaperbase”,这是一种库存管理系统,已被美国各地的尿布银行使用。这些活动的主要目标之一是将看似不同的行业和思维方式的组织和个人聚集在一起,以谋求共同利益。公司可以赞助活动,非营利组织可以提交项目构想,各种技能的人都可以注册参加活动并做出贡献。通过两岸(美国大西洋和太平洋东西海岸)的努力,Ruby for Good 和Python for Good 一直恪守“使世界变得更好”的座右铭。 +在周末,人们聚在一起聆听当地非营利组织的建议,并通过构建开源解决方案来解决他们的问题。 2017 年,“Ruby For Good” 参与者创建了 “Justice for Juniors”,该计划指导当前和以前被监禁的年轻人,并将他们重新融入社区。参与者还创建了 “Diaperbase”,这是一种库存管理系统,为美国各地的尿布库diaper bank所使用。这些活动的主要目标之一是将看似不同的行业和思维方式的组织和个人聚集在一起,以谋求共同利益。公司可以赞助活动,非营利组织可以提交项目构想,各种技能的人都可以注册参加活动并做出贡献。通过两岸(美国大西洋和太平洋东西海岸)的努力,“Ruby for Good” 和 “Python for Good” 一直恪守“使世界变得更好”的座右铭。 -[Ruby for Good][4] 在夏天举行,举办地点在弗吉尼亚州费尔法克斯的乔治•梅森(George Mason)大学。 +“[Ruby for Good][4]” 在夏天举行,举办地点在弗吉尼亚州费尔法克斯的乔治•梅森大学。 ### Social Coder -英国的Ed Guiness创建了Social Coder,将志愿者和慈善机构召集在一起,为六大洲的非营利组织创建和使用开源项目。 Social Coder积极招募来自世界各地的熟练IT志愿者,并将其与通过Social Coder注册的慈善机构和非营利组织进行匹配。项目范围从简单的网站更新到整个移动应用程序的开发。 +英国的 Ed Guiness 创建了 “Social Coder”,将志愿者和慈善机构召集在一起,为六大洲的非营利组织创建和使用开源项目。“Social Coder” 积极招募来自世界各地的熟练 IT 志愿者,并将其与通过 Social Coder 注册的慈善机构和非营利组织进行匹配。项目范围从简单的网站更新到整个移动应用程序的开发。 -例如,PHASE Worldwide 是一个在尼泊尔支持工作的小型非政府组织,因为Social Coder,它获得了利用开源技术的关键支持和专业知识。 +例如,PHASE Worldwide 是一个在尼泊尔支持工作的小型非政府组织,因为 “Social Coder”,它获得了利用开源技术的关键支持和专业知识。 -有许多慈善机构已经与英国的Social Coder进行了合作,也欢迎其它国家的组织加入。通过他们的网站,个人可以注册为社会软件项目工作,找到寻求帮助的组织和慈善机构。 +有许多慈善机构已经与英国的 “Social Coder”进行了合作,也欢迎其它国家的组织加入。通过他们的网站,个人可以注册为社会软件项目工作,找到寻求帮助的组织和慈善机构。 - -对 Social Coder 的志愿服务感兴趣的个人可以 [在此][5]注册. +对 “Social Coder” 的志愿服务感兴趣的个人可以 [在此][5]注册. -------------------------------------------------------------------------------- @@ -57,8 +55,8 @@ via: https://opensource.com/article/19/12/ways-volunteer 作者:[John Jones][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6e35d595b911954bc6b28d164dee3e9832a37551 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 20 Jan 2020 22:39:44 +0800 Subject: [PATCH 0330/3057] PUB @Morisun029 https://linux.cn/article-11803-1.html --- .../20191220 4 ways to volunteer this holiday season.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191220 4 ways to volunteer this holiday season.md (98%) diff --git a/translated/tech/20191220 4 ways to volunteer this holiday season.md b/published/20191220 4 ways to volunteer this holiday season.md similarity index 98% rename from translated/tech/20191220 4 ways to volunteer this holiday season.md rename to published/20191220 4 ways to volunteer this holiday season.md index 7da97feaf3..ca2c8fb8e0 100644 --- a/translated/tech/20191220 4 ways to volunteer this holiday season.md +++ b/published/20191220 4 ways to volunteer this holiday season.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11803-1.html) [#]: subject: (4 ways to volunteer this holiday season) [#]: via: (https://opensource.com/article/19/12/ways-volunteer) [#]: author: (John Jones https://opensource.com/users/johnjones4) From fbc71c83a8e9c15a9b84a42c269bdadc43fb1181 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 20 Jan 2020 23:53:43 +0800 Subject: [PATCH 0331/3057] PRF @geekpi --- ...eep your email in sync with OfflineIMAP.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md b/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md index c5b20565ad..bca35ab20d 100644 --- a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md +++ b/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Keep your email in sync with OfflineIMAP) @@ -9,21 +9,22 @@ 使用 OfflineIMAP 同步邮件 ====== -将邮件镜像保存到本地是整理消息的第一步。在我们的 20 个使用开源提升生产力的系列的第三篇文章中了解该如何做。 -![email or newsletters via inbox and browser][1] + +> 将邮件镜像保存到本地是整理消息的第一步。在我们的 20 个使用开源提升生产力的系列的第三篇文章中了解该如何做。 + +![](https://img.linux.net.cn/data/attachment/album/202001/20/235324nbgfyuwl98syowta.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 OfflineIMAP 在本地同步你的邮件 -我与邮件之间存在爱恨交织的关系。我喜欢它让我与世界各地的人交流的方式。但是,像你们中的许多人一样,我收到过很多邮件,许多是来自列表中的人,但也有很多垃圾邮件、广告等。这些积累了很多。 +我与邮件之间存在爱恨交织的关系。我喜欢它让我与世界各地的人交流的方式。但是,像你们中的许多人一样,我收到过很多邮件,许多是来自邮件列表的,但也有很多垃圾邮件、广告等。这些积累了很多。 ![The OfflineIMAP "blinkenlights" UI][2] -我尝试过的大多数工具(除了大型提供商外)都可以很好地处理大量邮件,它们都有一个共同点:它们都依赖于以 [Maildir][3] 格式存储的本地邮件副本。这其中最有用的是 [OfflineIMAP][4]。OfflineIMAP 是将 IMAP 邮箱镜像到本地 Maildir 文件夹树的 Python 脚本。我用它来创建邮件的本地副本并使其保持同步。大多数 Linux 发行版都包含它,并且可以通过 Python 的 pip 包管理器获得。 - -示例的最小配置文件是一个很好的模板。首先将其复制到 **~/.offlineimaprc**。我的看起来像这样: +我尝试过的大多数工具(除了大型邮件服务商外)都可以很好地处理大量邮件,它们都有一个共同点:它们都依赖于以 [Maildir][3] 格式存储的本地邮件副本。这其中最有用的是 [OfflineIMAP][4]。OfflineIMAP 是将 IMAP 邮箱镜像到本地 Maildir 文件夹树的 Python 脚本。我用它来创建邮件的本地副本并使其保持同步。大多数 Linux 发行版都包含它,并且可以通过 Python 的 pip 包管理器获得。 +示例的最小配置文件是一个很好的模板。首先将其复制到 `~/.offlineimaprc`。我的看起来像这样: ``` [general] @@ -54,9 +55,9 @@ createfolder = true 我的配置要做的是定义两个仓库:远程 IMAP 服务器和本地 Maildir 文件夹。还有一个**帐户**,告诉 OfflineIMAP 运行时要同步什么。你可以定义链接到不同仓库的多个帐户。除了本地复制外,这还允许你从一台 IMAP 服务器复制到另一台作为备份。 -如果你有很多邮件,那么首次运行 OfflineIMAP 将花费一些时间。但是完成后,下次会花_少得多_的时间。你也可以将 CoffeeIMAP 作为 cron 任务(我的偏好)或作为守护程序在仓库之间不断进行同步。文档涵盖了所有这些内容以及 Gmail 等高级配置选项。 +如果你有很多邮件,那么首次运行 OfflineIMAP 将花费一些时间。但是完成后,下次会花*少得多*的时间。你也可以将 OfflineIMAP 作为 cron 任务(我的偏好)或作为守护程序在仓库之间不断进行同步。其文档涵盖了所有这些内容以及 Gmail 等高级配置选项。 -现在,我的邮件已在本地复制,并有多种工具用来加快搜索、归档和管理邮件的速度。我明天再说。 +现在,我的邮件已在本地复制,并有多种工具用来加快搜索、归档和管理邮件的速度。这些我明天再说。 -------------------------------------------------------------------------------- @@ -65,7 +66,7 @@ via: https://opensource.com/article/20/1/sync-email-offlineimap 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ddacd9f1c25e19e14a96c66f3ffc083d136aebc1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 20 Jan 2020 23:54:54 +0800 Subject: [PATCH 0332/3057] PUB @geekpi https://linux.cn/article-11804-1.html --- .../20200113 Keep your email in sync with OfflineIMAP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200113 Keep your email in sync with OfflineIMAP.md (98%) diff --git a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md b/published/20200113 Keep your email in sync with OfflineIMAP.md similarity index 98% rename from translated/tech/20200113 Keep your email in sync with OfflineIMAP.md rename to published/20200113 Keep your email in sync with OfflineIMAP.md index bca35ab20d..64ecd19ab6 100644 --- a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md +++ b/published/20200113 Keep your email in sync with OfflineIMAP.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11804-1.html) [#]: subject: (Keep your email in sync with OfflineIMAP) [#]: via: (https://opensource.com/article/20/1/sync-email-offlineimap) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From b5f17f7093b413d62e7c4919d076d70c5e2e0c54 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:53:02 +0800 Subject: [PATCH 0333/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Ansi?= =?UTF-8?q?ble=20Automation=20Tool=20Installation,=20Configuration=20and?= =?UTF-8?q?=20Quick=20Start=20Guide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md --- ...on, Configuration and Quick Start Guide.md | 360 ++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md diff --git a/sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md b/sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md new file mode 100644 index 0000000000..76cf181ff2 --- /dev/null +++ b/sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md @@ -0,0 +1,360 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ansible Automation Tool Installation, Configuration and Quick Start Guide) +[#]: via: (https://www.2daygeek.com/install-configure-ansible-automation-tool-linux-quick-start-guide/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Ansible Automation Tool Installation, Configuration and Quick Start Guide +====== + +There are many automation tools on the market. + +I can name a few of them, and they are widely used by many organizations, such as Puppet, Chef, CFEngine, Foreman, Katello, Saltstock, Space Walk. + +### What Automation Tool Does? + +Automation tools make the life of a Linux administrator much easier by automating routine tasks without human intervention. + +These tools allow users to perform configuration management, application deployment and provisioning. + +### Why do you like Ansible? + +Ansible is an agent-less automation tool that uses SSH to perform all tasks, but others require agents on client nodes. + +### What is Ansible? + +Ansible is an open source, easy-to-use, powerful IT automation tool that performs tasks on client nodes over SSH. + +It is built in Python and is one of the most popular and robust programming languages in the world today’s. + +The Python package is required on both ends to perform all the modules. + +It can configure systems, deploy software, and schedule advanced IT tasks such as continuous deployment or zero downtime rolling updates. + +You can easily perform any kind of automation tasks with simple and complex tasks through Ansible. + +Before you get started, you need to understand some of the Ansible terminology that helps you to make a task easier. + +### How Ansible Works? + +Ansible works by pushing small programs known as ansible modules on the client nodes, and these modules are temporarily stored in the client nodes, which are used to communicate with the Ansible server via a JSON protocol. + +Ansible runs these modules via SSH and remove them when finished. + +Modules are nothing but scripts written in Python, Perl, etc,. + +![][1] + +The control node, which controls the entire functionality of the playbook, including client nodes (hosts). + + * **Control node:** The host you use Ansible to execute tasks on managed nodes. You can have multiple control nodes, but you cannot use a Windows machine as a control node. + * **Managed nodes:** List of hosts configured by the control node + * **Inventory:** A list of hosts managed by the control nodes, these nodes are configured in the **“/etc/ansible/hosts”** file. It contains information about each node, such as an IP address or its hostname, and these nodes can be grouped as needed. + * **Modules:** Each module is used to perform a specific task, which currently supports 3387 modules. + * **ad-hoc:** It allows you to run one task at a time (it uses the **/usr/bin/ansible** binary). + * **Tasks:** There is a list of tasks in each play. Tasks are executed in order, one at a time in the managed nodes. + * **Playbooks:** You can perform multiple tasks simultaneously using playbooks, whereas you can only perform one task using an ad-hoc command. Playbooks are written in YAML and are easy to read (which uses the **/usr/bin/ansible-playbook** binary). In the future we will create an article about playbooks that you can use to perform complex tasks. + + + +### Testing Environment: + +This environment contains one control node (**server.2g.lab**) and three managed nodes (**node1.2g.lab, node2.2g.lab, node3.2g.lab**), all running in the virtual environment with the following operating systems. + +``` ++----------------------+---------------+-------------+---------------+ +| System Purpose | Hostname | IP Address | OS | ++----------------------+---------------+-------------+---------------+ +|Ansible Control Node | server.2g.lab | 192.168.1.7 | Manjaro 18 | +|Managed Node1 | node1.2g.lab | 192.168.1.6 | CentOS7 | +|Managed Node2 | node2.2g.lab | 192.168.1.5 | CentOS8 | +|Managed Node3 | node3.2g.lab | 192.168.1.9 | Ubuntu 18.04 | +|User: daygeek | ++--------------------------------------------------------------------+ +``` + +### Prerequisites: + + * Enable password-less authentication between Ansible control node and managed nodes. + * The control node must be Python 2 (version 2.7) or Python 3 (versions 3.5 and higher). + * The managed node must be Python 2 (version 2.6 or later) or Python 3 (version 3.5 or later). + * If you have SELinux enabled on remote nodes, you will also want to install **libselinux-python** on them before using any copy/file/template related functions in Ansible. + + + +### How to Install the Ansible on Control Node + +The Ansible package is available in the distribution official repository, so you can easily install it. + +For **“Fedora/RHEL 8/CentOS 8”** system, use the **[DNF Command][2]** to install ansible. + +Make a note: You need to enable the **[EPEL repository][3]** on RHEL/CentOS systems because the Ansible package is not available in the distribution official repository. + +``` +$ sudo dnf install ansible +``` + +For **“Debian/Ubuntu”** systems, use **[APT-GET Command][4]** or **[APT Command][5]** to install ansible. + +Configure the blow PPA to install the latest stable version of ansible on Ubuntu. + +``` +$ sudo apt update +$ sudo apt install software-properties-common +$ sudo apt-add-repository --yes --update ppa:ansible/ansible +$ sudo apt install ansible +``` + +For Debian system, configure the blow source list: + +``` +$ echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/ansible.list +$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 +$ sudo apt update +$ sudo apt install ansible +``` + +For **“Arch Linux”** based systems, use **[Pacman Command][6]** to install ansible. + +``` +$ sudo pacman -S ansible +``` + +For **“RHEL/CentOS”** systems, use **[YUM Command][7]** to install ansible. + +``` +$ sudo yum install ansible +``` + +For **“openSUSE”** system, use **[Zypper Command][8]** to install ansible. + +``` +$ sudo zypper install ansible +``` + +Alternatively, you can install it using the **[PIP Python package manager][9]** + +``` +$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py +$ sudo python get-pip.py +$ sudo pip install ansible +``` + +Check the version of Ansible installed on the control node as follows: + +``` +$ ansible --version + +ansible 2.9.2 + config file = /etc/ansible/ansible.cfg + configured module search path = ['/home/daygeek/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] + ansible python module location = /usr/lib/python3.8/site-packages/ansible + executable location = /usr/bin/ansible + python version = 3.8.1 (default, Jan 8 2020, 23:09:20) [GCC 9.2.0] +``` + +### How to Install Python Package on Managed Nodes + +Use the following command to install the python package on managed nodes. + +``` +$ sudo yum install -y python +$ sudo dnf install -y python +$ sudo zypper install -y python +$ sudo pacman -S python +$ sudo apt install -y python +``` + +### How to Setup SSH key authentication (Password-less Authentication) on Linux + +Use the following command to create an ssh key, and then copy them to remote machines. + +``` +$ ssh-keygen +$ ssh-copy-id [email protected] +$ ssh-copy-id [email protected] +$ ssh-copy-id [email protected] +``` + +Refer the following article to **[setup SSH key authentication (Password-less Authentication) on Linux][10]** + +### How to Create Ansible Inventory + +Add the list of nodes you want to manage in the **“/etc/ansible/hosts”** file. If you do not find an existing one you can create a new file. This is a sample inventory file for my test environment. + +``` +$ sudo vi /etc/ansible/hosts + +[web] +node1.2g.lab +node2.2g.lab + +[app] +node3.2g.lab +``` + +Let’s see if we can find all hosts using the following command. + +``` +$ ansible all --list-hosts + + hosts (3): + node1.2g.lab + node2.2g.lab + node3.2g.lab +``` + +Run the below command for individual groups. + +``` +$ ansible web --list-hosts + + hosts (2): + node1.2g.lab + node2.2g.lab +``` + +### How to Perform a Task Using the ad-hoc Command + +Once the host inventory validation check is done, you are ready to drive a car. Here you go..! + +**Syntax:** + +``` +ansible [pattern] -m [module] -a "[module options]" + +Details: +======== +ansible: A command +pattern: Enter the entire inventory or a specific group +-m [module]: Run the given module name +-a [module options]: Specify the module arguments +``` + +Use the Ping module to ping all nodes in your inventory: + +``` +$ ansible all -m ping + +node3.2g.lab | SUCCESS => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/bin/python" + }, + "changed": false, + "ping": "pong" +} +node1.2g.lab | SUCCESS => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/bin/python" + }, + "changed": false, + "ping": "pong" +} +node2.2g.lab | SUCCESS => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/libexec/platform-python" + }, + "changed": false, + "ping": "pong" +} +``` + +All systems have given a successful result, nothing has changed, and return `pong’ on success. + +You can get a list of available modules using the following command. + +``` +$ ansible-doc -l +``` + +Currently supports 3387 built-in modules, which will grow with each Ansible release: + +``` +$ ansible-doc -l | wc -l +3387 +``` + +Use the command module to execute commands against all nodes in your inventory: + +``` +$ ansible all -m command -a "uptime" + +node3.2g.lab | CHANGED | rc=0 >> + 18:05:07 up 1:21, 3 users, load average: 0.12, 0.06, 0.01 +node1.2g.lab | CHANGED | rc=0 >> + 06:35:06 up 1:21, 4 users, load average: 0.01, 0.03, 0.05 +node2.2g.lab | CHANGED | rc=0 >> + 18:05:07 up 1:25, 3 users, load average: 0.01, 0.01, 0.00 +``` + +Execute the command module for a specific group. + +To check the memory usage for the **“app”** group. + +``` +$ ansible app -m command -a "free -m" + +node3.2g.lab | CHANGED | rc=0 >> + total used free shared buff/cache available +Mem: 1993 1065 91 6 836 748 +Swap: 1425 0 1424 +``` + +To run the hostnamectl command against the **“web”** group, use the following format. + +``` +$ ansible web -m command -a "hostnamectl" + +node1.2g.lab | CHANGED | rc=0 >> + Static hostname: CentOS7.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 002f47b82af248f5be1d67b67e03514c + Boot ID: dc38f9b8089d4b2d9304e526e00c6a8f + Virtualization: kvm + Operating System: CentOS Linux 7 (Core) + CPE OS Name: cpe:/o:centos:centos:7 + Kernel: Linux 3.10.0-957.el7.x86_64 + Architecture: x86-64 +node2.2g.lab | CHANGED | rc=0 >> + Static hostname: node2.2g.lab + Icon name: computer-vm + Chassis: vm + Machine ID: e39e3a27005d44d8bcbfcab201480b45 + Boot ID: 27b46a09dde546da95ace03420fe12cb + Virtualization: oracle + Operating System: CentOS Linux 8 (Core) + CPE OS Name: cpe:/o:centos:centos:8 + Kernel: Linux 4.18.0-80.el8.x86_64 + Architecture: x86-64 +``` + +**Reference:** [Ansible Docs][11] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/install-configure-ansible-automation-tool-linux-quick-start-guide/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[3]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-oracle-linux/ +[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[6]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[7]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[8]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[9]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[10]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ +[11]: https://docs.ansible.com/ansible/latest/user_guide/index.html From dca9fef3e2cdc24a6c88bc731c9f3dc22bded075 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:53:39 +0800 Subject: [PATCH 0334/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200120=20Lear?= =?UTF-8?q?ning=20about=20Partitions=20and=20How=20to=20Create=20Them=20fo?= =?UTF-8?q?r=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md --- ...tions and How to Create Them for Fedora.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md diff --git a/sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md b/sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md new file mode 100644 index 0000000000..93fa25b3ef --- /dev/null +++ b/sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learning about Partitions and How to Create Them for Fedora) +[#]: via: (https://fedoramagazine.org/learning-about-partitions-and-how-to-create-them-for-fedora/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +Learning about Partitions and How to Create Them for Fedora +====== + +![][1] + +Operating system distributions try to craft a one size fits all partition layout for their file systems. Distributions cannot know the details about how your hardware is configured or how you use your system though. Do you have more than one storage drive? If so, you might be able to get a performance benefit by putting the write-heavy partitions (_var_ and _swap_ for example) on a separate drive from the others that tend to be more read-intensive since most drives cannot read and write at the same time. Or maybe you are running a database and have a small solid-state drive that would improve the database’s performance if its files are stored on the SSD. + +The following sections attempt to describe in brief some of the historical reasons for separating some parts of the file system out into separate partitions so that you can make a more informed decision when you install your Linux operating system. + +If you know more (or contradictory) historical details about the partitioning decisions that shaped the Linux operating systems used today, contribute what you know below in the comments section! + +### Common partitions and why or why not to create them + +#### The boot partition + +One of the reasons for putting the ***/*_boot_ directory on a separate partition was to ensure that the boot loader and kernel were located within [the first 1024 cylinders of the disk][2]. Most modern computers do not have the 1024 cylinder restriction. So for most people, this concern is no longer relevant. However, modern UEFI-based computers have [a different restriction][3] that makes it necessary to have a separate partition for the boot loader. UEFI-based computers require that the boot loader ([which can be the Linux kernel directly][4]) be on a FAT-formatted file system. The Linux operating system, however, requires a POSIX-compliant file system that can designate access permissions to individual files. Since [FAT file systems do not support access permissions][5], the boot loader must be on a separate file system than the rest of the operating system on modern UEFI-based computers. A single partition cannot be [formatted][6] with more than one type of file system. + +#### The var partition + +One of the historical reasons for [putting the /var directory on a separate partition][7] was to prevent files that were frequently written to (_/var/log/*_ for example) from filling up the entire drive. Since modern drives tend to be much larger and since other means like [log rotation][8] and [disk quotas][9] are available to manage storage utilization, putting _/var_ on a separate partition may not be necessary. It is much easier to change a disk quota than it is to re-partition a drive. + +Another reason for isolating _/var_ was that file system corruption was much more common in the original version of the Linux [Extended File System (EXT)][10]. The file systems that had more write activity were much more likely to be irreversibly corrupted by a power outage than those that did not. By partitioning the disk into separate file systems, one could limit the scope of the damage in the event of file system corruption. This concern is no longer as significant because modern file systems support [journaling][11]. + +#### The home partition + +Having ***/*_home_ on a separate partition makes it possible to re-format the other partitions without overwriting your home directories. However, because modern Linux distributions are much better at doing in-place operating system upgrades, re-formatting shouldn’t be needed as frequently as it might have been in the past. + +It can still be useful to have _/home_ on a separate partition if you have a dual-boot setup and want both operating systems to share the same home directories. Or if your operating system is installed on a file system that supports snapshots and rollbacks and you want to be able to rollback your operating system to an older snapshot without reverting the content in your user profiles. Even then, some file systems allow their descendant file systems to be rolled back independently, so it still may not be necessary to have a separate partition for _/home_. On ZFS, for example, one pool/partition can have multiple descendant file systems. + +#### The swap partition + +The _swap_ partition reserves space for the contents of RAM to be written to permanent storage. There are pros and cons to having a swap partition. A pro of having swap memory is that it theoretically gives you time to gracefully shutdown unneeded applications before [the OOM killer][12] takes matters into its own hands. This might be important if the system is running mission-critical software that you don’t want abruptly terminated. A con might be that your system runs so slow when it starts swapping memory to disk that you’d rather the OOM killer take care of the problem for you. + +Another use for swap memory is [hibernation mode][13]. This might be where the rule that the swap partition should be twice the size of your computer’s RAM originated. Ideally, you should be able to put a system into hibernation even if nearly all of its RAM is in use. Beware that Linux’s support for hibernation is not perfect. It is not uncommon that after a Linux system is resumed from hibernation some hardware devices are left in an inoperable state (for example, no video from the video card or no internet from the WiFi card). + +In any case, having a swap partition is more a matter of taste. It is not required. + +#### The root partition + +The _root_ partition (/) is the catch-all for all directories that have not been assigned to a separate partition. There is always at least one root partition. BIOS-based systems that are new enough to not have the 1024 cylinder limit can be configured with only a root partition and no others so that there is never a need to resize a partition or file system if space requirements change. + +#### The EFI system partition + +The [EFI System Partition (ESP)][14] serves the same purpose on UEFI-based computers as the _boot_ partition did on the older BIOS-based computers. It contains the boot loader and kernel. Because the files on the ESP need to be accessible by the computer’s firmware, the ESP has a few restrictions that the older boot partition did not have. The restrictions are: + + 1. The ESP must be formatted with a FAT file system (_vfat_ in Anaconda) + 2. The ESP must have a special [type-code][15] (_EF00_ when using [gdisk][16]) + + + +Because the older boot partition did not have file system or type-code restrictions, it is permissible to apply the above properties to the _boot_ partition and use it as your ESP. Note, however, that the GRUB boot loader does not support combining the boot and ESP partitions. If you use GRUB, you will have to create a separate partition and mount it beneath the _/boot_ directory. + +The [Boot Loader Specification (BLS)][17] lists several reasons why it is ideal to use the legacy boot partition as your ESP. The reasons include: + + 1. The UEFI firmware should be able to load the kernel directly. Having a separate, non-ESP compliant boot partition for the kernel prevents the UEFI firmware from being able to directly load the kernel. + 2. Nesting the ESP mount point three mount levels deep increases the likelihood that an intermediate mount could fail or otherwise be unavailable when needed. That is, requiring _root_ (/), then _boot_ (/boot), then _efi_ (/efi) to be consecutively mounted is unnecessarily complex and prone to error. + 3. Requiring the boot loader to be able to read other partitions/disks which may be formatted with arbitrary file systems is non-trivial. Even when the boot loader does contain such code, the code that works at installation time can become outdated and fail to access the kernel/initrd after a file system update. This is currently true of GRUB’s _ZFS_ file system driver, for example. You must be careful not to update your _ZFS_ file system if you use the GRUB boot loader or else your system may not come back up the next time you reboot. + + + +Besides the concerns listed above, it is a good idea to have your startup environment — up to and including your [initramfs][18] — on a single self-contained file system for recovery purposes. Suppose, for example, that you need to rollback your root file system because it has become corrupted or it has become infected with malware. If your _kernel_ and _initramfs_ are on the _root_ file system, you may be unable to perform the recovery. By having the _boot loader_, _kernel_, and _initramfs_ all on a single file system that is rarely accessed or updated, you can increase your chances of being able to recover the rest of your system. + +In summary, there are many ways that you can layout your partitions and the type of hardware (BIOS or UEFI) and the brand of boot loader (GRUB, Syslinux or [systemd-boot][19]) are among the factors that will influence which layouts will work. + +### Other considerations + +#### MBR vs. GPT + +[GUID Partition Table (GPT)][20] is the newer partition format that supports larger disks. GPT was designed to work with the newer UEFI firmware. It is backward-compatible with the older [Master Boot Record (MBR)][21] partition format but not all boot loaders support the [MBR boot method][21]. _GRUB_ and _Syslinux_ support both MBR and UEFI, but _systemd-boot_ only supports the newer [UEFI boot method][22]. + +By using GPT now, you can increase the likelihood that your storage device, or an image of it, can be transferred over to a newer computer in the future should you wish to do so. If you have an older computer that natively supports only MBR-partitioned drives, you may need to add the _inst.gpt_ parameter to **Anaconda** when starting the installer to get it to use the newer format. How to add the _inst.gpt_ parameter is shown in the below video titled **“Partitioning a BIOS Computer”**. + +If you use the _GPT_ partition format on a BIOS-based computer, and you use the _GRUB_ boot loader, you must additionally create a one megabyte _biosboot_ partition at the start of your storage device. The _biosboot_ partition is not needed by any other brand of boot loader. How to create the _biosboot_ partition is demonstrated in the below video titled **“Partitioning a BIOS Computer”**. + +#### LVM + +One last thing to consider when manually partitioning your Linux system is whether to use standard partitions or logical volumes. Logical volumes are managed by the [Logical Volume Manager (LVM)][23]. You can setup LVM volumes directly on your disk without first creating standard partitions to hold them. However, most computers still require that the boot partition be a standard partition and not an LVM volume. Consequently, having LVM volumes only increases the complexity of the system because the LVM volumes must be created within standard partitions. + +The main features of LVM — online storage resizing and clustering — are not really applicable to the typical end user. Most laptops do not have hot-swappable drive bays for adding or reconfiguring storage while the system is running. And not many laptop or desktop users have [clvmd][24] configured so they can access a centralized storage device concurrently from multiple client computers. + +LVM is great for servers and clusters. But it adds extra complexity for the typical end user. Go with standard partitions unless you are a server admin who needs the more advanced features. + +### Video demonstrations + +Now that you know which partitions you need, you can watch the sort video demonstrations below to see how to manually partition a Fedora Linux computer from the Anaconda installer. + +These videos demonstrate creating only the minimally required partitions. You can add more if you choose. + +Because the _GRUB_ boot loader requires a more complex partition layout on UEFI systems, the below video titled **“Partitioning a UEFI Computer”** additionally demonstrates how to install the _systemd-boot_ boot loader. By using the _systemd-boot_ boot loader, you can reduce the number of needed partitions to just two — _boot_ and _root_. How to use a boot loader other than the default (GRUB) with Fedora’s Anaconda installer is officially documented [here][25]. + +**Partitioning a UEFI Computer** + +**Partitioning a BIOS Computer** + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/learning-about-partitions-and-how-to-create-them-for-fedora/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/partitions-fedora-816x346.png +[2]: https://en.wikipedia.org/wiki/Cylinder_1024 +[3]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#EFI_system_partition +[4]: https://www.kernel.org/doc/Documentation/efi-stub.txt +[5]: https://en.wikipedia.org/wiki/File_system_permissions#Operating_system_variations +[6]: https://en.wikipedia.org/wiki/Disk_formatting#Formatting +[7]: https://access.redhat.com/discussions/641923 +[8]: https://linuxconfig.org/setting-up-logrotate-on-redhat-linux +[9]: https://docs.oracle.com/cd/E19253-01/819-5461/gazud/index.html +[10]: https://en.wikipedia.org/wiki/Extended_file_system +[11]: https://en.wikipedia.org/wiki/Journaling_file_system +[12]: https://lwn.net/Articles/317814/ +[13]: https://www.fosslinux.com/184/what-is-difference-between-suspend-and-hibernate-in-linux.htm +[14]: https://en.wikipedia.org/wiki/EFI_system_partition +[15]: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs +[16]: https://fedoramagazine.org/managing-partitions-with-sgdisk/ +[17]: https://systemd.io/BOOT_LOADER_SPECIFICATION/ +[18]: https://fedoramagazine.org/initramfs-dracut-and-the-dracut-emergency-shell/ +[19]: https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/ +[20]: https://en.wikipedia.org/wiki/GUID_Partition_Table +[21]: https://en.wikipedia.org/wiki/Master_boot_record +[22]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#UEFIBOOT +[23]: https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux) +[24]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/logical_volume_manager_administration/lvm_cluster_overview +[25]: https://docs.fedoraproject.org/en-US/fedora/rawhide/install-guide/install/Installing_Using_Anaconda/#sect-installation-gui-storage-partitioning-bootloader From 9fcfc5c97f5378852c2a62ea7f6551c97dcc73c7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:54:09 +0800 Subject: [PATCH 0335/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Sync?= =?UTF-8?q?thing:=20Open=20Source=20P2P=20File=20Syncing=20Tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md --- ...hing- Open Source P2P File Syncing Tool.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md diff --git a/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md new file mode 100644 index 0000000000..aa87c0f873 --- /dev/null +++ b/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Syncthing: Open Source P2P File Syncing Tool) +[#]: via: (https://itsfoss.com/syncthing/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Syncthing: Open Source P2P File Syncing Tool +====== + +_**Brief: Syncthing is an open-source peer-to-peer file synchronization tool that you can use for syncing files between multiple devices (including an Android phone).**_ + +Usually, we have a cloud sync solution like [MEGA][1] or Dropbox to have a backup of our files on the cloud while making it easier to share it. + +But, what do you do if you want to sync your files across multiple devices without storing them on the cloud? + +That is where [Syncthing][2] comes to the rescue. + +### Syncthing: An open source tool to synchronize files across devices + +![][3] + +Syncthing lets you sync your files across multiple devices (including the support for Android smartphones). It primarily works through a web UI on Linux but also offers a GUI (to separately install). + +However, Syncthing does not utilize the cloud at all – it is a [peer-to-peer][4] file synchronization tool. Your data doesn’t go to a central server. Instead, the data is synced with all the devices between them. So, it does not really replace the [typical cloud storage services on Linux][5]. + +To add remote devices, you just need the device ID (or simply scan the QR code), no IP addresses involved. + +If you want a remote backup of your files – you should probably rely on the cloud. + +![Syncthing GUI][6] + +All things considered, Syncthing can come in handy for a lot of things. Technically, you can have your important files accessible on multiple systems securely and privately without worrying about anyone spying on your data. + +For instance, you may not want to store some of the sensitive files on the cloud – so you can add other trusted devices to sync and keep a copy of those files. + +Even though I described it briefly, there’s more to it and than meets the eye. I’d also recommend reading the [official FAQ][7] to clear some confusion on how it works – if you’re interested. + +### Features of Syncthing + +You probably do not want a lot of options in a synchronization tool – it should be dead simple to work reliably to sync your files. + +Syncthing is indeed quite simple and easy to understand – even though it is recommended that you should go through the [documentation][8] if you want to use every bit of its functionality. + +Here, I’ll highlight a few useful features of Syncthing: + +#### Cross-Platform Support + +![Syncthing on Android][9] + +Being an open-source solution, it does support Windows, Linux, and macOS. + +In addition to that, it also supports Android smartphones. You’ll be disappointed if you have an iOS device – so far, no plans for iOS support. + +#### File Versioning + +![Syncthing File Versioning][10] + +Syncthing utilizes a variety of [File Versioning methods][11] to archive the old files if they are replaced or deleted. + +By default, you won’t find it enabled. But, when you create a folder to sync, that’s when you will find the option to toggle the file versioning to your preferred method. + +#### Easy To Use + +While being a peer-to-peer file synchronization tool, it just works out of the box with no advanced tweaks. + +However, it does let you configure advanced settings when needed. + +#### Security & Privacy + +Even though you do not share your data with any cloud service providers, there are still some connections made that might gain the attention of an eavesdropper. So, Syncthing makes sure the communication is secured using TLS. + +In addition to that, there are solid authentication methods to ensure that only the devices/connections you allow explicitly will be granted access to sync/read data. + +For Android smartphones, you can also force the traffic through Tor if you’re using the [Orbot app][12]. You’ll find several other options for Android as well. + +#### Other Functionalities + +![][13] + +When exploring the tool yourself, you will notice that there are no limits to how many folders you can sync and the number of devices that you can sync. + +So, being a free and open-source solution with lots of useful features makes it an impressive choice for Linux users looking to have a peer-to-peer sync client. + +### Installing Syncthing on Linux + +You may not observe a .deb file or an .AppImage file for it on its official download webpage. But, you do get a snap package on the [Snap store][14] – if you’re curious you can read about [using snap apps][15] on Linux to get started. + +You may not find it in the software center (if you do – it may not be the latest version). + +**Note:** _There’s also a [Syncthing-GTK][16] available if you want a GUI to manage that – instead of a browser._ + +[Syncthing][2] + +You can also utilize the terminal to get it installed if you have a Debian-based distro – the instructions are on the [official download page][17]. + +### My experience with Syncthing + +Personally, I got it installed on Pop!_OS 19.10 and used it for a while before writing this up. + +I tried syncing folders, removing them, adding duplicate files to see how the file versioning works, and so on. It worked just fine. + +However, when I tried syncing it to a phone (Android) – the sync started a bit late, it wasn’t very quick. So, if we could have an option to explicitly force sync, that could help. Or, did I miss the option? Let me know in the comments if I did. + +Technically, it uses the resources of your system to work – so if you have a number of devices connected to sync, it should potentially improve the sync speed (upload/download). + +Overall, it works quite well – but I must say that you shouldn’t rely on it as the only backup solution to your data. + +**Wrapping Up** + +Have you tried Syncthing yet? If yes, how was your experience with it? Feel free to share it in the comments below. + +Also, if you know about some awesome alternatives to this – let me know about it as well. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/syncthing/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-mega-cloud-storage-linux/ +[2]: https://syncthing.net/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/Peer-to-peer +[5]: https://itsfoss.com/cloud-services-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-gtk.png?ssl=1 +[7]: https://docs.syncthing.net/users/faq.html +[8]: https://docs.syncthing.net/users/index.html +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-android.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-file-versioning.jpg?ssl=1 +[11]: https://docs.syncthing.net/users/versioning.html +[12]: https://play.google.com/store/apps/details?id=org.torproject.android&hl=en_IN +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot1.jpg?ssl=1 +[14]: https://snapcraft.io/syncthing +[15]: https://itsfoss.com/install-snap-linux/ +[16]: https://github.com/syncthing/syncthing-gtk/releases/latest +[17]: https://syncthing.net/downloads/ From 0fa02709dc4dca1af132a44ca5277700e2a42e2b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:55:05 +0800 Subject: [PATCH 0336/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200120=20Use?= =?UTF-8?q?=20this=20Twitter=20client=20for=20Linux=20to=20tweet=20from=20?= =?UTF-8?q?the=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md --- ...nt for Linux to tweet from the terminal.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md diff --git a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md new file mode 100644 index 0000000000..c49b45ace4 --- /dev/null +++ b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this Twitter client for Linux to tweet from the terminal) +[#]: via: (https://opensource.com/article/20/1/tweet-terminal-rainbow-stream) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use this Twitter client for Linux to tweet from the terminal +====== +Keep up with your Twitter feed without leaving the terminal by using +Rainbow Stream in the tenth in our series on 20 ways to be more +productive with open source in 2020. +![Chat bubbles][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Keep up with Twitter with Rainbow Stream + +I love social networking and microblogging. It's quick, it's easy, and I can share my thoughts with the world really quickly. The drawback is, of course, that almost all the desktop options for non-Windows users are wrappers around the website. [Twitter][2] has a lot of clients, but what I really want is something lightweight, easy to use, and most importantly, attractive. + +![Rainbow Stream for Twitter][3] + +[Rainbow Stream][4] is one of the prettier Twitter clients. It is easy to use and installs quickly with a simple **pip3 install rainbowstream**. On the first run, it will open a browser window and have you authorize with Twitter. Once that is done, you land at a prompt, and your Twitter timeline will start scrolling by. + +![Rainbow Stream first run][5] + +The most important commands to know are **p** to pause the stream, **r** to resume the stream, **h** to get help, and **t** to post a new tweet. For example, **h tweets** will give you all the options for sending and replying to tweets. Another useful help screen is **h messages**, which gives the commands for working with direct messages, which is something my wife and I use a lot. There are a lot of other commands, and I refer back to help a lot. + +As your timeline scrolls by, you can see that it has full UTF-8 support and, with the right font, will show indicators for how many times something was retweeted and liked, as well as icons and emojis. + +![Kill this love][6] + +One of the _best_ things about Rainbow Stream is that you don't have to give up on photos and images. This feature is off by default, but you can try it out with the **config** command. + + +``` +`config IMAGE_ON_TERM = true` +``` + +This command renders any images as ASCII art. If you have a photo-heavy stream, this may be a bit much, but I like it. It has a very retro-1990s BBS feel, and I did love the BBS scene in the 1990s. + +You can also use Rainbow Stream to manage lists, mute people, block people, follow, unfollow, and everything else that is available with the Twitter API. There is also theme support, so you can customize the stream to your favorite color scheme. + +When I'm working and don't want to have yet-another-tab open on my browser, Rainbow Stream lets me keep up in a terminal off to the side. + +Without open source, Twitter wouldn't exist. Every Tweet you send and receive touches open source... + +Sergey Bronnikov shares why the OpenVZ team created Twisource, an open source social media tool. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) +[2]: https://twitter.com/home +[3]: https://opensource.com/sites/default/files/uploads/productivity_10-1.png (Rainbow Stream for Twitter) +[4]: https://rainbowstream.readthedocs.io/en/latest/ +[5]: https://opensource.com/sites/default/files/uploads/productivity_10-2.png (Rainbow Stream first run) +[6]: https://opensource.com/sites/default/files/uploads/day10-image3_1.png (Kill this love) From b74628396a159e5cdbc6f6cbf1bc47b43e1cd241 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:55:38 +0800 Subject: [PATCH 0337/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200120=20Use?= =?UTF-8?q?=20Wireshark=20at=20the=20Linux=20command=20line=20with=20TShar?= =?UTF-8?q?k?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md --- ...k at the Linux command line with TShark.md | 768 ++++++++++++++++++ 1 file changed, 768 insertions(+) create mode 100644 sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md diff --git a/sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md b/sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md new file mode 100644 index 0000000000..d582ca77f0 --- /dev/null +++ b/sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md @@ -0,0 +1,768 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Wireshark at the Linux command line with TShark) +[#]: via: (https://opensource.com/article/20/1/wireshark-linux-tshark) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Use Wireshark at the Linux command line with TShark +====== +Learning to analyze network packets is a powerful skill. +![Multi-colored and directional network computer cables][1] + +Most of the time when we connect to the internet, we don't think about the network protocols at work underneath that make it all possible. Right now, while you are reading this article, numerous packets are being exchanged by your computer and traveling across the internet. + +To understand these protocols, you need a tool that can capture and help you analyze these packets. [Wireshark][2] is a popular open source graphical user interface (GUI) tool for analyzing packets. However, it also provides a powerful command-line utility called [TShark][3] for people who prefer to work on the Linux command line. + +To try the examples in this article, you need to be connected to the internet. For any changes to TShark's command-line options or flags, please refer to the appropriate man pages and online [documentation][4]. Also, I am using Fedora for these examples. + + +``` +[gaurav@testbox ~]$ cat /etc/fedora-release +Fedora release 30 (Thirty) +[gaurav@testbox ~]$ +``` + +### Check your installation + +First, ensure the required packages are installed: + + +``` +[gaurav@testbox ~]$ rpm -qa | grep -i wireshark +wireshark-cli-3.0.1-1.fc30.x86_64 +[gaurav@testbox ~]$ +``` + +If the Wireshark package is installed, check whether the TShark utility is installed and, if so, which version: + + +``` +[gaurav@testbox ~]$ tshark -v +TShark (Wireshark) 3.0.1 (23f278e2) + +Built using gcc 9.0.1 20190312 (Red Hat 9.0.1-0.10). +[gaurav@testbox ~]$ +``` + +If you are logged in as a regular, non-root user, you need sudo rights to use the TShark utility. Root users can skip sudo and directly run the **tshark** command. + +### Find network devices available to TShark + +Before TShark can analyze packets, it needs to capture those packets. Network packets are processed via a network interface card (NIC) on servers, workstations, or desktops or a WiFi card on laptops. Begin by identifying the NIC or WiFi card used to connect to the internet. + +To identify what network devices are available to TShark, run the following command. My laptop (which I am using for these examples) shows: + + +``` +[gaurav@testbox ~]$ sudo tshark -D +Running as user "root" and group "root". This could be dangerous. +1\. wlp61s0 +2\. lo (Loopback) +3\. any +4\. virbr0 +5\. enp0s31f6 +6\. bluetooth-monitor +7\. nflog +8\. nfqueue +[gaurav@testbox ~]$ +``` + +I am using my WiFi card to connect to my home router for accessing the internet. You can use the **ifconfig -a** command to view all network interfaces on a system. If the **ifconfig** command is not installed, you can use the newer **ip addr show** command instead. One of the interfaces should have an IP address assigned to it. For a specific interface, you can use **ifconfig <interface-name>**, for example: + + +``` +`ifconfig wlp61s0` +``` + +### Capture some packets + +Now that you know which interface is being used to connect to the internet, you can start capturing some packets using it. The **-i** option can be used to capture packets on this specific interface. You'll see a bunch of output that shows the network packets being transmitted via the interface, but you can stop it with the **Ctrl+C** command: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xa02b AAAA fedoraproject.org +    2 0.000128115  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xcc47 A fedoraproject.org +    3 0.000316195  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xe29d A fedoraproject.org +    4 0.000616019  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xac7c AAAA fedoraproject.org +    5 0.007963200  192.168.1.1 → 192.168.1.9  DNS 93 Standard query response 0xcc47 A fedoraproject.org A 185.141.165.254 +    6 0.009171815  192.168.1.1 → 192.168.1.9  DNS 93 Standard query response 0xe29d A fedoraproject.org A 185.141.165.254 +    7 0.011075350  192.168.1.1 → 192.168.1.9  DNS 322 Standard query response 0xa02b AAAA fedoraproject.org AAAA 2610:28:3090:3001:dead:beef:cafe:fed3 AAAA 2605:bc80:3010:600:dead:beef:cafe:fed9 AAAA 2604:1580:fe00:0:dead:beef:cafe:fed1 NS ns04.fedoraproject.org NS ns05.fedoraproject.org NS ns02.fedoraproject.org A 152.19.134.139 AAAA 2610:28:3090:3001:dead:beef:cafe:fed5 A 209.132.181.17 A 85.236.55.10 AAAA 2001:4178:2:1269:dead:beef:cafe:fed5 +    8 0.012458151  192.168.1.1 → 192.168.1.9  DNS 322 Standard query response 0xac7c AAAA fedoraproject.org AAAA 2605:bc80:3010:600:dead:beef:cafe:fed9 AAAA 2610:28:3090:3001:dead:beef:cafe:fed3 AAAA 2604:1580:fe00:0:dead:beef:cafe:fed1 NS ns05.fedoraproject.org NS ns02.fedoraproject.org NS ns04.fedoraproject.org A 152.19.134.139 AAAA 2610:28:3090:3001:dead:beef:cafe:fed5 A 209.132.181.17 A 85.236.55.10 AAAA 2001:4178:2:1269:dead:beef:cafe:fed5 +^C8 packets captured +[gaurav@testbox ~]$ +``` + +Look at the first two packets above; they are denoted by numbers at the beginning of the line: + + +``` +1 0.000000000  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xa02b AAAA fedoraproject.org +2 0.000128115  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xcc47 A fedoraproject.org +``` + +These lines include two IP addresses on either side of an arrow—these are the hosts that are exchanging the packet. The arrow's direction indicates which direction the packet is going. Therefore, **192.168.1.9 → 192.168.1.1** means the packet originated at host **192.168.1.9**, which is my laptop, and is headed for destination **192.168.1.1**, which is my home router. After the destination IP address, you see **DNS**, which is just the Domain Name System protocol, followed by a DNS query. More about that later. + +You can limit the number of packets captured and displayed on the screen using the **-c** (count) option. The following example shows 10 packets being captured. Notice the protocols—you saw DNS above, and here there are other protocols like NTP and TCP: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 10 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 10.5.26.10   NTP 90 NTP Version 4, client +    2 0.803303963  192.168.1.9 → 10.5.27.10   NTP 90 NTP Version 4, client +    3 3.524867645  192.168.1.9 → 192.168.1.1  DNS 69 Standard query 0x3837 A testbox +    4 6.227373094  192.168.1.9 → 192.168.1.1  DNS 89 Standard query 0x0814 A location.services.mozilla.com +    5 6.227395145  192.168.1.9 → 192.168.1.1  DNS 89 Standard query 0x5e1c AAAA location.services.mozilla.com +    6 6.234878912  192.168.1.1 → 192.168.1.9  DNS 105 Standard query response 0x0814 A location.services.mozilla.com A 34.253.23.107 +    7 6.238110416  192.168.1.1 → 192.168.1.9  DNS 223 Standard query response 0x5e1c AAAA location.services.mozilla.com CNAME locprod1-elb-eu-west-1.prod.mozaws.net SOA ns-1260.awsdns-29.org +    8 6.238446999  192.168.1.9 → 34.253.23.107 TCP 74 35326 → 443 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=2832002333 TSecr=0 WS=128 +    9 6.438833991 34.253.23.107 → 192.168.1.9  TCP 74 443 → 35326 [SYN, ACK] Seq=0 Ack=1 Win=26847 Len=0 MSS=1440 SACK_PERM=1 TSval=2056252981 TSecr=2832002333 WS=256 +   10 6.438947001  192.168.1.9 → 34.253.23.107 TCP 66 35326 → 443 [ACK] Seq=1 Ack=1 Win=64256 Len=0 TSval=2832002533 TSecr=2056252981 +10 packets captured +[gaurav@testbox ~]$ +``` + +The DNS protocol converts the hostname to an IP address and the IP address to a hostname. There are dedicated DNS (or name) servers, which you can query with either a hostname or an IP address. The example below uses the **nslookup** command to query the name servers to resolve a hostname to an IP address. Before you proceed, ensure the **bind-utils** package is installed: + + +``` +[gaurav@testbox ~]$ rpm -qa | grep -i bind-utils +bind-utils-9.11.5-13.P4.fc30.x86_64 +[gaurav@testbox ~]$ +``` + +In order to query your name server, you need to find out which one your machine is talking to. You can find that information in the **/etc/resolv.conf** file. In my case, the name server is pointed to **1.1.1.1**, which is a public DNS service provided by Cloudflare: + + +``` +[gaurav@testbox ~]$ cat /etc/resolv.conf +# Generated by NetworkManager +nameserver 1.1.1.1 +[gaurav@testbox ~]$ +``` + +Hostnames like Opensource.com are easy for humans to understand, but machines use IP addresses to connect to other machines over a network or the internet. For your computer to connect to opensource.com, it needs to find the site's IP address; you can find it with the command: + + +``` +`nslookup opensource.com` +``` + +If **nslookup** is not available on your machine, you can use the **dig** command instead: + + +``` +`dig opensource.com` +``` + +But—_before you hit Enter_—open another terminal and type the following command to tell TShark to capture any traffic that goes to your name server (e.g., 1.1.1.1): + + +``` +`sudo tshark -i wlp61s0 host 1.1.1.1` +``` + +Keep that terminal running and return to the other one, then run **nslookup** (or **dig**). When the command completes, it gives Opensource.com's IP address, which is 54.204.39.132. Here is **nslookup**'s output: + + +``` +[gaurav@testbox ~]$ nslookup opensource.com +Server:         1.1.1.1 +Address:        1.1.1.1#53 + +Non-authoritative answer: +Name:   opensource.com +Address: 54.204.39.132 + +[gaurav@testbox ~]$ +``` + +And **dig**'s output: + + +``` +[gaurav@testbox ~]$ dig opensource.com + +; <<>> DiG 9.11.5-P4-RedHat-9.11.5-13.P4.fc30 <<>> opensource.com +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<\- opcode: QUERY, status: NOERROR, id: 33030 +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 1452 +;; QUESTION SECTION: +;opensource.com.                        IN      A + +;; ANSWER SECTION: +opensource.com.         206     IN      A       54.204.39.132 + +;; Query time: 30 msec +;; SERVER: 1.1.1.1#53(1.1.1.1) +;; WHEN: Sat Nov 02 21:05:54 IST 2019 +;; MSG SIZE  rcvd: 59 + +[gaurav@testbox ~]$ +``` + +So far, so good, but what is happening at the packet level? Move to the terminal where you entered the **tshark** command. It captured a few packets: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 host 1.1.1.1 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    2 1.798275687  192.168.1.9 → 1.1.1.1      DNS 74 Standard query 0xcda0 A opensource.com +    3 1.827143443      1.1.1.1 → 192.168.1.9  DNS 90 Standard query response 0xcda0 A opensource.com A 54.204.39.132 +    ^C packets captured +[gaurav@testbox ~]$ +``` + +The packet below originated from my laptop **192.168.1.9** and is headed for destination **1.1.1.1**. The packet is for the DNS protocol, and it's querying (Standard query) the name server for Opensource.com: + + +``` +`2 1.798275687 192.168.1.9 → 1.1.1.1 DNS 74 Standard query 0xcda0 A opensource.com` +``` + +The packet below is a reply coming from my name server **1.1.1.1** to my machine **192.168.1.9**. Again, it's DNS, but now it's a response for the query (Standard query response) for Opensource.com's IP address: + + +``` +`3 1.827143443      1.1.1.1 → 192.168.1.9  DNS 90 Standard query response 0xcda0 A opensource.com A 54.204.39.132` +``` + +If you know beforehand what protocol you are looking for, you can add it to the **tshark** command. The following example is looking only for UDP packets, but it captured DNS packets. This is because DNS packets use the UDP protocol underneath: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 udp +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 1.1.1.1      DNS 89 Standard query 0xcc6d A location.services.mozilla.com +    2 0.000068640  192.168.1.9 → 1.1.1.1      DNS 89 Standard query 0x6484 AAAA location.services.mozilla.com +    3 0.032616053      1.1.1.1 → 192.168.1.9  DNS 189 Standard query response 0xcc6d A location.services.mozilla.com CNAME locprod1-elb-eu-west-1.prod.mozaws.net A 52.215.71.87 A 54.72.168.141 A 34.253.23.107 +    4 0.108203529      1.1.1.1 → 192.168.1.9  DNS 241 Standard query response 0x6484 AAAA location.services.mozilla.com CNAME locprod1-elb-eu-west-1.prod.mozaws.net SOA ns-1260.awsdns-29.org +    5 1.268489014  192.168.1.9 → 1.1.1.1      DNS 69 Standard query 0x74be A testbox +    6 1.302652455      1.1.1.1 → 192.168.1.9  DNS 144 Standard query response 0x74be No such name A testbox SOA a.root-servers.net +    7 6.268558254  192.168.1.9 → 1.1.1.1      DNS 79 Standard query 0xc47a A cups.pnq.redhat.com +    8 6.268618039  192.168.1.9 → 1.1.1.1      DNS 79 Standard query 0xb08b AAAA cups.pnq.redhat.com +    9 6.664992312      1.1.1.1 → 192.168.1.9  DNS 143 Standard query response 0xb08b AAAA cups.pnq.redhat.com SOA a1-68.akam.net +   10 6.665088305      1.1.1.1 → 192.168.1.9  DNS 143 Standard query response 0xc47a A cups.pnq.redhat.com SOA a1-68.akam.net +^C10 packets captured +[gaurav@testbox ~]$ +``` + +The **ping** command is often used to check if a machine is up or accessible over a network. You can run the **ping** command against Opensource.com's IP address to see if the server is up and running. + +Before you do that, start a packet capture so you can analyze the packet later. Open a terminal and run the following command, which will keep running and looking for packets that are originating in or destined for IP address 54.204.39.132: + + +``` +`sudo tshark -i wlp61s0 host 54.204.39.132` +``` + +In another terminal, run the following **ping** command. The **-c** is for count, so **-c 2** means it should send only two packets to the given host: + + +``` +`ping -c 2 54.204.39.132` +``` + +From the terminal where you ran the **ping** command, you can see two packets were sent and two were received. It also says that there was 0% packet loss, which suggests that the destination 54.204.39.132 responded to the **ping** requests: + + +``` +[gaurav@testbox ~]$ ping -c 2 54.204.39.132 +PING 54.204.39.132 (54.204.39.132) 56(84) bytes of data. +64 bytes from 54.204.39.132: icmp_seq=1 ttl=43 time=357 ms +64 bytes from 54.204.39.132: icmp_seq=2 ttl=43 time=278 ms + +\--- 54.204.39.132 ping statistics --- +2 packets transmitted, 2 received, 0% packet loss, time 1ms +rtt min/avg/max/mdev = 278.045/317.410/356.776/39.369 ms +[gaurav@testbox ~]$ +``` + +Move back to the terminal where TShark is running. It shows four packets: the requests in the **ping** command (**-c 2**) and two replies, hence a total of four packets: + + +``` +Packet 1 - request (1st request) +Packet 2 - reply (to Packet 1) +Packet 3 - request (2nd request) +Packet 4 - reply (to Packet 3) +``` + +The output shows that it is using the [ICMP][5] protocol. **Ping** works over ICMP to complete its tasks: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1749, seq=1/256, ttl=64 +    2 0.356750411 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1749, seq=1/256, ttl=43 (request in 1) +    3 1.000295229  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1749, seq=2/512, ttl=64 +    4 1.278267790 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1749, seq=2/512, ttl=43 (request in 3) +^C4 packets captured +[gaurav@testbox ~]$ +``` + +Network packets are sent in binary format, so if you want to see how they look on the network, you can dump the packet's hexadecimal format by simply adding an **-x** to the **tshark** command, and you will see the hexadecimal output. The following output shows a **ping** request sent by running the command **ping -c 1 54.204.39.132**: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -x -c 2 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +0000  28 c6 8e 3e 39 3a 48 89 e7 a0 33 db 08 00 45 00   (..>9:H...3...E. +0010  00 54 e6 29 40 00 40 01 34 7e c0 a8 01 09 36 cc   .T.)@.@.4~....6. +0020  27 84 08 00 25 5f 27 d1 00 01 7e aa bd 5d 00 00   '...%_'...~..].. +0030  00 00 a2 f3 0d 00 00 00 00 00 10 11 12 13 14 15   ................ +0040  16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25   .......... !"#$% +0050  26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35   &'()*+,-./012345 +0060  36 37                                             67 + +0000  48 89 e7 a0 33 db 28 c6 8e 3e 39 3a 08 00 45 00   H...3.(..>9:..E. +0010  00 54 31 06 00 00 2b 01 3e a2 36 cc 27 84 c0 a8   .T1...+.>.6.'... +0020  01 09 00 00 2d 5f 27 d1 00 01 7e aa bd 5d 00 00   ....-_'...~..].. +0030  00 00 a2 f3 0d 00 00 00 00 00 10 11 12 13 14 15   ................ +0040  16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25   .......... !"#$% +0050  26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35   &'()*+,-./012345 +0060  36 37                                             67 + +2 packets captured +[gaurav@testbox ~]$ +``` + +### Save your output + +Seeing output on the screen is OK, but often you need to save data to a file to use it later. Use the **ping** command but add **-w** to tell TShark to dump the output to a file. For example, the following saves the output to file named **nlog.pcap** within the **/tmp** directory: + + +``` +`sudo tshark -w /tmp/nlog.pcap -i wlp61s0 host 54.204.39.132` +``` + +Now run the **ping** command again from another terminal, but this time with a count of five packets: + + +``` +`ping -c 5 54.204.39.132` +``` + +The TShark terminal shows that 10 packets were captured. Why 10? Because you asked **ping** to send five requests, and you got five replies, hence 10 packets. Use **Ctrl+C** to stop the packet capture: + + +``` +[gaurav@testbox ~]$ sudo tshark -w /tmp/nlog.pcap -i wlp61s0 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +10 ^C +[gaurav@testbox ~]$ +``` + +TShark saved the output to the file **/tmp/nlog.pcap**: + + +``` +[gaurav@testbox ~]$ ls -l /tmp/nlog.pcap +-rw-------. 1 root root 1692 Nov  2 21:10 /tmp/nlog.pcap +[gaurav@testbox ~]$ +``` + +The **file** command shows the file type is a **pcapng** capture file, so you can't just open the file using an editor like Vim and start reading; all you'll see is a bunch of garbage characters: + + +``` +[gaurav@testbox ~]$ sudo file /tmp/nlog.pcap +/tmp/nlog.pcap: pcapng capture file - version 1.0 +[gaurav@testbox ~]$ +``` + +Since TShark wrote the data to the file, it can read it back from the file as well using the **-r** option followed by the filename. The following shows all 10 packets (five requests and five replies): + + +``` +[gaurav@testbox ~]$ sudo tshark -r /tmp/nlog.pcap +Running as user "root" and group "root". This could be dangerous. +    1 0.000000000  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=1/256, ttl=64 +    2 0.270098703 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=1/256, ttl=43 (request in 1) +    3 1.000485186  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=2/512, ttl=64 +    4 1.323571769 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=2/512, ttl=43 (request in 3) +    5 2.000955585  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=3/768, ttl=64 +    6 2.347737132 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=3/768, ttl=43 (request in 5) +    7 3.000912998  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=4/1024, ttl=64 +    8 3.269412434 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=4/1024, ttl=43 (request in 7) +    9 4.001573635  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=5/1280, ttl=64 +   10 4.293431592 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=5/1280, ttl=43 (request in 9) +[gaurav@testbox ~]$ + +#TCP handshake +``` + +A [TCP handshake][6] is done before establishing a connection over a network. The examples above just queried a name server or tried to determine whether a machine is reachable via a **ping** command, neither of which requires establishing a connection with the host. Try to fetch [www.opensource.com][7] via the **wget** command. + +Before you run **wget**, run the following command in another terminal to capture packets. I have deliberately kept the count to three since the handshake involves initial packets: + + +``` +`sudo tshark -i wlp61s0 -c 3 host 54.204.39.132` +``` + +Next, run the **wget** command to download the index file: + + +``` +[gaurav@testbox ~]$ wget +\--2019-11-02 21:13:54--   +Resolving [www.opensource.com][7] ([www.opensource.com][7])... 54.204.39.132 +Connecting to [www.opensource.com][7] ([www.opensource.com)|54.204.39.132|:443][8]... connected. +HTTP request sent, awaiting response... 301 Moved Permanently +Location: [following] +\--2019-11-02 21:13:56--   +Resolving opensource.com (opensource.com)... 54.204.39.132 +Connecting to opensource.com (opensource.com)|54.204.39.132|:80... connected. +HTTP request sent, awaiting response... 302 Found +Location: [following] +\--2019-11-02 21:13:57--   +Connecting to opensource.com (opensource.com)|54.204.39.132|:443... connected. +HTTP request sent, awaiting response... 200 OK +Length: 71561 (70K) [text/html] +Saving to: ‘index.html’ + +index.html                        100%[=============================================================>]  69.88K   105KB/s    in 0.7s     + +2019-11-02 21:13:59 (105 KB/s) - ‘index.html’ saved [71561/71561] + +[gaurav@testbox ~]$ ^C +``` + +You can view the three packets below. The first packet sends a **SYN** request from my laptop to the Opensource.com server. The second packet is the Opensource.com server replying with a **SYN, ACK** flag set. Finally, the third packet is my laptop sending an **ACK** request to acknowledge receiving the second packet. This is called a TCP handshake. After this handshake, both nodes (i.e., my laptop and the Opensource.com server) can exchange data. + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 3 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 54.204.39.132 TCP 74 58784 → 443 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=790376430 TSecr=0 WS=128 +    2 0.306538226 54.204.39.132 → 192.168.1.9  TCP 74 443 → 58784 [SYN, ACK] Seq=0 Ack=1 Win=26847 Len=0 MSS=1440 SACK_PERM=1 TSval=1306268046 TSecr=790376430 WS=512 +    3 0.306671608  192.168.1.9 → 54.204.39.132 TCP 66 58784 → 443 [ACK] Seq=1 Ack=1 Win=64256 Len=0 TSval=790376737 TSecr=1306268046 +3 packets captured +[gaurav@testbox ~]$ +``` + +If you exclude **-c 3**, it will capture all packets, and you will see a similar ritual to close a connection. Only this time, my laptop sent a **FIN, ACK** packet to Opensource.com (in packet 1 below), followed by a **FIN, ACK** from Opensource.com to my laptop (in packet 2 below), and finally an **ACK** packet sent by my laptop to the Opensource.com server. This concludes the network connection that was established earlier, and any future connections will have to set up a TCP handshake again. + + +``` +   73 4.505715716  192.168.1.9 → 54.204.39.132 TCP 66 59574 → 443 [FIN, ACK] Seq=814 Ack=76239 Win=69888 Len=0 TSval=792384514 TSecr=1306769989 +   74 4.737227282 54.204.39.132 → 192.168.1.9  TCP 66 443 → 59574 [FIN, ACK] Seq=76239 Ack=815 Win=29184 Len=0 TSval=1306770066 TSecr=792384514 +   75 4.737389399  192.168.1.9 → 54.204.39.132 TCP 66 59574 → 443 [ACK] Seq=815 Ack=76240 Win=69888 Len=0 TSval=792384745 TSecr=1306770066 +``` + +### Encrypt handshake data + +These days, most websites are accessed over HTTPS instead of HTTP. This ensures the data passed between the two nodes is encrypted on the wire as it passes through the internet. To ensure data is encrypted, a [TLS handshake][9] method, which is similar to the TCP handshake, happens. + +Fire another **wget** command, but this time it captures 11 packets from the beginning: + + +``` +[gaurav@testbox ~]$ wget +\--2019-11-02 21:15:21--   +Resolving [www.opensource.com][7] ([www.opensource.com][7])... 54.204.39.132 +Connecting to [www.opensource.com][7] ([www.opensource.com)|54.204.39.132|:443][8]... connected. +HTTP request sent, awaiting response... 301 Moved Permanently +Location: [following] +\--2019-11-02 21:15:23--   +Resolving opensource.com (opensource.com)... 54.204.39.132 +Connecting to opensource.com (opensource.com)|54.204.39.132|:80... connected. +HTTP request sent, awaiting response... 302 Found +Location: [following] +\--2019-11-02 21:15:28--   +Connecting to opensource.com (opensource.com)|54.204.39.132|:443... connected. +HTTP request sent, awaiting response... 200 OK +Length: 71561 (70K) [text/html] +Saving to: ‘index.html’ + +index.html                        100%[=============================================================>]  69.88K   114KB/s    in 0.6s     + +2019-11-02 21:15:31 (114 KB/s) - ‘index.html’ saved [71561/71561] + +[gaurav@testbox ~]$ +``` + +The TCP handshake concludes in the first three packets, and the fourth to the ninth have various packets that have TLS strings, which follow a similar handshake ritual to set up a secure, encrypted connection between the two hosts: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 11 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 54.204.39.132 TCP 74 58800 → 443 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=790462858 TSecr=0 WS=128 +    2 0.305006506 54.204.39.132 → 192.168.1.9  TCP 74 443 → 58800 [SYN, ACK] Seq=0 Ack=1 Win=26847 Len=0 MSS=1440 SACK_PERM=1 TSval=1306289652 TSecr=790462858 WS=512 +    3 0.305135180  192.168.1.9 → 54.204.39.132 TCP 66 58800 → 443 [ACK] Seq=1 Ack=1 Win=64256 Len=0 TSval=790463163 TSecr=1306289652 +    4 0.308282152  192.168.1.9 → 54.204.39.132 TLSv1 583 Client Hello +    5 0.613210220 54.204.39.132 → 192.168.1.9  TCP 66 443 → 58800 [ACK] Seq=1 Ack=518 Win=28160 Len=0 TSval=1306289729 TSecr=790463166 +    6 0.613298883 54.204.39.132 → 192.168.1.9  TLSv1.2 3139 Server Hello, Certificate, Server Key Exchange, Server Hello Done +    7 0.613356054  192.168.1.9 → 54.204.39.132 TCP 66 58800 → 443 [ACK] Seq=518 Ack=3074 Win=61184 Len=0 TSval=790463472 TSecr=1306289729 +    8 0.617318607  192.168.1.9 → 54.204.39.132 TLSv1.2 192 Client Key Exchange, Change Cipher Spec, Encrypted Handshake Message +    9 0.919718195 54.204.39.132 → 192.168.1.9  TLSv1.2 324 New Session Ticket, Change Cipher Spec, Encrypted Handshake Message +   10 0.940858609  192.168.1.9 → 54.204.39.132 TLSv1.2 240 Application Data +   11 1.228530079 54.204.39.132 → 192.168.1.9  TLSv1.2 754 Application Data +11 packets captured +[gaurav@testbox ~]$ +``` + +Because HTTPS works on port 443 by default, you can use it as a filter in TShark to capture traffic going to that specific port: + + +``` +`sudo tshark -i wlp61s0 host 54.204.39.132 and port 443` +``` + +Timestamps are essential when you need to analyze packets offline to reconstruct events from the past, e.g., for debugging. Adding a **-t ad** flag to TShark will add timestamps to the beginning of each packet capture: + + +``` +[gaurav@testbox ~]$ sudo tshark -n -i wlp61s0 -t ad +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 2019-11-02 21:43:58.344158174 25:c9:8e:3f:38:3a → 48:89:e7:a0:33:db ARP 42 Who has 192.168.1.9? Tell 192.168.1.1 +    2 2019-11-02 21:43:58.344194844 48:89:e7:a0:33:db → 25:c9:8e:3f:38:3a ARP 42 192.168.1.9 is at 48:89:e7:a0:33:db +    3 2019-11-02 21:44:00.223393961  192.168.1.9 → 1.1.1.1      DNS 79 Standard query 0x00fb A cups.pnq.redhat.com +    4 2019-11-02 21:44:00.223460961  192.168.1.9 → 1.1.1.1      DNS 79 Standard query 0x1814 AAAA cups.pnq.redhat.com +    5 2019-11-02 21:44:00.266325914      1.1.1.1 → 192.168.1.9  DNS 143 Standard query response 0x00fb A cups.pnq.redhat.com SOA a1-68.akam.net +    6 2019-11-02 21:44:00.269102767      1.1.1.1 → 192.168.1.9  DNS 143 Standard query response 0x1814 AAAA cups.pnq.redhat.com SOA a1-68.akam.net +^C6 packets captured +[gaurav@testbox ~]$ +``` + +### View an entire packet + +So far, you have seen several examples of packets and ways to interpret them but not an entire packet. Here's how to use **ping** and the **nslookup** utility to dump an entire packet: + + +``` +[gaurav@testbox ~]$ ping -c 1 54.204.39.132 +PING 54.204.39.132 (54.204.39.132) 56(84) bytes of data. +64 bytes from 54.204.39.132: icmp_seq=1 ttl=43 time=357 ms + +\--- 54.204.39.132 ping statistics --- +1 packets transmitted, 1 received, 0% packet loss, time 0ms +rtt min/avg/max/mdev = 356.961/356.961/356.961/0.000 ms +[gaurav@testbox ~]$ +``` + +In another window, run the following command and then the **ping** command above. Notice the additional **-V** flag—it is used to dump the entire packet information on the screen. The output is divided into various sections, starting with Frames, then moving to Ethernet, then to Internet Protocol, and so on. + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 1 -V host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +Frame 1: 98 bytes on wire (784 bits), 98 bytes captured (784 bits) on interface 0 +    Interface id: 0 (wlp61s0) +        Interface name: wlp61s0 +    Encapsulation type: Ethernet (1) +    Arrival Time: Nov  2, 2019 21:17:55.556150846 IST +    [Time shift for this packet: 0.000000000 seconds] +    Epoch Time: 1572709675.556150846 seconds +    [Time delta from previous captured frame: 0.000000000 seconds] +    [Time delta from previous displayed frame: 0.000000000 seconds] +    [Time since reference or first frame: 0.000000000 seconds] +    Frame Number: 1 +    Frame Length: 98 bytes (784 bits) +    Capture Length: 98 bytes (784 bits) +    [Frame is marked: False] +    [Frame is ignored: False] +    [Protocols in frame: eth:ethertype:ip:icmp:data] +Ethernet II, Src: IntelCor_a0:33:db (48:89:e7:a0:33:db), Dst: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +    Destination: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +        Address: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) +        .... ...0 .... .... .... .... = IG bit: Individual address (unicast) +    Source: IntelCor_a0:33:db (48:89:e7:a0:33:db) +        Address: IntelCor_a0:33:db (48:89:e7:a0:33:db) +        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) +        .... ...0 .... .... .... .... = IG bit: Individual address (unicast) +    Type: IPv4 (0x0800) +Internet Protocol Version 4, Src: 192.168.1.9, Dst: 54.204.39.132 +    0100 .... = Version: 4 +    .... 0101 = Header Length: 20 bytes (5) +    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) +        0000 00.. = Differentiated Services Codepoint: Default (0) +        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) +    Total Length: 84 +    Identification: 0x8f68 (36712) +    Flags: 0x4000, Don't fragment +        0... .... .... .... = Reserved bit: Not set +        .1.. .... .... .... = Don't fragment: Set +        ..0. .... .... .... = More fragments: Not set +        ...0 0000 0000 0000 = Fragment offset: 0 +    Time to live: 64 +    Protocol: ICMP (1) +    Header checksum: 0x8b3f [validation disabled] +    [Header checksum status: Unverified] +    Source: 192.168.1.9 +    Destination: 54.204.39.132 +Internet Control Message Protocol +    Type: 8 (Echo (ping) request) +    Code: 0 +    Checksum: 0xcfc5 [correct] +    [Checksum Status: Good] +    Identifier (BE): 7399 (0x1ce7) +    Identifier (LE): 59164 (0xe71c) +    Sequence number (BE): 1 (0x0001) +    Sequence number (LE): 256 (0x0100) +    Timestamp from icmp data: Nov  2, 2019 21:17:55.000000000 IST +    [Timestamp from icmp data (relative): 0.556150846 seconds] +    Data (48 bytes) + +0000  5b 7c 08 00 00 00 00 00 10 11 12 13 14 15 16 17   [|.............. +0010  18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27   ........ !"#$%&' +0020  28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37   ()*+,-./01234567 +        Data: 5b7c080000000000101112131415161718191a1b1c1d1e1f… +        [Length: 48] + +1 packet captured +[gaurav@testbox ~] +``` + +Similarly, run the following **nslookup** command and, on the side, dump the entire packet via TShark: + + +``` +[gaurav@testbox ~]$ nslookup opensource.com +Server:         1.1.1.1 +Address:        1.1.1.1#53 + +Non-authoritative answer: +Name:   opensource.com +Address: 54.204.39.132 + +[gaurav@testbox ~]$ +``` + +Here is how the packet looks when you do a DNS lookup—notice the UDP protocol is being used: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 1 -V host 1.1.1.1 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +Frame 1: 88 bytes on wire (704 bits), 88 bytes captured (704 bits) on interface 0 +    Interface id: 0 (wlp61s0) +        Interface name: wlp61s0 +    Encapsulation type: Ethernet (1) +    Arrival Time: Nov  2, 2019 21:19:32.161216715 IST +    [Time shift for this packet: 0.000000000 seconds] +    Epoch Time: 1572709772.161216715 seconds +    [Time delta from previous captured frame: 0.000000000 seconds] +    [Time delta from previous displayed frame: 0.000000000 seconds] +    [Time since reference or first frame: 0.000000000 seconds] +    Frame Number: 1 +    Frame Length: 88 bytes (704 bits) +    Capture Length: 88 bytes (704 bits) +    [Frame is marked: False] +    [Frame is ignored: False] +    [Protocols in frame: eth:ethertype:ip:udp:dns] +Ethernet II, Src: IntelCor_a0:33:db (48:89:e7:a0:33:db), Dst: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +    Destination: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +        Address: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) +        .... ...0 .... .... .... .... = IG bit: Individual address (unicast) +    Source: IntelCor_a0:33:db (48:89:e7:a0:33:db) +        Address: IntelCor_a0:33:db (48:89:e7:a0:33:db) +        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) +        .... ...0 .... .... .... .... = IG bit: Individual address (unicast) +    Type: IPv4 (0x0800) +Internet Protocol Version 4, Src: 192.168.1.9, Dst: 1.1.1.1 +    0100 .... = Version: 4 +    .... 0101 = Header Length: 20 bytes (5) +    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) +        0000 00.. = Differentiated Services Codepoint: Default (0) +        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) +    Total Length: 74 +    Identification: 0x907d (36989) +    Flags: 0x4000, Don't fragment +        0... .... .... .... = Reserved bit: Not set +        .1.. .... .... .... = Don't fragment: Set +        ..0. .... .... .... = More fragments: Not set +        ...0 0000 0000 0000 = Fragment offset: 0 +    Time to live: 64 +    Protocol: UDP (17) +    Header checksum: 0xe672 [validation disabled] +    [Header checksum status: Unverified] +    Source: 192.168.1.9 +    Destination: 1.1.1.1 +User Datagram Protocol, Src Port: 60656, Dst Port: 53 +    Source Port: 60656 +    Destination Port: 53 +    Length: 54 +    Checksum: 0x2fd2 [unverified] +    [Checksum Status: Unverified] +    [Stream index: 0] +    [Timestamps] +        [Time since first frame: 0.000000000 seconds] +        [Time since previous frame: 0.000000000 seconds] +Domain Name System (query) +    Transaction ID: 0x303c +    Flags: 0x0100 Standard query +        0... .... .... .... = Response: Message is a query +        .000 0... .... .... = Opcode: Standard query (0) +        .... ..0. .... .... = Truncated: Message is not truncated +        .... ...1 .... .... = Recursion desired: Do query recursively +        .... .... .0.. .... = Z: reserved (0) +        .... .... ...0 .... = Non-authenticated data: Unacceptable +    Questions: 1 +    Answer RRs: 0 +    Authority RRs: 0 +    Additional RRs: 0 +    Queries +        clock01.util.phx2.redhat.com: type A, class IN +            Name: clock01.util.phx2.redhat.com +            [Name Length: 28] +            [Label Count: 5] +            Type: A (Host Address) (1) +            Class: IN (0x0001) + +1 packet captured +[gaurav@testbox ~]$ +``` + +### Next steps + +Once you are comfortable with these basics of packet capturing and analysis, you can utilize TShark's various capture and display filters when working on more advanced use cases. Refer to the online documentation for more information on these filters. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/wireshark-linux-tshark + +作者:[Gaurav Kamathe][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: https://www.wireshark.org/ +[3]: https://www.wireshark.org/docs/wsug_html_chunked/AppToolstshark.html +[4]: https://www.wireshark.org/docs/man-pages/tshark.html +[5]: https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol +[6]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Connection_establishment +[7]: http://www.opensource.com +[8]: http://www.opensource.com)|54.204.39.132|:443 +[9]: https://en.wikipedia.org/wiki/Transport_Layer_Security#TLS_handshake From cb78502d5a011ac5ab00cc833d9b57451d03fa5d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 08:25:30 +0800 Subject: [PATCH 0338/3057] APL --- sources/talk/20191015 How GNOME uses Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191015 How GNOME uses Git.md b/sources/talk/20191015 How GNOME uses Git.md index f64057287e..5cf183f2e8 100644 --- a/sources/talk/20191015 How GNOME uses Git.md +++ b/sources/talk/20191015 How GNOME uses Git.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c98195bdd0cee9646945f652b133caed6d013847 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 09:15:36 +0800 Subject: [PATCH 0339/3057] TSL --- sources/talk/20191015 How GNOME uses Git.md | 60 ------------------ .../talk/20191015 How GNOME uses Git.md | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 60 deletions(-) delete mode 100644 sources/talk/20191015 How GNOME uses Git.md create mode 100644 translated/talk/20191015 How GNOME uses Git.md diff --git a/sources/talk/20191015 How GNOME uses Git.md b/sources/talk/20191015 How GNOME uses Git.md deleted file mode 100644 index 5cf183f2e8..0000000000 --- a/sources/talk/20191015 How GNOME uses Git.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How GNOME uses Git) -[#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) -[#]: author: (Molly de Blanc https://opensource.com/users/mollydb) - -How GNOME uses Git -====== -The GNOME project's decision to centralize on GitLab is creating -benefits across the community—even beyond the developers. -![red panda][1] - -“What’s your GitLab?” is one of the first questions I was asked on my first day working for the [GNOME Foundation][2]—the nonprofit that supports GNOME projects, including the [desktop environment][3], [GTK][4], and [GStreamer][5]. The person was referring to my username on [GNOME’s GitLab instance][6]. In my time with GNOME, I’ve been asked for my GitLab a lot. - -We use GitLab for basically everything. In a typical day, I get several issues and reference bug reports, and I occasionally need to modify a file. I don’t do this in the capacity of being a developer or a sysadmin. I’m involved with the Engagement and Inclusion & Diversity (I&D) teams. I write newsletters for Friends of GNOME and interview contributors to the project. I work on sponsorships for GNOME events. I don’t write code, and I use GitLab every day. - -The GNOME project has been managed a lot of ways over the past two decades. Different parts of the project used different systems to track changes to code, collaborate, and share information both as a project and as a social space. However, the project made the decision that it needed to become more integrated and it took about a year from conception to completion. - -There were a number of reasons GNOME wanted to switch to a single tool for use across the community. External projects touch GNOME, and providing them an easier way to interact with resources was important for the project, both to support the community and to grow the ecosystem. We also wanted to better track metrics for GNOME—the number of contributors, the type and number of contributions, and the developmental progress of different parts of the project. - -When it came time to pick a collaboration tool, we considered what we needed. One of the most important requirements was that it must be hosted by the GNOME community; being hosted by a third party didn’t feel like an option, so that discounted services like GitHub and Atlassian. And, of course, it had to be free software. It quickly became obvious that the only real contender was GitLab. We wanted to make sure contribution would be easy. GitLab has features like single sign-on, which allows people to use GitHub, Google, GitLab.com, and GNOME accounts. - -We agreed that GitLab was the way to go, and we began to migrate from many tools to a single tool. GNOME board member [Carlos Soriano][7] led the charge. With lots of support from GitLab and the GNOME community, we completed the process in May 2018. - -There was a lot of hope that moving to GitLab would help grow the community and make contributing easier. Because GNOME previously used so many different tools, including Bugzilla and CGit, it’s hard to quantitatively measure how the switch has impacted the number of contributions. We can more clearly track some statistics though, such as the nearly 10,000 issues closed and 7,085 merge requests merged between June and November 2018. People feel that the community has grown and become more welcoming and that contribution is, in fact, easier. - -People come to free software from all sorts of different starting points, and it’s important to try to even out the playing field by providing better resources and extra support for people who need them. Git, as a tool, is widely used, and more people are coming to participate in free software with those skills ready to go. Self-hosting GitLab provides the perfect opportunity to combine the familiarity of Git with the feature-rich, user-friendly environment provided by GitLab. - -It’s been a little over a year, and the change is really noticeable. Continuous integration (CI) has been a huge benefit for development, and it has been completely integrated into nearly every part of GNOME. Teams that aren’t doing code development have also switched to using the GitLab ecosystem for their work. Whether it’s using issue tracking to manage assigned tasks or version control to share and manage assets, even teams like Engagement and I&D have taken up using GitLab. - -It can be hard for a community, even one developing free software, to adapt to a new technology or tool. It is especially hard in a case like GNOME, a project that [recently turned 22][8]. After more than two decades of building a project like GNOME, with so many parts used by so many people and organizations, the migration was an endeavor that was only possible thanks to the hard work of the GNOME community and generous assistance from GitLab. - -I find a lot of convenience in working for a project that uses Git for version control. It’s a system that feels comfortable and is familiar—it’s a tool that is consistent across workplaces and hobby projects. As a new member of the GNOME community, it was great to be able to jump in and just use GitLab. As a community builder, it’s inspiring to see the results: more associated projects coming on board and entering the ecosystem; new contributors and community members making their first contributions to the project; and increased ability to measure the work we’re doing to know it’s effective and successful. - -It’s great that so many teams doing completely different things (such as what they’re working on and what skills they’re using) agree to centralize on any tool—especially one that is considered a standard across open source. As a contributor to GNOME, I really appreciate that we’re using GitLab. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/how-gnome-uses-git - -作者:[Molly de Blanc][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mollydb -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/redpanda_firefox_pet_animal.jpg?itok=aSpKsyna (red panda) -[2]: https://www.gnome.org/foundation/ -[3]: https://gnome.org/ -[4]: https://www.gtk.org/ -[5]: https://gstreamer.freedesktop.org/ -[6]: https://gitlab.gnome.org/ -[7]: https://twitter.com/csoriano1618?lang=en -[8]: https://opensource.com/article/19/8/poll-favorite-gnome-version diff --git a/translated/talk/20191015 How GNOME uses Git.md b/translated/talk/20191015 How GNOME uses Git.md new file mode 100644 index 0000000000..e9b82aa7d1 --- /dev/null +++ b/translated/talk/20191015 How GNOME uses Git.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How GNOME uses Git) +[#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) +[#]: author: (Molly de Blanc https://opensource.com/users/mollydb) + +GNOME 项目是如何使用 Git 的? +====== + +将 GNOME 项目集中在 GitLab 上的决定为整个社区(不只是开发人员)带来了好处。 + +![red panda][1] + +“您的 GitLab 是什么?”这是我在 [GNOME 基金会][2]工作的第一天被问到的第一个问题之一,该基金会是支持 GNOME 项目的非盈利组织,包括[桌面环境][3]、[GTK][4] 和 [GStreamer][5]。此人指的是我在 [GNOME 的 GitLab 实例][6上的用户名。我在 GNOME 期间,经常有人要求我提供我的 GitLab。 + +我们使用 GitLab 进行几乎所有操作。通常情况下,我会收到一些提案和参考错误报告,有时还需要修改文件。我不是以开发人员或系统管理员的身份进行此操作的。我参与了“参与度、包容性和多样性(I&D)”团队。我为 GNOME 朋友们撰写新闻通讯,并采访该项目的贡献者。我为 GNOME 活动提供赞助。我不写代码,但我每天都使用 GitLab。 + +在过去的二十年中,GNOME 项目的管理采用了各种方式。该项目的不同部分使用不同的系统来跟踪代码更改、协作以及作为项目和社交空间共享信息。但是,该项目决定,它需要更加一体化,这从构思到完成大约花费了一年的时间。 + +GNOME 希望切换到单个工具供整个社区使用的原因很多。外部项目与 GNOME 息息相关,并为它们提供与资源交互的更简单的方式对于项目至关重要,无论是支持社区还是发展生态系统。我们还希望更好地跟踪 GNOME 的指标,即贡献者的数量、贡献的类型和数量以及项目不同部分的开发进度。 + +当需要选择一种协作工具时,我们考虑了我们需要的东西。最重要的要求之一是它必须由 GNOME 社区托管。由第三方托管并不是一种选择,因此像 GitHub 和 Atlassian 这样的服务就不在考虑之中。而且,当然了,它必须是自由软件。很快,唯一真正的竞争者就是 GitLab。我们希望确保进行贡献很容易。GitLab 具有诸如单点登录的功能,该功能允许人们使用 GitHub、Google、GitLab.com 和 GNOME 帐户登录。 + +我们认为 GitLab 是一条出路,我们开始从许多工具迁移到单个工具。GNOME 董事会成员 [Carlos Soriano][7] 领导这项改变。在 GitLab 和 GNOME 社区的大力支持下,我们于 2018 年 5 月完成了该过程。 + +人们非常希望迁移到 GitLab 有助于社区的发展,并使贡献更容易。由于 GNOME 以前使用了许多不同的工具,包括 Bugzilla 和 CGit,因此很难定量地评估这次切换对贡献量的影响。但是,我们可以更清楚地跟踪一些统计数据,例如在 2018 年 6 月至 2018 年 11 月之间关闭了近 10,000 个提案,合并了 7,085 个合并请求。人们感到社区在发展壮大,越来越受欢迎,而且贡献实际上也更容易。 + +人们因不同的原因而开始使用自由软件,重要的是,可以通过为需要软件的人提供更好的资源和更多的支持来公平竞争。Git 作为一种工具已被广泛使用,并且越来越多的人使用这些技能来参与到自由软件当中。自托管的 GitLab 提供了将 Git 的熟悉度与 GitLab 提供的功能丰富、用户友好的环境相结合的绝佳机会。 + +已经一年多了,变化确实很明显。持续集成(CI)为开发带来了巨大的好处,并且已经完全集成到 GNOME 的几乎每个部分当中。不进行代码开发的团队也转而使用 GitLab 生态系统进行工作。无论是使用问题跟踪来管理分配的任务,还是使用版本控制来共享和管理资产,就连“参与度、包容性和多样性(I&D)”这样的团队都已经使用了 GitLab。 + +一个社区,即使是一个正在开发的自由软件,也很难适应新技术或新工具。在类似 GNOME 的情况下,这尤其困难,该项目[最近已经 22 岁了] [8]。像 GNOME 这样经过了 20 多年建设的项目,太多的人和组织使用了太多的部件,但迁移工作之所以能实现,这要归功于 GNOME 社区的辛勤工作和 GitLab 的慷慨帮助。 + +在为使用 Git 进行版本控制的项目工作时,我发现很方便。这是一个令人感觉舒适和熟悉的系统,是一个在工作场所和爱好项目之间保持一致的工具。作为 GNOME 社区的新成员,能够参与并使用 GitLab 真是太好了。作为社区建设者,看到这样结果是令人鼓舞的:越来越多的相关项目加入并进入生态系统;新的贡献者和社区成员对该项目做出了首次贡献;以及增强了衡量我们正在做的工作以了解其成功和成功的能力。 + +如此多的做着完全不同的事情(例如他们正在从事的不同工作以及所使用的不同技能)的团队同意集中在一个工具上(尤其是被认为是跨开源的标准工具),这一点很棒。 作为 GNOME 的贡献者,我真的非常感谢我们使用了 GitLab。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-gnome-uses-git + +作者:[Molly de Blanc][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mollydb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/redpanda_firefox_pet_animal.jpg?itok=aSpKsyna (red panda) +[2]: https://www.gnome.org/foundation/ +[3]: https://gnome.org/ +[4]: https://www.gtk.org/ +[5]: https://gstreamer.freedesktop.org/ +[6]: https://gitlab.gnome.org/ +[7]: https://twitter.com/csoriano1618?lang=en +[8]: https://opensource.com/article/19/8/poll-favorite-gnome-version From 292bd2260937aebe9c2688948b10cd490b22fb9d Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 21 Jan 2020 09:23:22 +0800 Subject: [PATCH 0340/3057] translated --- ...ith this open source to-do list manager.md | 109 ------------------ ...ith this open source to-do list manager.md | 107 +++++++++++++++++ 2 files changed, 107 insertions(+), 109 deletions(-) delete mode 100644 sources/tech/20200117 Get started with this open source to-do list manager.md create mode 100644 translated/tech/20200117 Get started with this open source to-do list manager.md diff --git a/sources/tech/20200117 Get started with this open source to-do list manager.md b/sources/tech/20200117 Get started with this open source to-do list manager.md deleted file mode 100644 index 210c8508c1..0000000000 --- a/sources/tech/20200117 Get started with this open source to-do list manager.md +++ /dev/null @@ -1,109 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with this open source to-do list manager) -[#]: via: (https://opensource.com/article/20/1/open-source-to-do-list) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Get started with this open source to-do list manager -====== -Todo is a powerful way to keep track of your task list. Learn how to use -it in the seventh in our series on 20 ways to be more productive with -open source in 2020. -![Team checklist][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Track your tasks with todo - -Tasks and to-do lists are very near and dear to my heart. I'm a big fan of productivity (so much so that I do a [podcast][2] about it) and try all sorts of different applications. I've even [given presentations][3] and [written articles][4] about them. So it only makes sense that, when I talk about being productive, task and to-do list tools are certain to come up. - -![Getting fancy with Todo.txt][5] - -In all honesty, for being simple, cross-platform, and easily synchronized, you cannot go wrong with [todo.txt][6]. It is one of the two to-do list and task management apps that I keep coming back to over and over again (the other is [Org mode][7]). And what keeps me coming back is that it is simple, portable, understandable, and has many great add-ons that don't break it if one machine has them and the others don't. And since it is a Bash shell script, I have never found a system that cannot support it. - -#### Set up todo.txt - -First things first, you need to install the base shell script and copy the default configuration file to the **~/.todo** directory: - - -``` -git clone -cd todo.txt-cli -make -sudo make install -mkdir ~/.todo -cp todo.cfg ~/.todo/config -``` - -Next, set up the configuration file. I like to uncomment the color settings at this point, but the only thing that must be set up right away is the **TODO_DIR** variable: - - -``` -`export TODO_DIR="$HOME/.todo"` -``` - -#### Add to-do's - -To add your first to-do item, simply type **todo.sh add <NewTodo>**, and it will be added. This will also create three files in **$HOME/.todo/**: todo.txt, done.txt, and reports.txt. - -After adding a few items, run **todo.sh ls** to see your to-do list. - -![Basic todo.txt list][8] - -#### Manage your tasks - -You can improve it a little by prioritizing the items. To add a priority to an item, run **todo.sh pri # A**. The number is the number of the task on the list, and the letter "A" is the priority. You can set the priority as anything from A to Z since that's how it will get sorted. - -To complete a task, run **todo.sh do #** to mark the item done and move the item to done.txt. Running **todo.sh report** will write a count of done and not done items to reports.txt. - -The file format used for all three files is well documented, so you can make changes with your text editor of choice. The basic format of todo.txt is: - - -``` -`(Priority) YYYY-MM-DD Task` -``` - -The date indicates the due date of a task, if one is set. When editing the file manually, just put an "x" in front of the task to mark it as done. Running **todo.sh archive** will move these items to done.txt, and you can work in that text file and archive the done items when you have time. - -#### Set up recurring tasks - -I have a lot of recurring tasks that I need to schedule every day/week/month. - -![Recurring tasks with the ice_recur add-on][9] - -This is where todo.txt's flexibility comes in. By using [add-ons][10] in **~/.todo.actions.d/**, you can add commands and extend the functionality of the base todo.sh. The add-ons are basically scripts that implement specific commands. For recurring tasks, the plugin [ice_recur][11] should fit the bill. By following the instructions on the page, you can set up tasks to recur in a very flexible manner. - -![Todour on MacOS][12] - -There are a lot of add-ons in the directory, including syncing to some cloud services. There are also links to desktop and mobile apps, so you can keep your to-do list with you on the go. - -I've only scratched the surface of todo's functionality, so take some time to dig in and see how powerful this tool is! It really helps me keep on task every day. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/open-source-to-do-list - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) -[2]: https://productivityalchemy.com/ -[3]: https://www.slideshare.net/AllThingsOpen/getting-to-done-on-the-command-line -[4]: https://opensource.com/article/18/2/getting-to-done-agile-linux-command-line -[5]: https://opensource.com/sites/default/files/uploads/productivity_7-1.png -[6]: http://todotxt.org/ -[7]: https://orgmode.org/ -[8]: https://opensource.com/sites/default/files/uploads/productivity_7-2.png (Basic todo.txt list) -[9]: https://opensource.com/sites/default/files/uploads/productivity_7-3.png (Recurring tasks with the ice_recur add-on) -[10]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory -[11]: https://github.com/rlpowell/todo-text-stuff -[12]: https://opensource.com/sites/default/files/uploads/productivity_7-4.png (Todour on MacOS) diff --git a/translated/tech/20200117 Get started with this open source to-do list manager.md b/translated/tech/20200117 Get started with this open source to-do list manager.md new file mode 100644 index 0000000000..5845325fde --- /dev/null +++ b/translated/tech/20200117 Get started with this open source to-do list manager.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with this open source to-do list manager) +[#]: via: (https://opensource.com/article/20/1/open-source-to-do-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +开始使用开源待办清单管理器 +====== +Todo 是跟踪任务列表的强大方法。在我们的 20 个使用开源提升生产力的系列的第七篇文章中了解如何使用它。 +![Team checklist][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 todo 跟踪任务 + +任务和待办事项列表离我很近。我是生产力的狂热粉丝(以至于我为此做了一个[播客][2]),我尝试了各种不同的应用。我甚至为此[做了演讲][3]并[写了些文章][4]。因此,当我谈到提高工作效率时,肯定会出现任务和待办事项清单工具。 + +![Getting fancy with Todo.txt][5] + +说实话,由于简单、跨平台且易于同步,你用 [todo.txt][6] 不会错。它是两个我经常使用的待办列表以及任务管理应用之一(另一个是 [Org mode][7])。让我继续使用它的原因它简单、便携、易于理解,并且有许多很好的附加组件,并且当一台机器有附加组件,而另一台没有,也不会破坏程序。由于它是一个 Bash shell 脚本,我还没发现一个无法支持它的系统。 + +#### 设置 todo.txt + +首先,你需要安装基本 shell 脚本并将默认配置文件复制到 **~/.todo** 目录: + + +``` +git clone +cd todo.txt-cli +make +sudo make install +mkdir ~/.todo +cp todo.cfg ~/.todo/config +``` + +接下来,设置配置文件。此时,我想取消注释颜色设置,但必须马上设置的是 **TODO_DIR** 变量: + + +``` +`export TODO_DIR="$HOME/.todo"` +``` + +#### 添加待办事件 + +要添加第一个待办事件,只需输入 **todo.sh add <NewTodo>** 就能添加。这还将在 **$HOME/.todo/** 中创建三个文件:todo.txt、todo.txt 和 reports.txt。 + +添加几个项目后,运行 **todo.sh ls** 查看你的待办事项。 + +![Basic todo.txt list][8] + +#### 管理任务 + +你可以通过给项目设置优先级来稍微改善它。要向项目添加优先级,运行 **todo.sh pri # A**。数字是列表中任务的数量,而字母 ”A“ 是优先级。你可以将优先级设置为从 A 到 Z,因为这是它的排序方式。 + +要完成任务,运行**todo.sh do #** 来标记项目已完成,并将项目移动到 done.txt。运行 **todo.sh report** 会向 report.txt 写入已完成和未完成项的数量。 + +所有三个文件的格式都有详细记录,因此你可以选择自己的文本编辑器修改。todo.txt 的基本格式是: + + +``` +`(Priority) YYYY-MM-DD Task` +``` + +如果设置了任务,那么日期表示任务的到期日期。手动编辑文件时,只需在任务前面加一个 ”x“ 来标记为已完成。运行 **todo.sh archive** 会将这些项目移动到 done.txt,你可以在该文本文件编辑,并在有时间时将已完成的项目归档。 + +#### 设置重复任务 + +我有很多重复任务,我需要以每天/周/月来计划。 + +![Recurring tasks with the ice_recur add-on][9] + +这就是 todo.txt 的灵活性所在。通过在 **~/.todo.actions.d/** 中使用[附加组件][10],你可以添加命令并扩展基本 todo.sh 的功能。附加组件基本上是实现特定命令的脚本。对于重复执行的任务,插件 [ice_recur][11] 可以满足。按照页面上的说明操作,你可以以非常灵活的方式设置要重复处理的任务。 + +![Todour on MacOS][12] + +目录中有很多附加组件,包括同步到某些云服务。也有链接到桌面或移动端应用的组件,这样你可以随时看到待办列表。 + +我只介绍了这个 todo 功能的表面,所以请花点时间深入了解这个工具的强大!它真的帮助我跟上每天的任务。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-to-do-list + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) +[2]: https://productivityalchemy.com/ +[3]: https://www.slideshare.net/AllThingsOpen/getting-to-done-on-the-command-line +[4]: https://opensource.com/article/18/2/getting-to-done-agile-linux-command-line +[5]: https://opensource.com/sites/default/files/uploads/productivity_7-1.png +[6]: http://todotxt.org/ +[7]: https://orgmode.org/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_7-2.png (Basic todo.txt list) +[9]: https://opensource.com/sites/default/files/uploads/productivity_7-3.png (Recurring tasks with the ice_recur add-on) +[10]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory +[11]: https://github.com/rlpowell/todo-text-stuff +[12]: https://opensource.com/sites/default/files/uploads/productivity_7-4.png (Todour on MacOS) \ No newline at end of file From 38356fac22520e687090afcc34661e06de2a07a3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 21 Jan 2020 09:26:25 +0800 Subject: [PATCH 0341/3057] translating --- ... this Twitter client for Linux to tweet from the terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md index c49b45ace4..1e9eda911f 100644 --- a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md +++ b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ebb37f710d3fd3262a22784f5a893c08b16ce25b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 09:27:45 +0800 Subject: [PATCH 0342/3057] PRF --- .../talk/20191015 How GNOME uses Git.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/talk/20191015 How GNOME uses Git.md b/translated/talk/20191015 How GNOME uses Git.md index e9b82aa7d1..adca6f09e9 100644 --- a/translated/talk/20191015 How GNOME uses Git.md +++ b/translated/talk/20191015 How GNOME uses Git.md @@ -1,42 +1,42 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How GNOME uses Git) [#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) [#]: author: (Molly de Blanc https://opensource.com/users/mollydb) -GNOME 项目是如何使用 Git 的? +一个非技术人员对 GNOME 项目使用 GitLab 的感受 ====== -将 GNOME 项目集中在 GitLab 上的决定为整个社区(不只是开发人员)带来了好处。 +> 将 GNOME 项目集中在 GitLab 上的决定为整个社区(不只是开发人员)带来了好处。 ![red panda][1] -“您的 GitLab 是什么?”这是我在 [GNOME 基金会][2]工作的第一天被问到的第一个问题之一,该基金会是支持 GNOME 项目的非盈利组织,包括[桌面环境][3]、[GTK][4] 和 [GStreamer][5]。此人指的是我在 [GNOME 的 GitLab 实例][6上的用户名。我在 GNOME 期间,经常有人要求我提供我的 GitLab。 +“您的 GitLab 是什么?”这是我在 [GNOME 基金会][2]工作的第一天被问到的第一个问题之一,该基金会是支持 GNOME 项目(包括[桌面环境][3]、[GTK][4] 和 [GStreamer][5])的非盈利组织。此人问的是我在 [GNOME 的 GitLab 实例][6]上的用户名。我在 GNOME 期间,经常有人要求我提供我的 GitLab。 -我们使用 GitLab 进行几乎所有操作。通常情况下,我会收到一些提案和参考错误报告,有时还需要修改文件。我不是以开发人员或系统管理员的身份进行此操作的。我参与了“参与度、包容性和多样性(I&D)”团队。我为 GNOME 朋友们撰写新闻通讯,并采访该项目的贡献者。我为 GNOME 活动提供赞助。我不写代码,但我每天都使用 GitLab。 +我们使用 GitLab 进行几乎所有操作。通常情况下,我会收到一些提案issue和参考错误报告,有时还需要修改文件。我不是以开发人员或系统管理员的身份进行此操作的。我参与了“参与度、包容性和多样性(I&D)”团队。我为 GNOME 朋友们撰写新闻通讯,并采访该项目的贡献者。我为 GNOME 活动提供赞助。我不写代码,但我每天都使用 GitLab。 -在过去的二十年中,GNOME 项目的管理采用了各种方式。该项目的不同部分使用不同的系统来跟踪代码更改、协作以及作为项目和社交空间共享信息。但是,该项目决定,它需要更加一体化,这从构思到完成大约花费了一年的时间。 +在过去的二十年中,GNOME 项目的管理采用了各种方式。该项目的不同部分使用不同的系统来跟踪代码更改、协作以及作为项目和社交空间共享信息。但是,该项目决定,它需要更加地一体化,这从构思到完成大约花费了一年的时间。 -GNOME 希望切换到单个工具供整个社区使用的原因很多。外部项目与 GNOME 息息相关,并为它们提供与资源交互的更简单的方式对于项目至关重要,无论是支持社区还是发展生态系统。我们还希望更好地跟踪 GNOME 的指标,即贡献者的数量、贡献的类型和数量以及项目不同部分的开发进度。 +GNOME 希望切换到单个工具供整个社区使用的原因很多。外部项目与 GNOME 息息相关,并为它们提供更简单的与资源交互的方式对于项目至关重要,无论是支持社区还是发展生态系统。我们还希望更好地跟踪 GNOME 的指标,即贡献者的数量、贡献的类型和数量以及项目不同部分的开发进度。 -当需要选择一种协作工具时,我们考虑了我们需要的东西。最重要的要求之一是它必须由 GNOME 社区托管。由第三方托管并不是一种选择,因此像 GitHub 和 Atlassian 这样的服务就不在考虑之中。而且,当然了,它必须是自由软件。很快,唯一真正的竞争者就是 GitLab。我们希望确保进行贡献很容易。GitLab 具有诸如单点登录的功能,该功能允许人们使用 GitHub、Google、GitLab.com 和 GNOME 帐户登录。 +当需要选择一种协作工具时,我们考虑了我们需要的东西。最重要的要求之一是它必须由 GNOME 社区托管。由第三方托管并不是一种选择,因此像 GitHub 和 Atlassian 这样的服务就不在考虑之中。而且,当然了,它必须是自由软件。很快,唯一真正的竞争者出现了,它就是 GitLab。我们希望确保进行贡献很容易。GitLab 具有诸如单点登录的功能,该功能允许人们使用 GitHub、Google、GitLab.com 和 GNOME 帐户登录。 我们认为 GitLab 是一条出路,我们开始从许多工具迁移到单个工具。GNOME 董事会成员 [Carlos Soriano][7] 领导这项改变。在 GitLab 和 GNOME 社区的大力支持下,我们于 2018 年 5 月完成了该过程。 -人们非常希望迁移到 GitLab 有助于社区的发展,并使贡献更容易。由于 GNOME 以前使用了许多不同的工具,包括 Bugzilla 和 CGit,因此很难定量地评估这次切换对贡献量的影响。但是,我们可以更清楚地跟踪一些统计数据,例如在 2018 年 6 月至 2018 年 11 月之间关闭了近 10,000 个提案,合并了 7,085 个合并请求。人们感到社区在发展壮大,越来越受欢迎,而且贡献实际上也更容易。 +人们非常希望迁移到 GitLab 有助于社区的发展,并使贡献更加容易。由于 GNOME 以前使用了许多不同的工具,包括 Bugzilla 和 CGit,因此很难定量地评估这次切换对贡献量的影响。但是,我们可以更清楚地跟踪一些统计数据,例如在 2018 年 6 月至 2018 年 11 月之间关闭了近 10,000 个提案,合并了 7,085 个合并请求。人们感到社区在发展壮大,越来越受欢迎,而且贡献实际上也更加容易。 人们因不同的原因而开始使用自由软件,重要的是,可以通过为需要软件的人提供更好的资源和更多的支持来公平竞争。Git 作为一种工具已被广泛使用,并且越来越多的人使用这些技能来参与到自由软件当中。自托管的 GitLab 提供了将 Git 的熟悉度与 GitLab 提供的功能丰富、用户友好的环境相结合的绝佳机会。 -已经一年多了,变化确实很明显。持续集成(CI)为开发带来了巨大的好处,并且已经完全集成到 GNOME 的几乎每个部分当中。不进行代码开发的团队也转而使用 GitLab 生态系统进行工作。无论是使用问题跟踪来管理分配的任务,还是使用版本控制来共享和管理资产,就连“参与度、包容性和多样性(I&D)”这样的团队都已经使用了 GitLab。 +切换到 GitLab 已经一年多了,变化确实很明显。持续集成(CI)为开发带来了巨大的好处,并且已经完全集成到 GNOME 的几乎每个部分当中。不进行代码开发的团队也转而使用 GitLab 生态系统进行工作。无论是使用问题跟踪来管理分配的任务,还是使用版本控制来共享和管理资产,就连“参与度、包容性和多样性(I&D)”这样的团队都已经使用了 GitLab。 一个社区,即使是一个正在开发的自由软件,也很难适应新技术或新工具。在类似 GNOME 的情况下,这尤其困难,该项目[最近已经 22 岁了] [8]。像 GNOME 这样经过了 20 多年建设的项目,太多的人和组织使用了太多的部件,但迁移工作之所以能实现,这要归功于 GNOME 社区的辛勤工作和 GitLab 的慷慨帮助。 在为使用 Git 进行版本控制的项目工作时,我发现很方便。这是一个令人感觉舒适和熟悉的系统,是一个在工作场所和爱好项目之间保持一致的工具。作为 GNOME 社区的新成员,能够参与并使用 GitLab 真是太好了。作为社区建设者,看到这样结果是令人鼓舞的:越来越多的相关项目加入并进入生态系统;新的贡献者和社区成员对该项目做出了首次贡献;以及增强了衡量我们正在做的工作以了解其成功和成功的能力。 -如此多的做着完全不同的事情(例如他们正在从事的不同工作以及所使用的不同技能)的团队同意集中在一个工具上(尤其是被认为是跨开源的标准工具),这一点很棒。 作为 GNOME 的贡献者,我真的非常感谢我们使用了 GitLab。 +如此多的做着完全不同的事情(例如他们正在从事的不同工作以及所使用的不同技能)的团队同意汇集在一个工具上(尤其是被认为是跨开源的标准工具),这一点很棒。作为 GNOME 的贡献者,我真的非常感谢我们使用了 GitLab。 -------------------------------------------------------------------------------- @@ -45,7 +45,7 @@ via: https://opensource.com/article/19/10/how-gnome-uses-git 作者:[Molly de Blanc][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8312cbc74e97a06e300817bbd6fb99e1f12a1940 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 09:28:35 +0800 Subject: [PATCH 0343/3057] PUB @wxy https://linux.cn/article-11806-1.html --- {translated/talk => published}/20191015 How GNOME uses Git.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20191015 How GNOME uses Git.md (98%) diff --git a/translated/talk/20191015 How GNOME uses Git.md b/published/20191015 How GNOME uses Git.md similarity index 98% rename from translated/talk/20191015 How GNOME uses Git.md rename to published/20191015 How GNOME uses Git.md index adca6f09e9..d39600f1ef 100644 --- a/translated/talk/20191015 How GNOME uses Git.md +++ b/published/20191015 How GNOME uses Git.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11806-1.html) [#]: subject: (How GNOME uses Git) [#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) [#]: author: (Molly de Blanc https://opensource.com/users/mollydb) From 0ef0271f2d5b900e73321257916bdb2d28a0e11c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 22:48:02 +0800 Subject: [PATCH 0344/3057] PART 4 --- ...e for programming hardware abstractions.md | 117 +++++++++--------- 1 file changed, 57 insertions(+), 60 deletions(-) diff --git a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index fc7077f3c2..6f41779697 100644 --- a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -185,92 +185,89 @@ fn enable_register(&mut reg) { 在上面的代码中,预期结果是什么?好吧,代码会将启用位设置为 0,因为 `10&1 = 0`。那真不幸;最好在尝试写入之前知道你要写入字段的值是否适合该字段。事实上,我会考虑放弃错误字段值的高位*未定义行为*(喘气)。 -### Using Rust with safety in mind +### 出于安全考虑使用 Rust -How can you check that a field's value fits in its prescribed position in a general way? More type-level numbers! - -You can add a `Width` parameter to `Field` and use it to verify that a given value can fit into the field: +如何以一般方式检查字段的值是否适合其规定的位置?需要更多类型级别的数字! +你可以在 `Field` 中添加 `Width` 参数,并使用它来验证给定的值是否适合该字段: ``` -struct Field<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> { -    value: u8, -    _mask: PhantomData<Mask>, -    _offset: PhantomData<Offset>, -    _width: PhantomData<Width>, +struct Field { + value: u8, + _mask: PhantomData, + _offset: PhantomData, + _width: PhantomData, } -type RegEnabled = Field<U1,U1, U0>; -type RegInterrupt = Field<U1, U2, U1>; -type RegKind = Field<U3, op!(U7 << U2), U2>; +type RegEnabled = Field; +type RegInterrupt = Field; +type RegKind = Field; -impl<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> Field<Width, Mask, Offset> { -    fn new(val: u8) -> Option<Self> { -        if val <= (1 << Width::U8) - 1 { -            Some(Field { -                value: (val << Offset::U8) & Mask::U8, -                _mask: PhantomData, -                _offset: PhantomData, -                _width: PhantomData, -            }) -        } else { -            None -        } -    } +impl Field { + fn new(val: u8) -> Option { + if val <= (1 << Width::U8) - 1 { + Some(Field { + value: (val << Offset::U8) & Mask::U8, + _mask: PhantomData, + _offset: PhantomData, + _width: PhantomData, + }) + } else { + None + } + } } ``` -Now you can construct a `Field` only if the given value fits! Otherwise, you have `None`, which signals that an error has occurred, rather than lopping off the high bits of the value and silently writing an unexpected value. +现在,只有给定值适合时,您才能构造一个 `Field`!否则,你将得到 `None` 信号,该信号指示发生了错误,而不是放弃该值的高位并静默写入意外的值。 -Note, though, this will raise an error at runtime. However, we knew the value we wanted to write beforehand, remember? Given that, we can teach the compiler to reject entirely a program which has an invalid field value—we don’t have to wait until we run it! - -This time, you'll add a _trait bound_ (the `where` clause) to a new realization of new, called `new_checked`, that asks the incoming value to be less than or equal to the maximum possible value a field with the given `Width` can hold: +但是请注意,这将在运行时引发错误。但是,我们知道我们想事先写入的值,还记得吗?鉴于此,我们可以教编译器完全拒绝具有无效字段值的程序 —— 我们不必等到运行它! +这次,您将向 `new` 的新实现 `new_checked` 中添加一个特征绑定(`where` 子句),该函数要求输入值小于或等于给定字段用 ``Width` 所控制的最大可能值: ``` -struct Field<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> { -    value: u8, -    _mask: PhantomData<Mask>, -    _offset: PhantomData<Offset>, -    _width: PhantomData<Width>, +struct Field { + value: u8, + _mask: PhantomData, + _offset: PhantomData, + _width: PhantomData, } -type RegEnabled = Field<U1, U1, U0>; -type RegInterrupt = Field<U1, U2, U1>; -type RegKind = Field<U3, op!(U7 << U2), U2>; +type RegEnabled = Field; +type RegInterrupt = Field; +type RegKind = Field; -impl<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> Field<Width, Mask, Offset> { -    const fn new_checked<V: Unsigned>() -> Self -    where -        V: IsLessOrEqual<op!((U1 << Width) - U1), Output = True>, -    { -        Field { -            value: (V::U8 << Offset::U8) & Mask::U8, -            _mask: PhantomData, -            _offset: PhantomData, -            _width: PhantomData, -        } -    } +impl Field { + const fn new_checked() -> Self + where + V: IsLessOrEqual, + { + Field { + value: (V::U8 << Offset::U8) & Mask::U8, + _mask: PhantomData, + _offset: PhantomData, + _width: PhantomData, + } + } } ``` -Only numbers for which this property holds has an implementation of this trait, so if you use a number that does not fit, it will fail to compile. Take a look! - +只有拥有此属性的数字才具有此特征的实现,因此,如果使用不适合的数字,它将无法编译。让我们看一看! ``` -fn enable_register(&mut reg) { -    reg.update(RegEnabled::new_checked::<U10>()); +fn enable_register(&mut reg) { + reg.update(RegEnabled::new_checked::()); } -12 |     reg.update(RegEnabled::new_checked::<U10>()); -   |                           ^^^^^^^^^^^^^^^^ expected struct `typenum::B0`, found struct `typenum::B1` -   | -   = note: expected type `typenum::B0` -           found type `typenum::B1` +12 | reg.update(RegEnabled::new_checked::()); + | ^^^^^^^^^^^^^^^^ expected struct `typenum::B0`, found struct `typenum::B1` + | + = note: expected type `typenum::B0` + found type `typenum::B1` ``` -`new_checked` will fail to produce a program that has an errant too-high value for a field. Your typo won't blow up at runtime because you could never have gotten an artifact to run. +`new_checked` 将无法生成一个程序,因为该字段的值错误地过高。你的输入错误不会在运行时爆炸,因为你永远无法获得一个可以运行的工件。 -You're nearing Peak Rust in terms of how safe you can make memory-mapped hardware interactions. However, what you wrote back in the first example in C was far more succinct than the type parameter salad you ended up with. Is doing such a thing even tractable when you're talking about potentially hundreds or even thousands of registers? +就使内存映射的硬件进行交互的安全性而言,你已经接近 Peak Rust。但是,你在 C 的第一个示例中所写的内容比最终得到的一锅粥类型参数更简洁。当你谈论潜在的数百甚至数千个寄存器时,这样做是否容易处理? ### Just right with Rust: both safe and accessible From 2f6b53dc8c43cbe6b25048d9b8b3ee664674a1d7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 23:43:30 +0800 Subject: [PATCH 0345/3057] PART 5 --- ...e for programming hardware abstractions.md | 199 ++++++++---------- 1 file changed, 90 insertions(+), 109 deletions(-) diff --git a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index 6f41779697..98215f6a9f 100644 --- a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -269,124 +269,119 @@ fn enable_register(&mut reg) { 就使内存映射的硬件进行交互的安全性而言,你已经接近 Peak Rust。但是,你在 C 的第一个示例中所写的内容比最终得到的一锅粥类型参数更简洁。当你谈论潜在的数百甚至数千个寄存器时,这样做是否容易处理? -### Just right with Rust: both safe and accessible +### Rust 恰到好处:既安全又方便使用 -Earlier, I called out calculating masks by hand as being problematic, but I just did that same problematic thing—albeit at the type level. While using such an approach is nice, getting to the point when you can write any code requires quite a bit of boilerplate and manual transcription (I'm talking about the type synonyms here). - -Our team wanted something like the [TockOS mmio registers][7], but one that would generate typesafe implementations with the least amount of manual transcription possible. The result we came up with is a macro that generates the necessary boilerplate to get a Tock-like API plus type-based bounds checking. To use it, write down some information about a register, its fields, their width and offsets, and optional [enum][8]-like values (should you want to give "meaning" to the possible values a field can have): +早些时候,我认为手工计算掩码有问题,但我只是做了同样有问题的事情 —— 尽管是在类型级别。虽然使用这种方法很不错,但要达到编写任何代码的地步,则需要大量样板和手动转录(我在这里谈论的是类型同义词)。 +我们的团队想要像 [TockOS mmio 寄存器][7]之类的东西,但是他们会以最少的手动转录生成类型安全的实现。我们得出的结果是一个宏,该宏生成必要的样板以获得类似 Tock 的 API 以及基于类型的边界检查。 要使用它,请写下一些有关寄存器的信息,其字段、宽度和偏移量以及可选的[枚举][8]类的值(你应该为字段可能具有的值赋予“含义”): ``` register! { -    // The register's name -    Status, -    // The type which represents the whole register. -    u8, -    // The register's mode, ReadOnly, ReadWrite, or WriteOnly. -    RW, -    // And the fields in this register. -    Fields [ -        On    WIDTH(U1) OFFSET(U0), -        Dead  WIDTH(U1) OFFSET(U1), -        Color WIDTH(U3) OFFSET(U2) [ -            Red    = U1, -            Blue   = U2, -            Green  = U3, -            Yellow = U4 -        ] -    ] + // The register's name + Status, + // The type which represents the whole register. + u8, + // The register's mode, ReadOnly, ReadWrite, or WriteOnly. + RW, + // And the fields in this register. + Fields [ + On WIDTH(U1) OFFSET(U0), + Dead WIDTH(U1) OFFSET(U1), + Color WIDTH(U3) OFFSET(U2) [ + Red = U1, + Blue = U2, + Green = U3, + Yellow = U4 + ] + ] } ``` -From this, you can generate register and field types like the previous example where the indices—the `Width`, `Mask`, and `Offset`—are derived from the values input in the `WIDTH` and `OFFSET` sections of a field's definition. Also, notice that all of these numbers are `typenums`; they're going to go directly into your `Field` definitions! - -The generated code provides namespaces for registers and their associated fields through the name given for the register and the fields. That's a mouthful; here's what it looks like: +由此,你可以生成寄存器和字段类型,如上例所示,其中索引:`Width`、`Mask` 和 `Offset` 是从一个字段定义的 `WIDTH` 和 `OFFSET` 部分的输入的值派生的。另外,请注意,所有这些数字都是 “类型数字”;他们将直接进入你的 `Field` 定义! +生成的代码通过为寄存器及字段指定名称来为寄存器及其相关字段提供名称空间。这很绕口,看起来是这样的: ``` mod Status { -    struct Register(u8); -    mod On { -        struct Field; // There is of course more to this definition -    } -    mod Dead { -        struct Field; -    } -    mod Color { -        struct Field; -        pub const Red: Field = Field::<U1>new(); -        // &c. -    } + struct Register(u8); + mod On { + struct Field; // There is of course more to this definition + } + mod Dead { + struct Field; + } + mod Color { + struct Field; + pub const Red: Field = Field::new(); + // &c. + } } ``` -The generated API contains the nominally expected read and write primitives to get at the raw register value, but it also has ways to get a single field's value, do collective actions, and find out if any (or all) of a collection of bits is set. You can read the documentation on the [complete generated API][9]. +生成的 API 包含名义上期望的读取和写入的原语,以获取原始寄存器的值,但它也有办法获取单个字段的值、执行集体操作以及确定是否有任何(或全部)位集合的方法。你可以阅读[完整生成的 API][9]上的文档。 -### Kicking the tires +### 粗略检查 -What does it look like to use these definitions for a real device? Will the code be littered with type parameters, obscuring any real logic from view? +将这些定义用于实际设备会是什么样?代码中是否会充斥着类型参数,从而掩盖了视图中的实际逻辑? -No! By using type synonyms and type inference, you effectively never have to think about the type-level part of the program at all. You get to interact with the hardware in a straightforward way and get those bounds-related assurances automatically. - -Here's an example of a [UART][10] register block. I'll skip the declaration of the registers themselves, as that would be too much to include here. Instead, it starts with a register "block" then helps the compiler know how to look up the registers from a pointer to the head of the block. We do that by implementing `Deref` and `DerefMut`: +不会!通过使用类型同义词和类型推断,你实际上根本不必考虑程序的类型级别部分。你可以直接与硬件交互,并自动获得与边界相关的保证。 +这是一个 [UART] [10] 寄存器块的示例。我将跳过寄存器本身的声明,因为包括在这里就太多了。而是从寄存器“块”开始,然后帮助编译器知道如何从指向该块开头的指针中查找寄存器。我们通过实现 `Deref` 和 `DerefMut` 来做到这一点: ``` #[repr(C)] pub struct UartBlock { -    rx: UartRX::Register, -    _padding1: [u32; 15], -    tx: UartTX::Register, -    _padding2: [u32; 15], -    control1: UartControl1::Register, + rx: UartRX::Register, + _padding1: [u32; 15], + tx: UartTX::Register, + _padding2: [u32; 15], + control1: UartControl1::Register, } pub struct Regs { -    addr: usize, + addr: usize, } impl Deref for Regs { -    type Target = UartBlock; + type Target = UartBlock; -    fn deref(&self) -> &UartBlock { -        unsafe { &*(self.addr as *const UartBlock) } -    } + fn deref(&self) -> &UartBlock { + unsafe { &*(self.addr as *const UartBlock) } + } } impl DerefMut for Regs { -    fn deref_mut(&mut self) -> &mut UartBlock { -        unsafe { &mut *(self.addr as *mut UartBlock) } -    } + fn deref_mut(&mut self) -> &mut UartBlock { + unsafe { &mut *(self.addr as *mut UartBlock) } + } } ``` -Once this is in place, using these registers is as simple as `read()` and `modify()`: - +一旦到位,使用这些寄存器就像 `read()` 和 `modify()` 一样简单: ``` fn main() { -    // A pretend register block. -    let mut x = [0_u32; 33]; + // A pretend register block. + let mut x = [0_u32; 33]; -    let mut regs = Regs { -        // Some shenanigans to get at `x` as though it were a -        // pointer. Normally you'd be given some address like -        // `0xDEADBEEF` over which you'd instantiate a `Regs`. -        addr: &mut x as *mut [u32; 33] as usize, -    }; + let mut regs = Regs { + // Some shenanigans to get at `x` as though it were a + // pointer. Normally you'd be given some address like + // `0xDEADBEEF` over which you'd instantiate a `Regs`. + addr: &mut x as *mut [u32; 33] as usize, + }; -    assert_eq!(regs.rx.read(), 0); + assert_eq!(regs.rx.read(), 0); -    regs.control1 -        .modify(UartControl1::Enable::Set + UartControl1::RecvReadyInterrupt::Set); + regs.control1 + .modify(UartControl1::Enable::Set + UartControl1::RecvReadyInterrupt::Set); -    // The first bit and the 10th bit should be set. -    assert_eq!(regs.control1.read(), 0b_10_0000_0001); + // The first bit and the 10th bit should be set. + assert_eq!(regs.control1.read(), 0b_10_0000_0001); } ``` -When we're working with runtime values we use `Option` like we saw earlier. Here I'm using `unwrap`, but in a real program with unknown inputs, you'd probably want to check that you got a `Some` back from that new call:[1][11],[2][12] - +当我们使用运行时值时,我们使用如前所述的 `Option`。这里我使用的是 `unwrap`,但是在一个实际的输入未知的程序中,你可能想检查一下从新调用中返回的 “Some”: [^1] [^2] ``` fn main() { @@ -405,65 +400,51 @@ fn main() { } ``` -### Decoding failure conditions - -Depending on your personal pain threshold, you may have noticed that the errors are nearly unintelligible. Take a look at a not-so-subtle reminder of what I'm talking about: +### 解码失败条件 +根据你的个人痛苦阈值,你可能已经注意到错误几乎是无法理解的。看一下我在说什么的微妙提醒: ``` -error[E0271]: type mismatch resolving `<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B1>, typenum::B0>, typenum::B0> as typenum::IsLessOrEqual<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B1>, typenum::B0>>>::Output == typenum::B1` -  --> src/main.rs:12:5 -   | -12 |     less_than_ten::<U20>(); -   |     ^^^^^^^^^^^^^^^^^^^^ expected struct `typenum::B0`, found struct `typenum::B1` -   | -   = note: expected type `typenum::B0` -       found type `typenum::B1` +error[E0271]: type mismatch resolving `, typenum::B0>, typenum::B1>, typenum::B0>, typenum::B0> as typenum::IsLessOrEqual, typenum::B0>, typenum::B1>, typenum::B0>>>::Output == typenum::B1` + --> src/main.rs:12:5 + | +12 | less_than_ten::(); + | ^^^^^^^^^^^^^^^^^^^^ expected struct `typenum::B0`, found struct `typenum::B1` + | + = note: expected type `typenum::B0` + found type `typenum::B1` ``` -The `expected typenum::B0 found typenum::B1` part kind of makes sense, but what on earth is the `typenum::UInt<typenum::UInt, typenum::UInt…` nonsense? Well, `typenum` represents numbers as binary [cons][13] cells! Errors like this make it hard, especially when you have several of these type-level numbers confined to tight quarters, to know which number it's talking about. Unless, of course, it's second nature for you to translate baroque binary representations to decimal ones. - -After the `U100`th time attempting to decipher any meaning from this mess, a teammate got Mad As Hell And Wasn't Going To Take It Anymore and made a little utility, `tnfilt`, to parse the meaning out from the misery that is namespaced binary cons cells. `tnfilt` takes the cons cell-style notation and replaces it with sensible decimal numbers. We imagine that others will face similar difficulties, so we shared [`tnfilt`][14]. You can use it like this: +` expected typenum::B0 found typenum::B1` 部分是有意义的,但是 ` typenum::UInt&1 | tnfilt` +$ cargo build 2>&1 | tnfilt ``` -It transforms the output above into something like this: - +它将上面的输出转换为如下所示: ``` -`error[E0271]: type mismatch resolving `>::Output == typenum::B1`` +error[E0271]: type mismatch resolving `>::Output == typenum::B1` ``` -Now _that_ makes sense! +现在*这*很有意义! -### In conclusion +### 结论 -Memory-mapped registers are used ubiquitously when interacting with hardware from software, and there are myriad ways to portray those interactions, each of which has a different place on the spectra of ease-of-use and safety. We found that the use of type-level programming to get compile-time checking on memory-mapped register interactions gave us the necessary information to make safer software. That code is available in the `[bounded-registers][15] crate` (Rust package). +当与软件中的硬件进行交互时,普遍使用内存映射寄存器,并且有无数种方法来描述这些交互,每种方法在易用性和安全性上都有不同的权衡。我们发现使用类型级编程来获取内存映射寄存器交互的编译时检查为我们提供了制作更安全软件的必要信息。该代码可在 [bounded-registers][15] crate(Rust包)中找到。 -Our team started out right at the edge of the more-safe side of that safety spectrum and then tried to figure out how to move the ease-of-use slider closer to the easy end. From those ambitions, `bounded-registers` was born, and we use it anytime we encounter memory-mapped devices in our adventures at Auxon. +我们的团队从安全性较高的一面开始,然后尝试找出如何将易用滑块移近易用端。从这些雄心壮志中,“边界寄存器”就诞生了,我们在 Auxon 冒险中遇到遇到内存映射设备的任何时候都可以使用它。 * * * - 1. Technically, a read from a register field, by definition, will only give a value within the prescribed bounds, but none of us lives in a pure world, and you never know what's going to happen when external systems come into play. You're at the behest of the Hardware Gods here, so instead of forcing you into a "might panic" situation, it gives you the `Option` to handle a "This Should Never Happen" case. - - 2. `get_field` looks a little weird. I'm looking at the `Field::Read` part, specifically. `Field` is a type, and you need an instance of that type to pass to `get_field`. A cleaner API might be something like: - - -``` -`regs.rx.get_field::();` -``` - -But remember that `Field` is a type synonym that has fixed indices for width, offset, etc. To be able to parameterize `get_field` like this, you'd need higher-kinded types. - - - +[^1]: 从技术上讲,从定义上看,从寄存器字段读取的值只能在规定的范围内,但是我们当中没有一个人生活在一个纯净的世界中,而且你永远都不知道外部系统发挥作用时会发生什么。你是在这里接受硬件之神的命令,因此与其强迫你进入“可能的恐慌”状态,还不如给你提供处理“这将永远不会发生”的机会。 +[^2]: `get_field` 看起来有点奇怪。我正在专门查看 `Field::Read` 部分。`Field` 是一种类型,你需要该类型的实例才能传递给 `get_field`。更干净的 API 可能类似于:`regs.rx.get_field::();`但是请记住,`Field` 是类型的同义词,它具有固定的宽度、偏移量等索引。要像这样对 `get_field` 进行参数化,你需要使用更高级的类型。 * * * -_This originally appeared on the [Auxon Engineering blog][16] and is edited and republished with permission._ +此内容最初出现在 [Auxon Engineering 博客] [16]上,并经许可进行编辑和重新发布。 -------------------------------------------------------------------------------- @@ -471,7 +452,7 @@ via: https://opensource.com/article/20/1/c-vs-rust-abstractions 作者:[Dan Pittman][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[wxy](https://github.com/wxy) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 54af0d82109dd2bec8c2d8a94b50f05e295404bc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:55:43 +0800 Subject: [PATCH 0346/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Read?= =?UTF-8?q?=20Reddit=20from=20the=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 Read Reddit from the Linux terminal.md --- ...121 Read Reddit from the Linux terminal.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20200121 Read Reddit from the Linux terminal.md diff --git a/sources/tech/20200121 Read Reddit from the Linux terminal.md b/sources/tech/20200121 Read Reddit from the Linux terminal.md new file mode 100644 index 0000000000..81c7e9d35e --- /dev/null +++ b/sources/tech/20200121 Read Reddit from the Linux terminal.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Read Reddit from the Linux terminal) +[#]: via: (https://opensource.com/article/20/1/open-source-reddit-client) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Read Reddit from the Linux terminal +====== +Take brief mental breaks from your work with Reddit client Tuir in the +eleventh in our series on 20 ways to be more productive with open source +in 2020. +![Digital creative of a browser on the internet][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Read Reddit with Tuir + +Taking short breaks is essential in staying productive. One of the places I like to go when taking a break is [Reddit][2], which can be a great resource if you want it to be. I find all kinds of articles there about DevOps, productivity, Emacs, chickens, and some ChromeOS projects I play with. These discussions can be valuable. I also follow a couple of subreddits that are just pictures of animals because I like pictures of animals (and not just chickens), and sometimes after a long work session, what I really need are kitten pictures. + +![/r/emacs in Tuir][3] + +When I'm reading Reddit (and not just looking at pictures of baby animals), I use [Tuir][4], which stands for Terminal UI for Reddit. Tuir is a feature-complete Reddit client and can be run on any system that runs Python. Installation is done through the pip Python installer and is exceptionally painless. + +On its first run, Tuir will take you to the default article list on Reddit. The top and bottom of the screen have bars that list different commands. The top bar shows your location on Reddit, and the second line shows the commands filtered by the Reddit "Hot/New/Controversial/etc." categories. Filtering is invoked by pressing the number next to the filter you want to use. + +![Filtering by Reddit's "top" category][5] + +You can navigate through the list with the arrow keys, or with the **j**, **k**, **h**, and **l** keys, the same ones you use for Vi/Vim. The bottom bar has commands for navigating the app. If you want to jump to another subreddit, simply hit the **/** key to open a prompt and type the name of the subreddit you want to interact with. + +![Logging in][6] + +Some things aren't accessible unless you are logged in. Tuir will prompt you if you try to do something that requires logging in, like posting a new article (**c**) or up/down voting (**a** and **z**, respectively). To log in, press the **u** key. This will launch a browser to log in via OAuth2, and Tuir will save the token. Afterward, your username should appear in the top-right of the screen. + +Tuir can also launch your browser to view images, load links, and so on. With a little tuning, it can even show images on the terminal (although I didn't manage to get that to work properly). + +Overall, I'm pretty happy with Tuir for quickly catching up on Reddit when I need a break. + +Tuir is one of two forks of the now-defunct [RTV][7]. The other is [TTRV][8], which isn't available via pip (yet) but has the same features. I'm looking forward to seeing how they differentiate themselves over time. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-reddit-client + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://www.reddit.com/ +[3]: https://opensource.com/sites/default/files/uploads/productivity_11-1.png (/r/emacs in Tuir) +[4]: https://gitlab.com/ajak/tuir +[5]: https://opensource.com/sites/default/files/uploads/productivity_11-2.png (Filtering by Reddit's "top" category) +[6]: https://opensource.com/sites/default/files/uploads/productivity_11-3.png (Logging in) +[7]: https://github.com/michael-lazar/rtv +[8]: https://github.com/tildeclub/ttrv From 0d4c1fc5d3a4596d9eaadf4194bec5dc05bb0ef6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:56:31 +0800 Subject: [PATCH 0347/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=2013?= =?UTF-8?q?=20of=20the=20best=20React=20JavaScript=20frameworks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 13 of the best React JavaScript frameworks.md --- ...of the best React JavaScript frameworks.md | 496 ++++++++++++++++++ 1 file changed, 496 insertions(+) create mode 100644 sources/tech/20200121 13 of the best React JavaScript frameworks.md diff --git a/sources/tech/20200121 13 of the best React JavaScript frameworks.md b/sources/tech/20200121 13 of the best React JavaScript frameworks.md new file mode 100644 index 0000000000..e82ef14a8a --- /dev/null +++ b/sources/tech/20200121 13 of the best React JavaScript frameworks.md @@ -0,0 +1,496 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (13 of the best React JavaScript frameworks) +[#]: via: (https://opensource.com/article/20/1/react-javascript-frameworks) +[#]: author: (Amit Dua https://opensource.com/users/amitdua) + +13 of the best React JavaScript frameworks +====== +If you're using React.js or React Native to create user interfaces, try +these frameworks. +![Javascript code close-up with neon graphic overlay][1] + +React.js and React Native are popular open source platforms for developing user interfaces (UIs); both rank well for desirability and use in StackOverflow's 2019 Developer Survey. React.js was developed by Facebook in 2011 as a JavaScript library to address the need for cross-platform, dynamic, and high-performing UIs, while React Native, which Facebook released in 2015, is used for building native applications using JavaScript. + +The following are 13 of the best React JavaScript frameworks; all are open source—the first 11 (like React) are licensed under the MIT license and the latter two are licensed under Apache 2.0. + +### 1\. Create React App + +This command-line interface from Facebook developers is a must-have for every React Native project. The reason is that the [Create React App][2] is easy to use and prevents you from having to manually set up and configure your app, thereby saving you a lot of time and effort. With just a simple command, everything will be ready for you to create a React native project easily. You can use it to build a catalog and files, and the framework also includes tools to build, test, and launch your application. + + +``` +# Install package +$ npm install -g create-react-native-web-app +  +# Run create-react-native-web-app <project-directory> +$ create-react-native-web-app myApp +  +# cd into your <project-directory> +$ cd myApp +  +# Run Web/Ios/Android development +# Web +$ npm run web +  +# IOS (simulator) +$ npm run ios +  +# Android (connected device) +$ npm run android +``` + +#### Why opt for Create React App + + 1. Top-notch tool developed with a configure bundle, transpiler, and test runner + 2. No configuration and no extra files at the app structure + 3. Fixed Development stack + 4. Effective Fast developing tool + + + +### 2\. Material Kit React + +Inspired by Google's Material Design system, [Material Kit React][3] can be an excellent choice for building React UI components. The best thing about this library is that it offers a lot of components that are built to fit together and look incredible. There are over 1,000 fully coded components, and each one comes with separate layers organized in folders. This means you have thousands of options to choose from. There are several example pages as well, in case you want to get inspiration or share an idea or concept with someone. + +#### Installing the Material Kit + + +``` +`  $ npm install @material-ui/core` +``` + +#### Implementation + + +``` +import React from 'react'; +import Button from '@material-ui/core/Button'; + +const App = () => ( +  <Button variant="contained" color="primary"> +    Hello World +  </Button> +); +``` + +The Material-UI component work without any additional setup, and do not pollute the global scope. + +#### Advantage + +The React component supports easier and faster web development. With it, you can build your own design system, or start with Material Design. + +### 3\. Shards React + +This modern React UI kit has been built from scratch to achieve fast performance. It has a modern design system that lets you customize things the way you want. You can even download the source files to customize things at the code level. Also, the SCSS syntax used for styling enhances the development experience. + +[Shards React][4] is based on Shards and uses React Datepicker, React Popper (a positioning engine), and noUISlider. It also supports incredible Material Design icons. There are some pre-made versions to help you gain some inspiration and get started. + +#### Installation Shards with Yarn or NPM + + +``` +# Yarn +yarn add shards-react + +# NPM +npm i shards-react +``` + +#### Advantages + + 1. Shards is lightweight having a small footprint and weighting ~13kb minified and gzipped + 2. Shards is responsive by default being able to adapt and reflow its layout to any screen size + 3. Shards is well documented so you can start building beautiful interfaces as soon as possible + + + +### 4\. Styled Components + +This efficient CSS tool helps build small, reusable components that are responsible for an app's visual interface. With traditional CSS, you can accidentally overwrite the selectors used in other places on the website, but [Styled Components][5] can help you completely avoid this problem by using a CSS syntax directly inside your components. + +#### Installation + + +``` +`npm install --save styled-components` +``` + +#### Implementation + + +``` +const Button = styled.button` +  background: background_type; +  border-radius: radius_value; +  border: abc; +  color: name_of_color; +  Margin: margin_value; +  padding: value; +``` + +#### Advantage + + 1. Make components more readable + 2. Components rely on JavaScript for their style + 3. Build custom components with CSS + 4. Inline styling + 5. Convert component even the custom component to a styled component by simply invoking styled() + + + +### 5\. Redux + +[Redux][6] is a state-management solution for JavaScript applications. While it is mostly used for React.js, you can also use it for other React-like frameworks. + +#### Installation + + +``` +sudo npm install redux +sudo npm install react-redux +``` + +#### Implementation + + +``` +import { createStore } from "redux"; +import rotateReducer from "reducers/rotateReducer"; + +function configureStore(state = { rotating: value}) { +  return createStore(rotateReducer,state); +} + +export default configureStore; +``` + +#### Advantage + + 1. Predictable state update helps in defining the data flow of the application + 2. Logic easier to test and time-travel debugging with reducer functions + 3. Centralizing the state + + + +### 6\. React Virtualized + +This React Native JavaScript framework helps in large-list and tabular-data rendering. Using [React Virtualized][7], you can restrict the number of requests and Document Object Model (DOM) elements, thus enhancing the performance of React apps. + +#### Installation + + +``` +`npm install react-virtualized` +``` + +#### Implementation + + +``` +import 'react-virtualized/styles.css' +import { Column, Table } from 'react-virtualized' +import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer' +import List from 'react-virtualized/dist/commonjs/List' +{ +  alias: { +    'react-virtualized/List': 'react-virtualized/dist/es/List', +  }, +  ...rest +} +``` + +#### Advantages + + 1. Display a large amount of data efficiently + 2. Rendering a huge data set + 3. Implements virtual rendering with a set of components + + + +### 7\. React DnD + +[ReactDnD][8] is responsible for the creation of complex drag-and-drop interfaces. There are dozens of drag-and-drop libraries, but React DnD stands out because it is built on top of modern HTML5's drag-and-drop API, making the process of creating interfaces easy. + +#### Installation + + +``` +`npm install react-dnd-preview` +``` + +#### Implementation + + +``` + import Preview from 'react-dnd-preview'; +  +  const generatePreview = ({itemType, item, style}) => { +    return <div class="item-list" style={style}>{itemType}</div>; +  }; +  +  class App extends React.Component { +    ... +  +    render() { +      return ( +        <DndProvider backend={MyBackend}> +          <ItemList /> +          <Preview generator={generatePreview} /> +          // or +          <Preview>{generatePreview}</Preview> +        </DndProvider> +      ); +    } +  } +``` + +#### Advantages + + 1. Beautiful and natural movement of items bouquet + 2. Powerful keyboard and screen reader support wheelchair + 3. Extremely performant + 4. Clean and powerful api + 5. Plays extremely well with standard browser interactions + 6. Unopinionated styling + 7. No creation of additional wrapper dom nodes + + + +### 8\. React Bootstrap + +This UI Kit library replaces Bootstrap's JavaScript with React, giving you more control over the functions of each component. Because each component is built to be easily accessible, [React Bootstrap][9] can be beneficial for frontend framework building. There are thousands of bootstrap themes to choose from. + +#### Installation + + +``` +`npm install react-bootstrap bootstrap` +``` + +#### Implementation + + +``` +import 'bootstrap/dist/css/bootstrap.min.css'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import './index.css'; +import App from './App'; +import registerServiceWorker from './registerServiceWorker'; + +ReactDOM.render(<App />, document.getElementById('root')); +registerServiceWorker(); +``` + +#### Advantages + + 1. Can easily import required code/component + 2. Saves typing and bugs by compressing the Bootstrap + 3. Reduces typing efforts and conflicts by compressing the Bootstrap + 4. It is easy to use + 5. It encapsulates in elements + + + +### 9\. React Suite + +[React Suite][10] is another efficient React.js framework that contains a wide range of component libraries for enterprise system products. It supports all major browsers and platforms, making it suitable for just about any system. It also supports server-side rendering. + +#### Installation + + +``` +`npm i rsuite --save` +``` + +#### Implementation + + +``` +import { Button } from 'rsuite'; +import 'rsuite/styles/less/index.less'; +ReactDOM.render(<Button>Button</Button>, mountNode); +``` + +#### Advantages + + 1. Easily manage the application easily by the help of global accessing features + 2. Redux library centralizes the state management + 3. Redux is flexible with all the UI layers and has a large ecosystem + 4. Redux reduces this complexity and provides global accessibility + + + +### 10\. PrimeReact + +The best thing about [PrimeReact][11] is that it provides components that cover almost all of a UI's basic requirements, such as input options, menus, data presentations, messages, etc. The framework also pays close attention to the mobile experience, thus helping you design touch-optimized elements. + +#### Installation + + +``` +npm install primereact --save +npm install primeicons --save +``` + +#### Implementation + + +``` +import {Dialog} from 'primereact/dialog'; +import {Accordion,AccordionTab} from 'primereact/accordion'; +dependencies: { +    "react": "^16.0.0", +    "react-dom": "^16.0.0", +    "react-transition-group": "^2.2.1", +    "classnames": "^2.2.5", +    "primeicons": "^2.0.0" +} +``` + +#### Advantages + + 1. Simplicity and Performance + 2. Ease of Use + 3. Spring Applications + 4. Create rich user interfaces + 5. Usability and simplicity + + + +### 11\. React Router + +[React Router][12] is quite popular in the React Native developer community because it is very easy to start working with. All you need is Git and the npm package manager installed on your PC, a basic knowledge of React, and a willingness to learn. There is nothing too complicated. + +#### Installation + + +``` +`$ npm install --save react-router` +``` + +#### Implementation + + +``` +import { Router, Route, Switch } from "react-router"; +  +// using CommonJS modules +var Router = require("react-router").Router; +var Route = require("react-router").Route; +var Switch = require("react-router").Switch; +``` + +#### Advantages + + 1. Dynamic route matching + 2. CSS transitions on views when navigating + 3. Standardized app structure and behavior + + + +### 12\. Grommet + +[Grommet][13] is used for creating responsive and accessible mobile-first web apps. The best thing about this Apache 2.0-licensed JavaScript framework is that it offers accessibility, modularity, responsiveness, and theming in one small package. Perhaps this is one of the major reasons it is widely used by companies like Netflix, GE, Uber, and Boeing. + +#### Installation for yarn and npm + + +``` +` $ npm install grommet styled-components --save` +``` + +#### Implementation + + +``` +"grommet-controls/chartjs": { +          "transform": "grommet-controls/es6/chartjs/${member}", +          "preventFullImport": true, +          "skipDefaultConversion": true +``` + +#### Advantages + + 1. Create one toolkit as a packaged deal + 2. Take the open-door policy to the extreme + 3. Restructuring can help influence an established org + + + +### 13\. Onsen UI + +[Onsen UI][14] is another mobile app development framework that uses HTML5 and JavaScript and offers integration with Angular, Vue, and React. It is licensed under Apache 2.0. + +Onsen offers tabs, a side menu, stack navigation, and other components. The best thing about the framework is that all of its components have iOS and Android Material Design support along with automatic styling, which changes the app's appearance depending on the platform. + +#### Installation + + +``` +`npm install onsenui` +``` + +#### Implementation + + +``` +(function() { +    'use strict'; +    var module = angular.module('app', ['onsen']); + +    module.controller('AppController', function($scope) { +      // more to come here +    }); + +})(); +``` + +#### Advantages + + 1. Onsen UI is built on free and open-source code + 2. Doesn't force any type of DRM on apps developed with it + 3. Compiles JavaScript and HTML5 code + 4. Offers end users the native experience + + + +* * * + +What are your favorite React JavaScript frameworks? Please share them in the comments. + +Learn more about React Native, a framework for building native apps using React and JavaScript. + +Whether you are new to JavaScript or an experienced JavaScript developer, using libraries and... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/react-javascript-frameworks + +作者:[Amit Dua][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/amitdua +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_javascript.jpg?itok=60evKmGl (Javascript code close-up with neon graphic overlay) +[2]: https://github.com/facebook/create-react-app +[3]: https://github.com/creativetimofficial/material-kit-react +[4]: https://github.com/DesignRevision/shards-react +[5]: https://github.com/styled-components/styled-components +[6]: https://github.com/reduxjs/redux +[7]: https://github.com/bvaughn/react-virtualized +[8]: https://github.com/react-dnd/react-dnd/ +[9]: https://github.com/react-bootstrap/react-bootstrap +[10]: https://github.com/rsuite/rsuite +[11]: https://github.com/primefaces/primereact +[12]: https://github.com/ReactTraining/react-router +[13]: https://github.com/grommet/grommet +[14]: https://github.com/OnsenUI/OnsenUI From 98aa3020a33c981fc754a0324537b088cba4053e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:57:00 +0800 Subject: [PATCH 0348/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20What?= =?UTF-8?q?=20you=20need=20to=20know=20about=20System76's=20open=20source?= =?UTF-8?q?=20firmware=20project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 What you need to know about System76-s open source firmware project.md --- ...System76-s open source firmware project.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20200121 What you need to know about System76-s open source firmware project.md diff --git a/sources/tech/20200121 What you need to know about System76-s open source firmware project.md b/sources/tech/20200121 What you need to know about System76-s open source firmware project.md new file mode 100644 index 0000000000..5e391d05c2 --- /dev/null +++ b/sources/tech/20200121 What you need to know about System76-s open source firmware project.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What you need to know about System76's open source firmware project) +[#]: via: (https://opensource.com/article/20/1/system76-open-source-firmware) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +What you need to know about System76's open source firmware project +====== +This Q&A with System76 principal engineer Jeremy Soller discusses the +company's project for an open source embedded controller. +![Person using a laptop][1] + +When you power on your computer, there’s a lot more going on than you might think. One of the most important elements involved is the embedded controller (EC). This is what is responsible for providing abstractions for the battery, charging system, keyboard, touchpad, suspend/resume, and thermal control, among others. These controllers are typically proprietary and usually run proprietary firmware. + +System76 is about to change that paradigm. Recently, the company adopted [coreboot][2] for their Galago Pro and Darter Pro laptop models. Now they intend to extend the open source approach to the EC. There is a project associated with Chrome OS devices called [Chromium EC][3] that is open source; however, it is only available for Chromebooks and specific EC chips. System76 wanted to supply their customers with an open source embedded controller firmware, too. + +They had to start from scratch with a project that can compile for the EC architecture they have in their laptops, the [Intel 8051][4]. Their project for an [open source EC][5], the System76 EC, is a GPLv3-licensed embedded controller firmware for System76 laptops. It is designed to be portable to boards using several 8-bit microcontrollers. This project has grown to the point where it is now possible to boot a System76 Galago Pro and have the battery, keyboard, touchpad, suspend/resume, and thermal control mentioned earlier. + +Eager to learn more, I emailed [Jeremy Soller][6], who is Principal Engineer at System76, for a deeper dive. Below are some highlights from our conversation. + +### Q: What is the importance of the Intel 8051? Do all laptops use that chipset? + +A: The embedded controller in our laptops, the ITE IT8587E, uses the Intel 8051 instruction set. Not all laptops use this instruction set, but many do. This is important because we need a toolchain that can compile firmware for the 8051 instruction set, as well as firmware that is written for that toolchain. + +### Q: What is involved in writing open code to utilize the Intel 8051? + +A: Mostly we have to define the registers for utilizing hardware on the embedded controller. There are protocols like SMBus and PECI that are implemented in hardware and need drivers for them. These drivers often have to be written for each embedded controller to abstract its hardware, so there is a common interface. Our EC firmware has abstractions for some Arduinos as well as the EC in our laptops, so we can write firmware that is portable. + +### Q: Google developed an open EC. Why not fork that project? + +A: Our initial concept was to utilize Chromium EC for our open EC firmware, but this was not possible. After discussions with members of the team at Google working on it, it became clear that the firmware was not capable of being ported to 8-bit microcontrollers like the 8051 used in our EC, or the AVR used in many Arduinos. It was mostly targeted to ARM microcontrollers. We mutually concluded that it was better to start a new project targeting 8-bit microcontrollers, which is a new codebase that is GPLv3, as opposed to the BSD license used by Chromium EC. + +### Q: How significant is it that System76 is open sourcing the code? + +A: The only other x86_64 laptops with open source EC firmware are certain Chromebooks using Chromium EC. However, these laptops have poor support for full desktop Linux distributions such as Ubuntu. We are providing users of our laptops with significant capabilities to view and modify the behavior of the laptop to their needs, all while running a full desktop operating system. When it is paired with our open system firmware, there is very little that a user cannot do with one of these laptops. + +### Q: What implications does open code have for firmware and other developers? + +A: I strongly believe that open EC firmware will be just as important for hardware customization as open system firmware. The user can adjust keyboard mappings, change fan curves, modify battery charging settings, and more. The most exciting thing about this is that I cannot predict all that is possible with this change. Many of the components in the system are tied to the EC firmware. Having the ability to change the EC and system firmware means these components could potentially be modified in a large number of different, unpredictable ways. + +### Q: What is really important about developing software for this EC, and what sets it apart? + +A: Something particularly important is that the EC we are using is the IT8587E, and its instruction set architecture is Intel 8051. Chromium EC cannot be compiled for the 8051, due to being targeted toward 32-bit microcontrollers. Our project aims to support the ubiquitous 8-bit microcontrollers from many vendors, as well as Arduino’s for easy prototyping. In addition, this unifies the work we were doing on [Thelio Io][7] with the work we have done on laptop firmware. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/system76-open-source-firmware + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/article/19/11/coreboot-system76-laptops +[3]: https://chromium.googlesource.com/chromiumos/platform/ec/+/master/README.md +[4]: https://en.wikipedia.org/wiki/Intel_MCS-51 +[5]: https://github.com/system76/ec +[6]: https://www.linkedin.com/in/jeremy-soller-0475a117/ +[7]: https://opensource.com/article/18/11/system76-thelio-desktop-computer From 4f16cc0aa33d7bf3b337f8e4e1d0af79cfecd2ec Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:57:20 +0800 Subject: [PATCH 0349/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Neve?= =?UTF-8?q?r=20enough:=20Working=20openly=20with=20anxiety?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 Never enough- Working openly with anxiety.md --- ...ver enough- Working openly with anxiety.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20200121 Never enough- Working openly with anxiety.md diff --git a/sources/tech/20200121 Never enough- Working openly with anxiety.md b/sources/tech/20200121 Never enough- Working openly with anxiety.md new file mode 100644 index 0000000000..5fb89e3bc1 --- /dev/null +++ b/sources/tech/20200121 Never enough- Working openly with anxiety.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Never enough: Working openly with anxiety) +[#]: via: (https://opensource.com/open-organization/20/1/leading-openly-anxiety) +[#]: author: (Sam Knuth https://opensource.com/users/samfw) + +Never enough: Working openly with anxiety +====== +Open organizations reward initiative. For leaders with anxiety, that may +fuel some exhausting patterns. +![A graph of a wave.][1] + +_Editor's note: This article is part of a series on working with mental health conditions. It details the author's personal experiences and is not meant to convey professional medical advice or guidance._ + +Something in [a recent podcast interview][2] with food writer Melissa Clark caught my ear. Asked if she was a "productive person,'' Clark replied by saying: "I am an anxious person. I have a lot of anxiety, and my way of coping with it is to be very, very busy […]. That's how I deal with the world. I [pause] _do_." + +Clark's point resonated with me, because I live with multiple mental health conditions that have a fundamental impact on how I approach my work. And I believe they've played a role in the career success I've experienced. + +I have [generalized anxiety disorder][3] and [obsessive-compulsive disorder][4] (OCD). Both of these conditions have had serious impacts on my life. Some of those impacts have been disruptive. At the same time, some have contributed positively to my success and my development as a leader in a growing organization. + +I've spent most of my career in an organization built on openness and transparency, and yet I have rarely spoken about my mental health and how it might impact my work. In sharing these stories now, I hope to help reduce the [stigma of mental health at work][5] and connect with others who may be experiencing similar or related situations. Given the prevalence of [mental illness globally][6], chances are good that if you don't experience a mental health condition first hand, then you're likely working on a daily basis with someone who does. + +Learning about how mental illness manifests at work may help you navigate relationships with others as well as your own challenges. As a leader in an open organization, I feel compelled to share my experiences in the hope that they are useful to others. Working openly has specific implications for me—and, I suspect, for others with similar mental health conditions—which I'll detail in this series. + +### How it started + +My anxiety and OCD started shortly after I graduated from college and was living in New York City (though I could probably trace their histories further, this was the moment when they became apparent). The wave of confidence I rode during the dot com boom was crushed in the bubble-bursting crash in March of 2001. The memory of coming into work, being called into an all hands meeting (the first we'd ever had at my small company), and being told that as of today there was no money to make payroll, is etched into my mind. + +My girlfriend and I had just moved into a $2100-per-month apartment. Fear of not being able to pay the rent, or being otherwise swallowed up by the city, resulted in a general sense of unease and nervousness in my gut, combined with very real symptoms of OCD. + +For example, while walking to work at a temp job I took after my company folded, I would wonder if I had remembered to lock the apartment door. I would retrace the steps of my morning routine in my mind, trying to find that moment when I turned the key. If I couldn't specifically remember, the sense of unease and worry in my gut would build to the point that I couldn't think about anything else. Frequently, I would turn around, rush back home, and double check that the door was locked. When I did so, I would have to do something memorable, like repeat a phrase out loud, so that I could mark the moment in my memory. Then, back on the way to work, I would again wonder if I had locked the door, and I could say "Yes, and when you did it, you said out loud 'It's Tuesday morning and I'm locking the door!'" + +I've spent most of my career in an organization built on openness and transparency, and yet I have rarely spoken about my mental health and how it might impact my work. + +### So, how does this translate to an advantage at work? + +One of the primary factors contributing to success at my company is an ability to take initiative. Much work needs to be done, and we're in an environment of continual growth and change—which means it's not always clear _what_ needs to be done or _who_ should be doing it. That creates the opportunity for people to observe a need then step up to fill it. This is true in many open organizations, where everyone, regardless of job title or level, is encouraged to step forward. + +Living with anxiety, I continually feel like I need to be doing something, or worry that I'm not doing enough. This motivates me to seek opportunities for contributing. In other words, the anxiety makes me proactive. Being "proactive" or a "self starter" is something you'll find in the "qualifications" section of many job postings! + +I'm very fortunate to have built my career at a successful company, where continual growth creates financial incentives. One of my largest anxieties is about money—the fear of not having enough of it. Being in a leadership role at a quickly growing, profitable company exponentially multiplies what I call the anxiety performance loop (see Figure 1). A high quarterly bonus or other financial reward for a job well done is an invitation to do more, to raise the bar higher, to double down on the behaviors that seem to provide positive outcomes at work. Quarter after quarter after quarter. + +![][7] + +You can observe in all this a virtuous cycle: Opportunities I find at work satisfy my mental needs, and as a result I experience success and rewards. And this, on the face of it, is true. + +So, what's the problem? + +The anxiety-driven performance loop presents two challenges: it never ends, and it is based on a negative emotional state (fear and worry). + +Perhaps the best phrase to illustrate this would be "What have you done for me lately?" In my mental landscape, this is what everyone is thinking about me all the time. No matter what I achieve, no matter what reward or recognition I receive, I imagine that within minutes the person acknowledging my achievement is thinking, "Now, why are you still sitting there? Get out and go do some more!" + +People are not, of course, really thinking this. But my mind can locate enough truth in it to justify a quick return to the fear of not doing enough, which restarts the cycle. + +The anxiety-driven performance loop presents two challenges: it never ends, and it is based on a negative emotional state (fear and worry). + +We live in a world of short attention spans, high expectations, and significant competitive pressures. All of these are real challenges that fuel the idea that after each accomplishment we need to raise the bar higher and keep going. Having anxiety causes me to internalize these pressures, which triggers the "looping" effect. + +The result is that both my company and my career benefit. Mentally, though, I get exhausted. + +I have developed a few coping mechanisms to help me maintain balance: + + * **Mediation.** After I was first diagnosed with my conditions almost 20 years ago, I saw a therapist. After a round of sessions, the therapist referred me to a mediation center, which opened up a new world of thought for me. I've recently been working to reinvigorate my daily practice. + * **Exercise.** I'm a bit compulsive about exercise. I make time every single day for at least one hour of exercise (for me it's walking, cross country skiing, or running). + * **Self awareness, reality checks, and reminders.** Anxiety and OCD can lead to a distorted view of reality. I may overstate stakes, read too much into other people's motivations, or imagine consequences that are just not realistic. Reminding myself of the _true_ worst case scenario (which usually isn't that bad), realizing that other people have more important things to worry about than me, or reminding myself that this is "just a job" can all help bring me back to a realistic perspective. I also have a few other people who can help with this. + + + +So far I've focused primarily on the performance-enhancing aspects of anxiety. In future articles, I'll discuss some of its performance-reducing aspects, as well as the impact my condition has on my colleagues. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/1/leading-openly-anxiety + +作者:[Sam Knuth][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/samfw +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_wavegraph.png?itok=z4pXCf_c (A graph of a wave.) +[2]: http://www.third-story.com/listen/melissaclark +[3]: https://www.mayoclinic.org/diseases-conditions/generalized-anxiety-disorder/symptoms-causes/syc-20360803 +[4]: https://www.mayoclinic.org/diseases-conditions/obsessive-compulsive-disorder/symptoms-causes/syc-20354432 +[5]: https://www.bloomberg.com/news/articles/2019-11-13/mental-health-is-still-a-don-t-ask-don-t-tell-subject-at-work +[6]: https://ourworldindata.org/mental-health +[7]: https://opensource.com/sites/default/files/images/open-org/anxiety_performance_loop.png From 52ff94e4ead43565dbd8599ebed0134b7f177ac2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:57:58 +0800 Subject: [PATCH 0350/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Beyo?= =?UTF-8?q?nd=20Moore's=20Law:=20Neuromorphic=20computing=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md --- ...ond Moore-s Law- Neuromorphic computing.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md diff --git a/sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md b/sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md new file mode 100644 index 0000000000..cf2595c012 --- /dev/null +++ b/sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Beyond Moore's Law: Neuromorphic computing?) +[#]: via: (https://www.networkworld.com/article/3514692/beyond-moores-law-neuromorphic-computing.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Beyond Moore's Law: Neuromorphic computing? +====== +Some researchers think brain-copying architectures should replace traditional computing. One group explains how that might work. +4x-image / Getty Images + +With the conceivable exhaustion of [Moore’s Law][1] – that the number of transistors on a microchip doubles every two years – the search is on for new paths that lead to reliable incremental processing gains over time. + +One possibility is that machines inspired by how the brain works could take over, fundamentally shifting computing to a revolutionary new tier, according to an explainer study released this month by Applied Physics Reviews. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“Today’s state-of-the-art computers process roughly as many instructions per second as an insect brain,” say [the paper’s][3] authors Jack Kendall, of Rain Neuromorphics, and Suhas Kumar, of Hewlett Packard Labs. The two write that processor architecture must now be completely re-thought if Moore’s law is to be perpetuated, and that replicating the “natural processing system of a [human] brain” is the way forward. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Deep neural networks (DNNs) should be the foundation, the group believes. A DNN is basically dynamic deep learning where layers pull high- and low-level detail features (edges and shapes, for example) from data. Kendall and Kumar explain that a human brain, which DNN copies, can sort through massive datasets and generally identify data  better than a traditional computer, so therefore it should be the starting point. + +This kind of thing is being attempted already. Existing artificial intelligence (AI) is a stab at getting computers to learn like a human brain. Much like the brain, AI engines learn from patterns in data. Algorithms are combined with processing power, and rewards are dished out when the machine gets it right. + +A brain-inspired neuromorphic computer, however, would take computing a step further, the team believes. Neuromorphic computing mimics neuro-biological architectures in a kind of hybrid digital-analog circuit, in a way like a body does biologically. + +The group says that they think there are 10 basics that need to be gotten right to get to this next level: + +**Parellelism** – Similar to how a brain works rapidly, numerous mathematical operations must be made to occur simultaneously. It’s an extension of what we see now in graphical processing units (GPUs) where large scale graphics are created using concurrent calculations called matrix multiplications. + +**In-memory computing** – It wastes resources to fetch data from remote places, and human brains, indeed, don’t do that; they store information in the same synapses that perform the thought. The introduction of electronic processing semiconductors that combine memory – [Memristors –][5] could help here. (I wrote a few weeks ago about [progress being made combining transistors with storage][6]. That combo could have similar resource advantages.) + +**Analog computing** – Numbers are analog, not digital, the authors point out. Most real-world numbers aren’t zeros and ones, so, for efficiency, any new computing architecture needs to accept that concept, adapt and handle the inherent precision problems that result. + +**Plasticity** – Real-time tuning needs to take place to account for things changing. + +**Probabilistic computing** – The authors suggest computers should get less precise, just like the human brain. Coming up with certain degrees of probability is faster than precise calculation, and it requires less information. + +**Scalability** – The depth of the network allows for complexity. By introducing more layers, one gains more scaling. + +**Sparsity** – Large-scale networks, including neural computers, can’t connect every node, just as not all neurons are connected to each other in the brain. It’s a redundancy that wastes resources. Hub-and-spoke topology works better and allows for better scaling. The same should happen in the next computers, the researchers say. + +**Learning (credit assignment)** – The adjustment of synaptic weights (the strength and amount of influence synapses have) needs attention related to new information presented. + +**Causality** – The relationship between cause and effect in a result has to be addressed. Causal interference is a problem, and machine learning generally has had problems with getting this bit right. + +**Nonlinearity** – The brain isn’t linear like a computer is. “The brain operates at the edge of chaos to produce the most optimal learning and computation,” the team says. The next computer architecture needs to encompass that brain-like nonlinearity, but also operate within linearity, like today’s electronics. + +“Our present hardware is not able to keep up,” Kendall and Kumar say in their paper, which also looks at materials. “The future of computing will not be about cramming more components on a chip but in rethinking processor architecture,” which should be neuromorphic. + +**Now see** [10 of the world's fastest supercomputers][7] + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3514692/beyond-moores-law-neuromorphic-computing.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3189051/its-time-to-dump-moores-law-to-advance-computing-researcher-says.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://aip.scitation.org/doi/10.1063/1.5129306 +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/2931818/brain-uploads-coming-as-pcs-get-more-powerful.html +[6]: https://www.networkworld.com/article/3510638/researchers-aim-to-build-transistors-that-can-compute-and-store-information-in-one-component.html +[7]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From b1498b9516849ebc7738b52927f2315c35caa130 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 22 Jan 2020 09:17:27 +0800 Subject: [PATCH 0351/3057] translated --- ...our activities with this Python program.md | 77 ------------------- ...our activities with this Python program.md | 75 ++++++++++++++++++ 2 files changed, 75 insertions(+), 77 deletions(-) delete mode 100644 sources/tech/20200118 Keep a journal of your activities with this Python program.md create mode 100644 translated/tech/20200118 Keep a journal of your activities with this Python program.md diff --git a/sources/tech/20200118 Keep a journal of your activities with this Python program.md b/sources/tech/20200118 Keep a journal of your activities with this Python program.md deleted file mode 100644 index bfa79a8893..0000000000 --- a/sources/tech/20200118 Keep a journal of your activities with this Python program.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Keep a journal of your activities with this Python program) -[#]: via: (https://opensource.com/article/20/1/python-journal) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Keep a journal of your activities with this Python program -====== -Jrnl creates a searchable, timestamped, exportable, and (if you want) -encrypted log of your daily activities. Learn more in the eighth in our -series on 20 ways to be more productive with open source in 2020. -![Writing in a notebook][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Journaling with jrnl - -At my workplace, many of us post an "end of day" status to Slack before we leave for the day. With a lot of projects going on and a global team, it is a pretty good way to share what you got done, what isn't done, and what you need help with. But some days are so busy, so hectic that I can't remember what I did. And this is where journaling comes in. - -![jrnl][2] - -It's pretty easy to keep a text editor open and just add a line when you do something. But it can be challenging to go back and figure out when you make a particular note or pull out related lines quickly and easily. Fortunately, [jrnl][3] is here to help. - -Jrnl allows you to enter a quick entry from your command line, search past entries, and export to rich text formats like HTML and Markdown. You can have multiple journals, meaning you can keep your work entries separated from private ones. It stores entries as plain text, so even if jrnl stops working, you have your data. - -Since jrnl is a Python program, the easiest way to install it is with **pip3 install jrnl**; this will make sure you get the latest and greatest version. On its first run, it will ask some questions, and then you are good to go. - -![jrnl's first run][4] - -Now, whenever you need to make a note or log work, simply type **jrnl <some text>,** and it will be logged with a timestamp to the default file. You can search for entries on a specific date with **jrnl -on YYYY-MM-DD**, entries since a date with **jrnl -from YYYY-MM-DD**, and entries up to a specific date with **jrnl -to YYYY-MM-DD**. Search terms can be combined with the **-and** parameter, allowing for searches like **jrnl -from 2019-01-01 -and -to 2019-12-31**. - -You can also edit entries in the journal with the **\--edit** command-line flag. Before you do, set up your default editor for entries by editing the file **~/.config/jrnl/jrnl.yaml**. This is also where you can specify what files to use for journals, what special character to use for tags, and a few other options. Right now, the important thing is to set the editor. I use Vim, and jrnl's documentation has some [helpful hints][5] for using other editors like VSCode and Sublime Text. - -![Example jrnl config file][6] - -Jrnl can also encrypt journal files. By setting the global **encrypt** variable, you'll tell jrnl to encrypt all the journals you have defined. Encryption can also be set per file by adding **encrypt: true** to the definition in the configuration file. - - -``` -journals: -  default: ~/journals/journal.txt -  work: ~/journals/work.txt -  private: -    journal: ~/journals/private.txt -    encrypt: true -``` - -If a journal isn't already encrypted, you will be prompted for the password on any actions for that journal. The journal file will be stored encrypted on disk and safe from prying eyes. [The jrnl documentation][7] has a lot more information on how it works, what ciphers it uses, and so on. - -![Encrypted jrnl file][8] - -Journaling helps me remember what I did when and find it later when I need it. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/python-journal - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook) -[2]: https://opensource.com/sites/default/files/uploads/productivity_8-1.png (jrnl) -[3]: https://jrnl.sh/ -[4]: https://opensource.com/sites/default/files/uploads/productivity_8-2.png (jrnl's first run) -[5]: https://jrnl.sh/recipes/#external-editors -[6]: https://opensource.com/sites/default/files/uploads/productivity_8-3.png (Example jrnl config file) -[7]: https://jrnl.sh/encryption/ -[8]: https://opensource.com/sites/default/files/uploads/productivity_8-4.png (Encrypted jrnl file) diff --git a/translated/tech/20200118 Keep a journal of your activities with this Python program.md b/translated/tech/20200118 Keep a journal of your activities with this Python program.md new file mode 100644 index 0000000000..ef9d39a396 --- /dev/null +++ b/translated/tech/20200118 Keep a journal of your activities with this Python program.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keep a journal of your activities with this Python program) +[#]: via: (https://opensource.com/article/20/1/python-journal) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用这个 Python 程序记录你的活动 +====== +Jrnl 可以创建可搜索、带时间戳、可导出、加密的(如果需要)的日常活动日志。在我们的 20 个使用开源提升生产力的系列的第八篇文章中了解更多。 +![Writing in a notebook][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 jrnl 记录日志 + +在我的公司,许多人会在下班之前发送一个“一天结束”的状态。在有着许多项目和全球化的团队里,这是一个分享你已完成、未完成以及你需要哪些帮助的一个很好的方式。但有时候我太忙了,以至于我忘了做了什么。这时候就需要记录日志了。 + +![jrnl][2] + +打开一个文本编辑器并在你做一些事的时候添加一行很容易。但是在需要找出你在什么时候做的笔记,或者要快速提取相关的行时会有挑战。幸运的是,[jrnl][3] 可以提供帮助,。 + +Jrnl 能让你在命令行中快速输入条目、搜索过去的条目并导出为 HTML 和 Markdown 等富文本格式。你可以有多个日志,这意味着你可以将工作条目与私有条目分开。它将条目存储为纯文本,因此即使 jrnl 停止工作,数据也不会丢失。 + +由于 jrnl 是一个 Python 程序,最简单的安装方法是使用 **pip3 install jrnl**。这将确保你获得最新和最好的版本。第一次运行它会询问一些问题,接下来就能正常使用。 + +![jrnl's first run][4] + +现在,每当你需要做笔记或记录日志时,只需输入 **jrnl <some text>**,它将带有时间戳的记录保存到默认文件中。你可以使用 **jrnl -on YYYY-MM-DD** 搜索特定日期条目,**jrnl -from YYYY-MM-DD** 搜索在那日期之后的条目,以及用 **jrnl -to YYYY-MM-DD** 搜索自那日期之后的条目。搜索词可以与 **-and** 参数结合使用,允许像 **jrnl -from 2019-01-01 -and -to 2019-12-31** 这类搜索。 + +你还可以使用 **\--edit** 标志编辑日志中的条目。开始之前,通过编辑文件 **~/.config/jrnl/jrnl.yaml** 来设置默认编辑器。你还可以指定使用什么日志文件、用于标签的特殊字符以及一些其他选项。现在,重要的是设置编辑器。我使用 Vim,jrnl 的文档中有一些使用其他编辑器如 VSCode 和 Sublime Text 的[有用提示][5] + +![Example jrnl config file][6] + +Jrnl 还可以加密日志文件。通过设置全局 **encrypt** 变量,你将告诉 jrnl 加密你定义的所有日志。还可在配置文件中的每个文件中设置 **encrypt: true** 来加密文件。 + + +``` +journals: +  default: ~/journals/journal.txt +  work: ~/journals/work.txt +  private: +    journal: ~/journals/private.txt +    encrypt: true +``` + +如果日志尚未加密,系统将提示你输入对它任何操作的密码。日志文件将加密保存在磁盘上,并免受窥探。[jrnl 文档][7] 中包含其工作原理、使用哪些加密方式等的更多信息。 + +![Encrypted jrnl file][8] + +日志记录帮助我记住什么时候做了什么事,并在我需要的时候能够找到它。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/python-journal + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook) +[2]: https://opensource.com/sites/default/files/uploads/productivity_8-1.png (jrnl) +[3]: https://jrnl.sh/ +[4]: https://opensource.com/sites/default/files/uploads/productivity_8-2.png (jrnl's first run) +[5]: https://jrnl.sh/recipes/#external-editors +[6]: https://opensource.com/sites/default/files/uploads/productivity_8-3.png (Example jrnl config file) +[7]: https://jrnl.sh/encryption/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_8-4.png (Encrypted jrnl file) From 31d0d65c6842a5069beb2ed02e8af31c1b94aa56 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 22 Jan 2020 09:23:10 +0800 Subject: [PATCH 0352/3057] translating --- .../20200116 3 open source tools to manage your contacts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200116 3 open source tools to manage your contacts.md b/sources/tech/20200116 3 open source tools to manage your contacts.md index eeb7877de1..e763954bcc 100644 --- a/sources/tech/20200116 3 open source tools to manage your contacts.md +++ b/sources/tech/20200116 3 open source tools to manage your contacts.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d873de95346783768a34688fb1c3a82ef9f2b2f8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 22 Jan 2020 11:08:04 +0800 Subject: [PATCH 0353/3057] Rename sources/tech/20200121 What you need to know about System76-s open source firmware project.md to sources/talk/20200121 What you need to know about System76-s open source firmware project.md --- ... need to know about System76-s open source firmware project.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200121 What you need to know about System76-s open source firmware project.md (100%) diff --git a/sources/tech/20200121 What you need to know about System76-s open source firmware project.md b/sources/talk/20200121 What you need to know about System76-s open source firmware project.md similarity index 100% rename from sources/tech/20200121 What you need to know about System76-s open source firmware project.md rename to sources/talk/20200121 What you need to know about System76-s open source firmware project.md From a17fbce9ec61adcbdd960c6e67b470a73a84c79a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 11:24:07 +0800 Subject: [PATCH 0354/3057] PRF @geekpi --- ...200114 Organize your email with Notmuch.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/translated/tech/20200114 Organize your email with Notmuch.md b/translated/tech/20200114 Organize your email with Notmuch.md index 1d81905ea3..41467a81a3 100644 --- a/translated/tech/20200114 Organize your email with Notmuch.md +++ b/translated/tech/20200114 Organize your email with Notmuch.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Organize your email with Notmuch) @@ -9,8 +9,10 @@ 使用 Notmuch 组织你的邮件 ====== -Notmuch 索引、标记和排序电子邮件。在我们的 20 个使用开源提升生产力的系列的第四篇文章中了解该如何使用。 -![Filing cabinet for organization][1] + +> Notmuch 可以索引、标记和排序电子邮件。在我们的 20 个使用开源提升生产力的系列的第四篇文章中了解该如何使用它。 + +![](https://img.linux.net.cn/data/attachment/album/202001/22/112231xg5dgv6f6g5a1iv1.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 @@ -26,12 +28,11 @@ Notmuch 索引、标记和排序电子邮件。在我们的 20 个使用开源 ![Notmuch's first run][7] -Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 **.notmuch-config** 文件。接下来,运行 **notmuch new** 来索引并标记所有邮件。你可以使用 **notmuch search tag:new** 进行验证,它会找到所有带有 “new” 标签的消息。这可能会有很多邮件,因为 Notmuch 使用 “new” 标签来指示新邮件,因此你需要对其进行清理。 +Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 `.notmuch-config` 文件。接下来,运行 `notmuch new` 来索引并标记所有邮件。你可以使用 `notmuch search tag:new` 进行验证,它会找到所有带有 `new` 标签的消息。这可能会有很多邮件,因为 Notmuch 使用 `new` 标签来指示新邮件,因此你需要对其进行清理。 -运行 **notmuch search tag:unread** 来查找未读消息,这会减少很多邮件。要从你已阅读的消息中删除 “new” 标签,请运行 **notmuch tag -new not tag:unread**,它将搜索所有没有 “unread” 标签的消息,并从其中删除 “new” 标签。现在,当你运行 **notmuch search tag:new**时,它将仅显示未读邮件。 - -但是,批量标记消息可能更有用,因为在每次运行时手动更新标记可能非常繁琐。**\--batch** 命令行选项告诉 Notmuch 读取多行命令并执行它们。还有一个 **\--input=filename** 选项,该选项从文件中读取命令并应用它们。我有一个名为 **tagmail.notmuch** 的文件,用于给”新“邮件添加标签;它看起来像这样: +运行 `notmuch search tag:unread` 来查找未读消息,这会减少很多邮件。要从你已阅读的消息中删除 `new` 标签,请运行 `notmuch tag -new not tag:unread`,它将搜索所有没有 `unread` 标签的消息,并从其中删除 `new` 标签。现在,当你运行 `notmuch search tag:new` 时,它将仅显示未读邮件。 +但是,批量标记消息可能更有用,因为在每次运行时手动更新标记可能非常繁琐。`--batch` 命令行选项告诉 Notmuch 读取多行命令并执行它们。还有一个 `--input=filename` 选项,该选项从文件中读取命令并应用它们。我有一个名为 `tagmail.notmuch` 的文件,用于给“新”邮件添加标签;它看起来像这样: ``` # Manage sent, spam, and trash folders @@ -49,9 +50,9 @@ Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 -new tag:new ``` -我可以在运行 **notmuch new** 后运行 **notmuch tag --input=tagmail.notmuch** 批量处理我的邮件,之后我也可以搜索这些标签。 +我可以在运行 `notmuch new` 后运行 `notmuch tag --input=tagmail.notmuch` 批量处理我的邮件,之后我也可以搜索这些标签。 -Notmuch 还支持 pre-new 和 post-new 钩子。这些脚本存放在 **Maildir/.notmuch/hooks** 中,它们定义了在使用 **notmuch new** 索引新邮件之前(pre-new)和之后(post-new)要做的操作。在昨天的文章中,我谈到了使用 [OfflineIMAP][8] 同步来自 IMAP 服务器的邮件。从 “pre-new” 钩子运行它非常容易: +Notmuch 还支持 `pre-new` 和 `post-new` 钩子。这些脚本存放在 `Maildir/.notmuch/hooks` 中,它们定义了在使用 `notmuch new` 索引新邮件之前(`pre-new`)和之后(`post-new`)要做的操作。在昨天的文章中,我谈到了使用 [OfflineIMAP][8] 同步来自 IMAP 服务器的邮件。从 `pre-new` 钩子运行它非常容易: ``` @@ -63,8 +64,7 @@ notmuch tag -new tag:new offlineimap -a LocalSync -u quiet ``` -你还可以使用可以操作 Notmuch 数据库的 Python 应用 [afew][9],来为你标记_邮件列表_和_垃圾邮件_。你可以用类似的方法在 post-new 钩子中使用 afew: - +你还可以使用可以操作 Notmuch 数据库的 Python 应用 [afew][9],来为你标记*邮件列表*和*垃圾邮件*。你可以用类似的方法在 `post-new` 钩子中使用 `afew`: ``` #!/bin/bash @@ -75,7 +75,7 @@ notmuch tag --input=~/tagmail.notmuch afew -t -n ``` -我建议你在使用 afew 标记邮件时,不要使用 **[ListMailsFilter]**,因为某些邮件处理程序会在邮件中添加模糊或者完全的垃圾列表中的标头(我说的是你 Google)。 +我建议你在使用 `afew` 标记邮件时,不要使用 `[ListMailsFilter]`,因为某些邮件处理程序会在邮件中添加模糊或者彻头彻尾是垃圾的列表标头(我说的就是你 Google)。 ![alot email client][10] @@ -90,14 +90,14 @@ via: https://opensource.com/article/20/1/organize-email-notmuch 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/ksonney [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) -[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[2]: https://linux.cn/article-11804-1.html [3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch) [4]: https://en.wikipedia.org/wiki/Maildir [5]: https://notmuchmail.org/ From c9ed6792836850877c48c39be0088497a7671986 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 22 Jan 2020 11:30:45 +0800 Subject: [PATCH 0355/3057] Rename sources/tech/20200121 Never enough- Working openly with anxiety.md to sources/talk/20200121 Never enough- Working openly with anxiety.md --- .../20200121 Never enough- Working openly with anxiety.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200121 Never enough- Working openly with anxiety.md (100%) diff --git a/sources/tech/20200121 Never enough- Working openly with anxiety.md b/sources/talk/20200121 Never enough- Working openly with anxiety.md similarity index 100% rename from sources/tech/20200121 Never enough- Working openly with anxiety.md rename to sources/talk/20200121 Never enough- Working openly with anxiety.md From 3260bfae7acce228ee6fe4e61a209f218ba63a1c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 11:42:23 +0800 Subject: [PATCH 0356/3057] PUB @geekpi https://linux.cn/article-11807-1.html --- .../20200114 Organize your email with Notmuch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200114 Organize your email with Notmuch.md (98%) diff --git a/translated/tech/20200114 Organize your email with Notmuch.md b/published/20200114 Organize your email with Notmuch.md similarity index 98% rename from translated/tech/20200114 Organize your email with Notmuch.md rename to published/20200114 Organize your email with Notmuch.md index 41467a81a3..dc9a67f7d6 100644 --- a/translated/tech/20200114 Organize your email with Notmuch.md +++ b/published/20200114 Organize your email with Notmuch.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11807-1.html) [#]: subject: (Organize your email with Notmuch) [#]: via: (https://opensource.com/article/20/1/organize-email-notmuch) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From af07e34d55fd86693675a397cdea5adfd907deda Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 11:56:12 +0800 Subject: [PATCH 0357/3057] APL --- ...0190619 Getting started with OpenSSL- Cryptography basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md index 0f3da1b13e..02d9f6f004 100644 --- a/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ b/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c8ba19eaaa506838d57191c97fd5a02028d47aab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 14:28:38 +0800 Subject: [PATCH 0358/3057] PART 1 --- ...arted with OpenSSL- Cryptography basics.md | 342 ------------------ ...arted with OpenSSL- Cryptography basics.md | 341 +++++++++++++++++ 2 files changed, 341 insertions(+), 342 deletions(-) delete mode 100644 sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md create mode 100644 translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md diff --git a/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md deleted file mode 100644 index 02d9f6f004..0000000000 --- a/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ /dev/null @@ -1,342 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with OpenSSL: Cryptography basics) -[#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-1) -[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen) - -Getting started with OpenSSL: Cryptography basics -====== -Need a primer on cryptography basics, especially regarding OpenSSL? Read -on. -![A lock on the side of a building][1] - -This article is the first of two on cryptography basics using [OpenSSL][2], a production-grade library and toolkit popular on Linux and other systems. (To install the most recent version of OpenSSL, see [here][3].) OpenSSL utilities are available at the command line, and programs can call functions from the OpenSSL libraries. The sample program for this article is in C, the source language for the OpenSSL libraries. - -The two articles in this series cover—collectively—cryptographic hashes, digital signatures, encryption and decryption, and digital certificates. You can find the code and command-line examples in a ZIP file from [my website][4]. - -Let’s start with a review of the SSL in the OpenSSL name. - -### A quick history - -[Secure Socket Layer (SSL)][5] is a cryptographic protocol that [Netscape][6] released in 1995. This protocol layer can sit atop HTTP, thereby providing the _S_ for _secure_ in HTTPS. The SSL protocol provides various security services, including two that are central in HTTPS: - - * Peer authentication (aka mutual challenge): Each side of a connection authenticates the identity of the other side. If Alice and Bob are to exchange messages over SSL, then each first authenticates the identity of the other. - * Confidentiality: A sender encrypts messages before sending these over a channel. The receiver then decrypts each received message. This process safeguards network conversations. Even if eavesdropper Eve intercepts an encrypted message from Alice to Bob (a _man-in-the-middle_ attack), Eve finds it computationally infeasible to decrypt this message. - - - -These two key SSL services, in turn, are tied to others that get less attention. For example, SSL supports message integrity, which assures that a received message is the same as the one sent. This feature is implemented with hash functions, which likewise come with the OpenSSL toolkit. - -SSL is versioned (e.g., SSLv2 and SSLv3), and in 1999 Transport Layer Security (TLS) emerged as a similar protocol based upon SSLv3. TLSv1 and SSLv3 are alike, but not enough so to work together. Nonetheless, it is common to refer to SSL/TLS as if they are one and the same protocol. For example, OpenSSL functions often have SSL in the name even when TLS rather than SSL is in play. Furthermore, calling OpenSSL command-line utilities begins with the term **openssl**. - -The documentation for OpenSSL is spotty beyond the **man** pages, which become unwieldy given how big the OpenSSL toolkit is. Command-line and code examples are one way to bring the main topics into focus together. Let’s start with a familiar example—accessing a web site with HTTPS—and use this example to pick apart the cryptographic pieces of interest. - -### An HTTPS client - -The **client** program shown here connects over HTTPS to Google: - - -``` -/* compilation: gcc -o client client.c -lssl -lcrypto */ - -#include <stdio.h> - -#include <stdlib.h> - -#include <openssl/bio.h> /* BasicInput/Output streams */ - -#include <openssl/err.h> /* errors */ - -#include <openssl/ssl.h> /* core library */ - -#define BuffSize 1024 - -void report_and_exit(const char* msg) { -  [perror][7](msg); -  ERR_print_errors_fp(stderr); -  [exit][8](-1); -} - -void init_ssl() { -  SSL_load_error_strings(); -  SSL_library_init(); -} - -void cleanup(SSL_CTX* ctx, BIO* bio) { -  SSL_CTX_free(ctx); -  BIO_free_all(bio); -} - -void secure_connect(const char* hostname) { -  char name[BuffSize]; -  char request[BuffSize]; -  char response[BuffSize]; - -  const SSL_METHOD* method = TLSv1_2_client_method(); -  if (NULL == method) report_and_exit("TLSv1_2_client_method..."); - -  SSL_CTX* ctx = SSL_CTX_new(method); -  if (NULL == ctx) report_and_exit("SSL_CTX_new..."); - -  BIO* bio = BIO_new_ssl_connect(ctx); -  if (NULL == bio) report_and_exit("BIO_new_ssl_connect..."); - -  SSL* ssl = NULL; - -  /* link bio channel, SSL session, and server endpoint */ - -  [sprintf][9](name, "%s:%s", hostname, "https"); -  BIO_get_ssl(bio, &ssl); /* session */ -  SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* robustness */ -  BIO_set_conn_hostname(bio, name); /* prepare to connect */ - -  /* try to connect */ -  if (BIO_do_connect(bio) <= 0) { -    cleanup(ctx, bio); -    report_and_exit("BIO_do_connect..."); -  } - -  /* verify truststore, check cert */ -  if (!SSL_CTX_load_verify_locations(ctx, -                                      "/etc/ssl/certs/ca-certificates.crt", /* truststore */ -                                      "/etc/ssl/certs/")) /* more truststore */ -    report_and_exit("SSL_CTX_load_verify_locations..."); - -  long verify_flag = SSL_get_verify_result(ssl); -  if (verify_flag != X509_V_OK) -    [fprintf][10](stderr, -            "##### Certificate verification error (%i) but continuing...\n", -            (int) verify_flag); - -  /* now fetch the homepage as sample data */ -  [sprintf][9](request, -          "GET / HTTP/1.1\x0D\x0AHost: %s\x0D\x0A\x43onnection: Close\x0D\x0A\x0D\x0A", -          hostname); -  BIO_puts(bio, request); - -  /* read HTTP response from server and print to stdout */ -  while (1) { -    [memset][11](response, '\0', sizeof(response)); -    int n = BIO_read(bio, response, BuffSize); -    if (n <= 0) break; /* 0 is end-of-stream, < 0 is an error */ -  [puts][12](response); -  } - -  cleanup(ctx, bio); -} - -int main() { -  init_ssl(); - -  const char* hostname = "www.google.com:443"; -  [fprintf][10](stderr, "Trying an HTTPS connection to %s...\n", hostname); -  secure_connect(hostname); - -return 0; -} -``` - -This program can be compiled and executed from the command line (note the lowercase L in **-lssl** and **-lcrypto**): - -**gcc** **-o** **client client.c -lssl** **-lcrypto** - -This program tries to open a secure connection to the web site [www.google.com][13]. As part of the TLS handshake with the Google web server, the **client** program receives one or more digital certificates, which the program tries (but, on my system, fails) to verify. Nonetheless, the **client** program goes on to fetch the Google homepage through the secure channel. This program depends on the security artifacts mentioned earlier, although only a digital certificate stands out in the code. The other artifacts remain behind the scenes and are clarified later in detail. - -Generally, a client program in C or C++ that opened an HTTP (non-secure) channel would use constructs such as a _file descriptor_ for a _network socket_, which is an endpoint in a connection between two processes (e.g., the client program and the Google web server). A file descriptor, in turn, is a non-negative integer value that identifies, within a program, any file-like construct that the program opens. Such a program also would use a structure to specify details about the web server’s address. - -None of these relatively low-level constructs occurs in the client program, as the OpenSSL library wraps the socket infrastructure and address specification in high-level security constructs. The result is a straightforward API. Here’s a first look at the security details in the example **client** program. - - * The program begins by loading the relevant OpenSSL libraries, with my function **init_ssl** making two calls into OpenSSL: - -**SSL_library_init(); SSL_load_error_strings();** - - * The next initialization step tries to get a security _context_, a framework of information required to establish and maintain a secure channel to the web server. **TLS 1.2** is used in the example, as shown in this call to an OpenSSL library function: - -**const SSL_METHOD* method = TLSv1_2_client_method(); /* TLS 1.2 */** - -If the call succeeds, then the **method** pointer is passed to the library function that creates the context of type **SSL_CTX**: - -**SSL_CTX*** **ctx** **= SSL_CTX_new(method);** - -The **client** program checks for errors on each of these critical library calls, and then the program terminates if either call fails. - - * Two other OpenSSL artifacts now come into play: a security session of type **SSL**, which manages the secure connection from start to finish; and a secured stream of type **BIO** (Basic Input/Output), which is used to communicate with the web server. The **BIO** stream is generated with this call: - -**BIO* bio = BIO_new_ssl_connect(ctx);** - -Note that the all-important context is the argument. The **BIO** type is the OpenSSL wrapper for the **FILE** type in C. This wrapper secures the input and output streams between the **client** program and Google's web server. - - * With the **SSL_CTX** and **BIO** in hand, the program then links these together in an **SSL** session. Three library calls do the work: - -**BIO_get_ssl(bio, &ssl); /* get a TLS session */** - -**SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* for robustness */** - -**BIO_set_conn_hostname(bio, name); /* prepare to connect to Google */** - -The secure connection itself is established through this call: - -**BIO_do_connect(bio);** - -If this last call does not succeed, the **client** program terminates; otherwise, the connection is ready to support a confidential conversation between the **client** program and the Google web server. - - - - -During the handshake with the web server, the **client** program receives one or more digital certificates that authenticate the server’s identity. However, the **client** program does not send a certificate of its own, which means that the authentication is one-way. (Web servers typically are configured _not_ to expect a client certificate.) Despite the failed verification of the web server’s certificate, the **client** program continues by fetching the Google homepage through the secure channel to the web server. - -Why does the attempt to verify a Google certificate fail? A typical OpenSSL installation has the directory **/etc/ssl/certs**, which includes the **ca-certificates.crt** file. The directory and the file together contain digital certificates that OpenSSL trusts out of the box and accordingly constitute a _truststore_. The truststore can be updated as needed, in particular, to include newly trusted certificates and to remove ones no longer trusted. - -The client program receives three certificates from the Google web server, but the OpenSSL truststore on my machine does not contain exact matches. As presently written, the **client** program does not pursue the matter by, for example, verifying the digital signature on a Google certificate (a signature that vouches for the certificate). If that signature were trusted, then the certificate containing it should be trusted as well. Nonetheless, the client program goes on to fetch and then to print Google’s homepage. The next section gets into more detail. - -### The hidden security pieces in the client program - -Let’s start with the visible security artifact in the client example—the digital certificate—and consider how other security artifacts relate to it. The dominant layout standard for a digital certificate is X509, and a production-grade certificate is issued by a certificate authority (CA) such as [Verisign][14]. - -A digital certificate contains various pieces of information (e.g., activation and expiration dates, and a domain name for the owner), including the issuer’s identity and _digital signature_, which is an encrypted _cryptographic hash_ value. A certificate also has an unencrypted hash value that serves as its identifying _fingerprint_. - -A hash value results from mapping an arbitrary number of bits to a fixed-length digest. What the bits represent (an accounting report, a novel, or maybe a digital movie) is irrelevant. For example, the Message Digest version 5 (MD5) hash algorithm maps input bits of whatever length to a 128-bit hash value, whereas the SHA1 (Secure Hash Algorithm version 1) algorithm maps input bits to a 160-bit value. Different input bits result in different—indeed, statistically unique—hash values. The next article goes into further detail and focuses on what makes a hash function _cryptographic_. - -Digital certificates differ in type (e.g., _root_, _intermediate_, and _end-entity_ certificates) and form a hierarchy that reflects these types. As the name suggests, a _root_ certificate sits atop the hierarchy, and the certificates under it inherit whatever trust the root certificate has. The OpenSSL libraries and most modern programming languages have an X509 type together with functions that deal with such certificates. The certificate from Google has an X509 format, and the **client** program checks whether this certificate is **X509_V_OK**. - -X509 certificates are based upon public-key infrastructure (PKI), which includes algorithms—RSA is the dominant one—for generating _key pairs_: a public key and its paired private key. A public key is an identity: [Amazon’s][15] public key identifies it, and my public key identifies me. A private key is meant to be kept secret by its owner. - -The keys in a pair have standard uses. A public key can be used to encrypt a message, and the private key from the same pair can then be used to decrypt the message. A private key also can be used to sign a document or other electronic artifact (e.g., a program or an email), and the public key from the pair can then be used to verify the signature. The following two examples fill in some details. - -In the first example, Alice distributes her public key to the world, including Bob. Bob then encrypts a message with Alice’s public key, sending the encrypted message to Alice. The message encrypted with Alice’s public key is decrypted with her private key, which (by assumption) she alone has, like so: - - -``` -             +------------------+ encrypted msg  +-------------------+ -Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's msg -             +------------------+                +-------------------+ -``` - -Decrypting the message without Alice’s private key is possible in principle, but infeasible in practice given a sound cryptographic key-pair system such as RSA. - -Now, for the second example, consider signing a document to certify its authenticity. The signature algorithm uses a private key from a pair to process a cryptographic hash of the document to be signed: - - -``` -                    +-------------------+ -Hash of document--->|Alice's private key|--->Alice's digital signature of the document -                    +-------------------+ -``` - -Assume that Alice digitally signs a contract sent to Bob. Bob then can use Alice’s public key from the key pair to verify the signature: - - -``` -                                             +------------------+ -Alice's digital signature of the document--->|Alice's public key|--->verified or not -                                             +------------------+ -``` - -It is infeasible to forge Alice’s signature without Alice’s private key: hence, it is in Alice’s interest to keep her private key secret. - -None of these security pieces, except for digital certificates, is explicit in the **client** program. The next article fills in the details with examples that use the OpenSSL utilities and library functions. - -### OpenSSL from the command line - -In the meantime, let’s take a look at OpenSSL command-line utilities: in particular, a utility to inspect the certificates from a web server during the TLS handshake. Invoking the OpenSSL utilities begins with the **openssl** command and then adds a combination of arguments and flags to specify the desired operation. - -Consider this command: - -**openssl list-cipher-algorithms** - -The output is a list of associated algorithms that make up a _cipher suite_. Here’s the start of the list, with comments to clarify the acronyms: - - -``` -AES-128-CBC ## Advanced Encryption Standard, Cipher Block Chaining -AES-128-CBC-HMAC-SHA1 ## Hash-based Message Authentication Code with SHA1 hashes -AES-128-CBC-HMAC-SHA256 ## ditto, but SHA256 rather than SHA1 -... -``` - -The next command, using the argument **s_client**, opens a secure connection to **[www.google.com][13]** and prints screens full of information about this connection: - -**openssl s_client -connect [www.google.com:443][16] -showcerts** - -The port number 443 is the standard one used by web servers for receiving HTTPS rather than HTTP connections. (For HTTP, the standard port is 80.) The network address **[www.google.com:443][16]** also occurs in the **client** program's code. If the attempted connection succeeds, the three digital certificates from Google are displayed together with information about the secure session, the cipher suite in play, and related items. For example, here is a slice of output from near the start, which announces that a _certificate chain_ is forthcoming. The encoding for the certificates is base64: - - -``` -Certificate chain - 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=www.google.com - i:/C=US/O=Google Trust Services/CN=Google Internet Authority G3 -\-----BEGIN CERTIFICATE----- -MIIEijCCA3KgAwIBAgIQdCea9tmy/T6rK/dDD1isujANBgkqhkiG9w0BAQsFADBU -MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMSUw -... -``` - -A major web site such as Google usually sends multiple certificates for authentication. - -The output ends with summary information about the TLS session, including specifics on the cipher suite: - - -``` -SSL-Session: -    Protocol : TLSv1.2 -    Cipher : ECDHE-RSA-AES128-GCM-SHA256 -    Session-ID: A2BBF0E4991E6BBBC318774EEE37CFCB23095CC7640FFC752448D07C7F438573 -... -``` - -The protocol **TLS 1.2** is used in the **client** program, and the **Session-ID** uniquely identifies the connection between the **openssl** utility and the Google web server. The **Cipher** entry can be parsed as follows: - - * **ECDHE** (Elliptic Curve Diffie Hellman Ephemeral) is an effective and efficient algorithm for managing the TLS handshake. In particular, ECDHE solves the _key-distribution problem_ by ensuring that both parties in a connection (e.g., the client program and the Google web server) use the same encryption/decryption key, which is known as the _session key_. The follow-up article digs into the details. - - * **RSA** (Rivest Shamir Adleman) is the dominant public-key cryptosystem and named after the three academics who first described the system in the late 1970s. The key-pairs in play are generated with the RSA algorithm. - - * **AES128** (Advanced Encryption Standard) is a _block cipher_ that encrypts and decrypts blocks of bits. (The alternative is a _stream cipher_, which encrypts and decrypts bits one at a time.) The cipher is _symmetric_ in that the same key is used to encrypt and to decrypt, which raises the key-distribution problem in the first place. AES supports key sizes of 128 (used here), 192, and 256 bits: the larger the key, the better the protection. - -Key sizes for symmetric cryptosystems such as AES are, in general, smaller than those for asymmetric (key-pair based) systems such as RSA. For example, a 1024-bit RSA key is relatively small, whereas a 256-bit key is currently the largest for AES. - - * **GCM** (Galois Counter Mode) handles the repeated application of a cipher (in this case, AES128) during a secured conversation. AES128 blocks are only 128-bits in size, and a secure conversation is likely to consist of multiple AES128 blocks from one side to the other. GCM is efficient and commonly paired with AES128. - - * **SHA256** (Secure Hash Algorithm 256 bits) is the cryptographic hash algorithm in play. The hash values produced are 256 bits in size, although even larger values are possible with SHA. - - - - -Cipher suites are in continual development. Not so long ago, for example, Google used the RC4 stream cipher (Ron’s Cipher version 4 after Ron Rivest from RSA). RC4 now has known vulnerabilities, which presumably accounts, at least in part, for Google’s switch to AES128. - -### Wrapping up - -This first look at OpenSSL, through a secure C web client and various command-line examples, has brought to the fore a handful of topics in need of more clarification. [The next article gets into the details][17], starting with cryptographic hashes and ending with a fuller discussion of how digital certificates address the key distribution challenge. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 - -作者:[Marty Kalin][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) -[2]: https://www.openssl.org/ -[3]: https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ -[4]: http://condor.depaul.edu/mkalin -[5]: https://en.wikipedia.org/wiki/Transport_Layer_Security -[6]: https://en.wikipedia.org/wiki/Netscape -[7]: http://www.opengroup.org/onlinepubs/009695399/functions/perror.html -[8]: http://www.opengroup.org/onlinepubs/009695399/functions/exit.html -[9]: http://www.opengroup.org/onlinepubs/009695399/functions/sprintf.html -[10]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html -[11]: http://www.opengroup.org/onlinepubs/009695399/functions/memset.html -[12]: http://www.opengroup.org/onlinepubs/009695399/functions/puts.html -[13]: http://www.google.com -[14]: https://www.verisign.com -[15]: https://www.amazon.com -[16]: http://www.google.com:443 -[17]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 diff --git a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md new file mode 100644 index 0000000000..02b9005801 --- /dev/null +++ b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -0,0 +1,341 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with OpenSSL: Cryptography basics) +[#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-1) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen) + +OpenSSL 入门:密码学基础知识 +====== + +> 需要有关基础的密码学入门知识,尤其是有关 OpenSSL 的入门知识吗?继续阅读。 + +![A lock on the side of a building][1] + +本文是两篇使用 [OpenSSL][2] 的密码学基础知识的第一篇,OpenSSL 是在 Linux 和其他系统上流行的生产级库和工具包。(要安装 OpenSSL 的最新版本,请参阅[这里][3]。)OpenSSL 实用程序可在命令行使用,而程序可以从 OpenSSL 库中调用函数。本文的示例程序使用 C 语言,即 OpenSSL 库的源语言。 + +本系列的两篇文章共同介绍了加密哈希、数字签名、加密和解密以及数字证书。你可以从[我的网站][4]的 ZIP 文件中找到代码和命令行示例。 + +让我们首先回顾一下 OpenSSL 名称中的 SSL。 + +### OpenSSL 简史 + +[安全套接字层][5](SSL)是 Netscape 在 1995 年发布的一种加密协议。该协议层可以位于 HTTP 之上,从而为 HTTPS 提供了 S:安全。SSL 协议提供了各种安全服务,其中包括两项在 HTTPS 中至关重要的服务: + +* 对等身份验证Peer authentication(也称为相互挑战):连接的每一边都对另一边的身份进行身份验证。如果 Alice 和 Bob 要通过 SSL 交换消息,则每个人首先验证彼此的身份。 +* 机密性Confidentiality:发送者在通过通道发送消息之前先对其进行加密。接收者然后解密每个接收到的消息。此过程可保护网络对话。即使窃听者 Eve 截获了从 Alice 到 Bob 的加密消息(*中间人*攻击),Eve 仍发现他在计算上无法解密此消息。 +   +反过来,这两个关键 SSL 服务与其他获得较少关注的服务捆绑在一起。例如,SSL 支持消息完整性,从而确保接收到的消息与发送的消息相同。此功能是通过散列函数实现的,散列函数也随 OpenSSL 工具箱一起提供。 + +SSL 已版本化(例如 SSLv2 和 SSLv3),并且在 1999 年,传输层安全性Transport Layer Security(TLS)成为基于 SSLv3 的类似协议。TLSv1 和 SSLv3 相似,但不足以相互配合。 但是,通常将 SSL/TLS 称为同一协议。例如,即使正在使用的是 TLS(而非 SSL),OpenSSL 函数也经常在名称中包含 SSL。此外,调用 OpenSSL 命令行实用程序以术语 `openssl` 开始。 + +OpenSSL 在其 man 页面之外的文档是零散的,鉴于 OpenSSL 工具包有多大,这些页面变得难以查找使用。命令行和代码示例是将主要主题集中起来的一种方法。让我们从一个熟悉的示例开始(使用 HTTPS 访问网站),然后使用该示例来挑选我们感兴趣的加密部分。 + + + +### 一个 HTTPS 客户端 + +此处显示的 `client` 程序通过 HTTPS 连接到 Google: + +``` +/* compilation: gcc -o client client.c -lssl -lcrypto */ +#include +#include +#include /* BasicInput/Output streams */ +#include /* errors */ +#include /* core library */ +#define BuffSize 1024 + +void report_and_exit(const char* msg) { + perror(msg); + ERR_print_errors_fp(stderr); + exit(-1); +} + +void init_ssl() { + SSL_load_error_strings(); + SSL_library_init(); +} + +void cleanup(SSL_CTX* ctx, BIO* bio) { + SSL_CTX_free(ctx); + BIO_free_all(bio); +} + +void secure_connect(const char* hostname) { + char name[BuffSize]; + char request[BuffSize]; + char response[BuffSize]; + + const SSL_METHOD* method = TLSv1_2_client_method(); + if (NULL == method) report_and_exit("TLSv1_2_client_method..."); + + SSL_CTX* ctx = SSL_CTX_new(method); + if (NULL == ctx) report_and_exit("SSL_CTX_new..."); + + BIO* bio = BIO_new_ssl_connect(ctx); + if (NULL == bio) report_and_exit("BIO_new_ssl_connect..."); + + SSL* ssl = NULL; + + /* link bio channel, SSL session, and server endpoint */ + + sprintf(name, "%s:%s", hostname, "https"); + BIO_get_ssl(bio, &ssl); /* session */ + SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* robustness */ + BIO_set_conn_hostname(bio, name); /* prepare to connect */ + + /* try to connect */ + if (BIO_do_connect(bio) <= 0) { + cleanup(ctx, bio); + report_and_exit("BIO_do_connect..."); + } + + /* verify truststore, check cert */ + if (!SSL_CTX_load_verify_locations(ctx, + "/etc/ssl/certs/ca-certificates.crt", /* truststore */ + "/etc/ssl/certs/")) /* more truststore */ + report_and_exit("SSL_CTX_load_verify_locations..."); + + long verify_flag = SSL_get_verify_result(ssl); + if (verify_flag != X509_V_OK) + fprintf(stderr, + "##### Certificate verification error (%i) but continuing...\n", + (int) verify_flag); + + /* now fetch the homepage as sample data */ + sprintf(request, + "GET / HTTP/1.1\x0D\x0AHost: %s\x0D\x0A\x43onnection: Close\x0D\x0A\x0D\x0A", + hostname); + BIO_puts(bio, request); + + /* read HTTP response from server and print to stdout */ + while (1) { + memset(response, '\0', sizeof(response)); + int n = BIO_read(bio, response, BuffSize); + if (n <= 0) break; /* 0 is end-of-stream, < 0 is an error */ + puts(response); + } + + cleanup(ctx, bio); +} + +int main() { + init_ssl(); + + const char* hostname = "www.google.com:443"; + fprintf(stderr, "Trying an HTTPS connection to %s...\n", hostname); + secure_connect(hostname); + +return 0; +} +``` + +可以从命令行编译和执行该程序(请注意 `-lssl` 和 `-lcrypto` 中的小写字母 `L`): + + +``` +gcc -o client client.c -lssl -lcrypto +``` + +该程序尝试打开与网站 [www.google.com][13] 的安全连接。作为与 Google Web 服务器的 TLS 握手的一部分,`client` 程序会接收一个或多个数字证书,该程序会尝试对其进行验证(但在我的系统上失败了)。尽管如此,`client` 程序仍继续通过安全通道获取 Google 主页。该程序取决于前面提到的安全工件,尽管在代码中只突出了数字证书。其他工件仍在幕后,稍后将对其进行详细说明。 + +通常,打开 HTTP(非安全)通道的 C 或 C++ 客户端程序将使用诸如*文件描述符*或*网络套接字*之类的结构,这些是两个进程(例如,客户端程序和 Google Web 服务器)之间连接的端点。另一方面,文件描述符是一个非负整数值,它在程序中标识该程序打开的任何文件类的结构。这样的程序还将使用一种结构来指定有关 Web 服务器地址的详细信息。 + +这些相对较低级别的结构都不会出现在客户端程序中,因为 OpenSSL 库会将套接字基础设施和地址规范等封装在高级的安全结构中。其结果是一个简单的 API。下面首先看一下 `client` 程序示例中的安全性详细信息。 + +* 该程序首先加载相关的 OpenSSL 库,而我的函数 `init_ssl` 则对 OpenSSL 进行了两次调用: + + ``` +SSL_library_init(); SSL_load_error_strings(); +``` +* 下一个初始化步骤尝试获取安全*上下文*,这是建立和维护通往 Web 服务器的安全通道所需的信息框架。 在示例中使用了 TLS 1.2,如对 OpenSSL 库函数的调用所示: + + ``` +const SSL_METHOD* method = TLSv1_2_client_method(); /* TLS 1.2 */ +``` + + 如果调用成功,则将 `method ` 指针被传递给库函数,该函数创建类型为 `SSL_CTX` 的上下文: + + ``` +SSL_CTX* ctx = SSL_CTX_new(method); +``` + + `client` 程序检查每个关键库调用中的错误,然后如果其中一个调用失败,则程序终止。 +* 现在还有另外两个 OpenSSL 工件在起作用:SSL 类型的安全会话,从头到尾管理安全连接;以及类型为BIO(基本输入/输出)的安全流,用于与 Web 服务器进行通信。BIO 流是通过以下调用生成的: + + ``` +BIO* bio = BIO_new_ssl_connect(ctx); +``` + 请注意,最重要的上下文是参数。`BIO` 类型是 C 语言中 `FILE` 类型的 OpenSSL 封装器。此封装器可保护 `client` 程序与 Google 的网络服务器之间的输入和输出流。 +* 有了 `SSL_CTX` 和 `BIO`,然后程序在 SSL 会话中将它们组合在一起。三个库调用可以完成工作: + + ``` +BIO_get_ssl(bio, &ssl); /* get a TLS session */ +SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* for robustness */ +BIO_set_conn_hostname(bio, name); /* prepare to connect to Google */ +``` + 安全连接本身是通过以下调用建立的: + + ``` +BIO_do_connect(bio); +``` + 如果最后一次调用不成功,则 `client` 程序终止;否则,该连接已准备就绪,可以支持 `client` 程序与Google Web 服务器之间的机密对话。 + + +During the handshake with the web server, the `client` program receives one or more digital certificates that authenticate the server’s identity. However, the `client` program does not send a certificate of its own, which means that the authentication is one-way. (Web servers typically are configured _not_ to expect a client certificate.) Despite the failed verification of the web server’s certificate, the `client` program continues by fetching the Google homepage through the secure channel to the web server. + +Why does the attempt to verify a Google certificate fail? A typical OpenSSL installation has the directory `/etc/ssl/certs`, which includes the `ca-certificates.crt` file. The directory and the file together contain digital certificates that OpenSSL trusts out of the box and accordingly constitute a _truststore_. The truststore can be updated as needed, in particular, to include newly trusted certificates and to remove ones no longer trusted. + +The client program receives three certificates from the Google web server, but the OpenSSL truststore on my machine does not contain exact matches. As presently written, the `client` program does not pursue the matter by, for example, verifying the digital signature on a Google certificate (a signature that vouches for the certificate). If that signature were trusted, then the certificate containing it should be trusted as well. Nonetheless, the client program goes on to fetch and then to print Google’s homepage. The next section gets into more detail. + +### The hidden security pieces in the client program + +Let’s start with the visible security artifact in the client example—the digital certificate—and consider how other security artifacts relate to it. The dominant layout standard for a digital certificate is X509, and a production-grade certificate is issued by a certificate authority (CA) such as [Verisign][14]. + +A digital certificate contains various pieces of information (e.g., activation and expiration dates, and a domain name for the owner), including the issuer’s identity and _digital signature_, which is an encrypted _cryptographic hash_ value. A certificate also has an unencrypted hash value that serves as its identifying _fingerprint_. + +A hash value results from mapping an arbitrary number of bits to a fixed-length digest. What the bits represent (an accounting report, a novel, or maybe a digital movie) is irrelevant. For example, the Message Digest version 5 (MD5) hash algorithm maps input bits of whatever length to a 128-bit hash value, whereas the SHA1 (Secure Hash Algorithm version 1) algorithm maps input bits to a 160-bit value. Different input bits result in different—indeed, statistically unique—hash values. The next article goes into further detail and focuses on what makes a hash function _cryptographic_. + +Digital certificates differ in type (e.g., _root_, _intermediate_, and _end-entity_ certificates) and form a hierarchy that reflects these types. As the name suggests, a _root_ certificate sits atop the hierarchy, and the certificates under it inherit whatever trust the root certificate has. The OpenSSL libraries and most modern programming languages have an X509 type together with functions that deal with such certificates. The certificate from Google has an X509 format, and the `client` program checks whether this certificate is `X509_V_OK`. + +X509 certificates are based upon public-key infrastructure (PKI), which includes algorithms—RSA is the dominant one—for generating _key pairs_: a public key and its paired private key. A public key is an identity: [Amazon’s][15] public key identifies it, and my public key identifies me. A private key is meant to be kept secret by its owner. + +The keys in a pair have standard uses. A public key can be used to encrypt a message, and the private key from the same pair can then be used to decrypt the message. A private key also can be used to sign a document or other electronic artifact (e.g., a program or an email), and the public key from the pair can then be used to verify the signature. The following two examples fill in some details. + +In the first example, Alice distributes her public key to the world, including Bob. Bob then encrypts a message with Alice’s public key, sending the encrypted message to Alice. The message encrypted with Alice’s public key is decrypted with her private key, which (by assumption) she alone has, like so: + + +``` +             +------------------+ encrypted msg  +-------------------+ +Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's msg +             +------------------+                +-------------------+ +``` + +Decrypting the message without Alice’s private key is possible in principle, but infeasible in practice given a sound cryptographic key-pair system such as RSA. + +Now, for the second example, consider signing a document to certify its authenticity. The signature algorithm uses a private key from a pair to process a cryptographic hash of the document to be signed: + + +``` +                    +-------------------+ +Hash of document--->|Alice's private key|--->Alice's digital signature of the document +                    +-------------------+ +``` + +Assume that Alice digitally signs a contract sent to Bob. Bob then can use Alice’s public key from the key pair to verify the signature: + + +``` +                                             +------------------+ +Alice's digital signature of the document--->|Alice's public key|--->verified or not +                                             +------------------+ +``` + +It is infeasible to forge Alice’s signature without Alice’s private key: hence, it is in Alice’s interest to keep her private key secret. + +None of these security pieces, except for digital certificates, is explicit in the `client` program. The next article fills in the details with examples that use the OpenSSL utilities and library functions. + +### OpenSSL from the command line + +In the meantime, let’s take a look at OpenSSL command-line utilities: in particular, a utility to inspect the certificates from a web server during the TLS handshake. Invoking the OpenSSL utilities begins with the `openssl` command and then adds a combination of arguments and flags to specify the desired operation. + +Consider this command: + +`openssl list-cipher-algorithms` + +The output is a list of associated algorithms that make up a _cipher suite_. Here’s the start of the list, with comments to clarify the acronyms: + + +``` +AES-128-CBC ## Advanced Encryption Standard, Cipher Block Chaining +AES-128-CBC-HMAC-SHA1 ## Hash-based Message Authentication Code with SHA1 hashes +AES-128-CBC-HMAC-SHA256 ## ditto, but SHA256 rather than SHA1 +... +``` + +The next command, using the argument `s_client`, opens a secure connection to `[www.google.com][13]` and prints screens full of information about this connection: + +`openssl s_client -connect [www.google.com:443][16] -showcerts` + +The port number 443 is the standard one used by web servers for receiving HTTPS rather than HTTP connections. (For HTTP, the standard port is 80.) The network address `[www.google.com:443][16]` also occurs in the `client` program's code. If the attempted connection succeeds, the three digital certificates from Google are displayed together with information about the secure session, the cipher suite in play, and related items. For example, here is a slice of output from near the start, which announces that a _certificate chain_ is forthcoming. The encoding for the certificates is base64: + + +``` +Certificate chain + 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=www.google.com + i:/C=US/O=Google Trust Services/CN=Google Internet Authority G3 +\-----BEGIN CERTIFICATE----- +MIIEijCCA3KgAwIBAgIQdCea9tmy/T6rK/dDD1isujANBgkqhkiG9w0BAQsFADBU +MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMSUw +... +``` + +A major web site such as Google usually sends multiple certificates for authentication. + +The output ends with summary information about the TLS session, including specifics on the cipher suite: + + +``` +SSL-Session: +    Protocol : TLSv1.2 +    Cipher : ECDHE-RSA-AES128-GCM-SHA256 +    Session-ID: A2BBF0E4991E6BBBC318774EEE37CFCB23095CC7640FFC752448D07C7F438573 +... +``` + +The protocol `TLS 1.2` is used in the `client` program, and the `Session-ID` uniquely identifies the connection between the `openssl` utility and the Google web server. The `Cipher` entry can be parsed as follows: + + * `ECDHE` (Elliptic Curve Diffie Hellman Ephemeral) is an effective and efficient algorithm for managing the TLS handshake. In particular, ECDHE solves the _key-distribution problem_ by ensuring that both parties in a connection (e.g., the client program and the Google web server) use the same encryption/decryption key, which is known as the _session key_. The follow-up article digs into the details. + + * `RSA` (Rivest Shamir Adleman) is the dominant public-key cryptosystem and named after the three academics who first described the system in the late 1970s. The key-pairs in play are generated with the RSA algorithm. + + * `AES128` (Advanced Encryption Standard) is a _block cipher_ that encrypts and decrypts blocks of bits. (The alternative is a _stream cipher_, which encrypts and decrypts bits one at a time.) The cipher is _symmetric_ in that the same key is used to encrypt and to decrypt, which raises the key-distribution problem in the first place. AES supports key sizes of 128 (used here), 192, and 256 bits: the larger the key, the better the protection. + +Key sizes for symmetric cryptosystems such as AES are, in general, smaller than those for asymmetric (key-pair based) systems such as RSA. For example, a 1024-bit RSA key is relatively small, whereas a 256-bit key is currently the largest for AES. + + * `GCM` (Galois Counter Mode) handles the repeated application of a cipher (in this case, AES128) during a secured conversation. AES128 blocks are only 128-bits in size, and a secure conversation is likely to consist of multiple AES128 blocks from one side to the other. GCM is efficient and commonly paired with AES128. + + * `SHA256` (Secure Hash Algorithm 256 bits) is the cryptographic hash algorithm in play. The hash values produced are 256 bits in size, although even larger values are possible with SHA. + + + + +Cipher suites are in continual development. Not so long ago, for example, Google used the RC4 stream cipher (Ron’s Cipher version 4 after Ron Rivest from RSA). RC4 now has known vulnerabilities, which presumably accounts, at least in part, for Google’s switch to AES128. + +### Wrapping up + +This first look at OpenSSL, through a secure C web client and various command-line examples, has brought to the fore a handful of topics in need of more clarification. [The next article gets into the details][17], starting with cryptographic hashes and ending with a fuller discussion of how digital certificates address the key distribution challenge. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 + +作者:[Marty Kalin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://www.openssl.org/ +[3]: https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ +[4]: http://condor.depaul.edu/mkalin +[5]: https://en.wikipedia.org/wiki/Transport_Layer_Security +[6]: https://en.wikipedia.org/wiki/Netscape +[7]: http://www.opengroup.org/onlinepubs/009695399/functions/perror.html +[8]: http://www.opengroup.org/onlinepubs/009695399/functions/exit.html +[9]: http://www.opengroup.org/onlinepubs/009695399/functions/sprintf.html +[10]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html +[11]: http://www.opengroup.org/onlinepubs/009695399/functions/memset.html +[12]: http://www.opengroup.org/onlinepubs/009695399/functions/puts.html +[13]: http://www.google.com +[14]: https://www.verisign.com +[15]: https://www.amazon.com +[16]: http://www.google.com:443 +[17]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 From fb1a20e4a977b5982618084d16fea02e2557e038 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 14:45:41 +0800 Subject: [PATCH 0359/3057] APL --- sources/tech/20200108 How to setup multiple monitors in sway.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200108 How to setup multiple monitors in sway.md b/sources/tech/20200108 How to setup multiple monitors in sway.md index f156d204dc..8113f29c95 100644 --- a/sources/tech/20200108 How to setup multiple monitors in sway.md +++ b/sources/tech/20200108 How to setup multiple monitors in sway.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 68f6fcf5b8303d3d04ef6ab54ecc3b26a7bc10be Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 15:01:16 +0800 Subject: [PATCH 0360/3057] TSL --- ... How to setup multiple monitors in sway.md | 85 ------------------- ... How to setup multiple monitors in sway.md | 85 +++++++++++++++++++ 2 files changed, 85 insertions(+), 85 deletions(-) delete mode 100644 sources/tech/20200108 How to setup multiple monitors in sway.md create mode 100644 translated/tech/20200108 How to setup multiple monitors in sway.md diff --git a/sources/tech/20200108 How to setup multiple monitors in sway.md b/sources/tech/20200108 How to setup multiple monitors in sway.md deleted file mode 100644 index 8113f29c95..0000000000 --- a/sources/tech/20200108 How to setup multiple monitors in sway.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to setup multiple monitors in sway) -[#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) -[#]: author: (arte219 https://fedoramagazine.org/author/arte219/) - -How to setup multiple monitors in sway -====== - -![][1] - -Sway is a tiling Wayland compositor which has mostly the same features, look and workflow as the [i3 X11 window manager][2]. Because Sway uses Wayland instead of X11, the tools to setup X11 don’t always work in sway. This includes tools like _xrandr_, which are used in X11 window managers or desktops to setup monitors. This is why monitors have to be setup by editing the sway config file, and that’s what this article is about. - -## **Getting your monitor ID’s** - -First, you have to get the names sway uses to refer to your monitors. You can do this by running: - -``` -$ swaymsg -t get_outputs -``` - -You will get information about all of your monitors, every monitor separated by an empty line. - -You have to look for the first line of every section, and for what’s after “Output”. For example, when you see a line like “_Output DVI-D-1 ‘Philips Consumer Electronics Company’_”, the output ID is “DVI-D-1”. Note these ID’s and which physical monitors they belong to. - -## **Editing the config file** - -If you haven’t edited the Sway config file before, you have to copy it to your home directory by running this command: - -``` -cp -r /etc/sway/config ~/.config/sway/config -``` - -Now the default config file is located in _~/.config/sway_ and called “config”. You can edit it using any text editor. - -Now you have to do a little bit of math. Imagine a grid with the origin in the top left corner. The units of the X and Y coordinates are pixels. The Y axis is inverted. This means that if you, for example, start at the origin and you move 100 pixels to the right and 80 pixels down, your coordinates will be (100, 80). - -You have to calculate where your displays are going to end up on this grid. The locations of the displays are specified with the top left pixel. For example, if we want to have a monitor with name HDMI1 and a resolution of 1920×1080, and to the right of it a laptop monitor with name eDP1 and a resolution of 1600×900, you have to type this in your config file: - -``` -output HDMI1 pos 0 0 -output eDP1 pos 1920 0 -``` - -You can also specify the resolutions manually by using the _res_ option:  - -``` -output HDMI1 pos 0 0 res 1920x1080 -output eDP1 pos 1920 0 res 1600x900 -``` - -## **Binding workspaces to monitors** - -Using sway with multiple monitors can be a little bit tricky with workspace management. Luckily, you can bind workspaces to a specific monitor, so you can easily switch to that monitor and use your displays more efficiently. This can simply be done by the workspace command in your config file. For example, if you want to bind workspace 1 and 2 to monitor DVI-D-1 and workspace 8 and 9 to monitor HDMI-A-1, you can do that by using: - -``` -workspace 1 output DVI-D-1 -workspace 2 output DVI-D-1 -``` - -``` -workspace 8 output HDMI-A-1 -workspace 9 output HDMI-A-1 -``` - -That’s it! These are the basics of multi monitor setup in sway. A more detailed guide can be found at . - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ - -作者:[arte219][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/arte219/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/sway-multiple-monitors-816x345.png -[2]: https://fedoramagazine.org/getting-started-i3-window-manager/ diff --git a/translated/tech/20200108 How to setup multiple monitors in sway.md b/translated/tech/20200108 How to setup multiple monitors in sway.md new file mode 100644 index 0000000000..b27ab5fe98 --- /dev/null +++ b/translated/tech/20200108 How to setup multiple monitors in sway.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to setup multiple monitors in sway) +[#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) +[#]: author: (arte219 https://fedoramagazine.org/author/arte219/) + +如何在 sway 中设置多个显示器 +====== + +![][1] + +Sway 是一种平铺式 Wayland 合成器,具有与 [i3 X11 窗口管理器][2]相同的功能、外观和工作流程。 由于 Sway 使用 Wayland 而不是 X11,因此就不能一如既往地使用设置 X11 的工具。这包括 `xrandr` 之类的工具,这些工具在 X11 窗口管理器或桌面中用于设置监视器。这就是为什么必须通过编辑 Sway 配置文件来设置显示器的原因,这就是本文的目的。 + +### 获取你的显示器 ID + +首先,你必须获得 Sway 用来指代显示器的名称。你可以通过运行以下命令进行操作: + +``` +$ swaymsg -t get_outputs +``` + +你将获得所有显示器的相关信息,每个显示器都用空行分隔。 + +你必须查看每个部分的第一行,以及 “Output” 之后的内容。例如,当你看到 `Output DVI-D-1 'Philips Consumer Electronics Company'` 之类的行时,则该输出 ID 为 `DVI-D-1`。注意这些 ID 及其所属的物理监视器。 + +### 编辑配置文件 + +如果你之前没有编辑过 Sway 配置文件,则必须通过运行以下命令将其复制到主目录中: + +``` +cp -r /etc/sway/config ~/.config/sway/config +``` + +现在,默认配置文件位于 `~/.config/sway` 中,名为 `config`。你可以使用任何文本编辑器进行编辑。 + +现在你需要做一点数学。想象有一个网格,其原点在左上角。X 和 Y 坐标的单位是像素。Y 轴反转。这意味着,例如,如果你从原点开始,向右移动 100 像素,向下移动 80 像素,则坐标将为 `(100, 80)`。 + +你必须计算最终显示在此网格上的位置。显示器的位置由左上方的像素指定。例如,如果我们要使用名称为“HDMI1”且分辨率为 1920×1080 的显示器,并在其右侧使用名称为 “eDP1” 且分辨率为 1600×900 的笔记本电脑显示器,则必须在配置文件中键入 : + +``` +output HDMI1 pos 0 0 +output eDP1 pos 1920 0 +``` + +你还可以使用 `res` 选项手动指定分辨率: + +``` +output HDMI1 pos 0 0 res 1920x1080 +output eDP1 pos 1920 0 res 1600x900 +``` + +### 将工作空间绑定到显示器上 + +与多个监视器一起使用 Sway 在工作区管理中可能会有些棘手。幸运的是,你可以将工作区绑定到特定的监视器,因此你可以轻松地切换到该显示器并更有效地使用它。只需通过配置文件中的工作区命令即可完成。例如,如果要绑定工作区 1 和 2 到显示器 “DVI-D-1”,绑定工作区 8 和 9 到显示器 “HDMI-A-1”,则可以使用以下方法: + +``` +workspace 1 output DVI-D-1 +workspace 2 output DVI-D-1 +``` + +``` +workspace 8 output HDMI-A-1 +workspace 9 output HDMI-A-1 +``` + +就是这样。这就在 Sway 中多显示器设置的基础知识。可以在 中找到更详细的指南。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ + +作者:[arte219][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/arte219/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/sway-multiple-monitors-816x345.png +[2]: https://fedoramagazine.org/getting-started-i3-window-manager/ From 4f32c39367defe03262aa390ea8462e4c9d9527f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 15:09:57 +0800 Subject: [PATCH 0361/3057] PRF @wxy --- ...0200108 How to setup multiple monitors in sway.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20200108 How to setup multiple monitors in sway.md b/translated/tech/20200108 How to setup multiple monitors in sway.md index b27ab5fe98..c6f5b216e7 100644 --- a/translated/tech/20200108 How to setup multiple monitors in sway.md +++ b/translated/tech/20200108 How to setup multiple monitors in sway.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to setup multiple monitors in sway) [#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) [#]: author: (arte219 https://fedoramagazine.org/author/arte219/) -如何在 sway 中设置多个显示器 +如何在 Sway 中设置多个显示器 ====== ![][1] -Sway 是一种平铺式 Wayland 合成器,具有与 [i3 X11 窗口管理器][2]相同的功能、外观和工作流程。 由于 Sway 使用 Wayland 而不是 X11,因此就不能一如既往地使用设置 X11 的工具。这包括 `xrandr` 之类的工具,这些工具在 X11 窗口管理器或桌面中用于设置监视器。这就是为什么必须通过编辑 Sway 配置文件来设置显示器的原因,这就是本文的目的。 +Sway 是一种平铺式 Wayland 合成器,具有与 [i3 X11 窗口管理器][2]相同的功能、外观和工作流程。由于 Sway 使用 Wayland 而不是 X11,因此就不能一如既往地使用设置 X11 的工具。这包括 `xrandr` 之类的工具,这些工具在 X11 窗口管理器或桌面中用于设置显示器。这就是为什么必须通过编辑 Sway 配置文件来设置显示器的原因,这就是本文的目的。 ### 获取你的显示器 ID @@ -24,7 +24,7 @@ $ swaymsg -t get_outputs 你将获得所有显示器的相关信息,每个显示器都用空行分隔。 -你必须查看每个部分的第一行,以及 “Output” 之后的内容。例如,当你看到 `Output DVI-D-1 'Philips Consumer Electronics Company'` 之类的行时,则该输出 ID 为 `DVI-D-1`。注意这些 ID 及其所属的物理监视器。 +你必须查看每个部分的第一行,以及 `Output` 之后的内容。例如,当你看到 `Output DVI-D-1 'Philips Consumer Electronics Company'` 之类的行时,则该输出 ID 为 `DVI-D-1`。注意这些 ID 及其所属的物理监视器。 ### 编辑配置文件 @@ -54,7 +54,7 @@ output eDP1 pos 1920 0 res 1600x900 ### 将工作空间绑定到显示器上 -与多个监视器一起使用 Sway 在工作区管理中可能会有些棘手。幸运的是,你可以将工作区绑定到特定的监视器,因此你可以轻松地切换到该显示器并更有效地使用它。只需通过配置文件中的工作区命令即可完成。例如,如果要绑定工作区 1 和 2 到显示器 “DVI-D-1”,绑定工作区 8 和 9 到显示器 “HDMI-A-1”,则可以使用以下方法: +与多个监视器一起使用 Sway 在工作区管理中可能会有些棘手。幸运的是,你可以将工作区绑定到特定的显示器上,因此你可以轻松地切换到该显示器并更有效地使用它。只需通过配置文件中的 `workspace` 命令即可完成。例如,如果要绑定工作区 1 和 2 到显示器 “DVI-D-1”,绑定工作区 8 和 9 到显示器 “HDMI-A-1”,则可以使用以下方法: ``` workspace 1 output DVI-D-1 @@ -75,7 +75,7 @@ via: https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ 作者:[arte219][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 21d4784af8cea630c3a5ee60807c9c08440015f1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 15:10:33 +0800 Subject: [PATCH 0362/3057] PUB @wxy https://linux.cn/article-11809-1.html --- .../20200108 How to setup multiple monitors in sway.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200108 How to setup multiple monitors in sway.md (98%) diff --git a/translated/tech/20200108 How to setup multiple monitors in sway.md b/published/20200108 How to setup multiple monitors in sway.md similarity index 98% rename from translated/tech/20200108 How to setup multiple monitors in sway.md rename to published/20200108 How to setup multiple monitors in sway.md index c6f5b216e7..153933d6be 100644 --- a/translated/tech/20200108 How to setup multiple monitors in sway.md +++ b/published/20200108 How to setup multiple monitors in sway.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11809-1.html) [#]: subject: (How to setup multiple monitors in sway) [#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) [#]: author: (arte219 https://fedoramagazine.org/author/arte219/) From c31282e5bdbc3961e5d7dca105d55e2351999bcd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 00:08:14 +0800 Subject: [PATCH 0363/3057] TSL --- ...arted with OpenSSL- Cryptography basics.md | 114 ++++++++---------- 1 file changed, 53 insertions(+), 61 deletions(-) diff --git a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md index 02b9005801..3fa15783dd 100644 --- a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -185,69 +185,67 @@ BIO_do_connect(bio); 如果最后一次调用不成功,则 `client` 程序终止;否则,该连接已准备就绪,可以支持 `client` 程序与Google Web 服务器之间的机密对话。 -During the handshake with the web server, the `client` program receives one or more digital certificates that authenticate the server’s identity. However, the `client` program does not send a certificate of its own, which means that the authentication is one-way. (Web servers typically are configured _not_ to expect a client certificate.) Despite the failed verification of the web server’s certificate, the `client` program continues by fetching the Google homepage through the secure channel to the web server. +在与 Web 服务器握手期间,`client` 程序会接收一个或多个数字证书,以认证服务器的身份。 但是,`client` 程序不会发送自己的证书,这意味着身份验证是单向的。(通常将 Web 服务器配置为**不**需要客户端证书。)尽管对 Web 服务器证书的验证失败,但 `client` 程序仍通过到 Web 服务器的安全通道继续获取 Google 主页。 -Why does the attempt to verify a Google certificate fail? A typical OpenSSL installation has the directory `/etc/ssl/certs`, which includes the `ca-certificates.crt` file. The directory and the file together contain digital certificates that OpenSSL trusts out of the box and accordingly constitute a _truststore_. The truststore can be updated as needed, in particular, to include newly trusted certificates and to remove ones no longer trusted. +为什么验证 Google 证书的尝试失败?典型的 OpenSSL 安装目录为 `/etc/ssl/certs`,其中包含 `ca-certificates.crt` 文件。该目录和文件包含着 OpenSSL 自带的数字证书,以此构成信任库。可以根据需要更新信任库,尤其是可以包括新信任的证书,并删除不再受信任的证书。 -The client program receives three certificates from the Google web server, but the OpenSSL truststore on my machine does not contain exact matches. As presently written, the `client` program does not pursue the matter by, for example, verifying the digital signature on a Google certificate (a signature that vouches for the certificate). If that signature were trusted, then the certificate containing it should be trusted as well. Nonetheless, the client program goes on to fetch and then to print Google’s homepage. The next section gets into more detail. +`client` 程序从 Google Web 服务器接收了三个证书,但是我的计算机上的 OpenSSL 信任库不包含完全匹配项。如目前所写,`client` 程序不会通过例如验证 Google 证书上的数字签名(一个用来证明该证书的签名)来解决此问题。如果该签名是受信任的,则包含该签名的证书也应受信任。尽管如此,`client` 程序仍继续进行获取页面,然后打印 Google 的主页。下一节将更详细地介绍。 -### The hidden security pieces in the client program +### 客户端程序中隐藏的安全性 -Let’s start with the visible security artifact in the client example—the digital certificate—and consider how other security artifacts relate to it. The dominant layout standard for a digital certificate is X509, and a production-grade certificate is issued by a certificate authority (CA) such as [Verisign][14]. +让我们从客户端示例中的可见安全工件(数字证书)开始,然后考虑其他安全工件如何与之相关。数字证书的主要布局标准是 X509,生产级证书由诸如 [Verisign][14] 的证书颁发机构(CA)颁发。 -A digital certificate contains various pieces of information (e.g., activation and expiration dates, and a domain name for the owner), including the issuer’s identity and _digital signature_, which is an encrypted _cryptographic hash_ value. A certificate also has an unencrypted hash value that serves as its identifying _fingerprint_. +数字证书包含各种信息(例如,激活和有效日期以及所有者的域名),包括发行者的身份和*数字签名*(这是加密过的*加密哈希*值)。证书还具有未加密的哈希值,用作其标识*指纹*。 -A hash value results from mapping an arbitrary number of bits to a fixed-length digest. What the bits represent (an accounting report, a novel, or maybe a digital movie) is irrelevant. For example, the Message Digest version 5 (MD5) hash algorithm maps input bits of whatever length to a 128-bit hash value, whereas the SHA1 (Secure Hash Algorithm version 1) algorithm maps input bits to a 160-bit value. Different input bits result in different—indeed, statistically unique—hash values. The next article goes into further detail and focuses on what makes a hash function _cryptographic_. +哈希值来自将任意数量的位映射到固定长度的摘要。这些位代表什么(会计报告、小说或数字电影)无关紧要。例如,消息摘要版本 5Message Digest version 5(MD5)哈希算法将任意长度的输入位映射到 128 位哈希值,而 SHA1(安全哈希算法版本 1Secure Hash Algorithm version 1)算法将输入位映射到 160 位值。不同的输入位会导致不同的(实际上是统计学上唯一的)哈希值。下一篇文章将进行更详细的介绍,并着重介绍什么使哈希函数具有加密功能。 -Digital certificates differ in type (e.g., _root_, _intermediate_, and _end-entity_ certificates) and form a hierarchy that reflects these types. As the name suggests, a _root_ certificate sits atop the hierarchy, and the certificates under it inherit whatever trust the root certificate has. The OpenSSL libraries and most modern programming languages have an X509 type together with functions that deal with such certificates. The certificate from Google has an X509 format, and the `client` program checks whether this certificate is `X509_V_OK`. +数字证书的类型有所不同(例如根证书、中间证书和最终实体证书),并形成了反映这些类型的层次结构。 顾名思义,*根*证书位于层次结构的顶部,其下的证书继承了根证书所具有的信任。OpenSSL 库和大多数现代编程语言都具有 X509 类型以及处理此类证书的函数。来自 Google 的证书具有 X509 格式,`client` 程序会检查该证书是否为 `X509_V_OK`。 -X509 certificates are based upon public-key infrastructure (PKI), which includes algorithms—RSA is the dominant one—for generating _key pairs_: a public key and its paired private key. A public key is an identity: [Amazon’s][15] public key identifies it, and my public key identifies me. A private key is meant to be kept secret by its owner. +X509 证书基于公共密钥基础结构public-key infrastructure(PKI),其中包括的算法(RSA 是占主导地位的算法)用于生成*密钥对*:公共密钥及其配对的私有密钥。公钥是一种身份:[Amazon][15] 的公钥对其进行标识,而我的公钥对我进行标识。私钥应由其所有者保密。 -The keys in a pair have standard uses. A public key can be used to encrypt a message, and the private key from the same pair can then be used to decrypt the message. A private key also can be used to sign a document or other electronic artifact (e.g., a program or an email), and the public key from the pair can then be used to verify the signature. The following two examples fill in some details. - -In the first example, Alice distributes her public key to the world, including Bob. Bob then encrypts a message with Alice’s public key, sending the encrypted message to Alice. The message encrypted with Alice’s public key is decrypted with her private key, which (by assumption) she alone has, like so: +成对出现的密钥具有标准用途。可以使用公钥对消息进行加密,然后可以使用同一个密钥对中的私钥对消息进行解密。私钥也可以用于对文档或其他电子产品(例如程序或电子邮件)进行签名,然后可以使用该对密钥中的公钥来验证签名。以下两个示例填充了一些细节。 +在第一个示例中,Alice 将她的公钥分发给世界,包括 Bob。然后,Bob 用 Alice 的公钥加密邮件,然后将加密的邮件发送给 Alice。用 Alice 的公钥加密的邮件将用她的私钥解密(假设是她自己的私钥),如下所示: ``` -             +------------------+ encrypted msg  +-------------------+ -Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's msg -             +------------------+                +-------------------+ + +------------------+ encrypted msg +-------------------+ +Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's msg + +------------------+ +-------------------+ ``` -Decrypting the message without Alice’s private key is possible in principle, but infeasible in practice given a sound cryptographic key-pair system such as RSA. - -Now, for the second example, consider signing a document to certify its authenticity. The signature algorithm uses a private key from a pair to process a cryptographic hash of the document to be signed: +原则上可以在没有 Alice 的私钥的情况下解密消息,但在实际情况下,如果使用像 RSA 这样的加密密钥对系统,则无法实现。 +现在,对于第二个示例,请考虑对文档签名以证明其真实性。签名算法使用密钥对中的私钥来处理要签名的文档的加密哈希: ``` -                    +-------------------+ -Hash of document--->|Alice's private key|--->Alice's digital signature of the document -                    +-------------------+ + +-------------------+ +Hash of document--->|Alice's private key|--->Alice's digital signature of the document + +-------------------+ ``` -Assume that Alice digitally signs a contract sent to Bob. Bob then can use Alice’s public key from the key pair to verify the signature: - +假设 Alice 以数字方式签署了发送给 Bob 的合同。然后,Bob 可以使用密钥对中的 Alice 的公钥来验证签名: ``` -                                             +------------------+ -Alice's digital signature of the document--->|Alice's public key|--->verified or not -                                             +------------------+ + +------------------+ +Alice's digital signature of the document--->|Alice's public key|--->verified or not + +------------------+ ``` -It is infeasible to forge Alice’s signature without Alice’s private key: hence, it is in Alice’s interest to keep her private key secret. +假若没有 Alice 的私钥,就无法伪造 Alice 的签名:因此,Alice 有必要保密她的私钥。 -None of these security pieces, except for digital certificates, is explicit in the `client` program. The next article fills in the details with examples that use the OpenSSL utilities and library functions. +在 `client` 程序中,除了数字证书以外,这些安全性都没有明确规定。下一篇文章使用使用 OpenSSL 实用程序和库函数的示例填充详细信息。 -### OpenSSL from the command line +### 命令行的 OpenSSL -In the meantime, let’s take a look at OpenSSL command-line utilities: in particular, a utility to inspect the certificates from a web server during the TLS handshake. Invoking the OpenSSL utilities begins with the `openssl` command and then adds a combination of arguments and flags to specify the desired operation. +同时,让我们看一下 OpenSSL 命令行实用程序:特别是在 TLS 握手期间检查来自 Web 服务器的证书的实用程序。调用 OpenSSL 实用程序从`openssl` 命令开始,然后添加参数和标志的组合以指定所需的操作。 -Consider this command: +看看以下命令: -`openssl list-cipher-algorithms` - -The output is a list of associated algorithms that make up a _cipher suite_. Here’s the start of the list, with comments to clarify the acronyms: +``` +openssl list-cipher-algorithms +``` +该输出是组成加密算法套件cipher suite的相关算法的列表。下面是列表的开头,注释以澄清首字母缩写词: ``` AES-128-CBC ## Advanced Encryption Standard, Cipher Block Chaining @@ -256,27 +254,28 @@ AES-128-CBC-HMAC-SHA256 ## ditto, but SHA256 rather than SHA1 ... ``` -The next command, using the argument `s_client`, opens a secure connection to `[www.google.com][13]` and prints screens full of information about this connection: +使用参数 `s_client` 的下一条命令将打开到 [www.google.com][13] 的安全连接,并在屏幕上显示有关此连接的所有信息: -`openssl s_client -connect [www.google.com:443][16] -showcerts` +``` +openssl s_client -connect www.google.com:443 -showcerts +``` -The port number 443 is the standard one used by web servers for receiving HTTPS rather than HTTP connections. (For HTTP, the standard port is 80.) The network address `[www.google.com:443][16]` also occurs in the `client` program's code. If the attempted connection succeeds, the three digital certificates from Google are displayed together with information about the secure session, the cipher suite in play, and related items. For example, here is a slice of output from near the start, which announces that a _certificate chain_ is forthcoming. The encoding for the certificates is base64: +端口号 443 是 Web 服务器用于接收 HTTPS 而不是 HTTP 连接的标准端口号。(对于 HTTP,标准端口为 80)网络地址 [www.google.com:443 也出现在 `client` 程序的代码中。如果尝试的连接成功,则将显示来自 Google 的三个数字证书以及有关安全会话、正在使用的加密算法套件以及相关项目的信息。例如,这是从头开始的一部分输出,它声明*证书链*即将到来。证书的编码为 base64: ``` Certificate chain - 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=www.google.com - i:/C=US/O=Google Trust Services/CN=Google Internet Authority G3 -\-----BEGIN CERTIFICATE----- + 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=www.google.com + i:/C=US/O=Google Trust Services/CN=Google Internet Authority G3 +-----BEGIN CERTIFICATE----- MIIEijCCA3KgAwIBAgIQdCea9tmy/T6rK/dDD1isujANBgkqhkiG9w0BAQsFADBU MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMSUw ... ``` -A major web site such as Google usually sends multiple certificates for authentication. - -The output ends with summary information about the TLS session, including specifics on the cipher suite: +诸如 Google 之类的主要网站通常会发送多个证书进行身份验证。 +输出以有关 TLS 会话的摘要信息结尾,包括加密算法套件的详细信息: ``` SSL-Session: @@ -286,28 +285,21 @@ SSL-Session: ... ``` -The protocol `TLS 1.2` is used in the `client` program, and the `Session-ID` uniquely identifies the connection between the `openssl` utility and the Google web server. The `Cipher` entry can be parsed as follows: +`client` 程序中使用了协议 TLS 1.2,`Session-ID` 唯一地标识了 `openssl` 实用程序和 Google Web 服务器之间的连接。 `Cipher` 条目可以按以下方式进行解析: - * `ECDHE` (Elliptic Curve Diffie Hellman Ephemeral) is an effective and efficient algorithm for managing the TLS handshake. In particular, ECDHE solves the _key-distribution problem_ by ensuring that both parties in a connection (e.g., the client program and the Google web server) use the same encryption/decryption key, which is known as the _session key_. The follow-up article digs into the details. +* `ECDHE`(Elliptic Curve Diffie Hellman Ephemeral椭圆曲线 Diffie-Hellman(临时))是一种用于管理 TLS 握手的有效而高效的算法。尤其是,ECDHE 通过确保连接双方(例如,`client` 程序和 Google Web 服务器)使用相同的加密/解密密钥(称为*会话密钥*)来解决“密钥分发问题”。后续文章会深入探讨该细节。 +* `RSA`(Rivest Shamir Adleman)是主要的公共密钥密码系统,并以 1970 年代后期首次描述该系统的三位学者的名字命名。这个正在使用的密钥对是使用 RSA 算法生成的。 +* `AES128`(高级加密标准Advanced Encryption Standard)是一种块式加密算法block cipher,用于加密和解密位块blocks of bits。(另一种算法是流式加密算法stream cipher,它一次加密和解密一个位。)该加密算法是对称加密算法,因为使用同一个密钥进行加密和解密,这首先引起了密钥分发问题。AES 支持 128(此处使用)、192 和 256 位的密钥大小:密钥越大,保护越好。 - * `RSA` (Rivest Shamir Adleman) is the dominant public-key cryptosystem and named after the three academics who first described the system in the late 1970s. The key-pairs in play are generated with the RSA algorithm. + 通常,像 AES 这样的对称加密系统的密钥大小要小于像 RSA 这样的非对称(基于密钥对)系统的密钥大小。例如,1024 位 RSA 密钥相对较小,而 256 位密钥当前是 AES 最大的密钥。 +* `GCM`(伽罗瓦计数器模式Galois Counter Mode)处理在安全对话期间重复应用加密算法(在这种情况下为 AES128)。AES128 块的大小仅为 128 位,安全对话很可能包含从一侧到另一侧的多个 AES128 块。GCM 非常有效,通常与 AES128 搭配使用。 +* `SHA256` (256 位安全哈希算法Secure Hash Algorithm 256 bits)是正在使用的加密哈希算法。生成的哈希值的大小为 256 位,尽管使用 SHA 甚至可以更大。 - * `AES128` (Advanced Encryption Standard) is a _block cipher_ that encrypts and decrypts blocks of bits. (The alternative is a _stream cipher_, which encrypts and decrypts bits one at a time.) The cipher is _symmetric_ in that the same key is used to encrypt and to decrypt, which raises the key-distribution problem in the first place. AES supports key sizes of 128 (used here), 192, and 256 bits: the larger the key, the better the protection. +加密算法套件正在不断发展中。例如,不久前,Google 使用 RC4 流加密算法(是 RSA 的 Ron Rivest 后来开发的 Ron's Cipher 版本 4)。 RC4 现在有已知的漏洞,这至少部分导致了 Google 转换为 AES128。 -Key sizes for symmetric cryptosystems such as AES are, in general, smaller than those for asymmetric (key-pair based) systems such as RSA. For example, a 1024-bit RSA key is relatively small, whereas a 256-bit key is currently the largest for AES. +### 总结 - * `GCM` (Galois Counter Mode) handles the repeated application of a cipher (in this case, AES128) during a secured conversation. AES128 blocks are only 128-bits in size, and a secure conversation is likely to consist of multiple AES128 blocks from one side to the other. GCM is efficient and commonly paired with AES128. - - * `SHA256` (Secure Hash Algorithm 256 bits) is the cryptographic hash algorithm in play. The hash values produced are 256 bits in size, although even larger values are possible with SHA. - - - - -Cipher suites are in continual development. Not so long ago, for example, Google used the RC4 stream cipher (Ron’s Cipher version 4 after Ron Rivest from RSA). RC4 now has known vulnerabilities, which presumably accounts, at least in part, for Google’s switch to AES128. - -### Wrapping up - -This first look at OpenSSL, through a secure C web client and various command-line examples, has brought to the fore a handful of topics in need of more clarification. [The next article gets into the details][17], starting with cryptographic hashes and ending with a fuller discussion of how digital certificates address the key distribution challenge. +通过安全的 C Web 客户端和各种命令行示例对 OpenSSL 的首次了解,使一些需要进一步阐明的主题脱颖而出。[下一篇文章会详细介绍][17],从加密散列开始,到结束时对数字证书如何应对密钥分发挑战的更全面讨论。 -------------------------------------------------------------------------------- @@ -315,7 +307,7 @@ via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 作者:[Marty Kalin][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[wxy](https://github.com/wxy) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1b372605e701c665eac47d0938515ffea7475bd2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 23 Jan 2020 00:58:09 +0800 Subject: [PATCH 0364/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200123=20Wine?= =?UTF-8?q?=205.0=20is=20Released!=20Here=E2=80=99s=20How=20to=20Install?= =?UTF-8?q?=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md --- ...0 is Released- Here-s How to Install it.md | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md diff --git a/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md b/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md new file mode 100644 index 0000000000..4c82b48a5d --- /dev/null +++ b/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Wine 5.0 is Released! Here’s How to Install it) +[#]: via: (https://itsfoss.com/wine-5-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Wine 5.0 is Released! Here’s How to Install it +====== + +_**Brief: A new major release of Wine is here. With Wine 5.0, running Windows applications and games on Linux is further improved.**_ + +With some efforts, you can [run Windows applications on Linux][1] using Wine. Wine is a tool that you may try when you must use a software that is available only on Windows. It supports a number of such software. + +A new major release for Wine has landed i.e Wine 5.0, almost after a year of its 4.0 release. + +Wine 5.0 release introduces a couple of major features and a lot of significant changes/improvements. In this article, I’ll highlight what’s new and also mention the installation instructions. + +### What’s New In Wine 5.0? + +![][2] + +The key changes in 5.0 release as mentioned in their [official announcement][3]: + + * Builtin modules in PE format. + * Multi-monitor support. + * XAudio2 reimplementation. + * Vulkan 1.1 support. + * Microsoft Installer (MSI) Patch Files are supported. + * Performance improvements. + + + +So, with Vulkan 1.1 support and multi-monitor support – Wine 5.0 release is a big deal. + +In addition to the key highlights, you can also expect better controller support in the new version considering thousands of changes/improvements involved in the new release. + +It is also worth noting that this release is being dedicated to the memory of **Józef Kucia** (_lead developer of the vkd3d project_) + +They’ve also mentioned this in their [release notes][4]: + +> This release is dedicated to the memory of Józef Kucia, who passed away in August 2019 at the young age of 30. Józef was a major contributor to Wine’s Direct3D implementation, and the lead developer of the vkd3d project. His skills and his kindness are sorely missed by all of us. + +### How to install Wine 5.0 on Ubuntu and Linux Mint + +Note + +_If you have Wine installed before, you should remove it completely to avoid any conflict (as you wish). Also, the WineHQ key repository key was changed recently, you should refer to its_ [_download page_][5] _for additional instructions on that according to your Linux distribution._ + +The source for Wine 5.0 is available on its [official website][3]. You can read more about [building wine][6] in order to make it work. Arch-based users should be getting it soon. + +Here’ I’ll show you the steps to install Wine 5.0 on Ubuntu and other Ubuntu-based distributions. + +First, remove existing Wine install with this command: + +``` +sudo apt remove winehq-stable wine-stable wine1.6 +``` + +Download the official Wine repository key and add it: + +``` +wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - +``` + +_**Now the next step involves adding the repository and for that, you need to [know your Ubuntu version][7] first.**_ + +For **Ubuntu 19.10**, add this repository: + +``` +sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ eoan main' +``` + +If you are using **Ubuntu 18.04** or **Linux Mint 19.x**, use this command to add the repository: + +``` +sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' +``` + +For **Ubuntu 16.04 and Linux Mint 18.x series**, you can use this command: + +``` +sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main' +``` + +Now that you have added the correct repository, you can install Wine 5.0 using this command: + +``` +sudo apt update && sudo apt install --install-recommends winehq-stable +``` + +**Wrapping Up** + +Have you tried the latest Wine 5.0 release yet? If yes, what improvements do you see in action? + +Let me know your thoughts on the new release in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/wine-5-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/use-windows-applications-linux/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/wine_5.png?ssl=1 +[3]: https://www.winehq.org/news/2020012101 +[4]: https://www.winehq.org/announce/5.0 +[5]: https://wiki.winehq.org/Download +[6]: https://wiki.winehq.org/Building_Wine +[7]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ From 49f2d59ecd57b88973b0adfb1c08aadb96c1e001 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 23 Jan 2020 00:59:28 +0800 Subject: [PATCH 0365/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200122=209=20?= =?UTF-8?q?favorite=20open=20source=20tools=20for=20Node.js=20developers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200122 9 favorite open source tools for Node.js developers.md --- ...pen source tools for Node.js developers.md | 249 ++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 sources/tech/20200122 9 favorite open source tools for Node.js developers.md diff --git a/sources/tech/20200122 9 favorite open source tools for Node.js developers.md b/sources/tech/20200122 9 favorite open source tools for Node.js developers.md new file mode 100644 index 0000000000..7885b9f642 --- /dev/null +++ b/sources/tech/20200122 9 favorite open source tools for Node.js developers.md @@ -0,0 +1,249 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (9 favorite open source tools for Node.js developers) +[#]: via: (https://opensource.com/article/20/1/open-source-tools-nodejs) +[#]: author: (Hiren Dhadhuk https://opensource.com/users/hirendhadhuk) + +9 favorite open source tools for Node.js developers +====== +Of the wide range of tools available to simplify Node.js development, +here are the 10 best. +![Tools illustration][1] + +I recently read a survey on [StackOverflow][2] that said more than 49% of developers use Node.js for their projects. This came as no surprise to me. + +As an avid user of technology, I think it's safe to say that the introduction of Node.js led to a new era of software development. It is now one of the most preferred technologies for software development, right next to JavaScript. + +### What is Node.js, and why is it so popular? + +Node.js is a cross-platform, open source runtime environment for executing JavaScript code outside of the browser. It is also a preferred runtime environment built on Chrome's JavaScript runtime and is mainly used for building fast, scalable, and efficient network applications. + +I remember when we used to sit for hours and hours coordinating between front-end and back-end developers who were writing different scripts for each side. All of this changed as soon as Node.js came into the picture. I believe that the one thing that drives developers towards this technology is its two-way efficiency. + +With Node.js, you can run your code simultaneously on both the client and the server side, speeding up the whole process of development. Node.js bridges the gap between front-end and back-end development and makes the development process much more efficient. + +### A wave of Node.js tools + +For 49% of all developers (including me), Node.js is at the top of the pyramid when it comes to front-end and back-end development. There are tons of [Node.js use cases][3] that have helped me and my team deliver complex projects within our deadlines. Fortunately, Node.js' rising popularity has also produced a wave of open source projects and tools to help developers working with the environment. + +Recently, there has been a sudden increase in demand for projects built with Node.js. Sometimes, I find it quite challenging to manage these projects and keep up the pace while delivering high-quality results. So I decided to automate certain aspects of development using some of the most efficient of the many open source tools available for Node.js developers. + +In my extensive experience with Node.js, I've worked with a wide range of tools that have helped me with the overall development process—from streamlining the coding process to monitoring to content management. + +To help my fellow Node.js developers, I compiled this list of 9 of my favorite open source tools for simplifying Node.js development. + +### Webpack + +[Webpack][4] is a handy JavaScript module bundler used to simplify front-end development. It detects modules with dependencies and transforms them into static assets that represent the modules. + +You can install the tool through either the npm or Yarn package manager. + +With npm: + + +``` +`npm install --save-dev webpack` +``` + +With Yarn: + + +``` +`yarn add webpack --dev` +``` + +Webpack creates single bundles or multiple chains of assets that can be loaded asynchronously at runtime. Each asset does not have to be loaded individually. Bundling and serving assets becomes quick and efficient with the Webpack tool, making the overall user experience better and reducing the developer's hassle in managing load time. + +### Strapi + +[Strapi][5] is an open source headless content management system (CMS). A headless CMS is basically software that lets you manage your content devoid of a prebuilt frontend. It is a backend-only system that functions using RESTful APIs. + +You can install Strapi through Yarn or npx packages. + +With Yarn: + + +``` +`yarn create strapi-app my-project --quickstart` +``` + +With npx: + + +``` +`npx create-strapi-app my-project --quickstart` +``` + +Strapi's goal is to fetch and deliver your content in a structured manner across any device. The CMS makes it easy to manage your applications' content and make sure they are dynamic and accessible across any device. + +It provides a lot of features, including file upload, a built-in email system, JSON Web Token (JWT) authentication, and auto-generated documentation. I find it very convenient, as it simplifies the overall CMS and gives me full autonomy in editing, creating, or deleting all types of contents. + +In addition, the content structure built through Strapi is extremely flexible because you can create and reuse groups of content and customizable APIs. + +### Broccoli + +[Broccoli][6] is a powerful build tool that runs on an [ES6][7] module. Build tools are software that let you assemble all the different assets within your application or website, e.g., images, CSS, JavaScript, etc., into one distributable format. Broccoli brands itself as the "asset pipeline for ambitious applications." + +You need a project directory to work with Broccoli. Once you have the project directory in place, you can install Broccoli with npm using: + + +``` +npm install --save-dev broccoli +npm install --global broccoli-cli +``` + +You can also use Yarn for installation.  + +The current version of Node.js would be the best version for the tool as it provides long-time support. This helps you avoid the hassle of updating and reinstalling as you go. Once the installation process is completed, you can include the build specification in your Brocfile.js. + +In Broccoli, the unit of abstraction is a tree, which stores files and subdirectories within specific subdirectories. Therefore, before you build, you must have a specific idea of what you want your build to look like. + +The best part about Broccoli is that it comes with a built-in server for development that lets you host your assets on a local HTTP server. Broccoli is great for streamlined rebuilds, as its concise architecture and flexible ecosystem boost rebuild and compilation speeds. Broccoli lets you get organized to save time and maximize productivity during development. + +### Danger + +[Danger][8] is a very handy open source tool for streamlining your pull request (PR) checks. As Danger's library description says, the tool helps you "formalize" your code review system by managing PR checks. Danger integrates with your CI and helps you speed up the review process. + +Integrating Danger with your project is an easy step-by-step process—you just need to include the Danger module and create a Danger file for each project. However, it's more convenient to create a Danger account (easy to do through GitHub or Bitbucket), then set up access tokens for your open source software projects. + +Danger can be installed via NPM or Yarn. To use Yarn, add danger -D to add it to your package.JSON. + +After you add Danger to your CI, you can: + + * Highlight build artifacts of importance + * Manage sprints by enforcing links to tools like Trello and Jira + * Enforce changelogs + * Utilize descriptive labels + * And much more + + + +For example, you can design a system that defines the team culture and sets out specific rules for code review and PR checks. Common issues can be solved based on the metadata Danger provides along with its extensive plugin ecosystem. + +### Snyk + +Cybersecurity is a major concern for developers. [Snyk][9] is one of the most well-known tools to fix vulnerabilities in open source components. It started as a project to fix vulnerabilities in Node.js projects and has evolved to detect and fix vulnerabilities in Ruby, Java, Python, and Scala apps as well. Snyk mainly runs in four stages: + + * Finding vulnerability dependencies + * Fixing specific vulnerabilities + * Preventing security risks by PR checks + * Monitoring apps continuously + + + +Snyk can be integrated with your project at any stage, including coding, CI/CD, and reporting. I find it extremely helpful for testing Node.js projects to test out npm packages for security risks or at build-time. You can also run PR checks for your applications in GitHub to make your projects more secure. Synx also provides a range of integrations that you can use to monitor dependencies and fix specific problems. + +To run Snyk on your machine locally, you can install it through NPM: + + +``` +`npm install -g snyk` +``` + +### Migrat + +[Migrat][10] is an extremely easy to use data-migration tool that uses plain text. It works across a diverse range of stacks and processes that make it even more convenient. You can install Migrat with a simple line of code: + + +``` +`$ npm install -g migrat` +``` + +Migrat is not specific to a particular database engine. It supports multi-node environments, as migrations can run on one node globally or once per server. What makes Migrat convenient is the facilitation of passing context to each migration. + +You can define what each migration is for (e.g.,. database sets, connections, logging interfaces, etc.). Moreover, to avoid haphazard migrations, where multiple servers are running migrations globally, Migrat facilitates global lockdown while the process is running so that it can run only once globally. It also comes with a range of plug-ins for SQL databases, Slack, HipChat, and the Datadog dashboard. You can send live migrations to any of these platforms. + +### Clinic.js + +[Clinic.js][11] is an open source monitoring tool for Node.js projects. It combines three different tools—Doctor, Bubbleprof, and Flame—that help you monitor, detect, and solve performance issues with Node.js. + +You can install Clinic.js from npm by running this command: + + +``` +`$ npm install clinic` +``` + +You can choose which of the three tools that comprise Clinic.js you want to use based on which aspect of your project you want to monitor and the report you want to generate: + + * Doctor provides detailed metrics by injecting probes and provides recommendations on the overall health of your project. + * Bubbleprof is great for profiling and generates metrics using async_hooks. + * Flame is great for uncovering hot paths and bottlenecks in your code. + + + +### PM2 + +Monitoring is one of the most important aspects of any backend development process. [PM2][12] is a process management tool for Node.js that helps developers monitor multiple aspects of their projects such as logs, delays, and speed. The tool is compatible with Linux, MacOS, and Windows and supports all Node.js versions starting from Node.js 8.X. + +You can install PM2 with npm using: + + +``` +`$ npm install pm2 --g` +``` + +If you do not already have Node.js installed, you can use: + + +``` +`wget -qO- https://getpm2.com/install.sh | bash` +``` + +Once it's installed, start the application with: + + +``` +`$ pm2 start app.js` +``` + +The best part about PM2 is that it lets you run your apps in cluster mode. You can spawn a process for multiple CPU cores at a time. This makes it easy to enhance application performance and maximize reliability. PM2 is also great for updates, as you can update your apps and reload them with zero downtime using the "hot reload" option. Overall, it's a great tool to simplify process management for Node.js applications. + +### Electrode + +[Electrode][13] is an open source application platform from Walmart Labs. The platform helps you build large-scale, universal React/Node.js applications in a structured manner. + +The Electrode app generator lets you build a flexible core focused on the code, provides some great modules to add complex features to the app, and comes with a wide range of tools to optimize your app's Node.js bundle. + +Electrode can be installed using npm. Once the installation is finished, you can start the app using Ignite and dive right in with the Electrode app generator. + +You can install Electrode using NPM: + + +``` +`npm install -g electrode-ignite xclap-cli` +``` + +### Which are your favorite? + +These are just a few of the always-growing list of open source tools that can come in handy at different stages when working with Node.js. Which are your go-to open source Node.js tools? Please share your recommendations in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-tools-nodejs + +作者:[Hiren Dhadhuk][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hirendhadhuk +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl (Tools illustration) +[2]: https://insights.stackoverflow.com/survey/2019#technology-_-other-frameworks-libraries-and-tools +[3]: https://www.simform.com/nodejs-use-case/ +[4]: https://webpack.js.org/ +[5]: https://strapi.io/ +[6]: https://broccoli.build/ +[7]: https://en.wikipedia.org/wiki/ECMAScript#6th_Edition_-_ECMAScript_2015 +[8]: https://danger.systems/ +[9]: https://snyk.io/ +[10]: https://github.com/naturalatlas/migrat +[11]: https://clinicjs.org/ +[12]: https://pm2.keymetrics.io/ +[13]: https://www.electrode.io/ From 338b1755aa743a62ae70ddb551512a6b5e9df765 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 23 Jan 2020 00:59:58 +0800 Subject: [PATCH 0366/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200122=20Get?= =?UTF-8?q?=20your=20RSS=20feeds=20and=20podcasts=20in=20one=20place=20wit?= =?UTF-8?q?h=20this=20open=20source=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md --- ...in one place with this open source tool.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md diff --git a/sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md b/sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md new file mode 100644 index 0000000000..994523d830 --- /dev/null +++ b/sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get your RSS feeds and podcasts in one place with this open source tool) +[#]: via: (https://opensource.com/article/20/1/open-source-rss-feed-reader) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Get your RSS feeds and podcasts in one place with this open source tool +====== +Keep up with your news feed and podcasts with Newsboat in the twelfth in +our series on 20 ways to be more productive with open source in 2020. +![Ship captain sailing the Kubernetes seas][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Access your RSS feeds and podcasts with Newsboat + +RSS news feeds are an exceptionally handy way to keep up to date on various websites. In addition to Opensource.com, I follow the annual [SysAdvent][2] sysadmin tools feed, some of my favorite authors, and several webcomics. RSS readers allow me to "batch up" my reading, so I'm not spending every day on a bunch of different websites. + +![Newsboat][3] + +[Newsboat][4] is a terminal-based RSS feed reader that looks and feels a lot like the email program [Mutt][5]. It makes news reading easy and has a lot of nice features. + +Installing Newsboat is pretty easy since it is included with most distributions (and Homebrew on MacOS). Once it is installed, adding the first feed is as easy as adding the URL to the **~/.newsboat/urls** file. If you are migrating from another feed reader and have an OPML file export of your feeds, you can import that file with: + + +``` +`newsboat -i ` +``` + +After you've added your feeds, the Newsboat interface is _very_ familiar, especially if you've used Mutt. You can scroll up and down with the arrow keys, check for new items in a feed with **r**, check for new items in all feeds with **R**, press **Enter** to open a feed and select an article to read. + +![Newsboat article list][6] + +You are not limited to just the local URL list, though. Newsboat is also a client for news reading services like [Tiny Tiny RSS][7], ownCloud and Nextcloud News, and a few Google Reader successors. Details on that and a whole host of other configuration options are covered in [Newsboat's documentation][8]. + +![Reading an article in Newsboat][9] + +#### Podcasts + +Newsboat also provides [podcast support][10] through Podboat, an included application that facilitates downloading and queuing podcast episodes. While viewing a podcast feed in Newsboat, press **e** to add the episode to your download queue. All the information will be stored in a queue file in the **~/.newsboat** directory. Podboat reads this queue and downloads the episode(s) to your local drive. You can do this from the Podboat user interface (which looks and acts like Newsboat), or you can tell Podboat to download them all with **podboat -a**. As a podcaster and podcast listener, I think this is _really_ handy. + +![Podboat][11] + +Overall, Newsboat has some really great features and is a nice, lightweight alternative to web-based or desktop apps. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-rss-feed-reader + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://sysadvent.blogspot.com/ +[3]: https://opensource.com/sites/default/files/uploads/productivity_12-1.png (Newsboat) +[4]: https://newsboat.org +[5]: http://mutt.org/ +[6]: https://opensource.com/sites/default/files/uploads/productivity_12-2.png (Newsboat article list) +[7]: https://tt-rss.org/ +[8]: https://newsboat.org/releases/2.18/docs/newsboat.html +[9]: https://opensource.com/sites/default/files/uploads/productivity_12-3.png (Reading an article in Newsboat) +[10]: https://newsboat.org/releases/2.18/docs/newsboat.html#_podcast_support +[11]: https://opensource.com/sites/default/files/uploads/productivity_12-4.png (Podboat) From 809602127fcf0197029c38e9697f27c64338fd2f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 23 Jan 2020 01:00:37 +0800 Subject: [PATCH 0367/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200122=20Scre?= =?UTF-8?q?enshot=20your=20Linux=20system=20configuration=20with=20Bash=20?= =?UTF-8?q?tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200122 Screenshot your Linux system configuration with Bash tools.md --- ...ux system configuration with Bash tools.md | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 sources/tech/20200122 Screenshot your Linux system configuration with Bash tools.md diff --git a/sources/tech/20200122 Screenshot your Linux system configuration with Bash tools.md b/sources/tech/20200122 Screenshot your Linux system configuration with Bash tools.md new file mode 100644 index 0000000000..325b3aa019 --- /dev/null +++ b/sources/tech/20200122 Screenshot your Linux system configuration with Bash tools.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Screenshot your Linux system configuration with Bash tools) +[#]: via: (https://opensource.com/article/20/1/screenfetch-neofetch) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Screenshot your Linux system configuration with Bash tools +====== +ScreenFetch and Neofetch make it easy to share your Linux environment +with others. +![metrics and data shown on a computer screen][1] + +There are many reasons you might want to share your Linux configuration with other people. You might be looking for help troubleshooting a problem on your system, or maybe you're so proud of the environment you've created that you want to showcase it to fellow open source enthusiasts. + +You could get some of that information with a **cat /proc/cpuinfo** or **lscpu** command at the Bash prompt. But if you want to share more details, such as your operating system, kernel, uptime, shell environment, screen resolution, etc., you have two great tools to choose: screenFetch and Neofetch. + +### ScreenFetch + +[ScreenFetch][2] is a Bash command-line utility that can produce a very nice screenshot of your system configuration and uptime. It is an easy way to share your system's configuration with others in a colorful way. + +It's simple to install screenFetch for many Linux distributions.  + +On Fedora, enter: + + +``` +`$ sudo dnf install screenfetch` +``` + +On Ubuntu, enter: + + +``` +`$ sudo apt install screenfetch` +``` + +For other operating systems, including FreeBSD, MacOS, and more, consult the screenFetch wiki's [installation page][3]. Once screenFetch is installed, it can produce a detailed and colorful screenshot like this: + +![screenFetch][4] + +ScreenFetch also provides various command-line options to fine-tune your results. For example, **screenfetch -v** returns verbose output that presents each option line-by-line along with the display shown above. + +And **screenfetch -n** eliminates the operating system icon when it displays your system information. + +![screenfetch -n option][5] + +Other options include **screenfetch -N**, which strips all color from the output; **screenfetch -t**, which truncates the output depending on the size of the terminal; and **screenFetch -E**, which suppresses errors. + +Be sure to check the man page on your system for other options. ScreenFetch is open source under the GPLv3, and you can learn more about the project in its [GitHub repository][6]. + +### Neofetch + +[Neofetch][7] is another tool to create a screenshot with your system information. It is written in Bash 3.2 and is open source under the [MIT License][8]. + +According to the project's website, "Neofetch supports almost 150 different operating systems. From Linux to Windows, all the way to more obscure operating systems like Minix, AIX, and Haiku." + +![Neofetch][9] + +The project maintains a wiki with excellent [installation documentation][10] for a variety of distributions and operating systems. + +If you are on Fedora, RHEL, or CentOS, you can install Neofetch at the Bash prompt with: + + +``` +`$ sudo dnf install neofetch` +``` + +On Ubuntu 17.10 and greater, you can use: + + +``` +`$ sudo apt install neofetch` +``` + +On its first run, Neofetch writes a **~/.config/neofetch/config.conf** file to your home directory (**.config/config.conf**), which enables you to [customize and control][11] every aspect of Neofetch's output. For example, you can configure Neofetch to use the image, ASCII file, or wallpaper of your choice—or nothing at all. The config.conf file also makes it easy to share your customization with others. + +If Neofetch doesn't support your operating system or provide all the options you are looking for, be sure to open up an issue in the project's [GitHub repo][12]. + +### Conclusion + +No matter why you want to share your system configuration, screenFetch or Neofetch should enable you to do so. Do you know of another open source tool that provides this functionality on Linux? Please share your favorite in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/screenfetch-neofetch + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://github.com/KittyKatt/screenFetch +[3]: https://github.com/KittyKatt/screenFetch/wiki/Installation +[4]: https://opensource.com/sites/default/files/uploads/screenfetch.png (screenFetch) +[5]: https://opensource.com/sites/default/files/uploads/screenfetch-n.png (screenfetch -n option) +[6]: http://github.com/KittyKatt/screenFetch +[7]: https://github.com/dylanaraps/neofetch +[8]: https://github.com/dylanaraps/neofetch/blob/master/LICENSE.md +[9]: https://opensource.com/sites/default/files/uploads/neofetch.png (Neofetch) +[10]: https://github.com/dylanaraps/neofetch/wiki/Installation +[11]: https://github.com/dylanaraps/neofetch/wiki/Customizing-Info +[12]: https://github.com/dylanaraps/neofetch/issues From 3e88d02a61fb8b571b4087922b99dfb8cc6626bf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 23 Jan 2020 01:02:11 +0800 Subject: [PATCH 0368/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200122=20Sett?= =?UTF-8?q?ing=20up=20passwordless=20Linux=20logins=20using=20public/priva?= =?UTF-8?q?te=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md --- ... Linux logins using public-private keys.md | 212 ++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md diff --git a/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md b/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md new file mode 100644 index 0000000000..2c61a4942b --- /dev/null +++ b/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md @@ -0,0 +1,212 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Setting up passwordless Linux logins using public/private keys) +[#]: via: (https://www.networkworld.com/article/3514607/setting-up-passwordless-linux-logins-using-publicprivate-keys.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Setting up passwordless Linux logins using public/private keys +====== +Using a set of public/private keys to allow you to log into a remote Linux system or run commands using ssh without a password can be very convenient, but setup is just tad tricky. Here's how and a script to help. +Ivanastar / Getty Images + +Setting up an account on a [Linux][1] system that allows you to log in or run commands remotely without a password isn’t all that hard, but there are some tedious details that you need to get right if you want it to work. In this post, we’re going to run through the process and then show a script that can help manage the details. + +Once set up, passwordless access is especially useful if you want to run ssh commands within a script, especially one that you might want to schedule to run automatically. + +It’s important to note that you do not have to be using the same user account on both systems. In fact, you can use your public key for a number of accounts on a system or for different accounts on multiple systems. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Here’s how to set this up. + +### Which system to start on? + +First, you need to start on the system from which you want to issue commands. That's the system that you will use to create the ssh keys.  You also need to have access to the account on the remote system on which those commands will be run. + +To keep the roles clear, we’ll call that first system in our scenario the “boss” since it will issue commands to be run on the other system. + +Thus, the command prompt: + +[RELATED: Linux hardening: a 15-step checklist for a secure Linux server][3] + +``` +boss$ +``` + +If you do not already have a public/private key pair set up for your account on the boss system, create one using a command like that shown below. Note that you can choose between the various encryption algorithms. (Either RSA or DSA is generally used.) Note that to access the system without typing a password, you will need to enter no password for the two prompts shown in the dialog below. + +If you already have a public/private key pair associated with this account, skip this step. + +``` +boss$ ssh-keygen -t rsa +Generating public/private rsa key pair. +Enter file in which to save the key (/home/myself/.ssh/id_rsa): +Enter passphrase (empty for no passphrase): <== just press the enter key +Enter same passphrase again: <== just press the enter key +Your identification has been saved in /home/myself/.ssh/id_rsa. +Your public key has been saved in /home/myself/.ssh/id_rsa.pub. +The key fingerprint is: +SHA256:1zz6pZcMjA1av8iyojqo6NVYgTl1+cc+N43kIwGKOUI myself@boss +The key's randomart image is: ++---[RSA 3072]----+ +| . .. | +| E+ .. . | +| .+ .o + o | +| ..+.. .o* . | +| ... So+*B o | +| + ...==B . | +| . o . ....++. | +|o o . . o..o+ | +|=..o.. ..o o. | ++----[SHA256]-----+ +``` + +The command shown above will create both a public and a private key. What one encrypts, the other will decrypt. So, the relationship between these keys is critical and the private key should **never** be shared. Instead, it should stay in your .ssh folder on the boss system. + +Notice that your public and private keys, on creation, will be saved in your .ssh folder. + +The next step is to copy the **public** key to the system you want to access from the boss system without using a password. You can use **scp** to do this though, at this point, you’ll still need to enter your password. In this example, that system is called “target”. + +``` +boss$ scp .ssh/id_rsa.pub myacct@target:/home/myaccount +myacct@target's password: +``` + +On the target system (the one on which the commands will be run), you will need to install your public key. If you don’t have a .ssh directory (e.g., if you’ve never used ssh on that system), running a command like this will set one up for you: + +``` +target$ ssh localhost date +target$ ls -la .ssh +total 12 +drwx------ 2 myacct myacct 4096 Jan 19 11:48 . +drwxr-xr-x 6 myacct myacct 4096 Jan 19 11:49 .. +-rw-r--r-- 1 myacct myacct 222 Jan 19 11:48 known_hosts +``` + +Still on the target system, you then need to add the public key you transferred from the “boss” system to your .ssh/authorized_keys file. The command below will add the key to the end of the file if it exists already or create the file and add the key if the file does not exist. + +``` +target$ cat id_rsa.pub >> .ssh/authorized_keys +``` + +Next, you need to make sure that the permissions on your authorized_keys file are set to 600. If not, run the **chmod 600 .ssh/authorized_keys** command. + +``` +target$ ls -l authorized_keys +-rw------- 1 myself myself 569 Jan 19 12:10 authorized_keys +``` + +Also check to be sure that permissions on your .ssh directory on the target system are set to 700. Fix the permissions with **chmod 700 .ssh** if needed. + +``` +target$ ls -ld .ssh +drwx------ 2 myacct myacct 4096 Jan 14 15:54 .ssh +``` + +At this point, you should be able to run a command remotely from your boss system to your target system without entering a password. This should work unless the target user account on the target system has an old public key for the same user and host as the one you’re trying to connect from. If so, you should be able to remove the earlier (and conflicting) entry. + +### Using a script + +Using a script can make some work a lot easier. In the example script below, however, the one annoying problem that you’ll run into is that you’ll have to enter the target user’s password numerous times before the password-free access is configured. One option would be to break the script into two parts – the commands that need to be run on the boss system and the commands that need to be run on the target system. + +Here’s the do-it-all version of the script: + +``` +#!/bin/bash +# NOTE: This script requires that you have the password for the remote acct +# in order to set up password-free access using your public key + +LOC=`hostname` # the local system from which you want to run commands from + # wo a password + +# get target system and account +echo -n "target system> " +read REM +echo -n "target user> " +read user + +# create a key pair if no public key exists +if [ ! -f ~/.ssh/id_rsa.pub ]; then + ssh-keygen -t rsa +fi + +# ensure a .ssh directory exists in the remote account +echo checking for .ssh directory on remote system +ssh $user@$REM "if [ ! -d /home/$user/.ssh ]; then mkdir /home/$user/.ssh; fi" + +# share the public key (using local hostname) +echo copying the public key +scp ~/.ssh/id_rsa.pub $user@$REM:/home/$user/$user-$LOC.pub + +# put the public key into the proper location +echo adding key to authorized_keys +ssh $user@$REM "cat /home/$user/$user-$LOC.pub >> /home/$user/.ssh/authorized_ke +ys" + +# set permissions on authorized_keys and .ssh (might be OK already) +echo setting permissions +ssh $user@$REM "chmod 600 ~/.ssh/authorized_keys" +ssh $user@$REM "chmod 700 ~/.ssh" + +# try it out -- should NOT ask for a password +echo testing -- if no password is requested, you are all set +ssh $user@$REM /bin/hostname +``` + +The script has been configured to tell you what it is doing each time you will have to enter a password. Interaction will look something like this: + +``` +$ ./rem_login_setup +target system> fruitfly +target user> lola +checking for .ssh directory on remote system +lola@fruitfly's password: +copying the public key +lola@fruitfly's password: +id_rsa.pub 100% 567 219.1KB/s 00:00 +adding key to authorized_keys +lola@fruitfly's password: +setting permissions +lola@fruitfly's password: +testing -- if no password is requested, you are all set +fruitfly +``` + +After the scenario shown above, you'd be able to log into lola's account on fruitfly like this: + +``` +$ ssh lola@fruitfly +[lola@fruitfly ~]$ +``` + +Once passwordless login is set up, you’ll both be able to log in from the boss system to the target system without a password and run arbitrary ssh commands. Running without a password in this way does not imply that your account is less secure. However, protecting your password on the boss system could become considerably more important depending on the nature of the target. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3514607/setting-up-passwordless-linux-logins-using-publicprivate-keys.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3143050/linux/linux-hardening-a-15-step-checklist-for-a-secure-linux-server.html#tk.nww-fsb +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 0e6feae483d42cf5ebfafa17e23c87625915ed42 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 01:17:33 +0800 Subject: [PATCH 0369/3057] PRF --- ...arted with OpenSSL- Cryptography basics.md | 129 +++++++++--------- 1 file changed, 64 insertions(+), 65 deletions(-) diff --git a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md index 3fa15783dd..be867e0f92 100644 --- a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -10,30 +10,28 @@ OpenSSL 入门:密码学基础知识 ====== -> 需要有关基础的密码学入门知识,尤其是有关 OpenSSL 的入门知识吗?继续阅读。 +> 需要入门密码学的基础知识,尤其是有关 OpenSSL 的入门知识吗?继续阅读。 ![A lock on the side of a building][1] -本文是两篇使用 [OpenSSL][2] 的密码学基础知识的第一篇,OpenSSL 是在 Linux 和其他系统上流行的生产级库和工具包。(要安装 OpenSSL 的最新版本,请参阅[这里][3]。)OpenSSL 实用程序可在命令行使用,而程序可以从 OpenSSL 库中调用函数。本文的示例程序使用 C 语言,即 OpenSSL 库的源语言。 +本文是使用 [OpenSSL][2] 的密码学基础知识的两篇文章中的第一篇,OpenSSL 是在 Linux 和其他系统上流行的生产级库和工具包。(要安装 OpenSSL 的最新版本,请参阅[这里][3]。)OpenSSL 实用程序可在命令行使用,程序也可以调用 OpenSSL 库中的函数。本文的示例程序使用的是 C 语言,即 OpenSSL 库的源语言。 -本系列的两篇文章共同介绍了加密哈希、数字签名、加密和解密以及数字证书。你可以从[我的网站][4]的 ZIP 文件中找到代码和命令行示例。 +本系列的两篇文章涵盖了加密哈希、数字签名、加密和解密以及数字证书。你可以从[我的网站][4]的 ZIP 文件中找到这些代码和命令行示例。 让我们首先回顾一下 OpenSSL 名称中的 SSL。 ### OpenSSL 简史 -[安全套接字层][5](SSL)是 Netscape 在 1995 年发布的一种加密协议。该协议层可以位于 HTTP 之上,从而为 HTTPS 提供了 S:安全。SSL 协议提供了各种安全服务,其中包括两项在 HTTPS 中至关重要的服务: +[安全套接字层][5]Secure Socket Layer(SSL)是 Netscape 在 1995 年发布的一种加密协议。该协议层可以位于 HTTP 之上,从而为 HTTPS 提供了 S:安全secure。SSL 协议提供了各种安全服务,其中包括两项在 HTTPS 中至关重要的服务: -* 对等身份验证Peer authentication(也称为相互挑战):连接的每一边都对另一边的身份进行身份验证。如果 Alice 和 Bob 要通过 SSL 交换消息,则每个人首先验证彼此的身份。 -* 机密性Confidentiality:发送者在通过通道发送消息之前先对其进行加密。接收者然后解密每个接收到的消息。此过程可保护网络对话。即使窃听者 Eve 截获了从 Alice 到 Bob 的加密消息(*中间人*攻击),Eve 仍发现他在计算上无法解密此消息。 +* 对等身份验证Peer authentication(也称为相互质询):连接的每一边都对另一边的身份进行身份验证。如果 Alice 和 Bob 要通过 SSL 交换消息,则每个人首先验证彼此的身份。 +* 机密性Confidentiality:发送者在通过通道发送消息之前先对其进行加密。然后,接收者解密每个接收到的消息。此过程可保护网络对话。即使窃听者 Eve 截获了从 Alice 到 Bob 的加密消息(即*中间人*攻击),Eve 会发现他在计算上无法解密此消息。    -反过来,这两个关键 SSL 服务与其他获得较少关注的服务捆绑在一起。例如,SSL 支持消息完整性,从而确保接收到的消息与发送的消息相同。此功能是通过散列函数实现的,散列函数也随 OpenSSL 工具箱一起提供。 - -SSL 已版本化(例如 SSLv2 和 SSLv3),并且在 1999 年,传输层安全性Transport Layer Security(TLS)成为基于 SSLv3 的类似协议。TLSv1 和 SSLv3 相似,但不足以相互配合。 但是,通常将 SSL/TLS 称为同一协议。例如,即使正在使用的是 TLS(而非 SSL),OpenSSL 函数也经常在名称中包含 SSL。此外,调用 OpenSSL 命令行实用程序以术语 `openssl` 开始。 - -OpenSSL 在其 man 页面之外的文档是零散的,鉴于 OpenSSL 工具包有多大,这些页面变得难以查找使用。命令行和代码示例是将主要主题集中起来的一种方法。让我们从一个熟悉的示例开始(使用 HTTPS 访问网站),然后使用该示例来挑选我们感兴趣的加密部分。 +反过来,这两个关键 SSL 服务与其他不太受关注的服务相关联。例如,SSL 支持消息完整性,从而确保接收到的消息与发送的消息相同。此功能是通过哈希函数实现的,哈希函数也随 OpenSSL 工具箱一起提供。 +SSL 有多个版本(例如 SSLv2 和 SSLv3),并且在 1999 年,传输层安全性Transport Layer Security(TLS)作为基于 SSLv3 的类似协议而出现。TLSv1 和 SSLv3 相似,但不足以相互配合工作。不过,通常将 SSL/TLS 称为同一协议。例如,即使正在使用的是 TLS(而非 SSL),OpenSSL 函数也经常在名称中包含 SSL。此外,调用 OpenSSL 命令行实用程序以 `openssl` 开始的。 +除了 man 页面之外,OpenSSL 的文档是零零散散的,鉴于 OpenSSL 工具包很大,这些页面很难以查找使用。命令行和代码示例可以将主要主题集中起来。让我们从一个熟悉的示例开始(使用 HTTPS 访问网站),然后使用该示例来选出我们感兴趣的加密部分进行讲述。 ### 一个 HTTPS 客户端 @@ -80,23 +78,23 @@ void secure_connect(const char* hostname) { SSL* ssl = NULL; - /* link bio channel, SSL session, and server endpoint */ + /* 链路 bio 通道,SSL 会话和服务器端点 */ sprintf(name, "%s:%s", hostname, "https"); - BIO_get_ssl(bio, &ssl); /* session */ - SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* robustness */ - BIO_set_conn_hostname(bio, name); /* prepare to connect */ + BIO_get_ssl(bio, &ssl); /* 会话 */ + SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* 鲁棒性 */ + BIO_set_conn_hostname(bio, name); /* 准备连接 */ - /* try to connect */ + /* 尝试连接 */ if (BIO_do_connect(bio) <= 0) { cleanup(ctx, bio); report_and_exit("BIO_do_connect..."); } - /* verify truststore, check cert */ + /* 验证信任库,检查证书 */ if (!SSL_CTX_load_verify_locations(ctx, - "/etc/ssl/certs/ca-certificates.crt", /* truststore */ - "/etc/ssl/certs/")) /* more truststore */ + "/etc/ssl/certs/ca-certificates.crt", /* 信任库 */ + "/etc/ssl/certs/")) /* 其它信任库 */ report_and_exit("SSL_CTX_load_verify_locations..."); long verify_flag = SSL_get_verify_result(ssl); @@ -105,17 +103,17 @@ void secure_connect(const char* hostname) { "##### Certificate verification error (%i) but continuing...\n", (int) verify_flag); - /* now fetch the homepage as sample data */ + /* 获取主页作为示例数据 */ sprintf(request, "GET / HTTP/1.1\x0D\x0AHost: %s\x0D\x0A\x43onnection: Close\x0D\x0A\x0D\x0A", hostname); BIO_puts(bio, request); - /* read HTTP response from server and print to stdout */ + /* 从服务器读取 HTTP 响应并打印到输出 */ while (1) { memset(response, '\0', sizeof(response)); int n = BIO_read(bio, response, BuffSize); - if (n <= 0) break; /* 0 is end-of-stream, < 0 is an error */ + if (n <= 0) break; /* 0 代表流结束,< 0 代表有错误 */ puts(response); } @@ -135,77 +133,78 @@ return 0; 可以从命令行编译和执行该程序(请注意 `-lssl` 和 `-lcrypto` 中的小写字母 `L`): - ``` gcc -o client client.c -lssl -lcrypto ``` -该程序尝试打开与网站 [www.google.com][13] 的安全连接。作为与 Google Web 服务器的 TLS 握手的一部分,`client` 程序会接收一个或多个数字证书,该程序会尝试对其进行验证(但在我的系统上失败了)。尽管如此,`client` 程序仍继续通过安全通道获取 Google 主页。该程序取决于前面提到的安全工件,尽管在代码中只突出了数字证书。其他工件仍在幕后,稍后将对其进行详细说明。 +该程序尝试打开与网站 [www.google.com][13] 的安全连接。作为与 Google Web 服务器的 TLS 握手的一部分,`client` 程序会收到一个或多个数字证书,该程序会尝试对其进行验证(但在我的系统上失败了)。尽管如此,`client` 程序仍继续通过安全通道获取 Google 主页。该程序取决于前面提到的安全工件,尽管在代码中只着重突出了数字证书。但其它工件仍在幕后发挥作用,稍后将对它们进行详细说明。 -通常,打开 HTTP(非安全)通道的 C 或 C++ 客户端程序将使用诸如*文件描述符*或*网络套接字*之类的结构,这些是两个进程(例如,客户端程序和 Google Web 服务器)之间连接的端点。另一方面,文件描述符是一个非负整数值,它在程序中标识该程序打开的任何文件类的结构。这样的程序还将使用一种结构来指定有关 Web 服务器地址的详细信息。 +通常,打开 HTTP(非安全)通道的 C 或 C++ 客户端程序将使用诸如*文件描述符*或*网络套接字*之类的结构,它们是两个进程(例如,这个 `client` 程序和 Google Web 服务器)之间连接的端点。另一方面,文件描述符是一个非负整数值,用于在程序中标识该程序打开的任何文件类的结构。这样的程序还将使用一种结构来指定有关 Web 服务器地址的详细信息。 -这些相对较低级别的结构都不会出现在客户端程序中,因为 OpenSSL 库会将套接字基础设施和地址规范等封装在高级的安全结构中。其结果是一个简单的 API。下面首先看一下 `client` 程序示例中的安全性详细信息。 +这些相对较低级别的结构不会出现在客户端程序中,因为 OpenSSL 库会将套接字基础设施和地址规范等封装在更高层面的安全结构中。其结果是一个简单的 API。下面首先看一下 `client` 程序示例中的安全性详细信息。 -* 该程序首先加载相关的 OpenSSL 库,而我的函数 `init_ssl` 则对 OpenSSL 进行了两次调用: +* 该程序首先加载相关的 OpenSSL 库,我的函数 `init_ssl` 中对 OpenSSL 进行了两次调用: ``` -SSL_library_init(); SSL_load_error_strings(); +SSL_load_error_strings(); +SSL_library_init(); ``` -* 下一个初始化步骤尝试获取安全*上下文*,这是建立和维护通往 Web 服务器的安全通道所需的信息框架。 在示例中使用了 TLS 1.2,如对 OpenSSL 库函数的调用所示: +* 下一个初始化步骤尝试获取安全*上下文*,这是建立和维护通往 Web 服务器的安全通道所需的信息框架。如对 OpenSSL 库函数的调用所示,在示例中使用了 TLS 1.2: ``` const SSL_METHOD* method = TLSv1_2_client_method(); /* TLS 1.2 */ ``` - 如果调用成功,则将 `method ` 指针被传递给库函数,该函数创建类型为 `SSL_CTX` 的上下文: - + 如果调用成功,则将 `method` 指针被传递给库函数,该函数创建类型为 `SSL_CTX` 的上下文: ``` SSL_CTX* ctx = SSL_CTX_new(method); ``` - `client` 程序检查每个关键库调用中的错误,然后如果其中一个调用失败,则程序终止。 -* 现在还有另外两个 OpenSSL 工件在起作用:SSL 类型的安全会话,从头到尾管理安全连接;以及类型为BIO(基本输入/输出)的安全流,用于与 Web 服务器进行通信。BIO 流是通过以下调用生成的: + `client` 程序会检查每个关键的库调用中的错误,如果其中一个调用失败,则程序终止。 +* 现在还有另外两个 OpenSSL 工件也在发挥作用:SSL 类型的安全会话,从头到尾管理安全连接;以及类型为 BIO(基本输入/输出Basic Input/Output)的安全流,用于与 Web 服务器进行通信。BIO 流是通过以下调用生成的: ``` BIO* bio = BIO_new_ssl_connect(ctx); ``` - 请注意,最重要的上下文是参数。`BIO` 类型是 C 语言中 `FILE` 类型的 OpenSSL 封装器。此封装器可保护 `client` 程序与 Google 的网络服务器之间的输入和输出流。 + + 请注意,这个最重要的上下文是其参数。`BIO` 类型是 C 语言中 `FILE` 类型的 OpenSSL 封装器。此封装器可保护 `client` 程序与 Google 的网络服务器之间的输入和输出流的安全。 * 有了 `SSL_CTX` 和 `BIO`,然后程序在 SSL 会话中将它们组合在一起。三个库调用可以完成工作: ``` -BIO_get_ssl(bio, &ssl); /* get a TLS session */ -SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* for robustness */ -BIO_set_conn_hostname(bio, name); /* prepare to connect to Google */ +BIO_get_ssl(bio, &ssl); /* 会话 */ +SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* 鲁棒性 */ +BIO_set_conn_hostname(bio, name); /* 准备连接 */ ``` + 安全连接本身是通过以下调用建立的: ``` BIO_do_connect(bio); ``` - 如果最后一次调用不成功,则 `client` 程序终止;否则,该连接已准备就绪,可以支持 `client` 程序与Google Web 服务器之间的机密对话。 + 如果最后一个调用不成功,则 `client` 程序终止;否则,该连接已准备就绪,可以支持 `client` 程序与 Google Web 服务器之间的机密对话。 -在与 Web 服务器握手期间,`client` 程序会接收一个或多个数字证书,以认证服务器的身份。 但是,`client` 程序不会发送自己的证书,这意味着身份验证是单向的。(通常将 Web 服务器配置为**不**需要客户端证书。)尽管对 Web 服务器证书的验证失败,但 `client` 程序仍通过到 Web 服务器的安全通道继续获取 Google 主页。 +在与 Web 服务器握手期间,`client` 程序会接收一个或多个数字证书,以认证服务器的身份。但是,`client` 程序不会发送自己的证书,这意味着这个身份验证是单向的。(Web 服务器通常配置为**不**需要客户端证书)尽管对 Web 服务器证书的验证失败,但 `client` 程序仍通过了连接到 Web 服务器的安全通道继续获取 Google 主页。 -为什么验证 Google 证书的尝试失败?典型的 OpenSSL 安装目录为 `/etc/ssl/certs`,其中包含 `ca-certificates.crt` 文件。该目录和文件包含着 OpenSSL 自带的数字证书,以此构成信任库。可以根据需要更新信任库,尤其是可以包括新信任的证书,并删除不再受信任的证书。 +为什么验证 Google 证书的尝试会失败?典型的 OpenSSL 安装目录为 `/etc/ssl/certs`,其中包含 `ca-certificates.crt` 文件。该目录和文件包含着 OpenSSL 自带的数字证书,以此构成信任库。可以根据需要更新信任库,尤其是可以包括新信任的证书,并删除不再受信任的证书。 -`client` 程序从 Google Web 服务器接收了三个证书,但是我的计算机上的 OpenSSL 信任库不包含完全匹配项。如目前所写,`client` 程序不会通过例如验证 Google 证书上的数字签名(一个用来证明该证书的签名)来解决此问题。如果该签名是受信任的,则包含该签名的证书也应受信任。尽管如此,`client` 程序仍继续进行获取页面,然后打印 Google 的主页。下一节将更详细地介绍。 +`client` 程序从 Google Web 服务器收到了三个证书,但是我的计算机上的 OpenSSL 信任库并不包含完全匹配的证书。如目前所写,`client` 程序不会通过例如验证 Google 证书上的数字签名(一个用来证明该证书的签名)来解决此问题。如果该签名是受信任的,则包含该签名的证书也应受信任。尽管如此,`client` 程序仍继续获取页面,然后打印出 Google 的主页。下一节将更详细地介绍这些。 ### 客户端程序中隐藏的安全性 -让我们从客户端示例中的可见安全工件(数字证书)开始,然后考虑其他安全工件如何与之相关。数字证书的主要布局标准是 X509,生产级证书由诸如 [Verisign][14] 的证书颁发机构(CA)颁发。 +让我们从客户端示例中可见的安全工件(数字证书)开始,然后考虑其他安全工件如何与之相关。数字证书的主要格式标准是 X509,生产级的证书由诸如 [Verisign][14] 的证书颁发机构Certificate Authority(CA)颁发。 -数字证书包含各种信息(例如,激活和有效日期以及所有者的域名),包括发行者的身份和*数字签名*(这是加密过的*加密哈希*值)。证书还具有未加密的哈希值,用作其标识*指纹*。 +数字证书中包含各种信息(例如,激活日期和失效日期以及所有者的域名),也包括发行者的身份和*数字签名*(这是加密过的*加密哈希*值)。证书还具有未加密的哈希值,用作其标识*指纹*。 -哈希值来自将任意数量的位映射到固定长度的摘要。这些位代表什么(会计报告、小说或数字电影)无关紧要。例如,消息摘要版本 5Message Digest version 5(MD5)哈希算法将任意长度的输入位映射到 128 位哈希值,而 SHA1(安全哈希算法版本 1Secure Hash Algorithm version 1)算法将输入位映射到 160 位值。不同的输入位会导致不同的(实际上是统计学上唯一的)哈希值。下一篇文章将进行更详细的介绍,并着重介绍什么使哈希函数具有加密功能。 +哈希值来自将任意数量的二进制位映射到固定长度的摘要。这些位代表什么(会计报告、小说或数字电影)无关紧要。例如,消息摘要版本 5Message Digest version 5(MD5)哈希算法将任意长度的输入位映射到 128 位哈希值,而 SHA1(安全哈希算法版本 1Secure Hash Algorithm version 1)算法将输入位映射到 160 位哈希值。不同的输入位会导致不同的(实际上在统计学上是唯一的)哈希值。下一篇文章将会进行更详细的介绍,并着重介绍什么使哈希函数具有加密功能。 -数字证书的类型有所不同(例如根证书、中间证书和最终实体证书),并形成了反映这些类型的层次结构。 顾名思义,*根*证书位于层次结构的顶部,其下的证书继承了根证书所具有的信任。OpenSSL 库和大多数现代编程语言都具有 X509 类型以及处理此类证书的函数。来自 Google 的证书具有 X509 格式,`client` 程序会检查该证书是否为 `X509_V_OK`。 +数字证书的类型有所不同(例如根证书、中间证书和最终实体证书),并形成了反映这些类型的层次结构。顾名思义,*根*证书位于层次结构的顶部,其下的证书继承了根证书所具有的信任。OpenSSL 库和大多数现代编程语言都具有 X509 数据类型以及处理此类证书的函数。来自 Google 的证书具有 X509 格式,`client` 程序会检查该证书是否为 `X509_V_OK`。 -X509 证书基于公共密钥基础结构public-key infrastructure(PKI),其中包括的算法(RSA 是占主导地位的算法)用于生成*密钥对*:公共密钥及其配对的私有密钥。公钥是一种身份:[Amazon][15] 的公钥对其进行标识,而我的公钥对我进行标识。私钥应由其所有者保密。 +X509 证书基于公共密钥基础结构public-key infrastructure(PKI),其中包括的算法(RSA 是占主导地位的算法)用于生成*密钥对*:公共密钥及其配对的私有密钥。公钥是一种身份:[Amazon][15] 的公钥对其进行标识,而我的公钥对我进行标识。私钥应由其所有者负责保密。 -成对出现的密钥具有标准用途。可以使用公钥对消息进行加密,然后可以使用同一个密钥对中的私钥对消息进行解密。私钥也可以用于对文档或其他电子产品(例如程序或电子邮件)进行签名,然后可以使用该对密钥中的公钥来验证签名。以下两个示例填充了一些细节。 +成对出现的密钥具有标准用途。可以使用公钥对消息进行加密,然后可以使用同一个密钥对中的私钥对消息进行解密。私钥也可以用于对文档或其他电子工件(例如程序或电子邮件)进行签名,然后可以使用该对密钥中的公钥来验证签名。以下两个示例补充了一些细节。 -在第一个示例中,Alice 将她的公钥分发给世界,包括 Bob。然后,Bob 用 Alice 的公钥加密邮件,然后将加密的邮件发送给 Alice。用 Alice 的公钥加密的邮件将用她的私钥解密(假设是她自己的私钥),如下所示: +在第一个示例中,Alice 将她的公钥分发给全世界,包括 Bob。然后,Bob 用 Alice 的公钥加密邮件,然后将加密的邮件发送给 Alice。用 Alice 的公钥加密的邮件将可以用她的私钥解密(假设是她自己的私钥),如下所示: ``` +------------------+ encrypted msg +-------------------+ @@ -213,9 +212,9 @@ Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's +------------------+ +-------------------+ ``` -原则上可以在没有 Alice 的私钥的情况下解密消息,但在实际情况下,如果使用像 RSA 这样的加密密钥对系统,则无法实现。 +原则上可以在没有 Alice 的私钥的情况下解密消息,但在实际情况中,如果使用像 RSA 这样的加密密钥对系统,则做不到。 -现在,对于第二个示例,请考虑对文档签名以证明其真实性。签名算法使用密钥对中的私钥来处理要签名的文档的加密哈希: +现在,第二个示例,请对文档签名以证明其真实性。签名算法使用密钥对中的私钥来处理要签名的文档的加密哈希: ``` +-------------------+ @@ -231,13 +230,13 @@ Alice's digital signature of the document--->|Alice's public key|--->verified or +------------------+ ``` -假若没有 Alice 的私钥,就无法伪造 Alice 的签名:因此,Alice 有必要保密她的私钥。 +假若没有 Alice 的私钥,就无法轻松伪造 Alice 的签名:因此,Alice 有必要保密她的私钥。 -在 `client` 程序中,除了数字证书以外,这些安全性都没有明确规定。下一篇文章使用使用 OpenSSL 实用程序和库函数的示例填充详细信息。 +在 `client` 程序中,除了数字证书以外,这些安全性都没有明确展示。下一篇文章使用使用 OpenSSL 实用程序和库函数的示例填充更多详细的信息。 ### 命令行的 OpenSSL -同时,让我们看一下 OpenSSL 命令行实用程序:特别是在 TLS 握手期间检查来自 Web 服务器的证书的实用程序。调用 OpenSSL 实用程序从`openssl` 命令开始,然后添加参数和标志的组合以指定所需的操作。 +同时,让我们看一下 OpenSSL 命令行实用程序:特别是在 TLS 握手期间检查来自 Web 服务器的证书的实用程序。调用 OpenSSL 实用程序可以使用 `openssl` 命令,然后添加参数和标志的组合以指定所需的操作。 看看以下命令: @@ -245,7 +244,7 @@ Alice's digital signature of the document--->|Alice's public key|--->verified or openssl list-cipher-algorithms ``` -该输出是组成加密算法套件cipher suite的相关算法的列表。下面是列表的开头,注释以澄清首字母缩写词: +该输出是组成加密算法套件cipher suite的相关算法的列表。下面是列表的开头,加了澄清首字母缩写词的注释: ``` AES-128-CBC ## Advanced Encryption Standard, Cipher Block Chaining @@ -254,13 +253,13 @@ AES-128-CBC-HMAC-SHA256 ## ditto, but SHA256 rather than SHA1 ... ``` -使用参数 `s_client` 的下一条命令将打开到 [www.google.com][13] 的安全连接,并在屏幕上显示有关此连接的所有信息: +下一条命令使用参数 `s_client` 将打开到 [www.google.com][13] 的安全连接,并在屏幕上显示有关此连接的所有信息: ``` openssl s_client -connect www.google.com:443 -showcerts ``` -端口号 443 是 Web 服务器用于接收 HTTPS 而不是 HTTP 连接的标准端口号。(对于 HTTP,标准端口为 80)网络地址 [www.google.com:443 也出现在 `client` 程序的代码中。如果尝试的连接成功,则将显示来自 Google 的三个数字证书以及有关安全会话、正在使用的加密算法套件以及相关项目的信息。例如,这是从头开始的一部分输出,它声明*证书链*即将到来。证书的编码为 base64: +端口号 443 是 Web 服务器用于接收 HTTPS(而不是 HTTP 连接)的标准端口号。(对于 HTTP,标准端口为 80)Web 地址 www.google.com:443 也出现在 `client` 程序的代码中。如果尝试连接成功,则将显示来自 Google 的三个数字证书以及有关安全会话、正在使用的加密算法套件以及相关项目的信息。例如,这是开头的部分输出,它声明*证书链*即将到来。证书的编码为 base64: ``` @@ -285,21 +284,21 @@ SSL-Session: ... ``` -`client` 程序中使用了协议 TLS 1.2,`Session-ID` 唯一地标识了 `openssl` 实用程序和 Google Web 服务器之间的连接。 `Cipher` 条目可以按以下方式进行解析: +`client` 程序中使用了协议 TLS 1.2,`Session-ID` 唯一地标识了 `openssl` 实用程序和 Google Web 服务器之间的连接。`Cipher` 条目可以按以下方式进行解析: -* `ECDHE`(Elliptic Curve Diffie Hellman Ephemeral椭圆曲线 Diffie-Hellman(临时))是一种用于管理 TLS 握手的有效而高效的算法。尤其是,ECDHE 通过确保连接双方(例如,`client` 程序和 Google Web 服务器)使用相同的加密/解密密钥(称为*会话密钥*)来解决“密钥分发问题”。后续文章会深入探讨该细节。 -* `RSA`(Rivest Shamir Adleman)是主要的公共密钥密码系统,并以 1970 年代后期首次描述该系统的三位学者的名字命名。这个正在使用的密钥对是使用 RSA 算法生成的。 -* `AES128`(高级加密标准Advanced Encryption Standard)是一种块式加密算法block cipher,用于加密和解密位块blocks of bits。(另一种算法是流式加密算法stream cipher,它一次加密和解密一个位。)该加密算法是对称加密算法,因为使用同一个密钥进行加密和解密,这首先引起了密钥分发问题。AES 支持 128(此处使用)、192 和 256 位的密钥大小:密钥越大,保护越好。 +* `ECDHE`(椭圆曲线 Diffie-Hellman(临时)Elliptic Curve Diffie Hellman Ephemeral)是一种用于管理 TLS 握手的高效的有效算法。尤其是,ECDHE 通过确保连接双方(例如,`client` 程序和 Google Web 服务器)使用相同的加密/解密密钥(称为*会话密钥*)来解决“密钥分发问题”。后续文章会深入探讨该细节。 +* `RSA`(Rivest Shamir Adleman)是主要的公共密钥密码系统,并以 1970 年代末首次描述了该系统的三位学者的名字命名。这个正在使用的密钥对是使用 RSA 算法生成的。 +* `AES128`(高级加密标准Advanced Encryption Standard)是一种块式加密算法block cipher,用于加密和解密位块blocks of bits。(另一种算法是流式加密算法stream cipher,它一次加密和解密一个位。)这个加密算法是对称加密算法,因为使用同一个密钥进行加密和解密,这首先引起了密钥分发问题。AES 支持 128(此处使用)、192 和 256 位的密钥大小:密钥越大,安全性越好。 - 通常,像 AES 这样的对称加密系统的密钥大小要小于像 RSA 这样的非对称(基于密钥对)系统的密钥大小。例如,1024 位 RSA 密钥相对较小,而 256 位密钥当前是 AES 最大的密钥。 -* `GCM`(伽罗瓦计数器模式Galois Counter Mode)处理在安全对话期间重复应用加密算法(在这种情况下为 AES128)。AES128 块的大小仅为 128 位,安全对话很可能包含从一侧到另一侧的多个 AES128 块。GCM 非常有效,通常与 AES128 搭配使用。 -* `SHA256` (256 位安全哈希算法Secure Hash Algorithm 256 bits)是正在使用的加密哈希算法。生成的哈希值的大小为 256 位,尽管使用 SHA 甚至可以更大。 + 通常,像 AES 这样的对称加密系统的密钥大小要小于像 RSA 这样的非对称(基于密钥对)系统的密钥大小。例如,1024 位 RSA 密钥相对较小,而 256 位密钥则当前是 AES 最大的密钥。 +* `GCM`(伽罗瓦计数器模式Galois Counter Mode)处理在安全对话期间重复应用的加密算法(在这种情况下为 AES128)。AES128 块的大小仅为 128 位,安全对话很可能包含从一侧到另一侧的多个 AES128 块。GCM 非常有效,通常与 AES128 搭配使用。 +* `SHA256`(256 位安全哈希算法Secure Hash Algorithm 256 bits)是我们正在使用的加密哈希算法。生成的哈希值的大小为 256 位,尽管使用 SHA 甚至可以更大。 -加密算法套件正在不断发展中。例如,不久前,Google 使用 RC4 流加密算法(是 RSA 的 Ron Rivest 后来开发的 Ron's Cipher 版本 4)。 RC4 现在有已知的漏洞,这至少部分导致了 Google 转换为 AES128。 +加密算法套件正在不断发展中。例如,不久前,Google 使用 RC4 流加密算法(RSA 的 Ron Rivest 后来开发的 Ron's Cipher 版本 4)。 RC4 现在有已知的漏洞,这大概部分导致了 Google 转换为 AES128。 ### 总结 -通过安全的 C Web 客户端和各种命令行示例对 OpenSSL 的首次了解,使一些需要进一步阐明的主题脱颖而出。[下一篇文章会详细介绍][17],从加密散列开始,到结束时对数字证书如何应对密钥分发挑战的更全面讨论。 +我们通过安全的 C Web 客户端和各种命令行示例对 OpenSSL 做了首次了解,使一些需要进一步阐明的主题脱颖而出。[下一篇文章会详细介绍][17],从加密散列开始,到对数字证书如何应对密钥分发挑战为结束的更全面讨论。 -------------------------------------------------------------------------------- From 626245368750f013d2dc19ccefbfb58958009adb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 01:20:57 +0800 Subject: [PATCH 0370/3057] PRF --- ...90619 Getting started with OpenSSL- Cryptography basics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md index be867e0f92..ac0e0222f6 100644 --- a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with OpenSSL: Cryptography basics) @@ -307,7 +307,7 @@ via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 作者:[Marty Kalin][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7f54abe36d01ae50815025e4d5dff3e2b203b7b8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 23 Jan 2020 09:17:22 +0800 Subject: [PATCH 0371/3057] translated --- ...nt for Linux to tweet from the terminal.md | 70 ------------------- ...nt for Linux to tweet from the terminal.md | 64 +++++++++++++++++ 2 files changed, 64 insertions(+), 70 deletions(-) delete mode 100644 sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md create mode 100644 translated/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md diff --git a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md deleted file mode 100644 index 1e9eda911f..0000000000 --- a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use this Twitter client for Linux to tweet from the terminal) -[#]: via: (https://opensource.com/article/20/1/tweet-terminal-rainbow-stream) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use this Twitter client for Linux to tweet from the terminal -====== -Keep up with your Twitter feed without leaving the terminal by using -Rainbow Stream in the tenth in our series on 20 ways to be more -productive with open source in 2020. -![Chat bubbles][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Keep up with Twitter with Rainbow Stream - -I love social networking and microblogging. It's quick, it's easy, and I can share my thoughts with the world really quickly. The drawback is, of course, that almost all the desktop options for non-Windows users are wrappers around the website. [Twitter][2] has a lot of clients, but what I really want is something lightweight, easy to use, and most importantly, attractive. - -![Rainbow Stream for Twitter][3] - -[Rainbow Stream][4] is one of the prettier Twitter clients. It is easy to use and installs quickly with a simple **pip3 install rainbowstream**. On the first run, it will open a browser window and have you authorize with Twitter. Once that is done, you land at a prompt, and your Twitter timeline will start scrolling by. - -![Rainbow Stream first run][5] - -The most important commands to know are **p** to pause the stream, **r** to resume the stream, **h** to get help, and **t** to post a new tweet. For example, **h tweets** will give you all the options for sending and replying to tweets. Another useful help screen is **h messages**, which gives the commands for working with direct messages, which is something my wife and I use a lot. There are a lot of other commands, and I refer back to help a lot. - -As your timeline scrolls by, you can see that it has full UTF-8 support and, with the right font, will show indicators for how many times something was retweeted and liked, as well as icons and emojis. - -![Kill this love][6] - -One of the _best_ things about Rainbow Stream is that you don't have to give up on photos and images. This feature is off by default, but you can try it out with the **config** command. - - -``` -`config IMAGE_ON_TERM = true` -``` - -This command renders any images as ASCII art. If you have a photo-heavy stream, this may be a bit much, but I like it. It has a very retro-1990s BBS feel, and I did love the BBS scene in the 1990s. - -You can also use Rainbow Stream to manage lists, mute people, block people, follow, unfollow, and everything else that is available with the Twitter API. There is also theme support, so you can customize the stream to your favorite color scheme. - -When I'm working and don't want to have yet-another-tab open on my browser, Rainbow Stream lets me keep up in a terminal off to the side. - -Without open source, Twitter wouldn't exist. Every Tweet you send and receive touches open source... - -Sergey Bronnikov shares why the OpenVZ team created Twisource, an open source social media tool. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) -[2]: https://twitter.com/home -[3]: https://opensource.com/sites/default/files/uploads/productivity_10-1.png (Rainbow Stream for Twitter) -[4]: https://rainbowstream.readthedocs.io/en/latest/ -[5]: https://opensource.com/sites/default/files/uploads/productivity_10-2.png (Rainbow Stream first run) -[6]: https://opensource.com/sites/default/files/uploads/day10-image3_1.png (Kill this love) diff --git a/translated/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/translated/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md new file mode 100644 index 0000000000..d67793031e --- /dev/null +++ b/translated/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this Twitter client for Linux to tweet from the terminal) +[#]: via: (https://opensource.com/article/20/1/tweet-terminal-rainbow-stream) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用这个 Twitter 客户端在 Linux 终端中发推特 +====== +在我们的 20 个使用开源提升生产力的系列的第十篇文章中使用 Rainbow Stream 跟上你的 Twitter 流而无需离开终端。 +![Chat bubbles][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 通过 Rainbow Stream 跟上Twitter + +我喜欢社交网络和微博。它快速、简单,还有我可以与世界分享我的想法。当然,缺点是几乎所有非 Windows 的桌面客户端都是网站的封装。[Twitter][2] 有很多客户端,但我真正想要的是轻量、易于使用,最重要的是吸引人的客户端。 + +![Rainbow Stream for Twitter][3] + +[Rainbow Stream][4] 是好看的 Twitter 客户端之一。它简单易用,并且可以通过 **pip3 install rainbowstream** 快速安装。第一次运行时,它将打开浏览器窗口,并让你通过 Twitter 授权。完成后,你将回到命令行,你的 Twitter 时间线将开始滚动。 + +![Rainbow Stream first run][5] + +要了解的最重要的命令是 **p** 暂停推流、**r** 继续推流、**h** 得帮助,以及 **t** 发布新的推文。例如,**h tweets** 将提供发送和回复推文的所有选项。另一个有用的帮助页面是 **h messages**,它提供了处理直接消息的命令,这是我妻子和我经常使用的东西。还有很多其他命令,我会回头获得很多帮助。 + +随着时间线的滚动,你可以看到它有完整的 UTF-8 支持,并以正确的字体显示推文被转推以及喜欢的次数,图标和 emoji 也能正确显示。 + +![Kill this love][6] + +关于 Rainbow Stream 的_最好_功能之一就是你不必放弃照片和图像。默认情况下,此功能是关闭的,但是你可以使用 **config** 命令尝试它。 + + +``` +`config IMAGE_ON_TERM = true` +``` + +此命令将任何图像渲染为 ASCII 艺术。如果你有大量照片流,它可能会有点多,但是我喜欢。它有非常复古的 1990 年代 BBS 感觉,我也确实喜欢 1990 年代的 BBS 场景。 + +你还可以使用 Rainbow Stream 管理列表、屏蔽某人、拉黑某人、关注、取消关注以及 Twitter API 的所有其他功能。它还支持主题,因此你可以用喜欢的颜色方案自定义流。 + +当我正在工作并且不想在浏览器上打开另一个选项卡时,Rainbow Stream 让我可以留在终端中。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) +[2]: https://twitter.com/home +[3]: https://opensource.com/sites/default/files/uploads/productivity_10-1.png (Rainbow Stream for Twitter) +[4]: https://rainbowstream.readthedocs.io/en/latest/ +[5]: https://opensource.com/sites/default/files/uploads/productivity_10-2.png (Rainbow Stream first run) +[6]: https://opensource.com/sites/default/files/uploads/day10-image3_1.png (Kill this love) From e4fb4a2d9cc5f1022cf908f93fb149099bf6f0de Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 23 Jan 2020 09:21:41 +0800 Subject: [PATCH 0372/3057] translating --- .../tech/20200119 One open source chat tool to rule them all.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200119 One open source chat tool to rule them all.md b/sources/tech/20200119 One open source chat tool to rule them all.md index 963b7246d0..25f6728c84 100644 --- a/sources/tech/20200119 One open source chat tool to rule them all.md +++ b/sources/tech/20200119 One open source chat tool to rule them all.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 483b75a8a48eb39fed7acde25cf032217adbf6f1 Mon Sep 17 00:00:00 2001 From: FSSlc Date: Thu, 23 Jan 2020 10:38:12 +0800 Subject: [PATCH 0373/3057] Update 20200117 Locking and unlocking accounts on Linux systems.md --- ...0200117 Locking and unlocking accounts on Linux systems.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md b/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md index c1cb3a7be1..469874c4ed 100644 --- a/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md +++ b/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (FSSlc) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -103,7 +103,7 @@ via: https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[FSSlc](https://github.com/FSSlc) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e572119af8857c49f2d84ea6c35b3025d9b8e40a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 14:25:02 +0800 Subject: [PATCH 0374/3057] PUB @wxy https://linux.cn/article-11810-1.html --- ...arted with OpenSSL- Cryptography basics.md | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) rename {translated/tech => published}/20190619 Getting started with OpenSSL- Cryptography basics.md (88%) diff --git a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/published/20190619 Getting started with OpenSSL- Cryptography basics.md similarity index 88% rename from translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md rename to published/20190619 Getting started with OpenSSL- Cryptography basics.md index ac0e0222f6..d7cd09934e 100644 --- a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ b/published/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11810-1.html) [#]: subject: (Getting started with OpenSSL: Cryptography basics) [#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-1) [#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen) @@ -10,9 +10,9 @@ OpenSSL 入门:密码学基础知识 ====== -> 需要入门密码学的基础知识,尤其是有关 OpenSSL 的入门知识吗?继续阅读。 +> 想要入门密码学的基础知识,尤其是有关 OpenSSL 的入门知识吗?继续阅读。 -![A lock on the side of a building][1] +![](https://img.linux.net.cn/data/attachment/album/202001/23/142249fpnhyqz9y2cz1exe.jpg) 本文是使用 [OpenSSL][2] 的密码学基础知识的两篇文章中的第一篇,OpenSSL 是在 Linux 和其他系统上流行的生产级库和工具包。(要安装 OpenSSL 的最新版本,请参阅[这里][3]。)OpenSSL 实用程序可在命令行使用,程序也可以调用 OpenSSL 库中的函数。本文的示例程序使用的是 C 语言,即 OpenSSL 库的源语言。 @@ -25,11 +25,11 @@ OpenSSL 入门:密码学基础知识 [安全套接字层][5]Secure Socket Layer(SSL)是 Netscape 在 1995 年发布的一种加密协议。该协议层可以位于 HTTP 之上,从而为 HTTPS 提供了 S:安全secure。SSL 协议提供了各种安全服务,其中包括两项在 HTTPS 中至关重要的服务: * 对等身份验证Peer authentication(也称为相互质询):连接的每一边都对另一边的身份进行身份验证。如果 Alice 和 Bob 要通过 SSL 交换消息,则每个人首先验证彼此的身份。 -* 机密性Confidentiality:发送者在通过通道发送消息之前先对其进行加密。然后,接收者解密每个接收到的消息。此过程可保护网络对话。即使窃听者 Eve 截获了从 Alice 到 Bob 的加密消息(即*中间人*攻击),Eve 会发现他在计算上无法解密此消息。 -   +* 机密性Confidentiality:发送者在通过通道发送消息之前先对其进行加密。然后,接收者解密每个接收到的消息。此过程可保护网络对话。即使窃听者 Eve 截获了从 Alice 到 Bob 的加密消息(即*中间人*攻击),Eve 会发现他无法在计算上解密此消息。 + 反过来,这两个关键 SSL 服务与其他不太受关注的服务相关联。例如,SSL 支持消息完整性,从而确保接收到的消息与发送的消息相同。此功能是通过哈希函数实现的,哈希函数也随 OpenSSL 工具箱一起提供。 -SSL 有多个版本(例如 SSLv2 和 SSLv3),并且在 1999 年,传输层安全性Transport Layer Security(TLS)作为基于 SSLv3 的类似协议而出现。TLSv1 和 SSLv3 相似,但不足以相互配合工作。不过,通常将 SSL/TLS 称为同一协议。例如,即使正在使用的是 TLS(而非 SSL),OpenSSL 函数也经常在名称中包含 SSL。此外,调用 OpenSSL 命令行实用程序以 `openssl` 开始的。 +SSL 有多个版本(例如 SSLv2 和 SSLv3),并且在 1999 年出现了一个基于 SSLv3 的类似协议传输层安全性Transport Layer Security(TLS)。TLSv1 和 SSLv3 相似,但不足以相互配合工作。不过,通常将 SSL/TLS 称为同一协议。例如,即使正在使用的是 TLS(而非 SSL),OpenSSL 函数也经常在名称中包含 SSL。此外,调用 OpenSSL 命令行实用程序以 `openssl` 开始。 除了 man 页面之外,OpenSSL 的文档是零零散散的,鉴于 OpenSSL 工具包很大,这些页面很难以查找使用。命令行和代码示例可以将主要主题集中起来。让我们从一个熟悉的示例开始(使用 HTTPS 访问网站),然后使用该示例来选出我们感兴趣的加密部分进行讲述。 @@ -137,9 +137,9 @@ return 0; gcc -o client client.c -lssl -lcrypto ``` -该程序尝试打开与网站 [www.google.com][13] 的安全连接。作为与 Google Web 服务器的 TLS 握手的一部分,`client` 程序会收到一个或多个数字证书,该程序会尝试对其进行验证(但在我的系统上失败了)。尽管如此,`client` 程序仍继续通过安全通道获取 Google 主页。该程序取决于前面提到的安全工件,尽管在代码中只着重突出了数字证书。但其它工件仍在幕后发挥作用,稍后将对它们进行详细说明。 +该程序尝试打开与网站 [www.google.com][13] 的安全连接。在与 Google Web 服务器的 TLS 握手过程中,`client` 程序会收到一个或多个数字证书,该程序会尝试对其进行验证(但在我的系统上失败了)。尽管如此,`client` 程序仍继续通过安全通道获取 Google 主页。该程序取决于前面提到的安全工件,尽管在上述代码中只着重突出了数字证书。但其它工件仍在幕后发挥作用,稍后将对它们进行详细说明。 -通常,打开 HTTP(非安全)通道的 C 或 C++ 客户端程序将使用诸如*文件描述符*或*网络套接字*之类的结构,它们是两个进程(例如,这个 `client` 程序和 Google Web 服务器)之间连接的端点。另一方面,文件描述符是一个非负整数值,用于在程序中标识该程序打开的任何文件类的结构。这样的程序还将使用一种结构来指定有关 Web 服务器地址的详细信息。 +通常,打开 HTTP(非安全)通道的 C 或 C++ 的客户端程序将使用诸如*文件描述符*或*网络套接字*之类的结构,它们是两个进程(例如,这个 `client` 程序和 Google Web 服务器)之间连接的端点。另一方面,文件描述符是一个非负整数值,用于在程序中标识该程序打开的任何文件类的结构。这样的程序还将使用一种结构来指定有关 Web 服务器地址的详细信息。 这些相对较低级别的结构不会出现在客户端程序中,因为 OpenSSL 库会将套接字基础设施和地址规范等封装在更高层面的安全结构中。其结果是一个简单的 API。下面首先看一下 `client` 程序示例中的安全性详细信息。 @@ -156,11 +156,12 @@ const SSL_METHOD* method = TLSv1_2_client_method(); /* TLS 1.2 */ ``` 如果调用成功,则将 `method` 指针被传递给库函数,该函数创建类型为 `SSL_CTX` 的上下文: + ``` SSL_CTX* ctx = SSL_CTX_new(method); ``` - `client` 程序会检查每个关键的库调用中的错误,如果其中一个调用失败,则程序终止。 + `client` 程序会检查每个关键的库调用的错误,如果其中一个调用失败,则程序终止。 * 现在还有另外两个 OpenSSL 工件也在发挥作用:SSL 类型的安全会话,从头到尾管理安全连接;以及类型为 BIO(基本输入/输出Basic Input/Output)的安全流,用于与 Web 服务器进行通信。BIO 流是通过以下调用生成的: ``` @@ -186,7 +187,7 @@ BIO_do_connect(bio); 在与 Web 服务器握手期间,`client` 程序会接收一个或多个数字证书,以认证服务器的身份。但是,`client` 程序不会发送自己的证书,这意味着这个身份验证是单向的。(Web 服务器通常配置为**不**需要客户端证书)尽管对 Web 服务器证书的验证失败,但 `client` 程序仍通过了连接到 Web 服务器的安全通道继续获取 Google 主页。 -为什么验证 Google 证书的尝试会失败?典型的 OpenSSL 安装目录为 `/etc/ssl/certs`,其中包含 `ca-certificates.crt` 文件。该目录和文件包含着 OpenSSL 自带的数字证书,以此构成信任库。可以根据需要更新信任库,尤其是可以包括新信任的证书,并删除不再受信任的证书。 +为什么验证 Google 证书的尝试会失败?典型的 OpenSSL 安装目录为 `/etc/ssl/certs`,其中包含 `ca-certificates.crt` 文件。该目录和文件包含着 OpenSSL 自带的数字证书,以此构成信任库truststore。可以根据需要更新信任库,尤其是可以包括新信任的证书,并删除不再受信任的证书。 `client` 程序从 Google Web 服务器收到了三个证书,但是我的计算机上的 OpenSSL 信任库并不包含完全匹配的证书。如目前所写,`client` 程序不会通过例如验证 Google 证书上的数字签名(一个用来证明该证书的签名)来解决此问题。如果该签名是受信任的,则包含该签名的证书也应受信任。尽管如此,`client` 程序仍继续获取页面,然后打印出 Google 的主页。下一节将更详细地介绍这些。 @@ -198,7 +199,7 @@ BIO_do_connect(bio); 哈希值来自将任意数量的二进制位映射到固定长度的摘要。这些位代表什么(会计报告、小说或数字电影)无关紧要。例如,消息摘要版本 5Message Digest version 5(MD5)哈希算法将任意长度的输入位映射到 128 位哈希值,而 SHA1(安全哈希算法版本 1Secure Hash Algorithm version 1)算法将输入位映射到 160 位哈希值。不同的输入位会导致不同的(实际上在统计学上是唯一的)哈希值。下一篇文章将会进行更详细的介绍,并着重介绍什么使哈希函数具有加密功能。 -数字证书的类型有所不同(例如根证书、中间证书和最终实体证书),并形成了反映这些类型的层次结构。顾名思义,*根*证书位于层次结构的顶部,其下的证书继承了根证书所具有的信任。OpenSSL 库和大多数现代编程语言都具有 X509 数据类型以及处理此类证书的函数。来自 Google 的证书具有 X509 格式,`client` 程序会检查该证书是否为 `X509_V_OK`。 +数字证书的类型有所不同(例如根证书、中间证书和最终实体证书),并形成了反映这些证书类型的层次结构。顾名思义,*根*证书位于层次结构的顶部,其下的证书继承了根证书所具有的信任。OpenSSL 库和大多数现代编程语言都具有 X509 数据类型以及处理此类证书的函数。来自 Google 的证书具有 X509 格式,`client` 程序会检查该证书是否为 `X509_V_OK`。 X509 证书基于公共密钥基础结构public-key infrastructure(PKI),其中包括的算法(RSA 是占主导地位的算法)用于生成*密钥对*:公共密钥及其配对的私有密钥。公钥是一种身份:[Amazon][15] 的公钥对其进行标识,而我的公钥对我进行标识。私钥应由其所有者负责保密。 @@ -212,7 +213,7 @@ Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's +------------------+ +-------------------+ ``` -原则上可以在没有 Alice 的私钥的情况下解密消息,但在实际情况中,如果使用像 RSA 这样的加密密钥对系统,则做不到。 +理论上可以在没有 Alice 的私钥的情况下解密消息,但在实际情况中,如果使用像 RSA 这样的加密密钥对系统,则在计算上做不到。 现在,第二个示例,请对文档签名以证明其真实性。签名算法使用密钥对中的私钥来处理要签名的文档的加密哈希: @@ -222,7 +223,7 @@ Hash of document--->|Alice's private key|--->Alice's digital signature of the do +-------------------+ ``` -假设 Alice 以数字方式签署了发送给 Bob 的合同。然后,Bob 可以使用密钥对中的 Alice 的公钥来验证签名: +假设 Alice 以数字方式签署了发送给 Bob 的合同。然后,Bob 可以使用 Alice 密钥对中的公钥来验证签名: ``` +------------------+ From 458c35e29d537171a922747ee331b560ffde1548 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 15:03:17 +0800 Subject: [PATCH 0375/3057] PRF --- ... your calendar with khal and vdirsyncer.md | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md index a84fc3c917..d9b618dc3c 100644 --- a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md +++ b/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Organize and sync your calendar with khal and vdirsyncer) @@ -9,14 +9,16 @@ 使用 khal 和 vdirsyncer 组织和同步你的日历 ====== -保存和共享日历可能会有点麻烦。在我们的 20 个使用开源提升生产力的系列的第五篇文章中了解如何让它更简单。 -![Calendar close up snapshot][1] + +> 保存和共享日历可能会有点麻烦。在我们的 20 个使用开源提升生产力的系列的第五篇文章中了解如何让它更简单。 + +![](https://img.linux.net.cn/data/attachment/album/202001/23/150009wsr3d5ovg4g1vzws.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 khal 和 vdirsyncer 跟踪你的日程 -处理日历很_麻烦_,要找到好的工具总是很困难的。但是自从我去年将日历列为[我的“失败“之一][2]以来,我已经取得了一些进步。 +处理日历很*麻烦*,要找到好的工具总是很困难的。但是自从我去年将日历列为[我的“失败"之一][2]以来,我已经取得了一些进步。 目前使用日历最困难的是一直需要以某种方式在线共享。两种最受欢迎的在线日历是 Google Calendar 和 Microsoft Outlook/Exchange。两者都在公司环境中大量使用,这意味着我的日历必须支持其中之一或者两个。 @@ -28,10 +30,9 @@ ![vdirsyncer][6] -Vdirsyncer 是个 Python 3 程序,可以通过软件包管理器或 pip 安装。它可以同步 CalDAV、VCalendar/iCalendar、Google Calendar 和目录中的本地文件。由于我使用 Google Calendar,尽管这不是最简单的设置,我也将以它为例。 - -在 vdirsyncer 中设置 Google Calendar 是[有文档参考的][7],所以这里我不再赘述。重要的是确保同步对设置将 Google Calendar 设置为冲突解决的”赢家“。也就是说,如果同一事件有两个更新,那么需要知道哪个更新优先。类似这样做: +Vdirsyncer 是个 Python 3 程序,可以通过软件包管理器或 `pip` 安装。它可以同步 CalDAV、VCalendar/iCalendar、Google Calendar 和目录中的本地文件。由于我使用 Google Calendar,尽管这不是最简单的设置,我也将以它为例。 +在 vdirsyncer 中设置 Google Calendar 是[有文档参考的][7],所以这里我不再赘述。重要的是确保设置你的同步对,将 Google Calendar 设置为冲突解决的“赢家”。也就是说,如果同一事件有两个更新,那么需要知道哪个更新优先。类似这样做: ``` [general] @@ -56,12 +57,11 @@ path = "~/.calendars/Personal" fileext = ".ics" ``` -在第一次 vdirsyncer 同步之后,你将在存储路径中看到一系列目录。每个文件夹都将包含多个文件,日历中的每个事件都是一个文件。下一步是导入 khal。首先运行 **khal configure** 进行初始设置。 +在第一次 vdirsyncer 同步之后,你将在存储路径中看到一系列目录。每个文件夹都将包含多个文件,日历中的每个事件都是一个文件。下一步是导入 khal。首先运行 `khal configure` 进行初始设置。 ![Configuring khal][8] -现在,运行 **khal interactive** 将显示本文开头的界面。输入 **n** 将打开“新事件”对话框。这里要注意的一件事:日历的名称与 vdirsyncer 创建的目录匹配,但是你可以更改 khal 配置文件来指定更清晰的名称。根据条目所在的日历向条目添加颜色还可以帮助你确定日历内容: - +现在,运行 `khal interactive` 将显示本文开头的界面。输入 `n` 将打开“新事件”对话框。这里要注意的一件事:日历的名称与 vdirsyncer 创建的目录匹配,但是你可以更改 khal 配置文件来指定更清晰的名称。根据条目所在的日历,向条目添加颜色还可以帮助你确定日历内容: ``` [calendars] @@ -76,7 +76,7 @@ path = ~/.calendars/Personal/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m color = brown ``` -现在,当你运行 **khal interactive** 时,每个日历将被着色以区别于其他日历,并且当你添加新条目时,它将有更具描述性的名称。 +现在,当你运行 `khal interactive` 时,每个日历将被着色以区别于其他日历,并且当你添加新条目时,它将有更具描述性的名称。 ![Adding a new calendar entry][9] @@ -89,7 +89,7 @@ via: https://opensource.com/article/20/1/open-source-calendar 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -103,3 +103,4 @@ via: https://opensource.com/article/20/1/open-source-calendar [6]: https://opensource.com/sites/default/files/uploads/productivity_5-2.png (vdirsyncer) [7]: https://vdirsyncer.pimutils.org/en/stable/config.html#google [8]: https://opensource.com/sites/default/files/uploads/productivity_5-3.png (Configuring khal) +[9]: https://opensource.com/sites/default/files/uploads/productivity_5-4.png From 4c8ab4d99ab79191d80aedfedf2eeb9795a2d07d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 15:03:47 +0800 Subject: [PATCH 0376/3057] PUB @geekpi https://linux.cn/article-11812-1.html --- ...rganize and sync your calendar with khal and vdirsyncer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200115 Organize and sync your calendar with khal and vdirsyncer.md (98%) diff --git a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/published/20200115 Organize and sync your calendar with khal and vdirsyncer.md similarity index 98% rename from translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md rename to published/20200115 Organize and sync your calendar with khal and vdirsyncer.md index d9b618dc3c..5ddb647095 100644 --- a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md +++ b/published/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11812-1.html) [#]: subject: (Organize and sync your calendar with khal and vdirsyncer) [#]: via: (https://opensource.com/article/20/1/open-source-calendar) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From e563950e4a348260579074b8aa9bb2ebce42708c Mon Sep 17 00:00:00 2001 From: FSSlc Date: Thu, 23 Jan 2020 17:49:35 +0800 Subject: [PATCH 0377/3057] [Translated] 20200117 Locking and unlocking accounts on Linux systems.md Signed-off-by: FSSlc --- ...and unlocking accounts on Linux systems.md | 118 ------------------ ...and unlocking accounts on Linux systems.md | 109 ++++++++++++++++ 2 files changed, 109 insertions(+), 118 deletions(-) delete mode 100644 sources/tech/20200117 Locking and unlocking accounts on Linux systems.md create mode 100644 translated/tech/20200117 Locking and unlocking accounts on Linux systems.md diff --git a/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md b/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md deleted file mode 100644 index 469874c4ed..0000000000 --- a/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md +++ /dev/null @@ -1,118 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (FSSlc) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Locking and unlocking accounts on Linux systems) -[#]: via: (https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Locking and unlocking accounts on Linux systems -====== -There are times when locking a Linux user account is necessary and times when you need to reverse that action. Here are commands for managing account access and what's behind them. -SQBack / Getty Images - -If you are administering a [Linux][1] system, there will likely be times that you need to lock an account. Maybe someone is changing positions and their continued need for the account is under question; maybe there’s reason to believe that access to the account has been compromised. In any event, knowing how to lock an account and how to unlock it should it be needed again is something you need to be able to do. - -One important thing to keep in mind is that there are multiple ways to lock an account, and they don't all have the same effect. If the account user is accessing an account using public/private keys instead of a password, some commands you might use to block access to an account will not be effective. - -### Locking an account using the passwd command - -One of the simplest ways to lock an account is with the **passwd -l** command. For example: - -[][2] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][2] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -``` -$ sudo passwd -l tadpole -``` - -The effect of this command is to insert an exclamation point as the first character in the encrypted password field in the /etc/shadow file. This is enough to keep the password from working. What previously looked like this (note the first character): - -``` -$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: -``` - -will look like this: - -``` -!$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: -``` - -On his next login attempt (should there be one), tadpole would probably try his password numerous times and not gain access. You, on the other hand, would be able to check the status of his account with a command like this (-S = status): - -``` -$ sudo passwd -S tadpole -tadpole L 10/15/2019 0 99999 7 -1 -``` - -The "L" in the second field tells you that the account is locked. Before the account was locked, it would have been a "P". An "NP" would mean that no password was set. - -**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][3] ]** - -The **usermod -L** command would have the same effect (inserting the exclamation character to disable use of the password). - -One of the benefits of locking an account in this way is that it's very easy to unlock the account when and if needed. Just reverse the change by removing the added exclamation point with a text editor or, better yet, by using the **passwd -u** command. - -``` -$ sudo passwd -u tadpole -passwd: password expiry information changed. -``` - -The problem with this approach is that, if the user is accessing his or her account with public/private keys, this change will not block their use. - -### Locking accounts with the chage command - -Another way to lock a user account is to the the **chage** command that helps manage account expiration dates. - -``` -$ sudu chage -E0 tadpole -$ sudo passwd -S tadpole -tadpole P 10/15/2019 0 99999 7 -1 -``` - -The **chage** command is going to make a subtle change to the /etc/shadow file. The eighth field in that colon-separated file (shown below) will be set to zero (previously empty) and this means the account is essentially expired. The **chage** command tracks the number of days between password changes, but also provides account expiration information when this option is used. A zero in the eiighth field would mean that the account expires a day after January 1, 1970, but also simply locks it when a command like that shown above is used. - -``` -$ sudo grep tadpole /etc/shadow | fold -tadpole:$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPC -nXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::0: - ^ - | - +--- days until expiration -``` - -To reverse this change, you can simply remove the 0 that was placed in the /etc/shadow entry for the user with a command like this: - -``` -% sudo chage -E-1 tadpole -``` - -Once an account is expired in this way, even passwordless [SSH][4] will not provide access. - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html -[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua -[4]: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md b/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md new file mode 100644 index 0000000000..d22b9d114a --- /dev/null +++ b/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (FSSlc) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Locking and unlocking accounts on Linux systems) +[#]: via: (https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 系统中禁用与解禁用户的账号 +====== +总有这样的时候:有时你需要禁用某位 Linux 用户的账号,有时你还需要反过来解禁用户的账号。 +本文将介绍一些管理用户访问的命令,并介绍它们背后的原理。 + +假如你正管理着一台 [Linux][1] 系统,那么很有可能将遇到需要禁用一个账号的情况。可能是某人已经换了职位,他们是否还需要该账号仍是个问题;或许有理由相信再次使用该账号并没有大碍。不管上述哪种情况,知晓如何禁用账号并解禁账号都是你需要知道的知识。 + +需要你记住的一件重要的事是尽管有多种方法来禁用账号,但它们并不都达到相同的效果。假如用户使用公钥/私钥来使用该账号而不是使用密码来访问,那么你使用的某些命令来阻止用户获取该账号或许将不会生效。 + +### 使用 `passwd` 来禁用一个账号 + +最为简单的用来禁用一个账号的方法是使用 `passwd -l` 命令。例如: + +``` +$ sudo passwd -l tadpole +``` + +上面这个命令的效果是在加密后的密码文件 `/etc/shadow` 中,用户对应的那一行的最前面加上一个 `!` 符号。这样就足够阻止用户使用密码来访问账号了。 +在没有使用上述命令前,加密后的密码行如下所示(请注意第一个字符): + +``` +$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: +``` + +而禁用该账号后,这一行将变为: + +``` +!$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: +``` + +在 tadpole 下一次尝试登录时, 他可能会使用他原有的密码来尝试多次登录,但就是无法再登录成功了。另一方面,你则可以使用下面的命令来查看他这个账号的状态(-S = status): + +``` +$ sudo passwd -S tadpole +tadpole L 10/15/2019 0 99999 7 -1 +``` + +第二项的 `L` 告诉你这个账号已经被禁用了。在该账号被禁用前,这一项应该是 `P`。如果显示的是 `NP` 则意味着该账号还没有设置密码。 + +命令 `usermod -L` 也具有相同的效果(添加 `!` 来禁用账号的使用)。 + +使用这种方法来禁用某个账号的一个好处是当需要解禁某个账号时非常容易。只需要使用一个文本编辑器或者使用 `passwd -u` 命令来执行相反的操作,即将添加的 `!` 移除即可。 + +``` +$ sudo passwd -u tadpole +passwd: password expiry information changed. +``` + +但使用这种方式的问题是如果用户使用公钥/私钥对的方式来访问他/她的账号,这种方式将不能阻止他们使用该账号。 + +### 使用 `chage` 命令来禁用账号 + +另一种禁用用户账号的方法是使用 `chage` 命令,它可以帮助管理用户账号的过期日期。 + +``` +$ sudu chage -E0 tadpole +$ sudo passwd -S tadpole +tadpole P 10/15/2019 0 99999 7 -1 +``` + +`chage` 命令将对 `/etc/shadow` 文件做出显著的变化。在这个使用 `:` 来分隔的文件(下面将进行展示)中,某行的第 8 项将被设置为 `0` (先前为空),这就意味着这个账号已经过期了。 `chage` 命令将追踪密码更改期间的日期数目,但给出选项是它也可以提供账号过期信息。第 8 项如果是 0 则意味着这个账号在 1970 年 1 月 1 日后的一天过期,当使用上面显示的那个命令时也可以用来禁用账号。 + +``` +$ sudo grep tadpole /etc/shadow | fold +tadpole:$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPC +nXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::0: + ^ + | + +--- days until expiration +``` + +为了执行相反的操作,你可以简单地使用下面的命令将放置在 `/etc/shadow` 文件中的 `0` 移除掉: + +``` +% sudo chage -E-1 tadpole +``` + +一旦一个账号使用这种方式被禁用,即便是免密的 [SSH][4] 登录也不能再访问该账号了。 + +最后请加入我们在 [Facebook][5] 和 [LinkedIn][6] 上的社区来对你感兴趣的话题进行评论。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[4]: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 23e43f683f53a0a0ea6a54a9f000501032a19b96 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 21:43:15 +0800 Subject: [PATCH 0378/3057] PRF @FSSlc --- ...and unlocking accounts on Linux systems.md | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md b/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md index d22b9d114a..a3cc947d1c 100644 --- a/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md +++ b/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (FSSlc) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Locking and unlocking accounts on Linux systems) @@ -9,14 +9,17 @@ 在 Linux 系统中禁用与解禁用户的账号 ====== -总有这样的时候:有时你需要禁用某位 Linux 用户的账号,有时你还需要反过来解禁用户的账号。 + +> 总有这样的时候:有时你需要禁用某位 Linux 用户的账号,有时你还需要反过来解禁用户的账号。 本文将介绍一些管理用户访问的命令,并介绍它们背后的原理。 +![](https://images.idgesg.net/images/article/2019/10/cso_cybersecurity_mysterious_padlock_complex_circuits_gold_by_sqback_gettyimages-1177918748_2400x1600-100813830-large.jpg) + 假如你正管理着一台 [Linux][1] 系统,那么很有可能将遇到需要禁用一个账号的情况。可能是某人已经换了职位,他们是否还需要该账号仍是个问题;或许有理由相信再次使用该账号并没有大碍。不管上述哪种情况,知晓如何禁用账号并解禁账号都是你需要知道的知识。 需要你记住的一件重要的事是尽管有多种方法来禁用账号,但它们并不都达到相同的效果。假如用户使用公钥/私钥来使用该账号而不是使用密码来访问,那么你使用的某些命令来阻止用户获取该账号或许将不会生效。 -### 使用 `passwd` 来禁用一个账号 +### 使用 passwd 来禁用一个账号 最为简单的用来禁用一个账号的方法是使用 `passwd -l` 命令。例如: @@ -25,6 +28,7 @@ $ sudo passwd -l tadpole ``` 上面这个命令的效果是在加密后的密码文件 `/etc/shadow` 中,用户对应的那一行的最前面加上一个 `!` 符号。这样就足够阻止用户使用密码来访问账号了。 + 在没有使用上述命令前,加密后的密码行如下所示(请注意第一个字符): ``` @@ -37,7 +41,7 @@ $6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7R !$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: ``` -在 tadpole 下一次尝试登录时, 他可能会使用他原有的密码来尝试多次登录,但就是无法再登录成功了。另一方面,你则可以使用下面的命令来查看他这个账号的状态(-S = status): +在 tadpole 下一次尝试登录时,他可能会使用他原有的密码来尝试多次登录,但就是无法再登录成功了。另一方面,你则可以使用下面的命令来查看他这个账号的状态(`-S` = status): ``` $ sudo passwd -S tadpole @@ -57,7 +61,7 @@ passwd: password expiry information changed. 但使用这种方式的问题是如果用户使用公钥/私钥对的方式来访问他/她的账号,这种方式将不能阻止他们使用该账号。 -### 使用 `chage` 命令来禁用账号 +### 使用 chage 命令来禁用账号 另一种禁用用户账号的方法是使用 `chage` 命令,它可以帮助管理用户账号的过期日期。 @@ -67,7 +71,7 @@ $ sudo passwd -S tadpole tadpole P 10/15/2019 0 99999 7 -1 ``` -`chage` 命令将对 `/etc/shadow` 文件做出显著的变化。在这个使用 `:` 来分隔的文件(下面将进行展示)中,某行的第 8 项将被设置为 `0` (先前为空),这就意味着这个账号已经过期了。 `chage` 命令将追踪密码更改期间的日期数目,但给出选项是它也可以提供账号过期信息。第 8 项如果是 0 则意味着这个账号在 1970 年 1 月 1 日后的一天过期,当使用上面显示的那个命令时也可以用来禁用账号。 +`chage` 命令将会稍微修改 `/etc/shadow` 文件。在这个使用 `:` 来分隔的文件(下面将进行展示)中,某行的第 8 项将被设置为 `0`(先前为空),这就意味着这个账号已经过期了。`chage` 命令会追踪密码更改期间的天数,通过选项也可以提供账号过期信息。第 8 项如果是 0 则意味着这个账号在 1970 年 1 月 1 日后的一天过期,当使用上面显示的那个命令时可以用来禁用账号。 ``` $ sudo grep tadpole /etc/shadow | fold @@ -84,9 +88,8 @@ nXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::0: % sudo chage -E-1 tadpole ``` -一旦一个账号使用这种方式被禁用,即便是免密的 [SSH][4] 登录也不能再访问该账号了。 +一旦一个账号使用这种方式被禁用,即便是无密码的 [SSH][4] 登录也不能再访问该账号了。 -最后请加入我们在 [Facebook][5] 和 [LinkedIn][6] 上的社区来对你感兴趣的话题进行评论。 -------------------------------------------------------------------------------- @@ -95,7 +98,7 @@ via: https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts 作者:[Sandra Henry-Stocker][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 a4071ef5453eb88efcef2955696dd9fc8fff24d8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 21:43:41 +0800 Subject: [PATCH 0379/3057] PUB @FSSlc https://linux.cn/article-11813-1.html --- ...0200117 Locking and unlocking accounts on Linux systems.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200117 Locking and unlocking accounts on Linux systems.md (98%) diff --git a/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md b/published/20200117 Locking and unlocking accounts on Linux systems.md similarity index 98% rename from translated/tech/20200117 Locking and unlocking accounts on Linux systems.md rename to published/20200117 Locking and unlocking accounts on Linux systems.md index a3cc947d1c..64a19e1010 100644 --- a/translated/tech/20200117 Locking and unlocking accounts on Linux systems.md +++ b/published/20200117 Locking and unlocking accounts on Linux systems.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (FSSlc) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11813-1.html) [#]: subject: (Locking and unlocking accounts on Linux systems) [#]: via: (https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From f20cc28ac47206de6f579b328953af2ebc3ab5c2 Mon Sep 17 00:00:00 2001 From: algzjh Date: Thu, 23 Jan 2020 21:53:34 +0800 Subject: [PATCH 0380/3057] translated by algzjh --- ...esources for agile software development.md | 65 ------------------- ...esources for agile software development.md | 64 ++++++++++++++++++ 2 files changed, 64 insertions(+), 65 deletions(-) delete mode 100644 sources/tech/20191229 The best resources for agile software development.md create mode 100644 translated/tech/20191229 The best resources for agile software development.md diff --git a/sources/tech/20191229 The best resources for agile software development.md b/sources/tech/20191229 The best resources for agile software development.md deleted file mode 100644 index 84c8c09548..0000000000 --- a/sources/tech/20191229 The best resources for agile software development.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (algzjh) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The best resources for agile software development) -[#]: via: (https://opensource.com/article/19/12/agile-resources) -[#]: author: (Leigh Griffin https://opensource.com/users/lgriffin) - -The best resources for agile software development -====== -Read our top articles that highlight the discussion around agile's past, -present, and what it may look like in the future. -![Women programming][1] - -It has been a great year for agile topics on Opensource.com. As we approach the end of 2019, reviewed our top agile-related articles, as read by you, our readers! - -### Small Scale Scrum guide - -Opensource.com's six-part guide to [Small Scale Scrum][2] (which I helped co-author) advises smaller teams on how to bring agile into their work. The traditional scrum framework outlined in the official [Scrum Guide][3] recommends a minimum of three people for the framework to realize its full potential. However, it provides no guidance for how teams of one or two people can follow scrum successfully. Our six-part series aims to formalize Small Scale Scrum and examines our experience with it in the real world. The series was received very warmly by our readers—so much such that the six individual articles comprise 60% of our Top 10 list. So, if you haven't already, make sure to download them from our [_Introduction to Small Scale Scrum_ page][2]. - -### A comprehensive guide to agile project management - -Teams following traditional project management approaches, initially skeptical about agile, have warmed up to the agile way of working. Now agile has reached acceptance, and a more flexible, hybrid style has found a home. [_A comprehensive guide to agile project management_][4] by Matt Shealy covers 12 guiding principles of agile project management and is perfect for traditional project managers looking to bring some agility to their projects. - -### 4 steps to becoming an awesome agile developer - -A DevOps culture has emerged in many modern software teams that embrace agile software development principles that leverage cutting-edge tooling and automation. But this mechanically agile approach does not guarantee that developers are following agile practices in their day-to-day work. In [_4 steps to becoming an awesome agile developer_][5], Daniel Oh gives great tips for increasing your agility by focusing on design thinking, using predictable approaches, putting quality at the center, and continuously learning and exploring. Complementing these methods with your agile tooling will create very flexible and strong agile developers. - -### Scrum vs. kanban: Which agile framework is better? - -Scrum and kanban are two of the most popular approaches for teams running in an agile manner, and in [_Scrum vs. kanban: Which agile framework is better?_][6] Taz Brown explores the history and purpose of both. While reading this article, a great saying came to my mind: "If the only tool in your toolbox is a hammer, every problem looks like a nail." Knowing when to use kanban and when to use scrum is important, and this article helps show that both have a place, depending on your team, your challenge, and your goals. - -### 4 ways developers can have a say in what agile looks like - -Developers often have a fear of having a workstyle imposed upon them when the topic of adopting agile comes up. In [_4 ways developers can have a say in what agile looks like_][7], [Clément Verna][8] looks at ways that developers can flip that narrative by helping to determine what agile looks like on their team. Examining the origins and the basics of agile is a great starting point, but the real value is in having metrics to help guide your journey. Knowing what challenges you can expect to have will give you a firm ground to move forward. And making decisions empirically not only empowers teams but gives them a sense of ownership of the journey. Verna's article also examines the importance of putting people over processes and working as a team to achieve your goals. - -### Agile now and later - -This year, Opensource.com authors created a lot of discussion around agile's past, present, and what it may look like in the future. Thank you to all of them, and be sure to [share your own agile story][9] here in 2020. - -A look back at the tools Opensource.com covered in 2014 and 2015 , with updates on new releases,... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/agile-resources - -作者:[Leigh Griffin][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/lgriffin -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard2.png?itok=WnKfsl-G (Women programming) -[2]: https://opensource.com/downloads/small-scale-scrum -[3]: https://scrumguides.org/scrum-guide.html -[4]: https://opensource.com/article/19/8/guide-agile-project-management -[5]: https://opensource.com/article/19/2/steps-agile-developer -[6]: https://opensource.com/article/19/8/scrum-vs-kanban -[7]: https://opensource.com/article/19/10/ways-developers-what-agile -[8]: https://twitter.com/clemsverna -[9]: https://opensource.com/how-submit-article diff --git a/translated/tech/20191229 The best resources for agile software development.md b/translated/tech/20191229 The best resources for agile software development.md new file mode 100644 index 0000000000..1f467430c7 --- /dev/null +++ b/translated/tech/20191229 The best resources for agile software development.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (algzjh) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The best resources for agile software development) +[#]: via: (https://opensource.com/article/19/12/agile-resources) +[#]: author: (Leigh Griffin https://opensource.com/users/lgriffin) + +敏捷软件开发的最佳资源 +====== +请阅读我们的热门文章,这些文章着重讨论了敏捷的过去、现在和未来。 +![Women programming][1] + +对于 Opensource.com 上的敏捷主题来说,今年是非常棒的一年。随着 2019 年的临近,我们回顾了我们读者所读的与敏捷相关的热门文章。 + +### 小规模 Scrum 指南 + +Opensource.com 关于[小规模 Scrum][2] 的指南(我曾参与合著)由六部分组成,为小型团队提供了关于如何将敏捷引入到他们的工作中的建议。在官方的 [Scrum 指南][3] 的概述中,传统的 Scrum 框架推荐至少三个人来实现,以充分发挥其潜力。但是,它并没有为一两个人的团队如何成功遵循 Scrum 提供指导。我们的六部分系列旨在规范化小规模的 Scrum,并检验我们在现实世界中使用它的经验。该系列受到了读者的热烈欢迎,以至于这六篇文章占据了前 10 名文章的 60%。因此,如果你还没有阅读的话,一定要从我们的[小规模 Scrum 介绍页面][2]下载。 + +### 全面的敏捷项目管理指南 + +遵循传统项目管理方法的团队最初对敏捷持怀疑态度,现在已经热衷于敏捷的工作方式。目前,敏捷已被接受,并且一种更加灵活的混合风格已经找到了归宿。Matt Shealy 撰写的[有关敏捷项目管理的综合指南][4]涵盖了敏捷项目管理的 12 条指导原则,对于希望为其项目带来敏捷性的传统项目经理而言,它是完美的选择。 + +### 成为出色的敏捷开发人员的 4 个步骤 + +DevOps 文化已经出现在许多现代软件团队中,这些团队采用了敏捷软件开发原则,利用了最先进的工具和自动化技术。但是,这种机械的敏捷方法并不能保证开发人员在日常工作中遵循敏捷实践。Daniel Oh 在[《成为出色的敏捷开发人员的 4 个步骤》][5]中给出了一些很棒的技巧,通过关注设计思维,使用可预测的方法,以质量为中心并不断学习和探索来提高你的敏捷性。用你的敏捷工具补充这些方法将形成非常灵活和强大的敏捷开发人员。 + +### Scrum 和 kanban:哪种敏捷框架更好? + +对于以敏捷方式运行的团队来说,Scrum 和 kanban 是两种最流行的方法。在 “[Scrum 与 kanban:哪种敏捷框架更好?][6]” 中,Taz Brown 探索了两者的历史和目的。在阅读本文时,我想起一句名言:“如果你的工具箱里只有锤子,那么所有问题看起来都像钉子。”知道何时使用 kanban 以及何时使用 Scrum 非常重要,本文有助于说明两者都有一席之地,这取决于你的团队、挑战和目标。 + +### 开发人员对敏捷发表意见的 4 种方式 + +当采用敏捷的话题出现时,开发人员常常会担心自己会被强加上一种工作风格。在“[开发人员对敏捷发表意见的 4 种方式][7]”中,[Clément Verna][8] 着眼于开发人员通过帮助确定敏捷在其团队中的表现形式来颠覆这种说法的方法。检查敏捷的起源和基础是一个很好的起点,但是真正的价值在于拥有可帮助指导你的过程的指标。知道你将面临什么样的挑战会给你的前进提供坚实的基础。根据经验进行决策不仅可以增强团队的能力,还可以使他们对整个过程有一种主人翁意识。Verna 的文章还探讨了将人置于过程之上并作为一个团队来实现目标的重要性。 + +### 敏捷的现在和未来 + +今年,Opensource.com 的作者围绕敏捷的过去、现在以及未来可能会是什么样子进行了大量的讨论。感谢他们所有人,请一定于 2020 年在这里分享[你自己的敏捷故事][9]。 + +回顾一下 Opensource.com 在 2014 年和 2015 年报道的工具,以及新版本的更新,…… + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/agile-resources + +作者:[Leigh Griffin][a] +选题:[lujun9972][b] +译者:[algzjh](https://github.com/algzjh) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lgriffin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard2.png?itok=WnKfsl-G "Women programming" +[2]: https://opensource.com/downloads/small-scale-scrum +[3]: https://scrumguides.org/scrum-guide.html +[4]: https://opensource.com/article/19/8/guide-agile-project-management +[5]: https://opensource.com/article/19/2/steps-agile-developer +[6]: https://opensource.com/article/19/8/scrum-vs-kanban +[7]: https://opensource.com/article/19/10/ways-developers-what-agile +[8]: https://twitter.com/clemsverna +[9]: https://opensource.com/how-submit-article From 82227a51a7f313bd6004f9b11f9d152a3422135c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 22:41:35 +0800 Subject: [PATCH 0381/3057] APL --- sources/tech/20191208 What-s your favorite terminal emulator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191208 What-s your favorite terminal emulator.md b/sources/tech/20191208 What-s your favorite terminal emulator.md index ff3ed8349d..a09a4d02b1 100644 --- a/sources/tech/20191208 What-s your favorite terminal emulator.md +++ b/sources/tech/20191208 What-s your favorite terminal emulator.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3f1a216f2502349ee8cfa6260f54f7e86c3050bb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 24 Jan 2020 00:03:01 +0800 Subject: [PATCH 0382/3057] TSL --- ... What-s your favorite terminal emulator.md | 74 ------------------- ... What-s your favorite terminal emulator.md | 73 ++++++++++++++++++ 2 files changed, 73 insertions(+), 74 deletions(-) delete mode 100644 sources/tech/20191208 What-s your favorite terminal emulator.md create mode 100644 translated/tech/20191208 What-s your favorite terminal emulator.md diff --git a/sources/tech/20191208 What-s your favorite terminal emulator.md b/sources/tech/20191208 What-s your favorite terminal emulator.md deleted file mode 100644 index a09a4d02b1..0000000000 --- a/sources/tech/20191208 What-s your favorite terminal emulator.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What's your favorite terminal emulator?) -[#]: via: (https://opensource.com/article/19/12/favorite-terminal-emulator) -[#]: author: (Opensource.com https://opensource.com/users/admin) - -What's your favorite terminal emulator? -====== -We asked our community to tell us about their experience with terminal -emulators. Here are a few of the responses we received. Take our poll to -weigh in on your favorite. -![Terminal window with green text][1] - -Preference of a terminal emulator can say a lot about a person's workflow. Is the ability to drive mouseless a must-have? Do you like to navigate between tabs or windows? There's something to be said about how it makes you feel, too. Does it have that cool factor? Tell us about your favorite terminal emulator by taking our poll or leaving us a comment. How many have you tried? - -We asked our community to tell us about their experience with terminal emulators. Here are a few of the responses we received. - -"My favorite terminal emulator is Tilix, customized with Powerline. I love that it supports multiple terminals open in a single window." —Dan Arel - -"urxvt ([rxvt-unicode][2]). It's simple to configure via files, is lightweight, and readily available in most package manager repositories." —Brian Tomlinson - -"gnome-terminal is still my go-to even though I don't use GNOME anymore. :)" —Justin W. Flory - -"Terminator at this point on FC31.  I just started using it but like the split screen feature and it seems light enough for me. Investigating plugins." —Marc Maxwell - -"I switched over to Tilix a while back and it does everything I need terminals to do. :) Multiple panes, notifications, lean and runs my tmux sessions great." —Kevin Fenzi - -"alacritty. It's optimized for speed, implemented in Rust and generally feature packed, but, honestly speaking, I only care about one feature: configurable inter-glyph spacing that allows me to further condense my font. I'm so-o hooked." —Alexander Sosedkin -  - -"I am old and grumpy: KDE Konsole. With tmux in it if session is remote." —Marcin Juszkiewicz - -"iTerm2 for macOS. Yes, it's open source. :-) Terminator on Linux." —Patrick Mullins - - "I've been using alacritty for a year or two now, but recently I started also using cool-retro-term in fullscreen mode whenever I have to run a script that has a lot of output because it looks cool and makes me feel cool. This is important to me." —Nick Childers -  -"I love Tilix, partly because it's good at staying out of the way (I usually just run it full screen with tmux inside), but also for the custom hotlinking support: in my terminal, text like "rhbz#1234" is a hotlink that takes me to bugzilla. Similar for LaunchPad issues, Gerrit change ids for OpenStack, etc." —Lars Kellogg-Stedman -  -"Eterm, also presentations look best in cool-retro-term with Vintage profile." —Ivan Horvath -  -"+1 for Tilix. It’s the best for an option for GNOME users, IMO!"  —Eric Rich -  -"urxvt. Fast. Small. Configurable. Extendable via perl plugins, which can make it mouseless." —Roman Dobosz  -  -"Konsole is the best, the only app I use from KDE project. The highlight of all search result occurrences is a killer feature which afaik does not have any other Linux terminal (glad if you prove me wrong). Best for searching compilation errors and output logs." —Jan Horak -  -"I use Terminator in past a lot. Now I cloned the theme (dark one) in Tilix and I didn't miss a thing. Is easy to move between tabs. That's all." —Alberto Fanjul Alonso -  -"Started my journey in using Terminator, I have since (in the past 3 years or so) completely switched over to Tilix." —Mike Harris -  -"I use Drop Down Terminal X. It's a very simple extension for GNOME 3 that lets me have a terminal always at the stroke of a single key (F12 for me). And it also supports tabs, which is kind of all I need." —Germán Pulido -  -"xfce4-terminal: wayland support, zoom, no borders, no title bar, no scroll bar - that's all I want from terminal emulator, for everything else I have tmux. I want my terminal emulator to use as much screen space as possible as I usually have editor (Vim) and repl side by side in tmux panes." —Martin Kourim - -"Fish! Don’t ask! ;-)" —Eric Schabell - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/favorite-terminal-emulator - -作者:[Opensource.com][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/admin -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_terminals_0.png?itok=XwIRERsn (Terminal window with green text) -[2]: https://opensource.com/article/19/10/why-use-rxvt-terminal diff --git a/translated/tech/20191208 What-s your favorite terminal emulator.md b/translated/tech/20191208 What-s your favorite terminal emulator.md new file mode 100644 index 0000000000..ccb9a6bbfc --- /dev/null +++ b/translated/tech/20191208 What-s your favorite terminal emulator.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's your favorite terminal emulator?) +[#]: via: (https://opensource.com/article/19/12/favorite-terminal-emulator) +[#]: author: (Opensource.com https://opensource.com/users/admin) + +你最喜欢的终端模拟器是什么? +====== + +> 我们让社区讲述他们在终端仿真器方面的经验。以下是我们收到的一些回复。 + +![Terminal window with green text][1] + +终端仿真器的偏好可以说明一个人的工作流程。无鼠标操作能力是否必须具备?你想要标签页还是窗口?对于终端仿真器你还有什么选择的原因?是否有酷的因素?欢迎参加调查或给我们留下评论,告诉我们你最喜欢的终端模拟器。你尝试过多少种终端仿真器呢? + +我们让社区讲述他们在终端仿真器方面的经验。以下是我们收到的一些回复。 + +“我最喜欢的终端仿真器是用 Powerline 定制的 Tilix。我喜欢它支持在一个窗口中打开多个终端。” —Dan Arel + +“[urxvt][2]。它可以通过文件简单配置,轻巧,并且在大多数程序包管理器存储库中都很容易找到。” —Brian Tomlinson + +“即使我不再使用 GNOME,gnome-terminal 仍然是我的首选。:)” —Justin W. Flory + +“现在 FC31 上的 Terminator。我刚刚开始使用它,我喜欢它的分屏功能,对我来说感觉很轻巧。我正在研究它的插件。” —Marc Maxwell + +“不久前,我切换到了 Tilix,它完成了我需要终端执行的所有工作。:) 多个窗格、通知,很精简,用来运行我的 tmux 会话很棒。” —Kevin Fenzi + +“alacritty。它针对速度进行了优化,是用 Rust 实现的,并且具有很多常规功能,但是老实说,我只关心一个功能:可配置的字形间距,使我可以进一步压缩字体。” —Alexander Sosedkin +  +“我是个老古板:KDE Konsole。如果是远程会话,请使用 tmux。” —Marcin Juszkiewicz + +“在 macOS 上用 iTerm2。是的,它是开源的。:-) 在 Linux 上是 Terminator。” —Patrick Mullins + +“我现在已经使用 alacritty 一两年了,但是最近我在全屏模式下使用 cool-retro-term,因为我必须运行一个输出内容有很多的脚本,而它看起来很酷,让我感觉很酷。这对我很重要。” —Nick Childers + +“我喜欢 Tilix,部分是因为它擅长免打扰(我通常全屏运行它,里面是 tmux),而且还提供自定义热链接支持:在我的终端中,像 ‘rhbz#1234’ 之类的文本是将我带到 Bugzilla 的热链接。类似的还有 LaunchPad 提案,OpenStack 的 Gerrit 更改 ID 等。” —Lars Kellogg-Stedman + +“Eterm,在使用 Vintage 配置文件的 cool-retro-term 中,演示效果也最好。” —Ivan Horvath + +“Tilix +1。这是 GNOME 用户最好的选择,我是这么觉得的!” —Eric Rich + +“urxvt。快速、小型、可配置、可通过 Perl 插件扩展,这使其可以无鼠标操作。” —Roman Dobosz  + +“Konsole 是最好的,也是 KDE 项目中我唯一使用的应用程序。所有搜索结果都高亮显示是一个杀手级功能,据我所知没有任何其它 Linux 终端有这个功能(如果能证明我错了,那我也很高兴)。最适合搜索编译错误和输出日志。” —Jan Horak + +“我过去经常使用 Terminator。现在我在 Tilix 中克隆了它的主题(深色主题),而感受一样好。它可以在选项卡之间轻松移动。就是这样。” —Alberto Fanjul Alonso + +“我开始使用的是 Terminator,自从差不多过去这三年,我已经完全切换到 Tilix。” —Mike Harris + +“我使用下拉式终端 X。这是 GNOME 3 的一个非常简单的扩展,使我始终可以通过一个按键(对于我来说是`F12`)拉出一个终端。它还支持制表符,这正是我所需要的。 ” —Germán Pulido + +“xfce4-terminal:支持 Wayland、缩放、无边框、无标题栏、无滚动条 —— 这就是我在 tmux 之外全部想要的终端仿真器的功能。我希望我的终端仿真器可以尽可能多地使用屏幕空间,我通常在 tmux 窗格中并排放着编辑器(Vim)和 repl。” —Martin Kourim + +“别问,问就是 Fish ! ;-)” —Eric Schabell + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/favorite-terminal-emulator + +作者:[Opensource.com][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/admin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_terminals_0.png?itok=XwIRERsn (Terminal window with green text) +[2]: https://opensource.com/article/19/10/why-use-rxvt-terminal From 61400de5f81ca0370c94c9527760665377b36b07 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 24 Jan 2020 00:09:18 +0800 Subject: [PATCH 0383/3057] PRF --- .../tech/20191208 What-s your favorite terminal emulator.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20191208 What-s your favorite terminal emulator.md b/translated/tech/20191208 What-s your favorite terminal emulator.md index ccb9a6bbfc..7a25309a53 100644 --- a/translated/tech/20191208 What-s your favorite terminal emulator.md +++ b/translated/tech/20191208 What-s your favorite terminal emulator.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What's your favorite terminal emulator?) @@ -12,7 +12,7 @@ > 我们让社区讲述他们在终端仿真器方面的经验。以下是我们收到的一些回复。 -![Terminal window with green text][1] +![](https://img.linux.net.cn/data/attachment/album/202001/24/000846qsmpz7s7spig77qg.jpg) 终端仿真器的偏好可以说明一个人的工作流程。无鼠标操作能力是否必须具备?你想要标签页还是窗口?对于终端仿真器你还有什么选择的原因?是否有酷的因素?欢迎参加调查或给我们留下评论,告诉我们你最喜欢的终端模拟器。你尝试过多少种终端仿真器呢? @@ -63,7 +63,7 @@ via: https://opensource.com/article/19/12/favorite-terminal-emulator 作者:[Opensource.com][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 62ed91ae4a937d04547759d433fbc7ab5ad24f3e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 24 Jan 2020 00:09:53 +0800 Subject: [PATCH 0384/3057] PUB @wxy https://linux.cn/article-11814-1.html --- .../20191208 What-s your favorite terminal emulator.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191208 What-s your favorite terminal emulator.md (98%) diff --git a/translated/tech/20191208 What-s your favorite terminal emulator.md b/published/20191208 What-s your favorite terminal emulator.md similarity index 98% rename from translated/tech/20191208 What-s your favorite terminal emulator.md rename to published/20191208 What-s your favorite terminal emulator.md index 7a25309a53..3979bb4a53 100644 --- a/translated/tech/20191208 What-s your favorite terminal emulator.md +++ b/published/20191208 What-s your favorite terminal emulator.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11814-1.html) [#]: subject: (What's your favorite terminal emulator?) [#]: via: (https://opensource.com/article/19/12/favorite-terminal-emulator) [#]: author: (Opensource.com https://opensource.com/users/admin) From b98f6cf7b453be6f5aa394fa10079d8f4e654cc9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 24 Jan 2020 00:52:34 +0800 Subject: [PATCH 0385/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200124=20Ansi?= =?UTF-8?q?ble=20Ad-hoc=20Command=20Quick=20Start=20Guide=20with=20Example?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200124 Ansible Ad-hoc Command Quick Start Guide with Examples.md --- ...Command Quick Start Guide with Examples.md | 313 ++++++++++++++++++ 1 file changed, 313 insertions(+) create mode 100644 sources/tech/20200124 Ansible Ad-hoc Command Quick Start Guide with Examples.md diff --git a/sources/tech/20200124 Ansible Ad-hoc Command Quick Start Guide with Examples.md b/sources/tech/20200124 Ansible Ad-hoc Command Quick Start Guide with Examples.md new file mode 100644 index 0000000000..cb4783b6ab --- /dev/null +++ b/sources/tech/20200124 Ansible Ad-hoc Command Quick Start Guide with Examples.md @@ -0,0 +1,313 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ansible Ad-hoc Command Quick Start Guide with Examples) +[#]: via: (https://www.2daygeek.com/ansible-ad-hoc-command-quick-start-guide-with-examples/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Ansible Ad-hoc Command Quick Start Guide with Examples +====== + +Recently, we have written an article about the **[Ansible installation and configuration][1]**. + +Only a few examples of how to use it are included in that tutorial. + +If you are new to Ansible, I suggest you read the Installation and Configuration section by pressing the URL above. + +Once you’re good in that area, go ahead and play with this article. + +By default, Ansible uses only 5 parallel processes. If you want to perform a task on multiple hosts, you need to manually set the value of the fork count by adding **“-f [fork count]”**. + +### What is ad-hoc Command + +The ad-hoc command is used to automate a task on one or more managed nodes. Ad-hoc commands are very simple, but they are not re-usable. It uses the **“/usr/bin/ansible”** binary to perform all actions. + +Ad-hoc commands are best for tasks you run once. For example, if you want to check whether a given user is available or not, you can use the Ansible Quick One liner without writing a playbook. + +### Why Would You Like to Know About ad-hoc Commands? + +Ad-hoc commands prove the simplicity and power of the Ansible. It currently supports 3389 modules as of version 2.9, so you need to understand and learn the list of Ansible modules you want to use regularly. + +If you are new to Ansible, you can easily practice those modules and their arguments with the help of ad-hoc command. + +The concepts you learn here will port over directly to the playbook language. + +**General Syntax of ad-hoc command:** + +``` +ansible | [pattern] | -m [module] | -a "[module options]" + A | B | C | D +``` + +The ad-hoc command comes with four parts and the details are below. + +``` ++-----------------+--------------------------------------------------+ +| Details | Description | ++-----------------+--------------------------------------------------+ +|ansible | A command | +|pattern | Input the entire inventory or a specific group | +|module | Run the given module name | +|module options | Specify the module arguments | ++-----------------+--------------------------------------------------+ +``` + +### How To Use Ansible Inventory File + +If you use the default inventory file of Ansible **“/etc/ansible/hosts”**, you can call it directly. + +If not, the entire path of the Ansible Inventory file should be called with the **“-i”** option. + +### What’s Pattern and How to Use it? + +An Ansible pattern can refer to a single host, IP address, an inventory group, a set of groups, or all hosts in your inventory. + +It allows you to run commands and playbooks against them. Patterns are very flexible and you can use them according to your needs. + +For example, you can exclude hosts, use wildcards or regular expressions, and more. + +The table below describes common patterns and their use. But if it doesn’t meet your needs, you can use variables in patterns with the **“-e”** argument in the ansible-playbook. + +``` ++-----------------------+------------------------------+-----------------------------------------------------+ +| Description | Pattern(s) | Targets | ++-----------------------+------------------------------+-----------------------------------------------------+ +|All hosts | all (or *) | Run an Ansible against all servers in your inventory| +|One host | host1 | Run an Ansible against only the given host. | +|Multiple hosts | host1:host2 (or host1,host2) | Run an Ansible against the mentioned multiple hosts | +|One group | webservers | Run an Ansible against the webservers group | +|Multiple groups | webservers:dbservers | all hosts in webservers plus all hosts in dbservers | +|Excluding groups | webservers:!atlanta | all hosts in webservers except those in atlanta | +|Intersection of groups | webservers:&staging | any hosts in webservers that are also in staging | ++-----------------------+------------------------------+-----------------------------------------------------+ +``` + +### What is Ansible Modules and What it Does? + +Modules (also referred to as “task plugins” or “library plugins”) are units of code that can be used to perform a specific task directly on remote hosts or through Playbooks. + +Ansible executes the given module on the remote target node and collects the return values. + +Each module supports multiple arguments, allowing it to meet the user’s needs. Almost all modules take **“key=value”** arguments except few. + +You can add multiple arguments with the space at once, and the command/shell modules directly take the string of the command you want to run. + +We will add a table with the most frequently used **“module options”** arguments. + +To list all available modules, run the command below. + +``` +$ ansible-doc -l +``` + +Run the command below to read the documentation for the given module + +``` +$ ansible-doc [Module] +``` + +### 1) How to List the Contents of a Directory Using Ansible on Linux + +This can be done using the Ansible command module as follows. We have listed the contents of the **“daygeek”** user’s home directory on the **“node1.2g.lab”** and **“node2.2g.lab”** remote server. + +``` +$ ansible web -m command -a "ls -lh /home/daygeek" + +node1.2g.lab | CHANGED | rc=0 >> +total 12K +drwxr-xr-x. 2 daygeek daygeek 6 Feb 15 2019 Desktop +drwxr-xr-x. 2 daygeek daygeek 6 Feb 15 2019 Documents +drwxr-xr-x. 2 daygeek daygeek 6 Feb 15 2019 Downloads +drwxr-xr-x. 2 daygeek daygeek 6 Feb 15 2019 Music +-rwxr-xr-x. 1 daygeek daygeek 159 Mar 4 2019 passwd-up.sh +drwxr-xr-x. 2 daygeek daygeek 6 Feb 15 2019 Pictures +drwxr-xr-x. 2 daygeek daygeek 6 Feb 15 2019 Public +drwxr-xr-x. 2 daygeek daygeek 6 Feb 15 2019 Templates +-rwxrwxr-x. 1 daygeek daygeek 138 Mar 10 2019 user-add.sh +-rw-rw-r--. 1 daygeek daygeek 18 Mar 10 2019 user-list1.txt +drwxr-xr-x. 2 daygeek daygeek 6 Feb 15 2019 Videos + +node2.2g.lab | CHANGED | rc=0 >> +total 0 +drwxr-xr-x. 2 daygeek daygeek 6 Nov 9 09:55 Desktop +drwxr-xr-x. 2 daygeek daygeek 6 Nov 9 09:55 Documents +drwxr-xr-x. 2 daygeek daygeek 6 Nov 9 09:55 Downloads +drwxr-xr-x. 2 daygeek daygeek 6 Nov 9 09:55 Music +drwxr-xr-x. 2 daygeek daygeek 6 Nov 9 09:55 Pictures +drwxr-xr-x. 2 daygeek daygeek 6 Nov 9 09:55 Public +drwxr-xr-x. 2 daygeek daygeek 6 Nov 9 09:55 Templates +drwxr-xr-x. 2 daygeek daygeek 6 Nov 9 09:55 Videos +``` + +### 2) How to Manage Files Using Ansible on Linux + +Ansible “copy module” copies a file from a local system to a remote system. Use the Ansible command module to move or copy files to a remote machine. + +``` +$ ansible web -m copy -a "src=/home/daygeek/backup/CentOS7.2daygeek.com-20191025.tar dest=/home/u1" --become + +node1.2g.lab | CHANGED => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/bin/python" + }, + "changed": true, + "checksum": "ad8aadc0542028676b5fe34c94347829f0485a8c", + "dest": "/home/u1/CentOS7.2daygeek.com-20191025.tar", + "gid": 0, + "group": "root", + "md5sum": "ee8e778646e00456a4cedd5fd6458cf5", + "mode": "0644", + "owner": "root", + "secontext": "unconfined_u:object_r:user_home_t:s0", + "size": 30720, + "src": "/home/daygeek/.ansible/tmp/ansible-tmp-1579726582.474042-118186643704900/source", + "state": "file", + "uid": 0 +} + +node2.2g.lab | CHANGED => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/libexec/platform-python" + }, + "changed": true, + "checksum": "ad8aadc0542028676b5fe34c94347829f0485a8c", + "dest": "/home/u1/CentOS7.2daygeek.com-20191025.tar", + "gid": 0, + "group": "root", + "md5sum": "ee8e778646e00456a4cedd5fd6458cf5", + "mode": "0644", + "owner": "root", + "secontext": "unconfined_u:object_r:user_home_t:s0", + "size": 30720, + "src": "/home/daygeek/.ansible/tmp/ansible-tmp-1579726582.4793239-237229399335623/source", + "state": "file", + "uid": 0 +} +``` + +We can verify it by running the command below. + +``` +$ ansible web -m command -a "ls -lh /home/u1" --become + +node1.2g.lab | CHANGED | rc=0 >> +total 36K +-rw-r--r--. 1 root root 30K Jan 22 14:56 CentOS7.2daygeek.com-20191025.tar +-rw-r--r--. 1 root root 25 Dec 9 03:31 user-add.sh + +node2.2g.lab | CHANGED | rc=0 >> +total 36K +-rw-r--r--. 1 root root 30K Jan 23 02:26 CentOS7.2daygeek.com-20191025.tar +-rw-rw-r--. 1 u1 u1 18 Jan 23 02:21 magi.txt +``` + +To copy a file from one location to another on the remote machine, use the following command. + +``` +$ ansible web -m command -a "cp /home/u2/magi/ansible-1.txt /home/u2/magi/2g" --become +``` + +To move a file, use the following command. + +``` +$ ansible web -m command -a "mv /home/u2/magi/ansible.txt /home/u2/magi/2g" --become +``` + +To create a new file named **“ansible.txt”** under **“u1”** user, run the following command. + +``` +$ ansible web -m file -a "dest=/home/u1/ansible.txt owner=u1 group=u1 state=touch" --become +``` + +To create a new directory named **“magi”** under the **“u1”** user, run the following command. **_“**The file module can also create directories as follows**_“**. + +``` +$ ansible web -m file -a "dest=/home/u1/magi mode=755 owner=u2 group=u2 state=directory" --become +``` + +To change the permission of the **“ansible.txt”** file to **“777”** under **“u1”** user, run the following command. + +``` +$ ansible web -m file -a "dest=/home/u1/ansible.txt mode=777" --become +``` + +To delete the “ansible.txt” file under “u1” user, run the following command. + +``` +$ ansible web -m file -a "dest=/home/u2/magi/ansible-1.txt state=absent" --become +``` + +Use the following command to delete a directory and it will delete the given directory recursively. + +``` +$ ansible web -m file -a "dest=/home/u2/magi/2g state=absent" --become +``` + +### 3) User Management + +You can easily perform the user management activity through Ansible, such as user creation, deleting a user, and adding a user to the group. + +``` +$ ansible all -m user -a "name=foo password=[crypted password here]" +``` + +To remove a user, run the following command. + +``` +$ ansible all -m user -a "name=foo state=absent" +``` + +### 4) Managing Package + +Package installation can be easily managed using the appropriate Ansible Package Manager module. For example, we are going to use the yum module to manage packages on the CentOS system. + +To install the latest Apache (httpd) package. + +``` +$ ansible web -m yum -a "name=httpd state=latest" +``` + +To uninstall the Apache (httpd) package. + +``` +$ ansible web -m yum -a "name=httpd state=absent" +``` + +### 5) Managing Service + +Use the following Ansible module command to manage any service on Linux using Ansible + +To stop the httpd service + +``` +$ ansible web -m service -a "name=httpd state=stopped" +``` + +To start the httpd service + +``` +$ ansible web -m service -a "name=httpd state=started" +``` + +To restart the httpd service + +``` +$ ansible web -m service -a "name=httpd state=restarted" +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/ansible-ad-hoc-command-quick-start-guide-with-examples/ + +作者:[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/install-configure-ansible-automation-tool-linux-quick-start-guide/ From ee2c4cf4fddbe63ab0967d6b90cc0aae38218b59 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 24 Jan 2020 00:53:48 +0800 Subject: [PATCH 0386/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200123=20Use?= =?UTF-8?q?=20this=20open=20source=20tool=20to=20get=20your=20local=20weat?= =?UTF-8?q?her=20forecast?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200123 Use this open source tool to get your local weather forecast.md --- ...tool to get your local weather forecast.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20200123 Use this open source tool to get your local weather forecast.md diff --git a/sources/tech/20200123 Use this open source tool to get your local weather forecast.md b/sources/tech/20200123 Use this open source tool to get your local weather forecast.md new file mode 100644 index 0000000000..644bd80331 --- /dev/null +++ b/sources/tech/20200123 Use this open source tool to get your local weather forecast.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this open source tool to get your local weather forecast) +[#]: via: (https://opensource.com/article/20/1/open-source-weather-forecast) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use this open source tool to get your local weather forecast +====== +Know whether you need a coat, an umbrella, or sunscreen before you go +out with wego in the thirteenth in our series on 20 ways to be more +productive with open source in 2020. +![Sky with clouds and grass][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Check the weather with wego + +One of the things I love about the past decade of my employment is that it mostly has been remote. I can work anywhere I happen to be in the world, although the reality is that I spend a lot of time in my home office. The downside is that when I leave the house, I base a lot of decisions on what the conditions look like outside my window. And where I live, "sunny and clear" can mean anything from "scorchingly hot" to "below freezing" to "it will rain in an hour." Being able to check the actual conditions and forecast quickly is pretty useful. + +![Wego][2] + +[Wego][3] is a program written in Go that will fetch and display your local weather. It even renders it in shiny ASCII art if you wish. + +To install wego, you need to make sure [Go][4] is installed on your system. After that, you can fetch the latest version with the **go get** command. You'll probably want to add the **~/go/bin** directory to your path as well: + + +``` +go get -u github.com/schachmat/wego +export PATH=~/go/bin:$PATH +wego +``` + +On its first run, wego will complain about missing API keys. Now you need to decide on a backend. The default backend is for [Forecast.io][5], which is part of [Dark Sky][6]. Wego also supports [OpenWeatherMap][7] and [WorldWeatherOnline][8]. I prefer OpenWeatherMap, so that's what I'll show you how to set up here. + +You'll need to [register for an API key][9] with OpenWeatherMap. Registration is free, although the free API key has a limit on how many queries you can make in a day; this should be fine for an average user. Once you have your API key, put it into the **~/.wegorc** file. Now is also a good time to fill in your location, language, and whether you use metric, imperial (US/UK), metric-ms, or International System of Units (SI). OpenWeatherMap supports locations by name, postal code, coordinates, and ID, which is one of the reasons I like it. + + +``` +# wego configuration for OEM +aat-coords=false +aat-monochrome=false +backend=openweathermap +days=3 +forecast-lang=en +frontend=ascii-art-table +jsn-no-indent=false +location=Pittsboro +owm-api-key=XXXXXXXXXXXXXXXXXXXXX +owm-debug=false +owm-lang=en +units=imperial +``` + +Now, running **wego** at the command line will show the local weather for the next three days. + +Wego can also show data as JSON output for consumption by programs and with emoji. You can choose a frontend with the **-f** command-line parameter or in the **.wegorc** file. + +![Wego at login][10] + +If you want to see the weather every time you open a new shell or log into a host, simply add wego to your **~/.bashrc** (or **~/.zshrc** in my case). + +The [wttr.in][11] project is a web-based wrapper around wego. It provides some additional display options and is available on the website of the same name. One cool thing about wttr.in is that you can fetch one-line information about the weather with **curl**. I have a little shell function called **get_wttr** that fetches the current forecast in a shortened form. + + +``` +get_wttr() { +  curl -s "wttr.in/Pittsboro?format=3"     +} +``` + +![weather tool for productivity][12] + +Now, before I leave the house, I have a quick and easy way to find out if I need a coat, an umbrella, or sunscreen—directly from the command line where I spend most of my time. + +I began paragliding a few years ago. It’s maybe the most weather-dependent sport in the world. We... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-weather-forecast + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass) +[2]: https://opensource.com/sites/default/files/uploads/productivity_13-1.png (Wego) +[3]: https://github.com/schachmat/wego +[4]: https://golang.org/doc/install +[5]: https://forecast.io +[6]: https://darksky.net +[7]: https://openweathermap.org/ +[8]: https://www.worldweatheronline.com/ +[9]: https://openweathermap.org/api +[10]: https://opensource.com/sites/default/files/uploads/productivity_13-2.png (Wego at login) +[11]: https://github.com/chubin/wttr.in +[12]: https://opensource.com/sites/default/files/uploads/day13-image3.png (weather tool for productivity) From ebe0cc31fe842c1b69ba069f5f31db8c34d66c51 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 24 Jan 2020 01:03:24 +0800 Subject: [PATCH 0387/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200123=20How?= =?UTF-8?q?=20to=20stop=20typosquatting=20attacks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200123 How to stop typosquatting attacks.md --- ...00123 How to stop typosquatting attacks.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20200123 How to stop typosquatting attacks.md diff --git a/sources/tech/20200123 How to stop typosquatting attacks.md b/sources/tech/20200123 How to stop typosquatting attacks.md new file mode 100644 index 0000000000..66a87fd459 --- /dev/null +++ b/sources/tech/20200123 How to stop typosquatting attacks.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to stop typosquatting attacks) +[#]: via: (https://opensource.com/article/20/1/stop-typosquatting-attacks) +[#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) + +How to stop typosquatting attacks +====== +Typosquatting is a way to lure users into divulging sensitive data to +cybercriminals. Learn how to protect your organization, your open source +project, and yourself. +![Gears above purple clouds][1] + +Cybercriminals are turning to social engineering to try to trick unsuspecting people into divulging private information or valuable credentials. It is behind many [phishing scams][2] where the attacker poses as a reputable company or organization and uses it as a front to distribute a virus or other piece of malware. + +One such risk is [typosquatting][3], a form of social engineering attack that tries to lure users into visiting malicious sites with URLs that are common misspellings of legitimate sites. These sites can cause significant damage to the reputation of organizations that are victimized by these attackers and harm users who are tricked into entering sensitive details into fake sites. Both system administrators and users need to be aware of the risks and take steps to protect themselves. + +Open source software, which is developed and tested by large groups in public repositories, is often lauded for its security benefits. However, when it comes to social engineering schemes and malware implantation, even open source tools can fall victim. + +This article looks at the rising trend of typosquatting and what these attacks could mean for open source software in the future. + +### What is typosquatting? + +Typosquatting is a very specific form of cybercrime that is often tied to a larger phishing attack. It begins with the cybercriminal buying and registering a domain name that is the misspelling of a popular site. For example, the cybercriminal might add an extra vowel or replace an "i" with a lowercase "l" character. Sometimes a cybercriminal obtains dozens of domain names, each with a different spelling variation. + +A typosquatting attack does not become dangerous until real users start visiting the site. To make that happen, the criminal runs a phishing scam, typically over email, to urge people to click a link and visit the typosquatting website. Normally these rogue pages have simple login screens bearing familiar logos that try to imitate the real company's design. + +If the user does not realize they are visiting a fake website and enters sensitive details, such as their password, username, or credit card number, into the page, the cybercriminal gets full access to that data. If a user is utilizing the same password across several sites, their other online accounts are likely to be exploited as well. This is a cybercriminal's payout: identity theft, ruined credit reports, stolen records, and sometimes worse. + +### Some recent attacks + +From a company perspective, having a typosquatting attack connected to your domain name can be a public relations disaster, even though you played no direct role in it, because it's seen as irresponsible internet stewardship. As a domain owner, you have a responsibility to be proactive in defending against typosquatting to limit the pain caused by this type of fraud. + +A few years ago, many [health insurance customers fell victim][4] to a typosquatting attack when they received a phishing email that pointed to we11point.com, with the number 1 replacing the character "l" in the URL. + +When the international domain name rules were changed to allow anyone to register a URL with an extension previously tied to specific countries, it created a brand new wave of typosquatting attacks. One of the most prevalent ones seen today is when a cybercriminal registers a .om domain that matches a popular .com domain to take advantage of accidental omissions of the letter "c" when entering a web address. + +### How to protect your website from typosquatting + +For companies, the best strategy is to try to stay ahead of typosquatting attacks. + +That means spending the money to trademark your domain and purchase all related URLs that could be easy misspellings. You don't need to buy all top-level domain variants of your site name, but at least focus on common misspellings to your primary site name. + +If you need to send your users to third-party sites, do so from your official website, not in a mass email. It's important to firmly establish a policy that official communication always and only sends users to your site. That way, should a cybercriminal attempt to spoof communication from you, your users will know something's amiss when they end up on an unfamiliar page or URL structure. + +Use an open source tool like [DNS Twist][5] to automatically scan your company's domain and determine whether there could already be a typosquatting attack in progress. DNS Twist runs on Linux operating systems and can be used through a series of shell commands. + +Some ISPs offer typosquatting protection as part of their product offering. This functions as an extra layer of web filtering—if a user in your organization accidentally misspells a common URL, they are alerted that the page is blocked and redirected to the proper domain. + +If you are a system administrator, consider running your own [DNS server][6] along with a blacklist of incorrect and forbidden domains. + +Another effective way to spot a typosquatting attack in progress is to monitor your site traffic closely and set an alert for a sudden decrease in visitors from a particular region. It could be that a large number of your regular users have been redirected to a fake site. + +As with almost any form of cyberattack, the key to stopping typosquatting is constant vigilance. Your users are counting on you to identify and shut down any fake sites that are operating under your name, and if you don't, you could lose your audience's trust. + +### Typosquatting threats to open source software + +Most major open source projects go through security and penetration testing, largely because the code is public. However, mistakes happen under even the best of conditions. Here are some things to watch for if you're involved in an open source project. + +When you get a merge request or patch from an unknown source, review it carefully before merging, especially if there's a networking stack involved. Don't fall prey to the temptation of only testing your build; look at the code to ensure that nothing nefarious has been embedded into an otherwise functional enhancement. + +Also, use the same rigor in protecting your project's identity as a business does for its domain. Don't let a cybercriminal create alternate download sites and offer a version of your project with additional harmful code. Use digital signatures, like the following, to create an assurance of authenticity for your software: + + +``` +gpg --armor --detach-sig \ +\--output advent-gnome.sig \ +example-0.0.1.tar.xz +``` + +You should also provide a checksum for the file you deliver: + + +``` +`sha256sum example-0.0.1.tar.xz > example-0.0.1.txt` +``` + +Provide these safeguards even if you don't believe your users will take advantage of them, because all it takes is one perceptive user to notice a missing signature on an alternative download to alert you that someone, somewhere is spoofing your project. + +### Final thoughts + +Humans are prone to making mistakes. When you have millions of people around the world typing in a common web address, it's no surprise that a certain percentage enter a typo in the URL. Cybercriminals are trying to capitalize on that trend with typosquatting. + +It's hard to stop cybercriminals from registering domains that are available for purchase, so mitigate against typosquatting attacks by focusing on the ways they spread. The best protection is to build trust with your users and to be diligent in detecting typosquatting attempts. Together, as a community, we can all help ensure that typosquatting attempts are ineffective. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/stop-typosquatting-attacks + +作者:[Sam Bocetta][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) +[2]: https://www.cloudberrylab.com/resources/guides/types-of-phishing/ +[3]: https://en.wikipedia.org/wiki/Typosquatting +[4]: https://www.menlosecurity.com/blog/-a-new-approach-to-end-typosquatting +[5]: https://github.com/elceef/dnstwist +[6]: https://opensource.com/article/17/4/build-your-own-name-server From a1d1d958d658bf66ca822ad7e699a9b5e1a9b4e9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 24 Jan 2020 01:09:29 +0800 Subject: [PATCH 0388/3057] add done: 20200123 How to stop typosquatting attacks.md --- ...6 things you should be doing with Emacs.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/tech/20200123 6 things you should be doing with Emacs.md diff --git a/sources/tech/20200123 6 things you should be doing with Emacs.md b/sources/tech/20200123 6 things you should be doing with Emacs.md new file mode 100644 index 0000000000..b01830cd8e --- /dev/null +++ b/sources/tech/20200123 6 things you should be doing with Emacs.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 things you should be doing with Emacs) +[#]: via: (https://opensource.com/article/20/1/emacs-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +6 things you should be doing with Emacs +====== +Here are six things you may not have realized you could do with Emacs. +Then, get our new cheat sheet to get the most out of Emacs. +![Text editor on a browser, in blue][1] + +Imagine using Python's IDLE interface to edit text. You would be able to load files into memory, edit them, and save changes. But every action you perform would be defined by a Python function. Making a word all capitals, for instance, calls **upper()**, opening a file calls **open**, and so on. Everything in your text document is a Python object and can be manipulated accordingly. From the user's perspective, it's the same experience as any text editor. For a Python developer, it's a rich Python environment that can be changed and developed with just a few custom functions in a config file. + +This is what [Emacs][2] does for the 1958 programming language [Lisp][3]. In Emacs, there's no separation between the Lisp engine running the application and the arbitrary text you type into it. To Emacs, everything is Lisp data, so everything can be analyzed and manipulated programmatically. + +That makes for a powerful user interface (UI). But if you're a casual Emacs user, you may only be scratching the surface of what it can do for you. Here are six things you may not have realized you could do with Emacs. + +## Use Tramp mode for cloud editing + +Emacs has been network-transparent for a lot longer than has been trendy, and today it still provides one of the smoothest remote editor experiences available. The [Tramp mode][4] in Emacs (formerly known as RPC mode) stands for "Transparent Remote (file) Access, Multiple Protocol," which spells out exactly what it offers: easy access to remote files you want to edit over most popular network protocols. The most popular and safest protocol for remote editing these days is [OpenSSH][5], so that's the default. + +Tramp is already included in Emacs 22.1 or greater, so to use Tramp, you just open a file in the Tramp syntax. In the **File** menu of Emacs, select **Open File**. When prompted in the mini-buffer at the bottom of the Emacs window, enter the file name using this syntax: + + +``` +`/ssh:user@example.com:/path/to/file` +``` + +If you are required to log in interactively, Tramp prompts you for your password. However, Tramp uses OpenSSH directly, so to avoid interactive prompts, you can also add your hostname, username, and SSH key path to your **~/.ssh/config** file. Like Git, Emacs uses your SSH config first and only stops to ask for more information in the event of an error. + +Tramp is great for editing files that don't exist on your computer, and the user experience is not noticeably any different from editing a local file. The next time you start to SSH into a server just to launch a Vim or Emacs session, try Tramp instead. + +## Calendaring + +If you parse text better than you parse graphical interfaces, you'll be happy to know that you can schedule your day (or life) in plain text with Emacs but still get fancy notifications on your mobile device with open source [Org mode][6] viewers. + +The process takes a little setup to create a convenient way to sync your agenda with your mobile device (I use Git, but you could invoke Bluetooth, KDE Connect, Nextcloud, or your file synchronization tool of choice), and you have to install an Org mode viewer (such as [Orgzly][7]) and a Git client app on your mobile. Once you've got your infrastructure sorted, though, the process is inherently perfectly integrated with your usual (or developing, if you're a new user) Emacs workflow. You can refer to your agenda easily in Emacs, make updates to your schedule, and generally stay on task. Pushing changes to your agenda is reflected on your mobile, so you can stay organized even when Emacs isn't available. + +![][8] + +Intrigued? Read my step-by-step guide about [calendaring with Org mode and Git][9]. + +## Access the terminal + +There are [lots of terminal emulators][10] available. Although the Elisp terminal emulator in Emacs isn't the greatest general-purpose one, it's got two notable advantages. + + 1. **Opens in an Emacs buffer: **I use Emacs' Elisp shell because it's conveniently located in my Emacs window, which I often run in fullscreen. It's a small but significant advantage to have a terminal just a **Ctrl+x+o** (or C-x o in Emacs notation) away, and it's especially nice to be able to glance over at it for status reports when it's running a lengthy job. + 2. **Easy copying and pasting if no system clipboard is available:** Whether I'm too lazy to move my hand from the keys to the mouse, or I don't have mouse functionality because I'm running Emacs in a remote console, having a terminal in Emacs can sometimes mean a quick transfer of data from my Emacs buffer to Bash. + + + +To try the Emacs terminal, type **Alt**+**x** (**M-x** in Emacs notation), then type **shell**, and press **Return**. + +## Use Racket mode + +[Racket][11] is an exciting emerging Lisp dialect with a dynamic programming environment, a GUI toolkit, and a passionate community. The default editor when learning Racket is DrRacket, which has a Definitions panel at the top and an Interactions panel at the bottom. Using this setup, the user writes definitions that affect the Racket runtime. Imagine the old [Logo Turtle][12] program, but with a terminal instead of just a turtle. + +![Racket-mode][13] + +LGPL sample code by PLT + +Emacs, being based on Lisp, makes a great integrated development environment (IDE) for advanced Racket coders. It doesn't ship with [Racket mode][14] (yet), but you can install Racket mode and several other helper extensions using the Emacs package installer. To install it, press **Alt**+**X** (**M-x** in Emacs notation), type **package-install**, and press **Return**. Then enter the package you want to install (**racket-mode**), and press **Return**. + +Enter Racket mode with **M-x racket-mode**. If you're new to Racket but not to Lisp or Emacs, start with the excellent [Quick introduction to Racket with pictures][15]. + +## Scripting + +You might know that Bash scripts are popular for automating and enhancing your Linux or Unix experience. You may have heard that Python does a pretty good job of that, too. But did you know that Lisp scripts can be run in much the same way? There's sometimes confusion about just how useful Lisp really is because many people are introduced to Lisp through Emacs, so there's the latent impression that the only way to run Lisp in the 21st century is to open an Emacs window. Luckily, that's not the case at all, and Emacs is a great IDE for the tools that enable you to run Lisp scripts as general system executables. + +There are two popular modern Lisps, aside from Elisp, that are easy to run as standalone scripts. + + 1. **Racket:** You can run Racket scripts relying on your system's Racket install to provide runtime support, or you can use **raco exe** to produce an executable. The **raco exe** command packages your code together with runtime support files to create an executable. The **raco distribute** command then packages that executable into a distribution that works on other machines. Emacs has many Racket-specific tools, so creating Racket files in Emacs is easy and efficient. + + 2. **GNU Guile:** [GNU Guile][16] (short for "GNU Ubiquitous Intelligent Language for Extensions") is an implementation of the [Scheme][17] programming language that's used for creating applications and games for the desktop, internet, terminal, and more. Writing Scheme is easy, using any one of the many Scheme extensions in Emacs. For example, here's a "Hello world" script in Guile: [code] #!/usr/bin/guile -s +!# + +(display "hello world") +     (newline) [/code] Compile and run it with the **guile** command: [code] $ guile ./hello.scheme +;;; compiling /home/seth/./hello.scheme +;;; compiled [...]/hello.scheme.go +hello world +$ guile ./hello.scheme +hello world +``` +## Run Elisp without Emacs + +Emacs can serve as an Elisp runtime, but you don't have to "open" Emacs in the traditional sense. The **\--script** option allows you to run Elisp scripts using Emacs as the engine but without launching the Emacs GUI (not even its terminal-based one). In this example, the **-Q** option causes Emacs to ignore your **.emacs** file to avoid any delays in executing the Elisp script (if your script relies upon something \ No newline at end of file From 401400d510d8246a0de58aef3a11e684a6995c34 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 24 Jan 2020 01:20:52 +0800 Subject: [PATCH 0389/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200123=20Surv?= =?UTF-8?q?ey:=20Digital=20transformation=20can=20reveal=20network=20weakn?= =?UTF-8?q?esses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200123 Survey- Digital transformation can reveal network weaknesses.md --- ...formation can reveal network weaknesses.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/talk/20200123 Survey- Digital transformation can reveal network weaknesses.md diff --git a/sources/talk/20200123 Survey- Digital transformation can reveal network weaknesses.md b/sources/talk/20200123 Survey- Digital transformation can reveal network weaknesses.md new file mode 100644 index 0000000000..c03da59858 --- /dev/null +++ b/sources/talk/20200123 Survey- Digital transformation can reveal network weaknesses.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Survey: Digital transformation can reveal network weaknesses) +[#]: via: (https://www.networkworld.com/article/3516030/survey-digital-transformation-can-reveal-network-weaknesses.html) +[#]: author: (Linda Musthaler https://www.networkworld.com/author/Linda-Musthaler/) + +Survey: Digital transformation can reveal network weaknesses +====== +When enterprises embraced digital transformation, some found their existing networks had a limited ability to address cloud connectivity or access for mobile users. +Metamorworks / Getty Images + +[Digital transformation][1] is a catch-all phrase that describes the process of using technology to modernize or even revolutionize how services are delivered to customers. Not only technology but also people and processes commonly undergo fundamental changes for the ultimate goal of significantly improving business performance. + +Such transformations have become so mainstream that IDC estimated that 40% of all technology spending now goes toward digital transformation projects, with enterprises spending in excess of $2 trillion on their efforts through 2019. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Every company’s digital transformation project is unique. Whether it’s transforming a company’s marketing and sales processes by using machine learning to garner deep insights on each and every customer, or building a seamless experience across sales channels and revamping distribution channels to provide the best products and resources to customers, a digital-transformation project is going to be dependent on as well as have an impact on the enterprise’s network infrastructure. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Many companies assume their networks can handle these changes. But can they? Do these new ways of working strain the existing network infrastructure by imposing new requirements for agility, cloud access, security and mobility? + +### Gauging Confidence in the Network Post-Digital Transformation + +A recent survey of more than 1,300 IT professionals dared to ask about the impact of digital transformation on each respondent’s enterprise network. Having just conducted its fourth annual state of the WAN survey at the end of 2019, Cato Networks issued the report, [Networking in 2020: Understanding Digital Transformation’s Impact on IT Confidence in Enterprise Networks][4]_._ Steve Taylor, publisher and editor-in-chief of Webtorials.Com, and Dr. Jim Metzler, principal at Ashton, Metzler, and Associates, were instrumental in designing and the analyzing the results from the portion of the survey relating to digital transformation. There are some worthy observations here for network managers. + +The study looked at networking and security priorities for IT professional in 2020. As part of that process, the study sought to identify how ready enterprise networks are for the digital era. According to the report, “The modern business has data and users residing everywhere. And just as the enterprise network provided performance and security to data centers and branch offices in the past, so, too, it must provide performance and security to the cloud and mobile users—both hallmarks of digital initiatives.” Without a network that delivers the right infrastructure with the right performance and security levels anywhere, digital transformation efforts can run aground. + +1,333 respondents took part in the survey in late 2019. Qualified respondents were those who work in IT and are involved in the purchase of telco services for enterprises with an SD-WAN or MPLS backbone (or a mix of MPLS and Internet VPN). The vast majority of the respondents say they are moderately or extremely involved in their organization’s digital transformation initiatives. + +More than half of respondents identified working for companies with a global or regional footprint. Nearly half of respondents work for companies with more than 2,500 employees. The vast majority said their organization spans 11 or more locations, with a quarter of the respondents from companies with more than 100 locations. All respondents’ companies have some cloud presence and most have two or more physical [data centers][5]. + +To gauge the impact of digital transformation on the network, the survey asked a number of qualitative questions pertaining to network characteristics that include agility, security, performance, and management and operations. For each characteristic, the study looked at the “network confidence level”; that is, whether the respondent feels more or less confident in the network’s capabilities in that area following the deployment of the transformation project. The study segmented respondents by the type of network they operate—[MPLS][6], hybrid (MPLS and Internet-based VPN), [SD-WAN][7], or [SASE][8] (secure access service edge, pronounced “sassy”). SASE converges SD-WAN and other networking capabilities and a complete security stack into a global, cloud-native platform. (Disclosure: Report publisher Cato Networks delivers an SD-WAN service and also bills itself as the world’s first SASE platform.) + +**Overall Findings** + +I’ll get to the results about network confidence level in a moment. First let’s look at some general information disclosed in the report: + + * Budgets are growing in 2020. Respondents report that both their network and their security budgets are expected to grow in 2020. That’s good news, considering both areas are being asked to do more. + * Site connectivity continues to drive the major networking challenges for 2020. This includes bandwidth costs, performance between locations, and managing the network. + * Mobility is becoming strategic for network buyers. The importance of managing mobile and remote access grew significantly since the last annual survey. Addressing this need has become another top networking challenge. + * Security is an essential consideration for [WAN][9] transformation. Enterprises must have a multi-edge security strategy that includes defending against emerging threats like malware/ransomware, enforcing corporate security policies on mobile users, and full awareness of the cost of buying and managing security appliances and software. + * The most critical applications are now in the cloud. More than half (60%) of all respondents indicate that their organization’s most critical applications will be hosted in the cloud over the next 12 months. This has a huge impact on how users will access the cloud via their WAN. + * Digital initiatives are driving a rethinking of legacy networks. More than half of the respondents whose organizations still rely on MPLS say their organizations are actively planning to deploy SD-WAN in the next 12 months to lower costs and support new business initiatives. + + + +### Digital transformations rattle network confidence + +To better understand why enterprises are abandoning MPLS and what lessons can be derived for any WAN transformation initiatives, respondents were asked to rate a series of statements evaluating their perceptions of their networks’ agility, management and operations, performance, and security. The respondents were then grouped by their network in order to assess the change in network confidence pre- and post-digital transformation. + +With one exception, respondents express lower confidence in their networks post-digital transformation. This is true in areas of MPLS’s presumed strength, such as performance, and it’s even true for hybrid networks as well as for SD-WAN. As organizations roll out digital initiatives, they uncover the weaknesses in their existing networks, such as a limited ability to address cloud connectivity or mobile user access. + +According to the report, the only exception is when respondents run a SASE architecture. They express greater confidence post-digital transformation. SASE’s convergence of SD-WAN with security, cloud connectivity, and mobility is well suited for digital transformation but may only be appreciated when required by the business. + +Going back to the network characteristics of agility, security, performance, and management and operations, let’s look at how each one is perceived in terms of respondents’ network confidence. + + * Network agility – This characteristic includes the ability to add new sites, adjust available bandwidth, add cloud resources, and generally adapt quickly to changing business needs. It’s understandable that respondents with an MPLS-based network would rate their confidence in network agility as low, but confidence among respondents who deployed an SD-WAN dropped the most when asked about rapidly delivering new public cloud infrastructure. The opposite is also true: SASE’s built-in cloud connectivity is a major factor in respondents being more confident in their network agility post-digital transformation. + * Security – It’s critical to protect users and resources regardless of the underlying network. MPLS does not protect resources and users, and certainly not those connected to the Internet, leading MPLS-only respondents to be significantly less confident in their network’s security post-digital transformation. SD-WAN respondents also demonstrate lower confidence in security post-digital transformation, largely because SD-WAN on its own fails to restrict access to specific applications or provide the advanced security tools needed to protect all edges – mobile devices, sites, and cloud resources. By contrast, SASE confidence grew post-digital transformation. Converging a complete security stack into the network allows SASE to bring granular control to sites, mobile, and cloud resources. + * Performance – Delivering cloud resources presents problems for MPLS and SD-WAN. Users expect their cloud application experience to be as responsive as on-premises applications. This point plays a significant role in performance confidence. When asked if respondents can provide access to cloud-based resources with the performance and availability comparable to internally hosted resources, respondents with MPLS, hybrid WAN, and SD-WAN networks showed significant drop-off in confidence post-digital transformation. On the other hand, SASE solutions that include native cloud optimization improve cloud performance out-of-the-box, making those network owners more confident that they can deliver what users need. + * Management and operations – Respondent confidence was high before digital transformation but dropped off post-digital transformation across all network types except for SASE. According to the report, the lack of redundant last mile connections with MPLS leaves sites susceptible to cable cuts and other last mile problems. Adding Internet VPNs to MPLS improves last mile access but still does not allow organizations to automatically overcome last mile issues without downtime. SD-WAN and SASE are better able to overcome last mile issues with active/active configurations. + + + +Digital transformation initiatives can vastly change network traffic patterns, bandwidth requirements, access locations, and security needs. These changes might not be apparent until the project is fully deployed. Every organization needs a network infrastructure that provides adequate performance, security, agility and manageability to support digital initiatives, now and into the future. Some network architectures are better at providing those characteristics than others are. IT organizations that want to be confident in their network’s ability to meet the future need to consider areas such as cloud, mobility and especially security when transforming their WANs today. + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3516030/survey-digital-transformation-can-reveal-network-weaknesses.html + +作者:[Linda Musthaler][a] +选题:[lujun9972][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/Linda-Musthaler/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3512830/how-to-deal-with-the-impact-of-digital-transformation-on-networks.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://go.catonetworks.com/Survey-Networking-in-2020.html +[5]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[6]: https://www.networkworld.com/article/2297171/network-security-mpls-explained.html +[7]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[8]: https://www.networkworld.com/article/3453030/sase-is-more-than-a-buzzword-for-bioivt.html +[9]: https://www.networkworld.com/article/3248989/what-is-a-wan-wide-area-network-definition-and-examples.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world From 520ee538ef2f4f8a3cf6248b37863a0fbcd79d61 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Fri, 24 Jan 2020 09:33:24 +0800 Subject: [PATCH 0390/3057] translated --- ...-CD resources to set you up for success.md | 57 ----------------- ...-CD resources to set you up for success.md | 64 +++++++++++++++++++ 2 files changed, 64 insertions(+), 57 deletions(-) delete mode 100644 sources/tech/20191227 Top CI-CD resources to set you up for success.md create mode 100644 translated/tech/20191227 Top CI-CD resources to set you up for success.md diff --git a/sources/tech/20191227 Top CI-CD resources to set you up for success.md b/sources/tech/20191227 Top CI-CD resources to set you up for success.md deleted file mode 100644 index d3da7c4d09..0000000000 --- a/sources/tech/20191227 Top CI-CD resources to set you up for success.md +++ /dev/null @@ -1,57 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top CI/CD resources to set you up for success) -[#]: via: (https://opensource.com/article/19/12/cicd-resources) -[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) - -Top CI/CD resources to set you up for success -====== -Continuous integration and continuous deployment were key topics in 2019 -as organizations look to achieve seamless, flexible, and scalable -deployments. -![Plumbing tubes in many directions][1] - -This has been a fantastic year for continuous integration/continuous deployment (CI/CD) and the world of DevOps. Opensource.com authors shared how they're moving toward agile and scrum as they focus on seamless, flexible, and scalable deployments. Here are some of the big themes in the CI/CD articles we published this year. - -### Learning and improving your CI/CD skills - -Some of our favorite articles focus on hands-on CI/CD experience and cover a lot of ground as they do. The place to start is always with [Jenkins][2] pipelines, and Bryant Son's [_Building CI/CD pipelines with Jenkins_][3] will give you enough experience to get started building your first pipelines. Daniel Oh's [_Automate user acceptance testing with your DevOps pipeline_][4] provides great information on acceptance testing, including various CI/CD applications you can use for testing in its own right. And my article on [_Security scanning your DevOps pipeline_][5] is a very short, to the point tutorial on how to set up security in a pipeline using the Jenkins platform. - -### Delivery workflow - -While learning how to use and improve your skills with CI/CD, the workflow matters, especially when it comes to pipelines, as Jithin Emmanuel shares in [_Screwdriver: A scalable build platform for continuous delivery_][6]. Emily Burns explains having the flexibility to build exactly what you need with your CI/CD workflow in [_Why Spinnaker matters to CI/CD_][7]. And Willy-Peter Schaub extols the idea of creating a unified pipeline for everything to build consistently in [_One CI/CD pipeline per product to rule them all_][8]. These articles will give you a good sense of what happens after you onboard team members to the workflow process. - -### How CI/CD affects organizations - -2019 was also the year of recognizing CI/CD's business impact and how it affects day-to-day operations. Agnieszka Gancarczyk shares the results of Red Hat's [_Small Scale Scrum vs. Large Scale Scrum_][9] survey, including respondents' differing opinions on scrums, the agile movement, and the impact on teams. Will Kelly covers [_How continuous deployment impacts the entire organization_][10], including the importance of open communication, and Daniel Oh emphasizes the importance of metrics and observability in [_3 types of metric dashboards for DevOps teams_][11]. Last, but far from least, Ann Marie Fred's great article [_Don't test in production? Test in production!_][12] details why it's important for you to test in production—before your customers do. - -We are thankful to the many contributing authors who shared their insights with Opensource.com readers in 2019, and I look forward to learning more from them about the evolution of CI/CD in 2020. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/cicd-resources - -作者:[Jessica Cherry][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jrepka -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/plumbing_pipes_tutorial_how_behind_scenes.png?itok=F2Z8OJV1 (Plumbing tubes in many directions) -[2]: https://jenkins.io/ -[3]: https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins -[4]: https://opensource.com/article/19/4/devops-pipeline-acceptance-testing -[5]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline -[6]: https://opensource.com/article/19/3/screwdriver-cicd -[7]: https://opensource.com/article/19/8/why-spinnaker-matters-cicd -[8]: https://opensource.com/article/19/7/cicd-pipeline-rule-them-all -[9]: https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum -[10]: https://opensource.com/article/19/7/organizational-impact-continuous-deployment -[11]: https://opensource.com/article/19/7/dashboards-devops-teams -[12]: https://opensource.com/article/19/5/dont-test-production diff --git a/translated/tech/20191227 Top CI-CD resources to set you up for success.md b/translated/tech/20191227 Top CI-CD resources to set you up for success.md new file mode 100644 index 0000000000..31ee2628b4 --- /dev/null +++ b/translated/tech/20191227 Top CI-CD resources to set you up for success.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top CI/CD resources to set you up for success) +[#]: via: (https://opensource.com/article/19/12/cicd-resources) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +顶级 CI / CD 资源,助您成功 +====== +随着企业期望实现无缝,灵活和可扩展的部署,持续集成和持续部署成为2019年的关键主题。 +![Plumbing tubes in many directions][1] + +对于 CI / CD 和 DevOps 来说,2019年是非常棒的一年。 Opensource 公司的作者分享了他们专注于无缝,灵活和可扩展部署时是如何朝着敏捷方向发展的。以下是我们2019年发布的 CI / CD 文章中的一些重要主题。 + +### 学习和提高您的 CI / CD 技能 + + +我们最喜欢的一些文章集中在 CI / CD 的实操经验上,并涵盖了许多方面。通常以[Jenkins][2]管道开始,布莱恩特的文章[用 Jenkins 构建 CI/CD 管道][4](Building CI/CD pipelines with Jenkins)将为您提供足够的经验,以开始构建您的第一个管道。丹尼尔在 [用DevOps 管道进行自动验收测试][4](Automate user acceptance testing with your DevOps pipeline )一文中,提供了有关验收测试的重要信息,包括可用于独立测试的各种 CI / CD 应用程序。我写的[安全扫描DevOps 管道][5](Security scanning your DevOps pipeline )非常简短,其中的关键点是关于如何使用 Jenkins 平台在管道中设置安全性的教程。 + +### 交付工作流程 + + +威利•彼得•绍布赞扬为所有产品创建统一流水线的想法,以使[每种产品在一个CI / CD 流水线中持续建立起来,以管控所有产品][8]。这些文章将使您更好地了解团队成员加入工作流流程后会发生什么。 + +### CI / CD 如何影响企业 + + +2019年也是认识到 CI / CD 的业务影响以及它如何影响日常运营的一年。 + + + +Agnieszka Gancarczyk 分享了Red Hat[小型Scrum vs.大型Scrum][9] 的调查结果, 包括受访者对srums, + +敏捷运动及其对团队的影响的不同看法。威尔安•凯丽 的[持续部署如何影响企业][10], 包括开放式沟通的重要性,丹尼尔也强调了[DevOps 团队在3 种类型的指表板][11]中指标和可观测性的重要性。最后是安•玛丽•弗雷德的精彩文章: [不要在生产环境中测试?在生产环境中测试!][12] 详细说明了验收测试前在生产环境中测试的重要性。 + +感谢许多贡献者在2019年与 Opensource 的读者分享他们的见解,我期望在2020年里从他们那里了解更多有关 CI / CD 发展的信息。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/cicd-resources + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/plumbing_pipes_tutorial_how_behind_scenes.png?itok=F2Z8OJV1 (Plumbing tubes in many directions) +[2]: https://jenkins.io/ +[3]: https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins +[4]: https://opensource.com/article/19/4/devops-pipeline-acceptance-testing +[5]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[6]: https://opensource.com/article/19/3/screwdriver-cicd +[7]: https://opensource.com/article/19/8/why-spinnaker-matters-cicd +[8]: https://opensource.com/article/19/7/cicd-pipeline-rule-them-all +[9]: https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum +[10]: https://opensource.com/article/19/7/organizational-impact-continuous-deployment +[11]: https://opensource.com/article/19/7/dashboards-devops-teams +[12]: https://opensource.com/article/19/5/dont-test-production From edb60f006d958f27f280e0fdbdd8638725dee6b9 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Fri, 24 Jan 2020 09:34:47 +0800 Subject: [PATCH 0391/3057] tranlated --- .../20191227 Top CI-CD resources to set you up for success.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20191227 Top CI-CD resources to set you up for success.md b/translated/tech/20191227 Top CI-CD resources to set you up for success.md index 31ee2628b4..102e53d153 100644 --- a/translated/tech/20191227 Top CI-CD resources to set you up for success.md +++ b/translated/tech/20191227 Top CI-CD resources to set you up for success.md @@ -17,7 +17,7 @@ ### 学习和提高您的 CI / CD 技能 -我们最喜欢的一些文章集中在 CI / CD 的实操经验上,并涵盖了许多方面。通常以[Jenkins][2]管道开始,布莱恩特的文章[用 Jenkins 构建 CI/CD 管道][4](Building CI/CD pipelines with Jenkins)将为您提供足够的经验,以开始构建您的第一个管道。丹尼尔在 [用DevOps 管道进行自动验收测试][4](Automate user acceptance testing with your DevOps pipeline )一文中,提供了有关验收测试的重要信息,包括可用于独立测试的各种 CI / CD 应用程序。我写的[安全扫描DevOps 管道][5](Security scanning your DevOps pipeline )非常简短,其中的关键点是关于如何使用 Jenkins 平台在管道中设置安全性的教程。 +我们最喜欢的一些文章集中在 CI / CD 的实操经验上,并涵盖了许多方面。通常以[Jenkins][2]管道开始,布莱恩特的文章[用 Jenkins 构建 CI/CD 管道][4]将为您提供足够的经验,以开始构建您的第一个管道。丹尼尔在 [用DevOps 管道进行自动验收测试][4]一文中,提供了有关验收测试的重要信息,包括可用于独立测试的各种 CI / CD 应用程序。我写的[安全扫描DevOps 管道][5]非常简短,其中的关键点是关于如何使用 Jenkins 平台在管道中设置安全性的教程。 ### 交付工作流程 From 6810ed8b5bdc3a9c7a9c116b7eef33d19a5157c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 24 Jan 2020 10:59:35 +0800 Subject: [PATCH 0392/3057] Translated --- ...03 Add scorekeeping to your Python game.md | 181 +++++++++--------- 1 file changed, 91 insertions(+), 90 deletions(-) rename {sources => translated}/tech/20200103 Add scorekeeping to your Python game.md (52%) diff --git a/sources/tech/20200103 Add scorekeeping to your Python game.md b/translated/tech/20200103 Add scorekeeping to your Python game.md similarity index 52% rename from sources/tech/20200103 Add scorekeeping to your Python game.md rename to translated/tech/20200103 Add scorekeeping to your Python game.md index 0bcfe955c7..4d2ba00a4f 100644 --- a/sources/tech/20200103 Add scorekeeping to your Python game.md +++ b/translated/tech/20200103 Add scorekeeping to your Python game.md @@ -7,56 +7,56 @@ [#]: via: (https://opensource.com/article/20/1/add-scorekeeping-your-python-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Add scorekeeping to your Python game +添加计分到你的 Python 游戏 ====== -In the tenth article in this series on programming with Python's Pygame -module, display your game player's score when they collect loot or take -damage. +In the tenth article in this series on programming with 在这一系列关于使用 Python 的 Pygame +模块编程的第 11 篇文章中,当你的玩家收集战利品或受到伤害时,显示你的玩家的得分。 ![connecting yellow dots in a maze][1] -This is part 10 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: +这是仍在进行中的关于使用 [Pygame][3] 模块来在 [Python 3][2] 在创建电脑游戏的第十一部分。先前的文章是: - * [Learn how to program in Python by building a simple dice game][4] - * [Build a game framework with Python using the Pygame module][5] - * [How to add a player to your Python game][6] - * [Using Pygame to move your game character around][7] - * [What's a hero without a villain? How to add one to your Python game][8] - * [Simulate gravity in your Python game][9] - * [Add jumping to your Python platformer game][10] - * [Enable your Python game player to run forward and backward][11] - * [Using Python to set up loot in Pygame][12] + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][4] + * [使用 Python 和 Pygame 模块构建一个游戏框架][5] + * [如何在你的 Python 游戏中添加一个玩家][6] + * [用 Pygame 使你的游戏角色移动起来][7] + * [如何向你的 Python 游戏中添加一个敌人][8] + * [在 Pygame 游戏中放置平台][19] + * [在你的 Python 游戏中模拟引力][9] + * [为你的 Python 平台类游戏添加跳跃功能][10] + * [使你的 Python 游戏玩家能够向前和向后跑][11] + * [在你的 Python 平台类游戏中放一些奖励][12] -If you've followed along with this series, you've learned all the essential syntax and patterns you need to create a video game with Python. However, it still lacks one vital component. This component isn't important just for programming games in Python; it's something you must master no matter what branch of computing you explore: Learning new tricks as a programmer by reading a language's or library's documentation. +如果你已经跟随这一系列很久,那么你已经学习你需要使用 Python 创建一个电脑游戏的所有的基本语法和样本。然而,它仍然缺少一个至关重要的组成部分。这一组成部分不仅仅对用 Python 编程游戏重要;不管你探究哪个计算机分支,你都必需精通:作为一个程序员,通过阅读一种语言的或库的文档来学习新的技巧。 -Luckily, the fact that you're reading this article is a sign that you're comfortable with documentation. For the practical purpose of making your platform game more polished, in this article, you will add a score and health display to your game screen. But the not-so-secret agenda of this lesson is to teach you how to find out what a library offers and how you can use new features. +幸运的是,事实上,你正在阅读的这篇文章是你适应阅读文档的一个标记。为了实现使你的平台类游戏更加优雅的实际目标,在这篇文章中,你将添加一个得分和健康状况显示到你游戏屏幕中。不过,教你如何找到一个库的功能以及如何使用这些新的功能的这节课程并不是如此神秘。 -### Displaying the score in Pygame +### 在 Pygame 中显示得分 -Now that you have loot that your player can collect, there's every reason to keep score so that your player sees just how much loot they've collected. You can also track the player's health so that when they hit one of the enemies, it has a consequence. +现在,你有你的玩家收集的奖励,这里有足够的正当理由来维持分数,以便你的玩家恰好看到他们收集了多少奖励。你也可以跟踪玩家的健康度,以便当他们击中一个敌人时,会有一个结果。 -You already have variables that track score and health, but it all happens in the background. This article teaches you to display these statistics in a font of your choice on the game screen during gameplay. +你已经有了跟踪分数和健康度的变量,但是这一切都发生在后台。这篇文章教你在游戏过程期间在游戏屏幕上以你选择的一种字体来显示这些统计数字。 -### Read the docs +### 阅读文档 -Most Python modules have documentation, and even those that do not can be minimally documented by Python's Help function. [Pygame's main page][13] links to its documentation. However, Pygame is a big module with a lot of documentation, and its docs aren't exactly written in the same approachable (and friendly and elucidating and helpful) narrative style as articles on Opensource.com. They're technical documents, and they list each class and function available in the module, what kind of inputs each expects, and so on. If you're not comfortable referring to descriptions of code components, this can be overwhelming. +大多数 Python 模块都有文档,即使那些没有文档的模块,也能通过 Python 的帮助功能来进行最小化地文档化。[Pygame 的主页面][13] 链接到它的文档。不过,Pygame 是一个带有很多文档的大模块,并且它的文档不像在 Opensource.com 上的文章一样,以同样的易理解的(友好地,易解释地,有用地)叙述样式准确地编写。它们是技术文档,并且它们列出在模块中可用的每个类和函数,每个要求输入的类型等等。如果你不适应参考代码组件描述,这可能令人不知所措的。 -The first thing to do, before bothering with a library's documentation, is to think about what you are trying to achieve. In this case, you want to display the player's score and health on the screen. +在烦恼一个库的文档前,第一件要做的事,就是来想想你正在尝试达到的目标。在这种情况下,你想在屏幕上显示玩家的得分和健康状况。 -Once you've determined your desired outcome, think about what components are required for it. You can think of this in terms of variables and functions or, if that doesn't come naturally to you yet, you can think generically. You probably recognize that displaying a score requires some text, which you want Pygame to draw on the screen. If you think it through, you might realize that it's not very different from rendering a player or loot or a platform on screen. +在你确定你需要的结果后,想想它需要什么的组件。你可以从变量和函数的方面考虑这一点,或者,如果你还没有自然地想到这一点,你可以考虑一般情况。你可能意识到需要一些文本来显示一个分数,你希望 Pygame 在屏幕上绘制这些文本。如果你彻头彻尾地思考,你可能会意识到它与在屏幕上渲染一个玩家或奖励或一个平台并多么大的不同。 -Technically, you _could_ use graphics of numbers and have Pygame display those. It's not the easiest way to achieve your goal, but if it's the only way you know, then it's a valid way. However, if you refer to Pygame's docs, you see that one of the modules listed is **font**, which is Pygame's method for making printing text on the screen as easy as typing. +从技术上讲,你 _可以_ 使用数字图形,并让 Pygame 显示这些数字图形。它不是达到你目标的最容易的方法,但是如果它是你唯一知道的方法,那么它是一个有效的方法。不过,如果你参考 Pygame 的文档,你看到列出的模块之一是 **font** ,这是 Pygame 使得在屏幕上来使打印文本像输入文字一样容易的方法。 -### Deciphering technical documentation +### 解密技术文档 -The **font** documentation page starts with **pygame.font.init()**, which it lists as the function that is used to initialize the font module. It's called automatically by **pygame.init()**, which you already call in your code. Once again, you've reached a point that that's technically _good enough_. While you don't know _how_ yet, you know that you _can_ use the **pygame.font** functions to print text on the screen. +**font** 文档页面以 **pygame.font.init()** 开始,它被列为用于初始化字体模块的函数。它由 **pygame.init()** 自动地调用,你已经在代码中调用了它。再强调一次,点,从技术上讲,你已经到达一个 _足够好_ 的点。虽然你尚不知道 _如何做_ ,你知道你 _能够_ 使用 **pygame.font** 函数来在屏幕上打印文本。 -If you read further, however, you find that there's yet an even better way to print fonts. The **pygame.freetype** module is described in the docs this way: +然而,如果你阅读更多一些,你会找到这里还有一种更好的方法来打印字体。**pygame.freetype** 模块被以这种方式描述在文档中: -> The pygame.freetype module is a replacement for pygame.fontpygame module for loading and rendering fonts. It has all of the functionality of the original, plus many new features. +> pygame.freetype 模块是 pygame.fontpygame 模块的一个替代品,用于加载和渲染字体。它有原函数的所有功能,外加很多新的功能。 -Further down the **pygame.freetype** documentation page, there's some sample code: +向下进一步到 **pygame.freetype** 文档页面,这里有一些样本代码: ``` @@ -64,7 +64,7 @@ import pygame import pygame.freetype ``` -Your code already imports Pygame, but modify your **import** statements to include the Freetype module: +你的代码应该导入 Pygame ,尽管如此,修改你的 **import** 语句以包含 Freetype 模块: ``` @@ -74,34 +74,34 @@ import os import pygame.freetype ``` -### Using a font in Pygame +### 在 Pygame 中使用一种字体 -From the description of the font modules, it's clear that Pygame uses a font, whether it's one you provide or a default font built into Pygame, to render text on the screen. Scroll through the **pygame.freetype** documentation to find the **pygame.freetype.Font** function: +从字体模块的描述开始,使用一种字体是很明显是,不管它的你提供的或内置到 Pygame 的默认字体,我在屏幕上渲染字体。滚动 **pygame.freetype** 文档来找到 **pygame.freetype.Font** 函数: ``` pygame.freetype.Font -Create a new Font instance from a supported font file. +从支持的字体文件中创建一个新的字体实例。 -Font(file, size=0, font_index=0, resolution=0, ucs4=False) -> Font +Font(file, size=0, font_index=0, resolution=0, ucs4=False) -> Font pygame.freetype.Font.name -  Proper font name. +  符合规则的字体名称。 pygame.freetype.Font.path -  Font file path +  字体文件路径。 pygame.freetype.Font.size -  The default point size used in rendering +  在渲染中使用的默认点大小 ``` -This describes how to construct a font "object" in Pygame. It may not feel natural to you to think of a simple object onscreen as the combination of several code attributes, but it's very similar to how you built your hero and enemy sprites. Instead of an image file, you need a font file. Once you have a font file, you can create a font object in your code with the **pygame.freetype.Font** function and then use that object to render text on the screen. +这描述了如何在 Pygame 中构建一个字体"对象"。你可能不太自然能把屏幕上的一个简单的对象考虑为一些代码属性的组合,但是它非常类似于你如何构建你的英雄和敌人精灵。你需要一个字体文件,而不是一个图像文件。在你有一个字体文件后,你可以在你的代码中使用 **pygame.freetype.Font** 函数来创建一个字体对象,然后使用该对象来在屏幕上渲染文本。 -Because not everyone in the world has the exact same fonts on their computers, it's important to bundle your chosen font with your game. To bundle a font, first create a new directory in your game folder, right along with the directory you created for your images. Call it **fonts**. +因为并不是世界上的每个人的电脑上都有完全一样的字体,将你选择的字体与你的游戏绑定在一起是很重要的。为绑定一种字体,首先在你的游戏文件夹中创建一个新的目录,恰好跟你为图像而创建的文件目录在一起。 称其为 **fonts** 。 -Even though several fonts come with your computer, it's not legal to give those fonts away. It seems strange, but that's how the law works. If you want to ship a font with your game, you must find an open source or Creative Commons font that permits you to give the font away along with your game. +虽然一些字体是随你的计算机操作系统一起提供,但是将这些字体给予其他人是非法的。这看起来很奇怪,但法律就是这样运作的。如果想与你的游戏一起随附一种字体,你必需找到一种开放源码或知识共享字体,它允许与你的游戏一起提供字体。 -Sites that specialize in free and legal fonts include: +专门提供自由和合法字体的网站包括: * [Font Library][14] * [Font Squirrel][15] @@ -109,20 +109,20 @@ Sites that specialize in free and legal fonts include: -When you find a font that you like, download it. Extract the ZIP or [TAR][17] file and move the **.ttf** or **.otf** file into the **fonts** folder in your game project directory. +当你找到你喜欢是字体后,下载下来。解压缩 ZIP 或 [TAR][17] 文件,并移动 **.ttf** 或 **.otf** 文件到你一下项目目录下的 **fonts** 文件夹中。 -You aren't installing the font on your computer. You're just placing it in your game's **fonts** folder so that Pygame can use it. You _can_ install the font on your computer if you want, but it's not necessary. The important thing is to have it in your game directory, so Pygame can "trace" it onto the screen. +你没有安装字体到你的计算机上。你只是放置字体到你游戏的 **fonts** 文件夹中,以便 Pygame 可以使用它。如果你想,你 _可以_ 在你的计算机上安装字体,但是它是没有必要的。重要的是字体在你的游戏目录中,这样 Pygame 可以 "描绘" 字体到屏幕上。 -If the font file has a complicated name with spaces or special characters, just rename it. The filename is completely arbitrary, and the simpler it is, the easier it is for you to type into your code. +如果字体有一个使用空格或特殊字符的复杂名称,只需要重新命名它。文件名称是完全任意的,并且对你来说,文件名称越简单,越任意将其键入你的代码中。 -Now tell Pygame about your font. From the documentation, you know that you'll get a font object in return when you provide at least the path to a font file to **pygame.freetype.Font** (the docs state explicitly that all remaining attributes are optional): +现在告诉 Pygame 关于你的字体。从文档中,你知道,当你至少提供一种字体文件的路径到 **pygame.freetype.Font** 时,你将在返回中获得一个字体对象(文档讲明所有剩余的属性都是可选的): ``` `Font(file, size=0, font_index=0, resolution=0, ucs4=False) -> Font` ``` -Create a new variable called **myfont** to serve as your font in the game, and place the results of the **Font** function into that variable. This example uses the **amazdoom.ttf** font, but you can use whatever font you want. Place this code in your Setup section: +创建一个称为 **myfont** 的新变量来充当你在游戏中字体,并放置 **Font** 函数的结果到这个变量中。这个示例使用 **amazdoom.ttf** 字体,但是你可以使用任何你想使用的字体。在你的 Setup 部分放置这些代码: ``` @@ -131,11 +131,11 @@ font_size = tx myfont = pygame.freetype.Font(font_path, font_size) ``` -### Displaying text in Pygame +### 在 Pygame 中显示文本 -Now that you've created a font object, you need a function to draw the text you want onto the screen. This is the same principle you used to draw the background and platforms in your game. +现在你已经创建一个字体对象,你需要一个函数来绘制你想绘制到屏幕上的文本。这和你在你的游戏中绘制背景和平台是相同的原理。 -First, create a function, and use the **myfont** object to create some text, setting the color to some RGB value. This must be a global function; it does not belong to any specific class: +首先,创建一个函数,并使用 **myfont** 对象来创建一些文本,设置颜色到一些 RGB 值。这必需是一个全局函数;它不属于任何具体的类: ``` @@ -144,7 +144,7 @@ def stats(score,health):     myfont.render_to(world, (4, 72), "Health:"+str(health), WHITE, None, size=64) ``` -Of course, you know by now that nothing happens in your game if it's not in the Main loop, so add a call to your **stats** function near the bottom of the file: +当然,你此刻已经知道,如果它不在主循环中,你的游戏将不会发生任何事,所以在文件的底部房间添加一个调用到你的 **stats** 函数: ``` @@ -154,21 +154,21 @@ Of course, you know by now that nothing happens in your game if it's not in the     pygame.display.flip() ``` -Try your game. +尝试你的游戏。 -When the player collects loot, the score goes up. When the player gets hit by an enemy, health goes down. Success! +当玩家收集奖励品时,得分上升。当玩家被敌人击中时,健康值下降。成功! ![Keeping score in Pygame][18] -There is one problem, though. When a player gets hit by an enemy, health goes _way_ down, and that's not fair. You have just discovered a non-fatal bug. Non-fatal bugs are those little problems in applications that don't keep the application from starting up or even from working (mostly), but they either don't make sense, or they annoy the user. Here's how to fix this one. +不过,这里有一个问题。当一个玩家被敌人击中时,健康度会 _大量_ 下降,这是不公平的。你刚刚发现一个非致命的错误。非致命的错误是这些在应用程序中小问题,(通常)不要延迟应用程序启动,或者甚至停止工作,但是它们两者要么讲不通,要么惹恼用户。这里是如何解决这个问题的方法。 -### Fixing the health counter +### 修复健康度计数 -The problem with the current health point system is that health is subtracted for every tick of the Pygame clock that the enemy is touching the player. That means that a slow-moving enemy can take a player down to –200 health in just one encounter, and that's not fair. You could, of course, just give your player a starting health score of 10,000 and not worry about it; that would work, and possibly no one would mind. But there is a better way. +当前健康度点系统的问题是,敌人接触玩家时,Pygame 时钟的每一次滴答,健康度都会减少。这意味着一个缓慢移动的敌人可能在一次遭遇中将一个玩家降低健康度至 -200 ,这不公平。当然,你可以给你的玩家一个 10000 的起始健康度得分,而不用担心它;这可以工作,并且可能没有人会注意。但是这里有一个更好的方法。 -Currently, your code detects when a player and an enemy collide. The fix for the health-point problem is to detect _two_ separate events: when the player and enemy collide and, once they have collided, when they _stop_ colliding. +当前,你的代码侦查出一个玩家和一个敌人碰撞的时候。健康度点问题的修复是侦查出 _两个_ 独立的事件:什么时候玩家和敌人碰撞,并且,在它们碰撞后,什么时候它们 _停止_ 碰撞。 -First, in your Player class, create a variable to represent when a player and enemy have collided: +首先,在你的玩家类中,创建一个变量来显示一个玩家和敌人碰撞在一起的时间: ``` @@ -177,7 +177,7 @@ First, in your Player class, create a variable to represent when a player and en         self.damage = 0 ``` -In the update function of your Player class, _remove_ this block of code: +在你的玩家类的更新函数中, _移除_ 这块代码块: ``` @@ -186,7 +186,7 @@ In the update function of your Player class, _remove_ this block of code:             #print(self.health) ``` -And in its place, check for collision as long as the player is not currently being hit: +并且在它的位置,只要玩家当前没有被击中,检查碰撞: ``` @@ -196,15 +196,15 @@ And in its place, check for collision as long as the player is not currently bei                     self.damage = self.rect.colliderect(enemy) ``` -You might see similarities between the block you deleted and the one you just added. They're both doing the same job, but the new code is more complex. Most importantly, the new code runs only if the player is not _currently_ being hit. That means that this code runs once when a player and enemy collide and not constantly for as long as the collision happens, the way it used to. +你可能会在你删除的语句块和你刚刚添加的语句块之间看到相似之处。它们都在做相同的工作,但是新的代码更复杂。最重要的是,只有当玩家 _当前_ 没有被击中时,新的代码运行。这意味着,当一个玩家和敌人碰撞时,这些代码运行一次,而不是像以前那样一直发生碰撞。 -The new code uses two new Pygame functions. The **self.rect.contains** function checks to see if an enemy is currently within the player's bounding box, and **self.rect.colliderect** sets your new **self.damage** variable to one when it is true, no matter how many times it is true. +新的代码使用两个新的 Pygame 函数。**self.rect.contains** 函数检查一个敌人当前是否在玩家的边界框内,并且当它是 true 时, **self.rect.colliderect** 设置你的新的 **self.damage** 变量为 1 ,而不管它多少次是 true 。 -Now even three seconds of getting hit by an enemy still looks like one hit to Pygame. +现在,即使被一个敌人击中 3 秒,对 Pygame 来说仍然看作一次击中。 -I discovered these functions by reading through Pygame's documentation. You don't have to read all the docs at once, and you don't have to read every word of each function. However, it's important to spend time with the documentation of a new library or module that you're using; otherwise, you run a high risk of reinventing the wheel. Don't spend an afternoon trying to hack together a solution to something that's already been solved by the framework you're using. Read the docs, find the functions, and benefit from the work of others! +我通过通读 Pygame 的文档而发现这些函数。你没有必要一次阅读完全部的文档,并且你也没有必要阅读每个函数的每个单词。不过,花费时间在你正在使用的新的库或模块的文档上是很重要的;否则,你将面临重新发明轮子的高风险。不要花费一个下午的时间来尝试修改拼接一个解决方案到一些东西,这些东西已经被你正在使用的框架的所解决。阅读文档,知悉函数,并从别人的工作中获益! -Finally, add another block of code to detect when the player and the enemy are no longer touching. Then and only then, subtract one point of health from the player. +最后,添加另一个代码语句块来侦查出什么时候玩家和敌人不再接触。只要那时,从玩家减少一点健康度点。 ``` @@ -215,19 +215,19 @@ Finally, add another block of code to detect when the player and the enemy are n                 self.health -= 1  # subtract 1 hp ``` -Notice that this new code gets triggered _only_ if the player has been hit. That means this code doesn't run while your player is running around your game world exploring or collecting loot. It only runs when the **self.damage** variable gets activated. +注意,_只有_ 当玩家被击中时,这个新的代码才会被触发。这意味着,在你的玩家在你的游戏世界正在探索或收集奖励时,这个代码不会运行。它仅当 **self.damage** 变量被激活时运行。 -When the code runs, it uses **self.rect.collidelist** to see whether or not the player is _still_ touching an enemy in your enemy list (**collidelist** returns negative one when it detects no collision). Once it is not touching an enemy, it's time to pay the **self.damage** debt: deactivate the **self.damage** variable by setting it back to zero and subtract one point of health. +当代码运行时,它使用 **self.rect.collidelist** 来查看玩家是否 _仍然_ 接触在你敌人列表中的一个敌人(当其未侦查到碰撞时,**collidelist** 返回 -1 )。在它没有接触一个敌人时,是来偿还 **self.damage** 负债的时机:通过设置 **self.damage** 变量回到 0 来使其无效,并减少一点健康度点。 -Try your game now. +现在尝试你的游戏。 -### Score reaction +### 得分反应 -Now that you have a way for your player to know their score and health, you can make certain events occur when your player reaches certain milestones. For instance, maybe there's a special loot item that restores some health points. And maybe a player who reaches zero health points has to start back at the beginning of a level. +现在,你有一个来让你的玩家知道它们分数和健康度的方法,当你的玩家达到某些里程碑时,你可以确保某些事件发生。例如,也许这里有一个特殊的恢复一些健康度点的奖励项目。也许一个到达 0 健康度点的玩家不得不从一个等级的起始位置重新开始。 -You can check for these events in your code and manipulate your game world accordingly. You already know how, so go skim the documentation for new tricks and try them out on your own. +你可以在你的代码中检查这些事件,并且相应地控制你的游戏世界。你也知道怎么做,所以去浏览文档来寻找新的技巧,并且独立地尝试这些技巧。 -Here's all the code so far: +这里是到目前为止所有的代码: ``` @@ -297,7 +297,7 @@ class Player(pygame.sprite.Sprite):     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty         @@ -317,16 +317,16 @@ class Player(pygame.sprite.Sprite):         self.rect.y = self.rect.y + self.movey         # moving left -        if self.movex < 0: +        if self.movex < 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani]         # moving right -        if self.movex > 0: +        if self.movex > 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] @@ -353,7 +353,7 @@ class Player(pygame.sprite.Sprite):         for p in plat_hit_list:             self.collide_delta = 0 # stop jumping             self.movey = 0 -            if self.rect.y > p.rect.y: +            if self.rect.y > p.rect.y:                 self.rect.y = p.rect.y+ty             else:                 self.rect.y = p.rect.y-ty @@ -363,11 +363,11 @@ class Player(pygame.sprite.Sprite):             self.movey = 0             self.rect.y = worldy-ty-ty             self.collide_delta = 0 # stop jumping -            if self.rect.y > g.rect.y: +            if self.rect.y > g.rect.y:                 self.health -=1                 print(self.health)                 -        if self.collide_delta < 6 and self.jump_delta < 6: +        if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2             self.movey -= 33  # how high to jump             self.collide_delta += 6 @@ -398,22 +398,22 @@ class Enemy(pygame.sprite.Sprite):         self.movey += 3.2         -        if self.counter >= 0 and self.counter <= distance: +        if self.counter >= 0 and self.counter <= distance:             self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: +        elif self.counter >= distance and self.counter <= distance*2:             self.rect.x -= speed         else:             self.counter = 0                 self.counter += 1 -        if not self.rect.y >= worldy-ty-ty: +        if not self.rect.y >= worldy-ty-ty:             self.rect.y += self.movey         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False)         for p in plat_hit_list:             self.movey = 0 -            if self.rect.y > p.rect.y: +            if self.rect.y > p.rect.y:                 self.rect.y = p.rect.y+ty             else:                 self.rect.y = p.rect.y-ty @@ -450,7 +450,7 @@ class Level():         ground_list = pygame.sprite.Group()         i=0         if lvl == 1: -            while i < len(gloc): +            while i < len(gloc):                 ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png')                 ground_list.add(ground)                 i=i+1 @@ -469,9 +469,9 @@ class Level():             ploc.append((300,worldy-ty-256,3))             ploc.append((500,worldy-ty-128,4)) -            while i < len(ploc): +            while i < len(ploc):                 j=0 -                while j <= ploc[i][2]: +                while j <= ploc[i][2]:                     plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png')                     plat_list.add(plat)                     j=j+1 @@ -528,7 +528,7 @@ font_size = tx myfont = pygame.freetype.Font(font_path, font_size)     i=0 -while i <= (worldx/tx)+tx: +while i <= (worldx/tx)+tx:     gloc.append(i*tx)     i=i+1 @@ -570,7 +570,7 @@ while main == True:                 main = False     # scroll the world forward -    if player.rect.x >= forwardx: +    if player.rect.x >= forwardx:         scroll = player.rect.x - forwardx         player.rect.x = forwardx         for p in plat_list: @@ -582,7 +582,7 @@ while main == True:             l.rect.x -= scroll                     # scroll the world backward -    if player.rect.x <= backwardx: +    if player.rect.x >= backwardx:         scroll = backwardx - player.rect.x         player.rect.x = backwardx         for p in plat_list: @@ -613,7 +613,7 @@ via: https://opensource.com/article/20/1/add-scorekeeping-your-python-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[robsean](https://github.com/robsean) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -638,3 +638,4 @@ via: https://opensource.com/article/20/1/add-scorekeeping-your-python-game [16]: https://www.theleagueofmoveabletype.com/ [17]: https://opensource.com/article/17/7/how-unzip-targz-file [18]: https://opensource.com/sites/default/files/uploads/pygame-score.jpg (Keeping score in Pygame) +[19]:https://opensource.com/article/18/7/put-platforms-python-game From d22b605d1b67f7446cb823dbd1baad7f99a074a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 24 Jan 2020 11:03:37 +0800 Subject: [PATCH 0393/3057] Translating --- ...nable your Python game player to run forward and backward.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191211 Enable your Python game player to run forward and backward.md b/sources/tech/20191211 Enable your Python game player to run forward and backward.md index fb9b020278..bde74f1526 100644 --- a/sources/tech/20191211 Enable your Python game player to run forward and backward.md +++ b/sources/tech/20191211 Enable your Python game player to run forward and backward.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9b360278ecb3a267a217a68f592bfa48a4de3af1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 25 Jan 2020 00:52:40 +0800 Subject: [PATCH 0394/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200124=20Thun?= =?UTF-8?q?derbolt=20=E2=80=93=20how=20to=20use=20keyboard=20during=20boot?= =?UTF-8?q?=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200124 Thunderbolt - how to use keyboard during boot time.md --- ... - how to use keyboard during boot time.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/tech/20200124 Thunderbolt - how to use keyboard during boot time.md diff --git a/sources/tech/20200124 Thunderbolt - how to use keyboard during boot time.md b/sources/tech/20200124 Thunderbolt - how to use keyboard during boot time.md new file mode 100644 index 0000000000..d8fc2ae581 --- /dev/null +++ b/sources/tech/20200124 Thunderbolt - how to use keyboard during boot time.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Thunderbolt – how to use keyboard during boot time) +[#]: via: (https://fedoramagazine.org/thunderbolt-how-to-use-keyboard-during-boot-time/) +[#]: author: (Martin Sehnoutka https://fedoramagazine.org/author/msehnout/) + +Thunderbolt – how to use keyboard during boot time +====== + +![][1] + +### Problem statement + +Imagine you bought a new laptop with a shiny new USB-C docking station. You install fresh Fedora, encrypt your hard drive because laptop is a travel equipment and you do not want to travel around with non-ecrypted hard drive. You finish the installation, close the lid because you have external monitor, reboot the machine, and finally you would like to enter the LUKS password using the external keyboard attached using USB 2.0 to the USB-C docking station but it does not work! + +The keyboard does not respond at all. So you open the lid, try the built-in keyboard which works just fine and once the machine boots the external keyboard works just fine as well. What is the problem? + +### What is this Thunderbolt anyway and why would anyone want it? + +Thunderbolt is a hardware interface to connect peripherals such as monitors, external network cards [1] or even graphic cards [1]. The physical connector is the same as USB-C, but there is usually a label with a little lightning right next to the port to differentiate “plain” USB-C from Thunderbolt ports. + +![][2] + +Of course it comes with very high transmission speed to support such demanding peripherals, but it also comes with a certain security risks. To achieve transmission speed like this, Thunderbolt uses Direct Memory Access (DMA) for the peripheral devices. As the name suggests, this method allows the external device to read and write memory directly without talking to the running operating system. + +I guess you can already spot the problem here. If some stranger is walking around my laptop (even with the screen locked), is it really possible to just attach a device and read content of my computer memory? Let’s discuss it in more detail. + +### User facing solution for Thunderbolt security + +In the recent versions, Gnome settings include a tab for Thunderbolt device configuration. You can enable and disable DMA access for external devices and you can also verify identity of the devices. + +![][3] + +_bolt_ is the component responsible for managing thunderbolt devices. See _man 8 boltd_ for more information. + +### CLI tools + +Of course it is possible to control the same via command line. I suggest you to read _man boltctl_ or check the upstream repository directly: + +### Pre-boot support – solution to the keyboard problem + +In pre-boot environment, the situation is slightly different. The userspace service responsible for device verification is not yet running so if a device is to be allowed, the firmware must to it. In order to enable this feature go to your BIOS and look for “support in pre boot environment”. For example this is how it looks on a Lenovo laptop: + +![][4] + +Once you enable this feature, bolt will add any verified device to a list of allowed devices. The next time you boot your machine, you should be able to use your external keyboard. + +Run _boltctl_ a look for “bootacl”. Make sure that the list of allowed devices contains the one you wish to use. + +![][5] + +Also note the “security: secure” line. If you see anything else, for instance “security: user” I recommend to reconfigure BIOS. + +### Technical details of the pre-boot support + +There is one unfortunate technical detail about this solution. Thunderbolt support different security levels. For running Fedora, I recommend you to use “secure” level to verify that the device is indeed the one that it claims to be by using a per-device key generated by the host and stored in the device. Firmware, on the other hand, will only use “user” level which uses simple UUID that is provided by the device. The difference is that a malicious device could claim to be a different one by providing the same UUID as a legitimate one. Anyway this should not be a problem as the memory does not contain any sensitive data yet. + +You can find more technical details in this blog post: + +### Conclusion + +As you can see, in recent enough Fedora version the solution is a simple switch in BIOS. So if you are still opening your laptop during boot, go ahead and configure it so you don’t have to do it next time. Meanwhile **check that the default security level is “secure”** instead of “user” [5]. + +### Sources: + +[1] + +[2] + +[3] + +[4] + +[5] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/thunderbolt-how-to-use-keyboard-during-boot-time/ + +作者:[Martin Sehnoutka][a] +选题:[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/msehnout/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/header-816x345.png +[2]: https://fedoramagazine.org/wp-content/uploads/2020/01/port-1024x165.jpg +[3]: https://fedoramagazine.org/wp-content/uploads/2020/01/Screenshot-from-2020-01-17-12-47-30.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/01/bios-1024x389.jpg +[5]: https://fedoramagazine.org/wp-content/uploads/2020/01/Screenshot-from-2020-01-17-13-18-21.png From ec5e2394feaa73597986d6bd75d504e640cea35b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 25 Jan 2020 00:56:20 +0800 Subject: [PATCH 0395/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200125=20Oh,?= =?UTF-8?q?=20Bummer!=20Rocket=20League=20is=20Ending=20Support=20For=20Li?= =?UTF-8?q?nux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200125 Oh, Bummer- Rocket League is Ending Support For Linux.md --- ...cket League is Ending Support For Linux.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20200125 Oh, Bummer- Rocket League is Ending Support For Linux.md diff --git a/sources/tech/20200125 Oh, Bummer- Rocket League is Ending Support For Linux.md b/sources/tech/20200125 Oh, Bummer- Rocket League is Ending Support For Linux.md new file mode 100644 index 0000000000..ab18ff6d7a --- /dev/null +++ b/sources/tech/20200125 Oh, Bummer- Rocket League is Ending Support For Linux.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Oh, Bummer! Rocket League is Ending Support For Linux) +[#]: via: (https://itsfoss.com/rocket-league-ending-support-for-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Oh, Bummer! Rocket League is Ending Support For Linux +====== + +If you’ve enjoyed playing Rocket League on Linux, you will be disappointed to know that [Pysonix][1], the developer team behind Rocket League [announced][2] that they will be dropping support for Linux and Mac in March, 2020. + +If it was just another casual game on [Steam][3], I wouldn’t mind- but Rocket League is a quite popular online multiplayer game across every platform. + +![][4] + +In fact, Rocket League was one of my [favorite games to play on Linux][5] (in addition to CS: GO). Even though I haven’t played it for a while – it is a bummer that I won’t be able to play it either. + +So, this is definitely sad for Linux gamers who were looking forward to having fun in a popular online multiplayer game that required a decent hardware configuration to work flawlessly. + +### Why are they ending support? + +![][6] + +In their [announcement][2], they mentioned: + +> As we continue to upgrade _**Rocket League**_ with new technologies, it is no longer viable for us to maintain support for the macOS and Linux (SteamOS) platforms. As a result, the final patch for the macOS and Linux versions of the game will be in March. This update will disable online functionality (such as in-game purchases) for players on macOS and Linux, but offline features including Local Matches, and splitscreen play will still be accessible. + +Well, this certainly does not explain why they’re dropping support for Linux/Mac. But, it looks like the game will get its final patches in March. + +**After that, you will not be able to play multiplayer sessions – but will be restricted to the local multiplayer sessions (or split-screen)**. + +Maybe you can try using [Wine][7] or [Steam Play][8] to play it on Linux? Doesn’t sound good though. + +Some furious users/gamers on [Reddit][9] mentioned that this is a result of Epic Games acquiring Rocket League developer **Psyonix**. I wouldn’t comment on that one – feel free to share your thoughts in the comments though. + +### How to get a refund for your Rocket League purchase + +![][10] + +To get a refund for your purchase of the Rocket League, you need to open a ticket on the [Psyonix Support][11] page. + +If you’ve purchased it recently in the ongoing Steam sale – you might just get an instant refund from Steam if you initiate a refund. + +If you have no plans to play it on a Windows machine (or trying Proton/Wine) on Linux – you should apply for a refund. + +**Wrapping Up** + +While this may not be a big-shot game for the platform but dropping support for Linux is not helping to improve the gaming scene on Linux. + +If a game that worked quite well on Linux drops support for it – how can we expect newer games to consider adding support for Linux? + +Feel free to share your thoughts in the comments down below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/rocket-league-ending-support-for-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://www.psyonix.com/ +[2]: https://www.rocketleague.com/news/ending-support-for-mac-and-linux/ +[3]: https://store.steampowered.com/app/252950/Rocket_League/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/rocket-league.jpg?ssl=1 +[5]: https://itsfoss.com/free-linux-games/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/rocket-league-shot.jpg?ssl=1 +[7]: https://itsfoss.com/use-windows-applications-linux/ +[8]: https://itsfoss.com/steam-play/ +[9]: https://www.reddit.com/r/linux/comments/esxil2/support_for_rocket_league_on_linux_is_ending/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/rocket-league-refund.jpg?ssl=1 +[11]: https://support.rocketleague.com/hc/en-us From 2c84e1cbe77f553d86707d5fd0b035b933faf1db Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 25 Jan 2020 00:56:40 +0800 Subject: [PATCH 0396/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200124=20Run?= =?UTF-8?q?=20multiple=20consoles=20at=20once=20with=20this=20open=20sourc?= =?UTF-8?q?e=20window=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200124 Run multiple consoles at once with this open source window environment.md --- ...ith this open source window environment.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20200124 Run multiple consoles at once with this open source window environment.md diff --git a/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md b/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md new file mode 100644 index 0000000000..97c2849b60 --- /dev/null +++ b/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run multiple consoles at once with this open source window environment) +[#]: via: (https://opensource.com/article/20/1/multiple-consoles-twin) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Run multiple consoles at once with this open source window environment +====== +Simulate the old-school DESQview experience with twin in the fourteenth +in our series on 20 ways to be more productive with open source in 2020. +![Digital creative of a browser on the internet][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Overcome "one screen, one app" limits with twin + +Who remembers [DESQview][2]? It allowed for things in DOS we take for granted now in Windows, Linux, and MacOS—namely the ability to run and have multiple programs running onscreen at once. In my early days running a dial-up BBS, DESQview was a necessity—it enabled me to have the BBS running in the background while doing other things in the foreground. For example, I could be working on new features or setting up new external programs while someone was dialed in without impacting their experience. Later, in my early days in support, I could have my work email ([DaVinci email on MHS][3]), the support ticket system, and other DOS programs running all at once. It was amazing! + +![twin][4] + +Running multiple console applications has come a long way since then. But applications like [tmux][5] and [Screen][6] still follow the "one screen, one app" kind of display. OK, yes, tmux has screen splitting and panes, but not like DESQview, with the ability to "float" windows over others, and I, for one, miss that. + +Enter [twin][7], the text-mode window environment. This relatively young project is, in my opinion, a spiritual successor to DESQview. It supports console and graphical environments, as well as the ability to detach from and reattach to sessions. It's not as easy to set up as some things, but it will run on most modern operating systems. + +Twin is installed from source (for now). But first, you need to install the required development libraries. The library names will vary by operating system. The following example shows it for my Ubuntu 19.10 installation. Once the libraries are installed, check out the twin source from Git and run **./configure** and **make**, which should auto-detect everything and build twin: + + +``` +sudo apt install libx11-dev libxpm-dev libncurses-dev zlib1g-dev libgpm-dev +git clone [git@github.com][8]:cosmos72/twin.git +cd twin +./configure +make +sudo make install +``` + +Note: If you are compiling this on MacOS or BSD, you will need to comment out **#define socklen_t int** in the files **include/Tw/autoconf.h** and **include/twautoconf.h** before running **make**. This should be addressed by [twin issue number 57][9]. + +![twin text mode][10] + +Invoking twin for the first time can be a bit of a challenge. You need to tell it what kind of display it is using with the **\--hw** parameter. For example, to launch a text-mode version of twin, you would enter **twin --hw=tty,TERM=linux**. The **TERM** variable specifies an override to the current terminal variable in your shell. To launch a graphical version, run **twin --hw=X@$DISPLAY**. On Linux, twin mostly "just works," and on MacOS, it mostly only works in terminals. + +The _real_ fun comes with the ability to attach to running sessions with the **twattach** and **twdisplay** commands. They allow you to attach to a running twin session somewhere else. For example, on my Mac, I can run the following command to connect to the twin session running on my demo box: + + +``` +`twdisplay --twin@20days2020.local:0 --hw=tty,TERM=linux` +``` + +![remote twin session][11] + +With some extra work, you can also use it as a login shell in place of [getty][12] on consoles. This requires the gdm mouse daemon, the twdm application (included), and a little extra configuration. On systems that use systemd, start by installing and enabling gdm (if it isn't already installed). Then use systemctl to create an override for a console (I used tty6). The commands must be run as the root user; on Ubuntu, they look something like this: + + +``` +apt install gdm +systemctl enable gdm +systemctl start gdm +systemctl edit getty@tty6 +``` + +The **systemctl edit getty@tty6** command will open an empty file named **override.conf**. This defines systemd service settings to override the default for console 6. Update the contents to: + + +``` +[service] +ExecStart= +ExecStart=-/usr/local/sbin/twdm --hw=tty@/dev/tty6,TERM=linux +StandardInput=tty +StandardOutput=tty +``` + +Now, reload systemd and restart tty6 to get a twin login prompt: + + +``` +systemctl daemon-reload +systemctl restart getty@tty6 +``` + +![twin][13] + +This will launch a twin session for the user who logs in. I do not recommend this for a multi-user system, but it is pretty cool for a personal desktop. And, by using **twattach** and **twdisplay**, you can access that session from the local GUI or remote desktops. + +I think twin is pretty darn cool. It has some rough edges, but the basic functionality is there, and it has some pretty good documentation. Also, it scratches the itch I have for a DESQview-like experience on modern operating systems. I look forward to improvements over time, and I hope you like it as much as I do. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/multiple-consoles-twin + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://en.wikipedia.org/wiki/DESQview +[3]: https://en.wikipedia.org/wiki/Message_Handling_System +[4]: https://opensource.com/sites/default/files/uploads/productivity_14-1.png (twin) +[5]: https://github.com/tmux/tmux/wiki +[6]: https://www.gnu.org/software/screen/ +[7]: https://github.com/cosmos72/twin +[8]: mailto:git@github.com +[9]: https://github.com/cosmos72/twin/issues/57 +[10]: https://opensource.com/sites/default/files/uploads/productivity_14-2.png (twin text mode) +[11]: https://opensource.com/sites/default/files/uploads/productivity_14-3.png (remote twin session) +[12]: https://en.wikipedia.org/wiki/Getty_(Unix) +[13]: https://opensource.com/sites/default/files/uploads/productivity_14-4.png (twin) From 71e9c5a46c47046a5e318fceef29a6cac4b5d88e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 25 Jan 2020 00:57:11 +0800 Subject: [PATCH 0397/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200124=203=20?= =?UTF-8?q?handy=20command-line=20internet=20speed=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200124 3 handy command-line internet speed tests.md --- ...handy command-line internet speed tests.md | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 sources/tech/20200124 3 handy command-line internet speed tests.md diff --git a/sources/tech/20200124 3 handy command-line internet speed tests.md b/sources/tech/20200124 3 handy command-line internet speed tests.md new file mode 100644 index 0000000000..ed9bdee828 --- /dev/null +++ b/sources/tech/20200124 3 handy command-line internet speed tests.md @@ -0,0 +1,158 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 handy command-line internet speed tests) +[#]: via: (https://opensource.com/article/20/1/internet-speed-tests) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +3 handy command-line internet speed tests +====== +Check your internet and network speeds with these three open source +tools. +![Old train][1] + +Being able to validate your network connection speed puts you in control of your computer. Three open source tools that enable you to check your internet and network speeds at the command line are Speedtest, Fast, and iPerf. + +### Speedtest + +[Speedtest][2] is an old favorite. It's implemented in Python, packaged in Apt, and also available with pip. You can use it as a command-line tool or within a Python script. + +Install it with: + + +``` +`sudo apt install speedtest-cli` +``` + +or + + +``` +`sudo pip3 install speedtest-cli` +``` + +Then run it with the command **speedtest**: + + +``` +$ speedtest +Retrieving speedtest.net configuration... +Testing from CenturyLink (65.128.194.58)... +Retrieving speedtest.net server list... +Selecting best server based on ping... +Hosted by CenturyLink (Cambridge, UK) [20.49 km]: 31.566 ms +Testing download speed................................................................................ +Download: 68.62 Mbit/s +Testing upload speed...................................................................................................... +Upload: 10.93 Mbit/s +``` + +This gives you your download and upload Internet speeds. It's fast and scriptable, so you can run it regularly and save the output to a file or database for a record of your network speed over time. + +### Fast + +[Fast][3] is a service provided by Netflix. Its web interface is located at [Fast.com][4], and it has a command-line interface available through npm: + + +``` +`npm install --global fast-cli` +``` + +Both the website and command-line utility provide the same basic interface: it's a simple-as-possible speed test: + + +``` +$ fast + +     82 Mbps ↓ +``` + +The command returns your Internet download speed. To get your upload speed, use the **-u** flag: + + +``` +$ fast -u + +   ⠧ 80 Mbps ↓ / 8.2 Mbps ↑ +``` + +### iPerf + +[iPerf][5] is a great way to test your LAN speed (rather than your Internet speed, as the two previous tools do). Debian, Raspbian, and Ubuntu users can install it with **apt**: + + +``` +`sudo apt install iperf` +``` + +It's also available for Mac and Windows. + +Once it's installed, you need two machines on the same network to use it (both must have iPerf installed). Designate one as the server. + +Obtain the IP address of the server machine: + + +``` +`ip addr show | grep inet.*brd` +``` + +Your local IP address (assuming an IPv4 local network) starts with either **192.168** or **10**. Take note of the IP address so you can use it on the other machine (the one designated as the client). + +Start **iperf** on the server: + + +``` +`iperf -s` +``` + +This waits for incoming connections from clients. Designate another machine as a client and run this command, substituting the IP address of your server machine for the sample one here: + + +``` +`iperf -c 192.168.1.2` +``` + +![iPerf][6] + +It only takes a few seconds to do a test, and it returns the transfer size and calculated bandwidth. I ran a few tests from my PC and my laptop, using my home server as the server machine. I recently put in Cat6 Ethernet around my house, so I get up to 1Gbps speeds from my wired connections but much lower speeds on WiFi connections. + +![iPerf][7] + +­You may notice where it recorded 16Gbps. That was me using the server to test itself, so it's just testing how fast it can write to its own disk. The server has hard disk drives, which are only 16Gbps, but my desktop PC gets 46Gbps, and my (newer) laptop gets over 60Gbps, as they have solid-state drives. + +![iPerf][8] + +### Wrapping up + +Knowing the speed of your network is a rather straightforward task with these tools. If you prefer to script or run these from the command line for the fun of it, any of the above projects will get you there. If you're after specific point-to-point metrics, iPerf is your go-to. + +What other tools do you use to measure the network at home? Share in the comments. + +* * * + +_This article was originally published on Ben Nuttall's [Tooling blog][9] and is used here with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/internet-speed-tests + +作者:[Ben Nuttall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/train-plane-speed-big-machine.png?itok=f377dXKs (Old train) +[2]: https://github.com/sivel/speedtest-cli +[3]: https://github.com/sindresorhus/fast-cli +[4]: https://fast.com/ +[5]: https://iperf.fr/ +[6]: https://opensource.com/sites/default/files/uploads/iperf.png (iPerf) +[7]: https://opensource.com/sites/default/files/uploads/iperf2.png (iPerf) +[8]: https://opensource.com/sites/default/files/uploads/iperf3.png (iPerf) +[9]: https://tooling.bennuttall.com/command-line-speedtest-tools/ From 6d3e3b8c4914f97906463d45d790b43e8364c625 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 25 Jan 2020 00:57:46 +0800 Subject: [PATCH 0398/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200124=20Gart?= =?UTF-8?q?ner:=20Data-center=20spending=20will=20inch=20up=20this=20year?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200124 Gartner- Data-center spending will inch up this year.md --- ...-center spending will inch up this year.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/talk/20200124 Gartner- Data-center spending will inch up this year.md diff --git a/sources/talk/20200124 Gartner- Data-center spending will inch up this year.md b/sources/talk/20200124 Gartner- Data-center spending will inch up this year.md new file mode 100644 index 0000000000..03fbef5355 --- /dev/null +++ b/sources/talk/20200124 Gartner- Data-center spending will inch up this year.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Gartner: Data-center spending will inch up this year) +[#]: via: (https://www.networkworld.com/article/3515314/data-center-spending-will-inch-up-in-year-of-accelerated-it-investment-gartner.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Gartner: Data-center spending will inch up this year +====== +After a down year in 2019, IT spending will pick up this year, led by enterprise software and the cloud, according to IT research firm Gartner, including an uptick for data-center spending that had takend a dip. +Getty Images + +Global IT spending could reach $3.865 trillion in 2020, up 3.4% over 2019, according to newly released data from IT research firm Gartner. In comparison, 2019 saw just 0.5% growth over 2018 levels. Spending is expected to continue to climb into 2021, surpassing the $4 trillion mark with 3.7% growth. + +Spending on hardware – including edge devices and data center hardware – will be deemphasized, while investments in software and services, including cloud, will see an increase, the firm predicts. + +**READ MORE:** [Data centers in 2020 will feature greater automation, cheaper memory][1] + +"With the waning of global uncertainties, businesses are redoubling investments in IT as they anticipate revenue growth, but their spending patterns are continually shifting," said John-David Lovelock, distinguished research vice president at Gartner, in a statement. + +After a decline of 2.7% in 2019, data center systems sales will grow 1.9% in 2020, while devices – everything from laptops to printers to smartphones – will rise just 0.8% in 2020 after a 4.3% decline in 2019. + +IT services will rise 5.0%, increasing its momentum over 2019, which saw a rise of 3.6%. But the real action will be in enterprise software, which is expected to grow 10.5% this year. This includes both on-premises software (such as Microsoft, Oracle) and cloud services. More of the spending growth is aimed at SaaS than on-premises software, Gartner notes. + +"Almost all of the market segments with enterprise software are being driven by the adoption of software as a service (SaaS)," Lovelock said. "We even expect spending on forms of software that are not cloud to continue to grow, albeit at a slower rate. SaaS is gaining more of the new spending, although licensed-based software will still be purchased and its use expanded through 2023." + +In a conference call with clients, Lovelock said there has been a shift over the last three years, where the world is going from "'we like all tech' to 'we like softer tech and not all tech.'" The trend is toward consulting, software, and the cloud, the softest of tech. + +The weakest segment is mobile devices. It's not that people don’t want them any longer, but in the mobile device space there is no more must-have feature, nothing to make people line up for days in advance like we saw a decade ago with each new iPhone release. "People are happy with the devices they have. The market is down to a replacement market so they extend their spending," Lovelock said. + +In data center space, there's a similar pattern. Servers last longer, and at the same time, more work is being done outside the company at colocations and the cloud. + +"The cloud is taking a lot [of money] out of the data center," Lovelock said. "SaaS and IaaS are all viable for organizations but taking data center dollars. Where we keep saying software is growing most quickly, that’s very true. But recognize that it is also taking money from other areas. Budgets aren’t going up, concentrations in spending is where we are seeing things happen." + +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/3515314/data-center-spending-will-inch-up-in-year-of-accelerated-it-investment-gartner.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3487684/data-centers-in-2020-automation-cheaper-memory.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From 26de3be19f907b73d1da9f73b5edc321661b90bb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 25 Jan 2020 00:58:06 +0800 Subject: [PATCH 0399/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200124=20How?= =?UTF-8?q?=20Open-RAN=20could=20=E2=80=98white-box=E2=80=99=205G?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200124 How Open-RAN could ‘white-box- 5G.md --- ...00124 How Open-RAN could ‘white-box- 5G.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/talk/20200124 How Open-RAN could ‘white-box- 5G.md diff --git a/sources/talk/20200124 How Open-RAN could ‘white-box- 5G.md b/sources/talk/20200124 How Open-RAN could ‘white-box- 5G.md new file mode 100644 index 0000000000..c42a630540 --- /dev/null +++ b/sources/talk/20200124 How Open-RAN could ‘white-box- 5G.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Open-RAN could ‘white-box’ 5G) +[#]: via: (https://www.networkworld.com/article/3516075/how-open-ran-could-white-box-5g.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How Open-RAN could ‘white-box’ 5G +====== +Open-hardware, software-defined mobile radio infrastructure could kick-start private LTE and 5G and perhaps eventually lead to their supremacy over Wi-Fi for enterprises. +mrdoomits / Getty Images + +One of Britain’s principal mobile networks, O2, has just announced that it intends to deploy Open Radio Access Network technology (O-RAN) in places. + +O-RAN is a wireless industry initiative for designing and building radio network solutions using “a general-purpose, vendor-neutral hardware and software-defined technology,” explains Telecom Infra Project, the body responsible, on its website. + +TIP is the trade body that, along with Intel and Vodafone, conceived of the technology alternative – an attempt at toppling the dominance of Ericsson, Huawei and Nokia, which provide almost all mobile telco infrastructure now. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +O2 joins fellow UK mobile operator Vodafone, which is also experimenting with O-RAN. + +O2 is working with partners including; Mavenir, DenseAir and WaveMobile to introduce O-RAN solutions, [the Telefónica-owned network says in a press release][2]. + +What it means by that is that by encouraging less powerful, smaller vendors to provide infrastructure, the grip that Ericsson, Huawei and Nokia hold over mobile networks might be lessened. Costs could be reduced because those big three would have to reduce prices to remain competitive. + +But most interestingly, it also allows for the standardizing of telco infrastructure, possibly making future private mobile networks cheaper and easier to implement. Private LTE and 5G networks are expected to genearate $4.7 billion in revenue by the end of this year, [according to an SNS Telecom & IT report published in October][3]. That number is expected to be $8 billion by the end of 2023. + +**[ Don’t miss [customer reviews of top remote access tools][4] and see [the most powerful IoT companies][5] . | Get daily insights by [signing up for Network World newsletters][6]. ]** + +Indeed, white-box telco equipment might be the result. White-box IT hardware is used in enterprises, and could be advantageous in telco equipment, too. Conceivably, as telco equipment prices and availability became more within reach, along with the availability of new, unlicensed, shared spectrum, such as is being launched in the U.S. with Citizen Broadband Radio Service; then implementation of a an enterprise-level, private LTE or 5G network, with “white-box” hardware and programmable software-defined networks, may be one-day no harder than a Wi-Fi network install, common now. + +“By providing authority over wireless coverage and capacity, private LTE and 5G networks ensure guaranteed and secure connectivity, while supporting a wide range of applications,” SNS Telecom & IT says of private mobile networks in its report. Factory robotics and IoT sensor  networks will be driving that investment. LTE and 5G are being pitched as more reliable than Wi-Fi, in part because of less congestion. Private mobile networks can be provided by existing mobile-network operators or built independently. + +In the case of TIP’s O-RAN, the vision is for modular base stations with a software stack functioning on common, off-the-shelf hardware, called COTS. Field-programmable gate arrays (FPGAs) are also part of the concept. + +“Thus the main objective of this project is to have RAN solutions that benefit from the flexibility and pace of innovation associated with software-driven developments on fully programmable platforms,” [TIP said on its website][7] last year. The influence of Wi-Fi diminishes. + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3516075/how-open-ran-could-white-box-5g.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://news.o2.co.uk/press-release/o2-to-further-improve-network-service-for-customers-using-open-radio-access-network-ran-technology/ +[3]: https://www.snstelecom.com/private-lte +[4]: https://www.networkworld.com/article/3262145/lan-wan/customer-reviews-top-remote-access-tools.html#nww-fsb +[5]: https://www.networkworld.com/article/2287045/internet-of-things/wireless-153629-10-most-powerful-internet-of-things-companies.html#nww-fsb +[6]: https://www.networkworld.com/newsletters/signup.html#nww-fsb +[7]: https://telecominfraproject.com/tip-project-group-feature-openran/ +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From 26feddb86886d7c6f45a08a70b31734a51c31570 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 12:13:34 +0800 Subject: [PATCH 0400/3057] PRF @algzjh --- ...resources for agile software development.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20191229 The best resources for agile software development.md b/translated/tech/20191229 The best resources for agile software development.md index 1f467430c7..b45ff6ba14 100644 --- a/translated/tech/20191229 The best resources for agile software development.md +++ b/translated/tech/20191229 The best resources for agile software development.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (algzjh) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The best resources for agile software development) @@ -9,14 +9,16 @@ 敏捷软件开发的最佳资源 ====== -请阅读我们的热门文章,这些文章着重讨论了敏捷的过去、现在和未来。 -![Women programming][1] -对于 Opensource.com 上的敏捷主题来说,今年是非常棒的一年。随着 2019 年的临近,我们回顾了我们读者所读的与敏捷相关的热门文章。 +> 请阅读我们的热门文章,这些文章着重讨论了敏捷的过去、现在和未来。 + +![](https://img.linux.net.cn/data/attachment/album/202001/25/121308jrs4speu2y09u09e.jpg) + +对于 Opensource.com 上的敏捷主题来说,2019 年是非常棒的一年。随着 2020 年的到来,我们回顾了我们读者所读的与敏捷相关的热门文章。 ### 小规模 Scrum 指南 -Opensource.com 关于[小规模 Scrum][2] 的指南(我曾参与合著)由六部分组成,为小型团队提供了关于如何将敏捷引入到他们的工作中的建议。在官方的 [Scrum 指南][3] 的概述中,传统的 Scrum 框架推荐至少三个人来实现,以充分发挥其潜力。但是,它并没有为一两个人的团队如何成功遵循 Scrum 提供指导。我们的六部分系列旨在规范化小规模的 Scrum,并检验我们在现实世界中使用它的经验。该系列受到了读者的热烈欢迎,以至于这六篇文章占据了前 10 名文章的 60%。因此,如果你还没有阅读的话,一定要从我们的[小规模 Scrum 介绍页面][2]下载。 +Opensource.com 关于[小规模 Scrum][2] 的指南(我曾参与合著)由六部分组成,为小型团队提供了关于如何将敏捷引入到他们的工作中的建议。在官方的 [Scrum 指南][3]的概述中,传统的 Scrum 框架推荐至少三个人来实现,以充分发挥其潜力。但是,它并没有为一两个人的团队如何成功遵循 Scrum 提供指导。我们的六部分系列旨在规范化小规模的 Scrum,并检验我们在现实世界中使用它的经验。该系列受到了读者的热烈欢迎,以至于这六篇文章占据了前 10 名文章的 60%。因此,如果你还没有阅读的话,一定要从我们的[小规模 Scrum 介绍页面][2]下载。 ### 全面的敏捷项目管理指南 @@ -24,7 +26,7 @@ Opensource.com 关于[小规模 Scrum][2] 的指南(我曾参与合著)由 ### 成为出色的敏捷开发人员的 4 个步骤 -DevOps 文化已经出现在许多现代软件团队中,这些团队采用了敏捷软件开发原则,利用了最先进的工具和自动化技术。但是,这种机械的敏捷方法并不能保证开发人员在日常工作中遵循敏捷实践。Daniel Oh 在[《成为出色的敏捷开发人员的 4 个步骤》][5]中给出了一些很棒的技巧,通过关注设计思维,使用可预测的方法,以质量为中心并不断学习和探索来提高你的敏捷性。用你的敏捷工具补充这些方法将形成非常灵活和强大的敏捷开发人员。 +DevOps 文化已经出现在许多现代软件团队中,这些团队采用了敏捷软件开发原则,利用了最先进的工具和自动化技术。但是,这种机械的敏捷方法并不能保证开发人员在日常工作中遵循敏捷实践。Daniel Oh 在[成为出色的敏捷开发人员的 4 个步骤][5]中给出了一些很棒的技巧,通过关注设计思维,使用可预测的方法,以质量为中心并不断学习和探索来提高你的敏捷性。用你的敏捷工具补充这些方法将形成非常灵活和强大的敏捷开发人员。 ### Scrum 和 kanban:哪种敏捷框架更好? @@ -38,8 +40,6 @@ DevOps 文化已经出现在许多现代软件团队中,这些团队采用了 今年,Opensource.com 的作者围绕敏捷的过去、现在以及未来可能会是什么样子进行了大量的讨论。感谢他们所有人,请一定于 2020 年在这里分享[你自己的敏捷故事][9]。 -回顾一下 Opensource.com 在 2014 年和 2015 年报道的工具,以及新版本的更新,…… - -------------------------------------------------------------------------------- via: https://opensource.com/article/19/12/agile-resources @@ -47,7 +47,7 @@ via: https://opensource.com/article/19/12/agile-resources 作者:[Leigh Griffin][a] 选题:[lujun9972][b] 译者:[algzjh](https://github.com/algzjh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9db5898593f2d41c02015302d417fb3b6411a275 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 12:14:18 +0800 Subject: [PATCH 0401/3057] PUB @algzjh https://linux.cn/article-11816-1.html --- ...91229 The best resources for agile software development.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191229 The best resources for agile software development.md (98%) diff --git a/translated/tech/20191229 The best resources for agile software development.md b/published/20191229 The best resources for agile software development.md similarity index 98% rename from translated/tech/20191229 The best resources for agile software development.md rename to published/20191229 The best resources for agile software development.md index b45ff6ba14..7ffc566009 100644 --- a/translated/tech/20191229 The best resources for agile software development.md +++ b/published/20191229 The best resources for agile software development.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (algzjh) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11816-1.html) [#]: subject: (The best resources for agile software development) [#]: via: (https://opensource.com/article/19/12/agile-resources) [#]: author: (Leigh Griffin https://opensource.com/users/lgriffin) From b43dfbf33f7a46788d0ab88f3f57b280dca4d007 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 12:37:51 +0800 Subject: [PATCH 0402/3057] APL --- .../tech/20200119 What-s your favorite Linux terminal trick.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200119 What-s your favorite Linux terminal trick.md b/sources/tech/20200119 What-s your favorite Linux terminal trick.md index d830c65072..91f6de51a2 100644 --- a/sources/tech/20200119 What-s your favorite Linux terminal trick.md +++ b/sources/tech/20200119 What-s your favorite Linux terminal trick.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 983228bab57a144f46fc792a791457553deb6c61 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 13:48:44 +0800 Subject: [PATCH 0403/3057] TSL --- ...at-s your favorite Linux terminal trick.md | 86 ------------------- ...at-s your favorite Linux terminal trick.md | 57 ++++++++++++ 2 files changed, 57 insertions(+), 86 deletions(-) delete mode 100644 sources/tech/20200119 What-s your favorite Linux terminal trick.md create mode 100644 translated/tech/20200119 What-s your favorite Linux terminal trick.md diff --git a/sources/tech/20200119 What-s your favorite Linux terminal trick.md b/sources/tech/20200119 What-s your favorite Linux terminal trick.md deleted file mode 100644 index 91f6de51a2..0000000000 --- a/sources/tech/20200119 What-s your favorite Linux terminal trick.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What's your favorite Linux terminal trick?) -[#]: via: (https://opensource.com/article/20/1/linux-terminal-trick) -[#]: author: (Opensource.com https://opensource.com/users/admin) - -What's your favorite Linux terminal trick? -====== -Take our poll or tell us about your favorite terminal trick. Is it a -nifty productivity shortcut or a fun Easter egg? -![Terminal command prompt on orange background][1] - -The beginning of a new year is always a great time to evaluate new ways to become more efficient. Many people try out new productivity tools or figure out how to optimize their most mundane processes. One area to assess is the terminal. Especially in the world of open source, there are tons of ways to make life at the terminal more efficient (and fun!) with shortcuts and commands.  - -  - -We asked our writers about their favorite terminal trick. They shared their time-saving tips and even a fun terminal Easter egg. Will you adopt one of these keyboard shortcuts or command line hacks? Do you have a favorite you'd like to share? Tell us about it by taking our poll or leaving a comment.  - -  - -"I couldn't choose a favorite; I use all three of these daily:  - - * **Ctrl + L** to clear screen (instead of typing "clear"). - * **sudo !!** to run previous command with sudo privileges.  - * **grep -Ev '^#|^$' <file>** will display file content without comments or empty lines." - - - -—Mars Toktonaliev - -  - -"For me, if I'm in a terminal text editor and I want to make it go away so I can quickly do something else, I background it with **Ctrl + Z**, do whatever I need to do, and then bring it back with **fg**. I will also sometimes do the same thing with **top** or **htop.** I can background it, and bring it back anytime I want to check current performance. I don't see backgrounding and foregrounding done in the wild very often, and it can really enhance multitasking on the terminal." - -—Jay LaCroix - -  - -"Because I tend to do much of the same things at the terminal on a given day, two things are constants in my day: - - * **Ctrl + R** to reverse search my Bash history for a command that I have already run and wish to do so again - * Caret substitution is the best as I often do things like **sudo dnf** **search <package name>** then if I find a suitable package that way I then do **^search^install** to rerun the command replacing the search with install. - - - -Sure these things are basic but so time-saving for me." - -—Steve Morris - -  - -"My cool terminal trick isn't something I do in the terminal, but _which terminal_ I use. Sometimes I just want the feeling of using an Apple II, or an old amber-on-black terminal. That's when I fire up Cool Retro Term. Screenshots are on the [website][2]." - -—Jim Hall - -  - -"Probably **ssh -X** to run graphical programs on other machines. Copy/pasting (on some terminal emulators, like gnome-terminal) C-S c and C-S v. I'm not sure if this counts (as it goes graphical in the interesting part, but starts with **ssh**). Most recently I had a need to log in to another machine but have my kids be able to follow along on the bigger screen from my laptop. This [link][3] showed me something I'd never before seen: mirroring the active session from another computer screen on my laptop over the local network (x11vnc -desktop) and being able to control it from both machines at the same time." - -—Kyle R. Conway - -  - -"You can install **Install 'sl' $ sudo apt install sl** or **$ sudo dnf install sl**, and when the command **sl** is entered at the Bash prompt a text-based steam locomotive moves across the display." - -—Don Watkins - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/linux-terminal-trick - -作者:[Opensource.com][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/admin -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) -[2]: https://github.com/Swordfish90/cool-retro-term -[3]: https://elinux.org/Screen_Casting_on_a_Raspberry_Pi diff --git a/translated/tech/20200119 What-s your favorite Linux terminal trick.md b/translated/tech/20200119 What-s your favorite Linux terminal trick.md new file mode 100644 index 0000000000..fc6f0a8ae2 --- /dev/null +++ b/translated/tech/20200119 What-s your favorite Linux terminal trick.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's your favorite Linux terminal trick?) +[#]: via: (https://opensource.com/article/20/1/linux-terminal-trick) +[#]: author: (Opensource.com https://opensource.com/users/admin) + +你有什么喜欢的 Linux 终端技巧? +====== + +> 告诉我们你最喜欢的终端技巧,无论是提高生产率的快捷方式还是有趣的彩蛋。 + +![Terminal command prompt on orange background][1] + +新年伊始始终是评估提高效率的新方法的好时机。许多人尝试使用新的生产力工具,或者想找出如何优化其最常用的流程。终端是一个需要评估的领域,尤其是在开源世界中,有无数种方法可以通过快捷键和命令使终端上的生活更加高效(又有趣!)。 + +我们向作者们询问了他们最喜欢的终端技巧。他们分享了一些节省时间的技巧,甚至还有一个有趣的终端彩蛋。你会采用这些键盘快捷键或命令行技巧吗?你有喜欢分享的最爱吗?请发表评论来告诉我们。 + +“我找不出哪个是我最喜欢的;每天我都会使用这三个: + +* `Ctrl + L` 来清除屏幕(而不是键入 `clear`)。 +* `sudo !!` 以 `sudo` 特权运行先前的命令。 +* `grep -Ev '^#|^$' ` 将显示文件内容,不带注释或空行。” —Mars Toktonaliev + +“对我来说,如果我正在使用终端文本编辑器,并且希望将其丢开,以便可以快速执行其他操作,则可以使用 `Ctrl + Z` 将其放到后台,接着执行我需要做的一切,然后用 `fg` 将其带回前台。有时我也会对 `top` 或 `htop` 做同样的事情。我可以将其丢到后台,并在我想检查当前性能时随时将其带回前台。我不会将通常很快能完成的任务在前后台之间切换,它确实可以增强终端上的多任务处理能力。” —Jay LaCroix + +“我经常在某一天在终端中做很多相同的事情,有两件事是每天都不变的: + +* `Ctrl + R` 反向搜索我的 Bash 历史记录以查找我已经运行并且希望再次执行的命令。 +* 插入号(`^`)替换是最好的,因为我经常做诸如 `sudo dnf search ` 之类的事情,然后,如果我以这种方式找到合适的软件包,则执行 `^search^install` 来重新运行该命令,以 `install` 替换 `search`。 + +这些东西肯定是很基本的,但是对我来说却节省了时间。” —Steve Morris + +“我的炫酷终端技巧不是我在终端上执行的操作,而是我使用的终端。有时候我只是想要使用 Apple II 或旧式琥珀色终端的感觉,那我就启动了 Cool-Retro-Term。它的截屏可以在这个[网站][2]上找到。” —Jim Hall + +“可能是用 `ssh -X` 来在其他计算机上运行图形程序。(在某些终端仿真器上,例如 gnome-terminal)用 `C-S c` 和 `C-S v` 复制/粘贴。我不确定这是否有价值(因为它有趣的是以 ssh 启动的图形化)。最近,我需要登录另一台计算机,但是我的孩子们可以在笔记本电脑的大屏幕上看到它。这个[链接][3]向我展示了一些我从未见过的内容:通过局域网从我的笔记本电脑上镜像来自另一台计算机屏幕上的活动会话(`x11vnc -desktop`),并能够同时从两台计算机上进行控制。” —Kyle R. Conway + +“你可以安装 `sl`(`$ sudo apt install sl` 或 `$ sudo dnf install sl`),并且当在 Bash 中输入命令 `sl` 时,一个基于文本的蒸汽机车就会在显示屏上移动。” —Don Watkins + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/linux-terminal-trick + +作者:[Opensource.com][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/admin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) +[2]: https://github.com/Swordfish90/cool-retro-term +[3]: https://elinux.org/Screen_Casting_on_a_Raspberry_Pi From 57930a5094c5282267cdea32d9bf496b0a914cb7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 13:59:43 +0800 Subject: [PATCH 0404/3057] PRF @wxy --- .../20200119 What-s your favorite Linux terminal trick.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20200119 What-s your favorite Linux terminal trick.md b/translated/tech/20200119 What-s your favorite Linux terminal trick.md index fc6f0a8ae2..5acd642ad5 100644 --- a/translated/tech/20200119 What-s your favorite Linux terminal trick.md +++ b/translated/tech/20200119 What-s your favorite Linux terminal trick.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What's your favorite Linux terminal trick?) @@ -12,7 +12,7 @@ > 告诉我们你最喜欢的终端技巧,无论是提高生产率的快捷方式还是有趣的彩蛋。 -![Terminal command prompt on orange background][1] +![](https://img.linux.net.cn/data/attachment/album/202001/25/135858accxc70tfxuifxx1.jpg) 新年伊始始终是评估提高效率的新方法的好时机。许多人尝试使用新的生产力工具,或者想找出如何优化其最常用的流程。终端是一个需要评估的领域,尤其是在开源世界中,有无数种方法可以通过快捷键和命令使终端上的生活更加高效(又有趣!)。 @@ -46,7 +46,7 @@ via: https://opensource.com/article/20/1/linux-terminal-trick 作者:[Opensource.com][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6b88060a2ca2a553c173c52d76f3b12eefa296b1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 14:00:31 +0800 Subject: [PATCH 0405/3057] PUB @wxy https://linux.cn/article-11817-1.html --- .../20200119 What-s your favorite Linux terminal trick.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200119 What-s your favorite Linux terminal trick.md (98%) diff --git a/translated/tech/20200119 What-s your favorite Linux terminal trick.md b/published/20200119 What-s your favorite Linux terminal trick.md similarity index 98% rename from translated/tech/20200119 What-s your favorite Linux terminal trick.md rename to published/20200119 What-s your favorite Linux terminal trick.md index 5acd642ad5..675f36a935 100644 --- a/translated/tech/20200119 What-s your favorite Linux terminal trick.md +++ b/published/20200119 What-s your favorite Linux terminal trick.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11817-1.html) [#]: subject: (What's your favorite Linux terminal trick?) [#]: via: (https://opensource.com/article/20/1/linux-terminal-trick) [#]: author: (Opensource.com https://opensource.com/users/admin) From d52a68e3c20ae227f4cc62080fd77786b081f6ca Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 21:16:29 +0800 Subject: [PATCH 0406/3057] TSL @robsean --- ...game player to run forward and backward.md | 949 +++++++++--------- 1 file changed, 475 insertions(+), 474 deletions(-) rename {sources => translated}/tech/20191211 Enable your Python game player to run forward and backward.md (73%) diff --git a/sources/tech/20191211 Enable your Python game player to run forward and backward.md b/translated/tech/20191211 Enable your Python game player to run forward and backward.md similarity index 73% rename from sources/tech/20191211 Enable your Python game player to run forward and backward.md rename to translated/tech/20191211 Enable your Python game player to run forward and backward.md index bde74f1526..e55d24d051 100644 --- a/sources/tech/20191211 Enable your Python game player to run forward and backward.md +++ b/translated/tech/20191211 Enable your Python game player to run forward and backward.md @@ -1,474 +1,475 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Enable your Python game player to run forward and backward) -[#]: via: (https://opensource.com/article/19/12/python-platformer-game-run) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Enable your Python game player to run forward and backward -====== -Let your player run free by enabling the side-scroller effect in your -Python platformer using the Pygame module. -![Gaming artifacts with joystick, GameBoy, paddle][1] - -This is part 8 in an ongoing series about creating video games in Python 3 using the Pygame module. Previous articles are: - - * [Learn how to program in Python by building a simple dice game][2] - * [Build a game framework with Python using the Pygame module][3] - * [How to add a player to your Python game][4] - * [Using Pygame to move your game character around][5] - * [What's a hero without a villain? How to add one to your Python game][6] - * [Simulate gravity in your Python game][7] - * [Add jumping to your Python platformer game][8] - - - -In previous entries in this series about creating video games in [Python 3][9] using the [Pygame][10] module, you designed your level-design layout, but some portion of your level probably extended past your viewable screen. The ubiquitous solution to that problem in platformer games is, as the term "side-scroller" suggests, scrolling. - -The key to scrolling is to make the platforms around the player sprite move when the player sprite gets close to the edge of the screen. This provides the illusion that the screen is a "camera" panning across the game world. - -This scrolling trick requires two dead zones at either edge of the screen, at which point your avatar stands still while the world scrolls by. - -### Putting the scroll in side-scroller - -You need one trigger point to go forward and another if you want your player to be able to go backward. These two points are simply two variables. Set them each about 100 or 200 pixels from each screen edge. Create the variables in your **setup** section. In the following code, the first two lines are for context, so just add the last two lines: - - -``` -player_list.add(player) -steps = 10 -forwardX  = 600 -backwardX = 230 -``` - -In the main loop, check to see if your player sprite is at the **forwardx** or **backwardx** scroll point. If so, move all platforms either left or right, depending on whether the world is moving forward or backward. In the following code, the final three lines of code are only for your reference: - - -``` -        # scroll the world forward -        if player.rect.x >= forwardx: -                scroll = player.rect.x - forwardx -                player.rect.x = forwardx -                for p in plat_list: -                        p.rect.x -= scroll - -        # scroll the world backward -        if player.rect.x <= backwardx: -                scroll = backwardx - player.rect.x -                player.rect.x = backwardx -                for p in plat_list: -                        p.rect.x += scroll - -        ## scrolling code above -    world.blit(backdrop, backdropbox) -    player.gravity() # check gravity -    player.update() -``` - -Launch your game and try it out. - -![Scrolling the world in Pygame][11] - -Scrolling works as expected, but you may notice a small problem that happens when you scroll the world around your player and non-player sprites: the enemy sprite doesn't scroll along with the world. Unless you want - -your enemy sprite to pursue your player endlessly, you need to modify the enemy code so that when your player makes an expeditious retreat, the enemy is left behind. - -### Enemy scroll - -In your main loop, you must apply the same rules for scrolling platforms to your enemy's position. Because your game world will (presumably) have more than one enemy in it, the rules are applied to your enemy list rather than an individual enemy sprite. That's one of the advantages of grouping similar elements into lists. - -The first two lines are for context, so just add the final two to your main loop: - - -``` -    # scroll the world forward -    if player.rect.x >= forwardx: -        scroll = player.rect.x - forwardx -        player.rect.x = forwardx -        for p in plat_list: -            p.rect.x -= scroll -        for e in enemy_list: -            e.rect.x -= scroll -``` - -To scroll in the other direction: - - -``` -    # scroll the world backward -    if player.rect.x <= backwardx: -        scroll = backwardx - player.rect.x -        player.rect.x = backwardx -        for p in plat_list: -            p.rect.x += scroll -        for e in enemy_list: -            e.rect.x += scroll -``` - -Launch the game again and see what happens. - -Here's all the code you've written for this Python platformer so far: - - -``` -#!/usr/bin/env python3 -# draw a world -# add a player and player control -# add player movement -# add enemy and basic collision -# add platform -# add gravity -# add jumping -# add scrolling - -# GNU All-Permissive License -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved.  This file is offered as-is, -# without any warranty. - -import pygame -import sys -import os - -''' -Objects -''' - -class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     -    def __init__(self,xloc,yloc,imgw,imgh,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)).convert() -        self.image.convert_alpha() -        self.rect = self.image.get_rect() -        self.rect.y = yloc -        self.rect.x = xloc - -class Player(pygame.sprite.Sprite): -    ''' -    Spawn a player -    ''' -    def __init__(self): -        pygame.sprite.Sprite.__init__(self) -        self.movex = 0 -        self.movey = 0 -        self.frame = 0 -        self.health = 10 -        self.collide_delta = 0 -        self.jump_delta = 6 -        self.score = 1 -        self.images = [] -        for i in range(1,9): -            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() -            img.convert_alpha() -            img.set_colorkey(ALPHA) -            self.images.append(img) -            self.image = self.images[0] -            self.rect  = self.image.get_rect() - -    def jump(self,platform_list): -        self.jump_delta = 0 - -    def gravity(self): -        self.movey += 3.2 # how fast player falls -        -        if self.rect.y > worldy and self.movey >= 0: -            self.movey = 0 -            self.rect.y = worldy-ty -        -    def control(self,x,y): -        ''' -        control player movement -        ''' -        self.movex += x -        self.movey += y -        -    def update(self): -        ''' -        Update sprite position -        ''' -        -        self.rect.x = self.rect.x + self.movex -        self.rect.y = self.rect.y + self.movey - -        # moving left -        if self.movex < 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[self.frame//ani] - -        # moving right -        if self.movex > 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[(self.frame//ani)+4] - -        # collisions -        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) -        for enemy in enemy_hit_list: -            self.health -= 1 -            #print(self.health) - -        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) -        for p in plat_hit_list: -            self.collide_delta = 0 # stop jumping -            self.movey = 0 -            if self.rect.y > p.rect.y: -                self.rect.y = p.rect.y+ty -            else: -                self.rect.y = p.rect.y-ty -            -        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) -        for g in ground_hit_list: -            self.movey = 0 -            self.rect.y = worldy-ty-ty -            self.collide_delta = 0 # stop jumping -            if self.rect.y > g.rect.y: -                self.health -=1 -                print(self.health) -                -        if self.collide_delta < 6 and self.jump_delta < 6: -            self.jump_delta = 6*2 -            self.movey -= 33  # how high to jump -            self.collide_delta += 6 -            self.jump_delta    += 6 -            -class Enemy(pygame.sprite.Sprite): -    ''' -    Spawn an enemy -    ''' -    def __init__(self,x,y,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)) -        self.movey = 0 -        #self.image.convert_alpha() -        #self.image.set_colorkey(ALPHA) -        self.rect = self.image.get_rect() -        self.rect.x = x -        self.rect.y = y -        self.counter = 0 - -                -    def move(self): -        ''' -        enemy movement -        ''' -        distance = 80 -        speed = 8 - -        self.movey += 3.2 -        -        if self.counter >= 0 and self.counter <= distance: -            self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: -            self.rect.x -= speed -        else: -            self.counter = 0 -        -        self.counter += 1 - -        if not self.rect.y >= worldy-ty-ty: -            self.rect.y += self.movey - -        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) -        for p in plat_hit_list: -            self.movey = 0 -            if self.rect.y > p.rect.y: -                self.rect.y = p.rect.y+ty -            else: -                self.rect.y = p.rect.y-ty - -        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) -        for g in ground_hit_list: -            self.rect.y = worldy-ty-ty - -        -class Level(): -    def bad(lvl,eloc): -        if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group -            -        if lvl == 2: -            print("Level " + str(lvl) ) - -        return enemy_list - -    def loot(lvl,lloc): -        print(lvl) - -    def ground(lvl,gloc,tx,ty): -        ground_list = pygame.sprite.Group() -        i=0 -        if lvl == 1: -            while i < len(gloc): -                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') -                ground_list.add(ground) -                i=i+1 - -        if lvl == 2: -            print("Level " + str(lvl) ) - -        return ground_list - -    def platform(lvl,tx,ty): -        plat_list = pygame.sprite.Group() -        ploc = [] -        i=0 -        if lvl == 1: -            ploc.append((0,worldy-ty-128,3)) -            ploc.append((300,worldy-ty-256,3)) -            ploc.append((500,worldy-ty-128,4)) - -            while i < len(ploc): -                j=0 -                while j <= ploc[i][2]: -                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') -                    plat_list.add(plat) -                    j=j+1 -                print('run' + str(i) + str(ploc[i])) -                i=i+1 - -        if lvl == 2: -            print("Level " + str(lvl) ) - -        return plat_list - -''' -Setup -''' -worldx = 960 -worldy = 720 - -fps = 40 # frame rate -ani = 4  # animation cycles -clock = pygame.time.Clock() -pygame.init() -main = True - -BLUE  = (25,25,200) -BLACK = (23,23,23 ) -WHITE = (254,254,254) -ALPHA = (0,255,0) - -world = pygame.display.set_mode([worldx,worldy]) -backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() -backdropbox = world.get_rect() -player = Player() # spawn player -player.rect.x = 0 -player.rect.y = 0 -player_list = pygame.sprite.Group() -player_list.add(player) -steps = 10 -forwardx = 600 -backwardx = 230 - -eloc = [] -eloc = [200,20] -gloc = [] -#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] -tx = 64 #tile size -ty = 64 #tile size - -i=0 -while i <= (worldx/tx)+tx: -    gloc.append(i*tx) -    i=i+1 - -enemy_list = Level.bad( 1, eloc ) -ground_list = Level.ground( 1,gloc,tx,ty ) -plat_list = Level.platform( 1,tx,ty ) - -''' -Main loop -''' -while main == True: -    for event in pygame.event.get(): -        if event.type == pygame.QUIT: -            pygame.quit(); sys.exit() -            main = False - -        if event.type == pygame.KEYDOWN: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                print("LEFT") -                player.control(-steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                print("RIGHT") -                player.control(steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                print('jump') - -        if event.type == pygame.KEYUP: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                player.control(steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                player.control(-steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                player.jump(plat_list) - -            if event.key == ord('q'): -                pygame.quit() -                sys.exit() -                main = False - -    # scroll the world forward -    if player.rect.x >= forwardx: -        scroll = player.rect.x - forwardx -        player.rect.x = forwardx -        for p in plat_list: -            p.rect.x -= scroll -        for e in enemy_list: -            e.rect.x -= scroll -                -    # scroll the world backward -    if player.rect.x <= backwardx: -        scroll = backwardx - player.rect.x -        player.rect.x = backwardx -        for p in plat_list: -            p.rect.x += scroll -        for e in enemy_list: -            e.rect.x += scroll - -    world.blit(backdrop, backdropbox) -    player.gravity() # check gravity -    player.update() -    player_list.draw(world) #refresh player position -    enemy_list.draw(world)  # refresh enemies -    ground_list.draw(world)  # refresh enemies -    plat_list.draw(world)   # refresh platforms -    for e in enemy_list: -        e.move() -    pygame.display.flip() -    clock.tick(fps) -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/python-platformer-game-run - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_gaming_games_roundup_news.png?itok=KM0ViL0f (Gaming artifacts with joystick, GameBoy, paddle) -[2]: https://opensource.com/article/17/10/python-101 -[3]: https://opensource.com/article/17/12/game-framework-python -[4]: https://opensource.com/article/17/12/game-python-add-a-player -[5]: https://opensource.com/article/17/12/game-python-moving-player -[6]: https://opensource.com/article/18/5/pygame-enemy -[7]: https://opensource.com/article/19/11/simulate-gravity-python -[8]: https://opensource.com/article/19/12/jumping-python-platformer-game -[9]: https://www.python.org/ -[10]: https://www.pygame.org/news -[11]: https://opensource.com/sites/default/files/uploads/pygame-scroll.jpg (Scrolling the world in Pygame) +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Enable your Python game player to run forward and backward) +[#]: via: (https://opensource.com/article/19/12/python-platformer-game-run) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使你的 Python 游戏玩家能够向前和向后跑 +====== +使用 Pygame 模块来使你的 Python 平台开启侧滚效果,来让你的玩家自由奔跑。 +![Gaming artifacts with joystick, GameBoy, paddle][1] + +这是仍在进行中的关于使用 Pygame 模块来在 Python 3 中在创建电脑游戏的第八部分。先前的文章是: + + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][2] + * [使用 Python 和 Pygame 模块构建一个游戏框架][3] + * [如何在你的 Python 游戏中添加一个玩家][4] + * [用 Pygame 使你的游戏角色移动起来][5] + * [如何向你的 Python 游戏中添加一个敌人][6] + * [在 Pygame 游戏中放置平台][12] + * [在你的 Python 游戏中模拟引力][7] + * [为你的 Python 平台类游戏添加跳跃功能][8] + + + +在这一系列关于使用 [Pygame][10] 模块来在 [Python 3][9]中创建电脑游戏的先前条目中,你已经设计了你的层设计布局,但是你的层的一些部分可能已近超出你的可视屏幕。在平台类游戏中,这个问题的普遍解决方案是,像术语"侧滚动"表明的一样,滚动。 + +滚动的关键是当玩家精灵接近屏的幕边缘时,使在玩家精灵周围的平台移动。这样给予一种错觉,屏幕是一个在游戏世界中穿梭追拍的"摄像机"。 + +这个滚动技巧需要两个在屏幕边缘的绝对区域,在绝对区域内的点处,在世界滚动期间,你的化身静止不动。 + +### 在侧滚动条中放置卷轴 + +如果你希望你的玩家能够后退,你需要一个触发点来向前和向后。这两个点仅仅是两个变量。设置它们各个距各个屏幕边缘大约 100 或 200 像素。在你的 **setup** 部分中创建变量。在下面的代码中,前两行用于背景说明,所以仅需要添加这行后的代码: + + +``` +player_list.add(player) +steps = 10 +forwardX  = 600 +backwardX = 230 +``` + +在主循环中,查看你的玩家精灵是否在 **前进** 或 **后退** 滚动点处。如果是这样,向左或向右移动使用的平台,取决于世界是向前或向后移动。在下面的代码中,代码的最后三行仅供你参考: + + +``` +        # scroll the world forward +        if player.rect.x >= forwardx: +                scroll = player.rect.x - forwardx +                player.rect.x = forwardx +                for p in plat_list: +                        p.rect.x -= scroll + +        # scroll the world backward +        if player.rect.x <= backwardx: +                scroll = backwardx - player.rect.x +                player.rect.x = backwardx +                for p in plat_list: +                        p.rect.x += scroll + +        ## scrolling code above +    world.blit(backdrop, backdropbox) +    player.gravity() # check gravity +    player.update() +``` + +启动你的游戏,并尝试它。 + +![Scrolling the world in Pygame][11] + +滚动工作像预期的一样,但是你可能注意到一个发生的小问题,当你滚动你的玩家和非玩家精灵周围的世界时:敌人精灵不随同世界滚动。除非你愿意。 + +你的敌人精灵要无休止地追逐你的玩家,你需要修改敌人代码,以便当你的玩家快速撤退时,敌人被留在hz后面。 + +### 敌人卷轴 + +在你的主循环中,你必需为你的敌人的位置的卷轴平台应用相同的规则。因为你的游戏世界将(很可能)有不止一个敌人在其中,该规则被应用于你的敌人列表,而不是一个单独的敌人精灵。 这是分组类似元素到列表中的优点之一。 + +前两行用于背景注释,所以只需添加这两行后面的代码到你的主循环中: + + +``` +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +``` + +来滚向另一个方向: + + +``` +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll +``` + +再次启动游戏,看看发生什么。 + +这里是到目前为止你已经为这个 Python 平台所写所有的代码: + + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform +# add gravity +# add jumping +# add scrolling + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os + +''' +Objects +''' + +class Platform(pygame.sprite.Sprite): +    # x location, y location, img width, img height, img file     +    def __init__(self,xloc,yloc,imgw,imgh,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)).convert() +        self.image.convert_alpha() +        self.rect = self.image.get_rect() +        self.rect.y = yloc +        self.rect.x = xloc + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 +        self.movey = 0 +        self.frame = 0 +        self.health = 10 +        self.collide_delta = 0 +        self.jump_delta = 6 +        self.score = 1 +        self.images = [] +        for i in range(1,9): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha() +            img.set_colorkey(ALPHA) +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() + +    def jump(self,platform_list): +        self.jump_delta = 0 + +    def gravity(self): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty +        +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +        +    def update(self): +        ''' +        Update sprite position +        ''' +        +        self.rect.x = self.rect.x + self.movex +        self.rect.y = self.rect.y + self.movey + +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        for enemy in enemy_hit_list: +            self.health -= 1 +            #print(self.health) + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.collide_delta = 0 # stop jumping +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty +            +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.movey = 0 +            self.rect.y = worldy-ty-ty +            self.collide_delta = 0 # stop jumping +            if self.rect.y > g.rect.y: +                self.health -=1 +                print(self.health) +                +        if self.collide_delta < 6 and self.jump_delta < 6: +            self.jump_delta = 6*2 +            self.movey -= 33  # how high to jump +            self.collide_delta += 6 +            self.jump_delta    += 6 +            +class Enemy(pygame.sprite.Sprite): +    ''' +    Spawn an enemy +    ''' +    def __init__(self,x,y,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)) +        self.movey = 0 +        #self.image.convert_alpha() +        #self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.counter = 0 + +                +    def move(self): +        ''' +        enemy movement +        ''' +        distance = 80 +        speed = 8 + +        self.movey += 3.2 +        +        if self.counter >= 0 and self.counter <= distance: +            self.rect.x += speed +        elif self.counter >= distance and self.counter <= distance*2: +            self.rect.x -= speed +        else: +            self.counter = 0 +        +        self.counter += 1 + +        if not self.rect.y >= worldy-ty-ty: +            self.rect.y += self.movey + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.rect.y = worldy-ty-ty + +        +class Level(): +    def bad(lvl,eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list.add(enemy)              # add enemy to group +            +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return enemy_list + +    def loot(lvl,lloc): +        print(lvl) + +    def ground(lvl,gloc,tx,ty): +        ground_list = pygame.sprite.Group() +        i=0 +        if lvl == 1: +            while i < len(gloc): +                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') +                ground_list.add(ground) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return ground_list + +    def platform(lvl,tx,ty): +        plat_list = pygame.sprite.Group() +        ploc = [] +        i=0 +        if lvl == 1: +            ploc.append((0,worldy-ty-128,3)) +            ploc.append((300,worldy-ty-256,3)) +            ploc.append((500,worldy-ty-128,4)) + +            while i < len(ploc): +                j=0 +                while j <= ploc[i][2]: +                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') +                    plat_list.add(plat) +                    j=j+1 +                print('run' + str(i) + str(ploc[i])) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return plat_list + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4  # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +ALPHA = (0,255,0) + +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +forwardx = 600 +backwardx = 230 + +eloc = [] +eloc = [200,20] +gloc = [] +#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] +tx = 64 #tile size +ty = 64 #tile size + +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) + +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print("LEFT") +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print("RIGHT") +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                player.jump(plat_list) + +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +                +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll + +    world.blit(backdrop, backdropbox) +    player.gravity() # check gravity +    player.update() +    player_list.draw(world) #refresh player position +    enemy_list.draw(world)  # refresh enemies +    ground_list.draw(world)  # refresh enemies +    plat_list.draw(world)   # refresh platforms +    for e in enemy_list: +        e.move() +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/python-platformer-game-run + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_gaming_games_roundup_news.png?itok=KM0ViL0f (Gaming artifacts with joystick, GameBoy, paddle) +[2]: https://opensource.com/article/17/10/python-101 +[3]: https://opensource.com/article/17/12/game-framework-python +[4]: https://opensource.com/article/17/12/game-python-add-a-player +[5]: https://opensource.com/article/17/12/game-python-moving-player +[6]: https://opensource.com/article/18/5/pygame-enemy +[7]: https://opensource.com/article/19/11/simulate-gravity-python +[8]: https://opensource.com/article/19/12/jumping-python-platformer-game +[9]: https://www.python.org/ +[10]: https://www.pygame.org/news +[11]: https://opensource.com/sites/default/files/uploads/pygame-scroll.jpg (Scrolling the world in Pygame) +[12]:https://opensource.com/article/18/7/put-platforms-python-game From a5ee878da3a4aaa9d2915cb8f52c077de6e91f25 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 22:07:02 +0800 Subject: [PATCH 0407/3057] PRF @robsean --- ...game player to run forward and backward.md | 714 +++++++++--------- 1 file changed, 353 insertions(+), 361 deletions(-) diff --git a/translated/tech/20191211 Enable your Python game player to run forward and backward.md b/translated/tech/20191211 Enable your Python game player to run forward and backward.md index e55d24d051..4efa93bd21 100644 --- a/translated/tech/20191211 Enable your Python game player to run forward and backward.md +++ b/translated/tech/20191211 Enable your Python game player to run forward and backward.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Enable your Python game player to run forward and backward) @@ -9,10 +9,11 @@ 使你的 Python 游戏玩家能够向前和向后跑 ====== -使用 Pygame 模块来使你的 Python 平台开启侧滚效果,来让你的玩家自由奔跑。 -![Gaming artifacts with joystick, GameBoy, paddle][1] +> 使用 Pygame 模块来使你的 Python 平台开启侧滚效果,来让你的玩家自由奔跑。 + +![](https://img.linux.net.cn/data/attachment/album/202001/25/220636x5mabbl47xvtsk55.jpg) -这是仍在进行中的关于使用 Pygame 模块来在 Python 3 中在创建电脑游戏的第八部分。先前的文章是: +这是仍在进行中的关于使用 Pygame 模块来在 Python 3 中在创建电脑游戏的第九部分。先前的文章是: * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][2] * [使用 Python 和 Pygame 模块构建一个游戏框架][3] @@ -23,9 +24,7 @@ * [在你的 Python 游戏中模拟引力][7] * [为你的 Python 平台类游戏添加跳跃功能][8] - - -在这一系列关于使用 [Pygame][10] 模块来在 [Python 3][9]中创建电脑游戏的先前条目中,你已经设计了你的层设计布局,但是你的层的一些部分可能已近超出你的可视屏幕。在平台类游戏中,这个问题的普遍解决方案是,像术语"侧滚动"表明的一样,滚动。 +在这一系列关于使用 [Pygame][10] 模块来在 [Python 3][9] 中创建电脑游戏的先前文章中,你已经设计了你的关卡设计布局,但是你的关卡的一些部分可能已近超出你的屏幕的可视区域。在平台类游戏中,这个问题的普遍解决方案是,像术语“侧滚side-scroller”表明的一样,滚动。 滚动的关键是当玩家精灵接近屏的幕边缘时,使在玩家精灵周围的平台移动。这样给予一种错觉,屏幕是一个在游戏世界中穿梭追拍的"摄像机"。 @@ -33,8 +32,7 @@ ### 在侧滚动条中放置卷轴 -如果你希望你的玩家能够后退,你需要一个触发点来向前和向后。这两个点仅仅是两个变量。设置它们各个距各个屏幕边缘大约 100 或 200 像素。在你的 **setup** 部分中创建变量。在下面的代码中,前两行用于背景说明,所以仅需要添加这行后的代码: - +如果你希望你的玩家能够后退,你需要一个触发点来向前和向后。这两个点仅仅是两个变量。设置它们各个距各个屏幕边缘大约 100 或 200 像素。在你的设置部分中创建变量。在下面的代码中,前两行用于上下文说明,所以仅需要添加这行后的代码: ``` player_list.add(player) @@ -43,8 +41,7 @@ forwardX  = 600 backwardX = 230 ``` -在主循环中,查看你的玩家精灵是否在 **前进** 或 **后退** 滚动点处。如果是这样,向左或向右移动使用的平台,取决于世界是向前或向后移动。在下面的代码中,代码的最后三行仅供你参考: - +在主循环中,查看你的玩家精灵是否在 `forwardx` 或 `backwardx` 滚动点处。如果是这样,向左或向右移动使用的平台,取决于世界是向前或向后移动。在下面的代码中,代码的最后三行仅供你参考: ```         # scroll the world forward @@ -71,16 +68,13 @@ backwardX = 230 ![Scrolling the world in Pygame][11] -滚动工作像预期的一样,但是你可能注意到一个发生的小问题,当你滚动你的玩家和非玩家精灵周围的世界时:敌人精灵不随同世界滚动。除非你愿意。 - -你的敌人精灵要无休止地追逐你的玩家,你需要修改敌人代码,以便当你的玩家快速撤退时,敌人被留在hz后面。 +滚动像预期的一样工作,但是你可能注意到一个发生的小问题,当你滚动你的玩家和非玩家精灵周围的世界时:敌人精灵不随同世界滚动。除非你要你的敌人精灵要无休止地追逐你的玩家,你需要修改敌人代码,以便当你的玩家快速撤退时,敌人被留在后面。 ### 敌人卷轴 -在你的主循环中,你必需为你的敌人的位置的卷轴平台应用相同的规则。因为你的游戏世界将(很可能)有不止一个敌人在其中,该规则被应用于你的敌人列表,而不是一个单独的敌人精灵。 这是分组类似元素到列表中的优点之一。 - -前两行用于背景注释,所以只需添加这两行后面的代码到你的主循环中: +在你的主循环中,你必须对卷轴平台为你的敌人的位置的应用相同的规则。因为你的游戏世界将(很可能)有不止一个敌人在其中,该规则应该被应用于你的敌人列表,而不是一个单独的敌人精灵。这是分组类似元素到列表中的优点之一。 +前两行用于上下文注释,所以只需添加这两行后面的代码到你的主循环中: ```     # scroll the world forward @@ -95,7 +89,6 @@ backwardX = 230 来滚向另一个方向: - ```     # scroll the world backward     if player.rect.x <= backwardx: @@ -111,341 +104,340 @@ backwardX = 230 这里是到目前为止你已经为这个 Python 平台所写所有的代码: - ``` -#!/usr/bin/env python3 -# draw a world -# add a player and player control -# add player movement -# add enemy and basic collision -# add platform -# add gravity -# add jumping -# add scrolling - -# GNU All-Permissive License -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved.  This file is offered as-is, -# without any warranty. - -import pygame -import sys -import os - -''' -Objects -''' - -class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     -    def __init__(self,xloc,yloc,imgw,imgh,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)).convert() -        self.image.convert_alpha() -        self.rect = self.image.get_rect() -        self.rect.y = yloc -        self.rect.x = xloc - -class Player(pygame.sprite.Sprite): -    ''' -    Spawn a player -    ''' -    def __init__(self): -        pygame.sprite.Sprite.__init__(self) -        self.movex = 0 -        self.movey = 0 -        self.frame = 0 -        self.health = 10 -        self.collide_delta = 0 -        self.jump_delta = 6 -        self.score = 1 -        self.images = [] -        for i in range(1,9): -            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() -            img.convert_alpha() -            img.set_colorkey(ALPHA) -            self.images.append(img) -            self.image = self.images[0] -            self.rect  = self.image.get_rect() - -    def jump(self,platform_list): -        self.jump_delta = 0 - -    def gravity(self): -        self.movey += 3.2 # how fast player falls -        -        if self.rect.y > worldy and self.movey >= 0: -            self.movey = 0 -            self.rect.y = worldy-ty -        -    def control(self,x,y): -        ''' -        control player movement -        ''' -        self.movex += x -        self.movey += y -        -    def update(self): -        ''' -        Update sprite position -        ''' -        -        self.rect.x = self.rect.x + self.movex -        self.rect.y = self.rect.y + self.movey - -        # moving left -        if self.movex < 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[self.frame//ani] - -        # moving right -        if self.movex > 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[(self.frame//ani)+4] - -        # collisions -        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) -        for enemy in enemy_hit_list: -            self.health -= 1 -            #print(self.health) - -        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) -        for p in plat_hit_list: -            self.collide_delta = 0 # stop jumping -            self.movey = 0 -            if self.rect.y > p.rect.y: -                self.rect.y = p.rect.y+ty -            else: -                self.rect.y = p.rect.y-ty -            -        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) -        for g in ground_hit_list: -            self.movey = 0 -            self.rect.y = worldy-ty-ty -            self.collide_delta = 0 # stop jumping -            if self.rect.y > g.rect.y: -                self.health -=1 -                print(self.health) -                -        if self.collide_delta < 6 and self.jump_delta < 6: -            self.jump_delta = 6*2 -            self.movey -= 33  # how high to jump -            self.collide_delta += 6 -            self.jump_delta    += 6 -            -class Enemy(pygame.sprite.Sprite): -    ''' -    Spawn an enemy -    ''' -    def __init__(self,x,y,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)) -        self.movey = 0 -        #self.image.convert_alpha() -        #self.image.set_colorkey(ALPHA) -        self.rect = self.image.get_rect() -        self.rect.x = x -        self.rect.y = y -        self.counter = 0 - -                -    def move(self): -        ''' -        enemy movement -        ''' -        distance = 80 -        speed = 8 - -        self.movey += 3.2 -        -        if self.counter >= 0 and self.counter <= distance: -            self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: -            self.rect.x -= speed -        else: -            self.counter = 0 -        -        self.counter += 1 - -        if not self.rect.y >= worldy-ty-ty: -            self.rect.y += self.movey - -        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) -        for p in plat_hit_list: -            self.movey = 0 -            if self.rect.y > p.rect.y: -                self.rect.y = p.rect.y+ty -            else: -                self.rect.y = p.rect.y-ty - -        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) -        for g in ground_hit_list: -            self.rect.y = worldy-ty-ty - -        -class Level(): -    def bad(lvl,eloc): -        if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group -            -        if lvl == 2: -            print("Level " + str(lvl) ) - -        return enemy_list - -    def loot(lvl,lloc): -        print(lvl) - -    def ground(lvl,gloc,tx,ty): -        ground_list = pygame.sprite.Group() -        i=0 -        if lvl == 1: -            while i < len(gloc): -                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') -                ground_list.add(ground) -                i=i+1 - -        if lvl == 2: -            print("Level " + str(lvl) ) - -        return ground_list - -    def platform(lvl,tx,ty): -        plat_list = pygame.sprite.Group() -        ploc = [] -        i=0 -        if lvl == 1: -            ploc.append((0,worldy-ty-128,3)) -            ploc.append((300,worldy-ty-256,3)) -            ploc.append((500,worldy-ty-128,4)) - -            while i < len(ploc): -                j=0 -                while j <= ploc[i][2]: -                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') -                    plat_list.add(plat) -                    j=j+1 -                print('run' + str(i) + str(ploc[i])) -                i=i+1 - -        if lvl == 2: -            print("Level " + str(lvl) ) - -        return plat_list - -''' -Setup -''' -worldx = 960 -worldy = 720 - -fps = 40 # frame rate -ani = 4  # animation cycles -clock = pygame.time.Clock() -pygame.init() -main = True - -BLUE  = (25,25,200) -BLACK = (23,23,23 ) -WHITE = (254,254,254) -ALPHA = (0,255,0) - -world = pygame.display.set_mode([worldx,worldy]) -backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() -backdropbox = world.get_rect() -player = Player() # spawn player -player.rect.x = 0 -player.rect.y = 0 -player_list = pygame.sprite.Group() -player_list.add(player) -steps = 10 -forwardx = 600 -backwardx = 230 - -eloc = [] -eloc = [200,20] -gloc = [] -#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] -tx = 64 #tile size -ty = 64 #tile size - -i=0 -while i <= (worldx/tx)+tx: -    gloc.append(i*tx) -    i=i+1 - -enemy_list = Level.bad( 1, eloc ) -ground_list = Level.ground( 1,gloc,tx,ty ) -plat_list = Level.platform( 1,tx,ty ) - -''' -Main loop -''' -while main == True: -    for event in pygame.event.get(): -        if event.type == pygame.QUIT: -            pygame.quit(); sys.exit() -            main = False - -        if event.type == pygame.KEYDOWN: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                print("LEFT") -                player.control(-steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                print("RIGHT") -                player.control(steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                print('jump') - -        if event.type == pygame.KEYUP: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                player.control(steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                player.control(-steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                player.jump(plat_list) - -            if event.key == ord('q'): -                pygame.quit() -                sys.exit() -                main = False - -    # scroll the world forward -    if player.rect.x >= forwardx: -        scroll = player.rect.x - forwardx -        player.rect.x = forwardx -        for p in plat_list: -            p.rect.x -= scroll -        for e in enemy_list: -            e.rect.x -= scroll -                -    # scroll the world backward -    if player.rect.x <= backwardx: -        scroll = backwardx - player.rect.x -        player.rect.x = backwardx -        for p in plat_list: -            p.rect.x += scroll -        for e in enemy_list: -            e.rect.x += scroll - -    world.blit(backdrop, backdropbox) -    player.gravity() # check gravity -    player.update() -    player_list.draw(world) #refresh player position -    enemy_list.draw(world)  # refresh enemies -    ground_list.draw(world)  # refresh enemies -    plat_list.draw(world)   # refresh platforms -    for e in enemy_list: -        e.move() -    pygame.display.flip() -    clock.tick(fps) +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform +# add gravity +# add jumping +# add scrolling + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os + +''' +Objects +''' + +class Platform(pygame.sprite.Sprite): + # x location, y location, img width, img height, img file + def __init__(self,xloc,yloc,imgw,imgh,img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)).convert() + self.image.convert_alpha() + self.rect = self.image.get_rect() + self.rect.y = yloc + self.rect.x = xloc + +class Player(pygame.sprite.Sprite): + ''' + Spawn a player + ''' + def __init__(self): + pygame.sprite.Sprite.__init__(self) + self.movex = 0 + self.movey = 0 + self.frame = 0 + self.health = 10 + self.collide_delta = 0 + self.jump_delta = 6 + self.score = 1 + self.images = [] + for i in range(1,9): + img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() + img.convert_alpha() + img.set_colorkey(ALPHA) + self.images.append(img) + self.image = self.images[0] + self.rect = self.image.get_rect() + + def jump(self,platform_list): + self.jump_delta = 0 + + def gravity(self): + self.movey += 3.2 # how fast player falls + + if self.rect.y > worldy and self.movey >= 0: + self.movey = 0 + self.rect.y = worldy-ty + + def control(self,x,y): + ''' + control player movement + ''' + self.movex += x + self.movey += y + + def update(self): + ''' + Update sprite position + ''' + + self.rect.x = self.rect.x + self.movex + self.rect.y = self.rect.y + self.movey + + # moving left + if self.movex < 0: + self.frame += 1 + if self.frame > ani*3: + self.frame = 0 + self.image = self.images[self.frame//ani] + + # moving right + if self.movex > 0: + self.frame += 1 + if self.frame > ani*3: + self.frame = 0 + self.image = self.images[(self.frame//ani)+4] + + # collisions + enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) + for enemy in enemy_hit_list: + self.health -= 1 + #print(self.health) + + plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) + for p in plat_hit_list: + self.collide_delta = 0 # stop jumping + self.movey = 0 + if self.rect.y > p.rect.y: + self.rect.y = p.rect.y+ty + else: + self.rect.y = p.rect.y-ty + + ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) + for g in ground_hit_list: + self.movey = 0 + self.rect.y = worldy-ty-ty + self.collide_delta = 0 # stop jumping + if self.rect.y > g.rect.y: + self.health -=1 + print(self.health) + + if self.collide_delta < 6 and self.jump_delta < 6: + self.jump_delta = 6*2 + self.movey -= 33 # how high to jump + self.collide_delta += 6 + self.jump_delta += 6 + +class Enemy(pygame.sprite.Sprite): + ''' + Spawn an enemy + ''' + def __init__(self,x,y,img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)) + self.movey = 0 + #self.image.convert_alpha() + #self.image.set_colorkey(ALPHA) + self.rect = self.image.get_rect() + self.rect.x = x + self.rect.y = y + self.counter = 0 + + + def move(self): + ''' + enemy movement + ''' + distance = 80 + speed = 8 + + self.movey += 3.2 + + if self.counter >= 0 and self.counter <= distance: + self.rect.x += speed + elif self.counter >= distance and self.counter <= distance*2: + self.rect.x -= speed + else: + self.counter = 0 + + self.counter += 1 + + if not self.rect.y >= worldy-ty-ty: + self.rect.y += self.movey + + plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) + for p in plat_hit_list: + self.movey = 0 + if self.rect.y > p.rect.y: + self.rect.y = p.rect.y+ty + else: + self.rect.y = p.rect.y-ty + + ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) + for g in ground_hit_list: + self.rect.y = worldy-ty-ty + + +class Level(): + def bad(lvl,eloc): + if lvl == 1: + enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy + enemy_list = pygame.sprite.Group() # create enemy group + enemy_list.add(enemy) # add enemy to group + + if lvl == 2: + print("Level " + str(lvl) ) + + return enemy_list + + def loot(lvl,lloc): + print(lvl) + + def ground(lvl,gloc,tx,ty): + ground_list = pygame.sprite.Group() + i=0 + if lvl == 1: + while i < len(gloc): + ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') + ground_list.add(ground) + i=i+1 + + if lvl == 2: + print("Level " + str(lvl) ) + + return ground_list + + def platform(lvl,tx,ty): + plat_list = pygame.sprite.Group() + ploc = [] + i=0 + if lvl == 1: + ploc.append((0,worldy-ty-128,3)) + ploc.append((300,worldy-ty-256,3)) + ploc.append((500,worldy-ty-128,4)) + + while i < len(ploc): + j=0 + while j <= ploc[i][2]: + plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') + plat_list.add(plat) + j=j+1 + print('run' + str(i) + str(ploc[i])) + i=i+1 + + if lvl == 2: + print("Level " + str(lvl) ) + + return plat_list + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4 # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +ALPHA = (0,255,0) + +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +forwardx = 600 +backwardx = 230 + +eloc = [] +eloc = [200,20] +gloc = [] +#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] +tx = 64 #tile size +ty = 64 #tile size + +i=0 +while i <= (worldx/tx)+tx: + gloc.append(i*tx) + i=i+1 + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) + +''' +Main loop +''' +while main == True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit(); sys.exit() + main = False + + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_LEFT or event.key == ord('a'): + print("LEFT") + player.control(-steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + print("RIGHT") + player.control(steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + print('jump') + + if event.type == pygame.KEYUP: + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(-steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + player.jump(plat_list) + + if event.key == ord('q'): + pygame.quit() + sys.exit() + main = False + + # scroll the world forward + if player.rect.x >= forwardx: + scroll = player.rect.x - forwardx + player.rect.x = forwardx + for p in plat_list: + p.rect.x -= scroll + for e in enemy_list: + e.rect.x -= scroll + + # scroll the world backward + if player.rect.x <= backwardx: + scroll = backwardx - player.rect.x + player.rect.x = backwardx + for p in plat_list: + p.rect.x += scroll + for e in enemy_list: + e.rect.x += scroll + + world.blit(backdrop, backdropbox) + player.gravity() # check gravity + player.update() + player_list.draw(world) #refresh player position + enemy_list.draw(world) # refresh enemies + ground_list.draw(world) # refresh enemies + plat_list.draw(world) # refresh platforms + for e in enemy_list: + e.move() + pygame.display.flip() + clock.tick(fps) ``` -------------------------------------------------------------------------------- @@ -455,21 +447,21 @@ via: https://opensource.com/article/19/12/python-platformer-game-run 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/seth [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_gaming_games_roundup_news.png?itok=KM0ViL0f (Gaming artifacts with joystick, GameBoy, paddle) -[2]: https://opensource.com/article/17/10/python-101 -[3]: https://opensource.com/article/17/12/game-framework-python -[4]: https://opensource.com/article/17/12/game-python-add-a-player -[5]: https://opensource.com/article/17/12/game-python-moving-player -[6]: https://opensource.com/article/18/5/pygame-enemy -[7]: https://opensource.com/article/19/11/simulate-gravity-python -[8]: https://opensource.com/article/19/12/jumping-python-platformer-game +[2]: https://linux.cn/article-9071-1.html +[3]: https://linux.cn/article-10850-1.html +[4]: https://linux.cn/article-10858-1.html +[5]: https://linux.cn/article-10874-1.html +[6]: https://linux.cn/article-10883-1.html +[7]: https://linux.cn/article-11780-1.html +[8]: https://linux.cn/article-11790-1.html [9]: https://www.python.org/ [10]: https://www.pygame.org/news [11]: https://opensource.com/sites/default/files/uploads/pygame-scroll.jpg (Scrolling the world in Pygame) -[12]:https://opensource.com/article/18/7/put-platforms-python-game +[12]:https://linux.cn/article-10902-1.html From 244a6ec05a561390cbbdf887c1785efd05c26309 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 25 Jan 2020 22:08:24 +0800 Subject: [PATCH 0408/3057] PUB @robsean https://linux.cn/article-11819-1.html --- ...ble your Python game player to run forward and backward.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191211 Enable your Python game player to run forward and backward.md (98%) diff --git a/translated/tech/20191211 Enable your Python game player to run forward and backward.md b/published/20191211 Enable your Python game player to run forward and backward.md similarity index 98% rename from translated/tech/20191211 Enable your Python game player to run forward and backward.md rename to published/20191211 Enable your Python game player to run forward and backward.md index 4efa93bd21..38d25cc1ab 100644 --- a/translated/tech/20191211 Enable your Python game player to run forward and backward.md +++ b/published/20191211 Enable your Python game player to run forward and backward.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11819-1.html) [#]: subject: (Enable your Python game player to run forward and backward) [#]: via: (https://opensource.com/article/19/12/python-platformer-game-run) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 354c69fd833d204d57e1d8d75d11361ad5dd23e6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 26 Jan 2020 00:55:46 +0800 Subject: [PATCH 0409/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200125=20What?= =?UTF-8?q?=202020=20brings=20for=20the=20developer,=20and=20more=20indust?= =?UTF-8?q?ry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200125 What 2020 brings for the developer, and more industry trends.md --- ...the developer, and more industry trends.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20200125 What 2020 brings for the developer, and more industry trends.md diff --git a/sources/tech/20200125 What 2020 brings for the developer, and more industry trends.md b/sources/tech/20200125 What 2020 brings for the developer, and more industry trends.md new file mode 100644 index 0000000000..e22735d21c --- /dev/null +++ b/sources/tech/20200125 What 2020 brings for the developer, and more industry trends.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What 2020 brings for the developer, and more industry trends) +[#]: via: (https://opensource.com/article/20/1/hybrid-developer-future-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +What 2020 brings for the developer, and more industry trends +====== +A weekly look at open source community and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [How developers will work in 2020][2] + +> Developers have been spending an enormous amount of time on everything *except* making software that solves problems. ‘DevOps’ has transmogrified from ‘developers releasing software’ into ‘developers building ever more complex infrastructure atop Kubernetes’ and ‘developers reinventing their software as distributed stateless functions.’ In 2020, ‘serverless’ will mature. Handle state. Handle data storage without requiring devs to learn yet-another-proprietary-database-service. Learning new stuff is fun-but shipping is even better, and we’ll finally see systems and services that support that. + +**The impact:** A lot of forces are converging to give developers superpowers. There are ever more open source building blocks in place; thousands of geniuses are collaborating to make developer workflows more fun and efficient, and artificial intelligences are being brought to bear solving the types of problems a developer might face. On the one hand, there is clear leverage to giving developer superpowers: if they can make magic with software they'll be able to make even bigger magic with all this help. On the other hand, imagine if teachers had the same level of investment and support. Makes ya wonder don't it? + +## [2020 forecast: Cloud-y with a chance of hybrid][3] + +> Behind this growth is an array of new themes and strategies that are pushing cloud further up business agendas the world over. With ‘emerging’ technologies, such as AI and machine learning, containers and functions, and even more flexibility available with hybrid cloud solutions being provided by the major providers, it’s no wonder cloud is set to take centre stage. + +**The impact:** Hybrid cloud finally has the same level of flesh that public cloud and on-premises have. Over the course of 2019 especially the competing visions offered for what it meant to be hybrid formed a composite that drove home why someone would want it. At the same time more and more of the technology pieces that make hybrid viable are in place and maturing. 2019 was the year that people truly "got" hybrid. 2020 will be the year that people start to take advantage of it. + +## [The no-code delusion][4] + +> Increasingly popular in the last couple of years, I think 2020 is going to be the year of “no code”: the movement that says you can write business logic and even entire applications without having the training of a software developer. I empathise with people doing this, and I think some of the “no code” tools are great. But I also thing it’s wrong at heart. + +**The impact:** I've heard many devs say it over many years: "software development is hard." It would be a mistake to interpret that as "all software development is equally hard." What I've always found hard about learning to code is trying to think in a way that a computer will understand. With or without code, making computers do complex things will always require a different kind of thinking. + +## [All things Java][5] + +> The open, multi-vendor model has been a major strength—it’s very hard for any single vendor to pioneer a market for a sustained period of time—and taking different perspectives from diverse industries has been a key strength of the [evolution of Java][6]. Choosing to open source Java in 2006 was also a decision that only worked to strengthen the Java ecosystem, as it allowed Sun Microsystems and later Oracle to share the responsibility of maintaining and evolving Java with many other organizations and individuals. + +**The impact:** The things that move quickly in technology are the things that can be thrown away. When you know you're going to keep something for a long time, you're likely to make different choices about what to prioritize when building it. Disposable and long-lived both have their places, and the Java community made enough good decisions over the years that the language itself can have a foot in both camps. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/hybrid-developer-future-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://thenextweb.com/readme/2020/01/15/how-developers-will-work-in-2020/ +[3]: https://www.itproportal.com/features/2020-forecast-cloud-y-with-a-chance-of-hybrid/ +[4]: https://www.alexhudson.com/2020/01/13/the-no-code-delusion/ +[5]: https://appdevelopermagazine.com/all-things-java/ +[6]: https://appdevelopermagazine.com/top-10-developer-technologies-in-2019/ From 3a1d79744d1f56579ed1128ea4a0fcfaa84c9552 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 26 Jan 2020 00:56:18 +0800 Subject: [PATCH 0410/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200125=20Use?= =?UTF-8?q?=20tmux=20to=20create=20the=20console=20of=20your=20dreams?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200125 Use tmux to create the console of your dreams.md --- ...ux to create the console of your dreams.md | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 sources/tech/20200125 Use tmux to create the console of your dreams.md diff --git a/sources/tech/20200125 Use tmux to create the console of your dreams.md b/sources/tech/20200125 Use tmux to create the console of your dreams.md new file mode 100644 index 0000000000..adab130489 --- /dev/null +++ b/sources/tech/20200125 Use tmux to create the console of your dreams.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use tmux to create the console of your dreams) +[#]: via: (https://opensource.com/article/20/1/tmux-console) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use tmux to create the console of your dreams +====== +You can do a lot with tmux, especially when you add tmuxinator to the +mix. Check them out in the fifteenth in our series on 20 ways to be more +productive with open source in 2020. +![Person drinking a hat drink at the computer][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Do it all on the console with tmux and tmuxinator + +In this series so far, I've written about individual apps and tools. Starting today, I'll put them together into comprehensive setups to streamline things. Starting at the command line. Why the command line? Simply put, working at the command line allows me to access a lot of these tools and functions from anywhere I can run SSH. I can SSH into one of my personal machines and run the same setup on my work machine as I use on my personal one. And the primary tool I'm going to use for that is [tmux][2]. + +Most people use tmux for very basic functions, such as opening it on a remote server then starting a process, maybe opening a second session to watch log files or debug information, then disconnecting and coming back later. But you can do so much work with tmux. + +![tmux][3] + +First things first—if you have an existing tmux configuration file, back it up. The configuration file for tmux is **~/.tmux.conf**. Move it to another directory, like **~/tmp**. Now, clone the [Oh My Tmux][4] project with Git. Link to **.tmux.conf** from that and copy in the **.tmux.conf.local** file to make adjustments: + + +``` +cd ~ +mkdir ~/tmp +mv ~/.tmux.conf ~/tmp/ +git clone +ln -s ~/.tmux/.tmux.conf ./ +cp ~/.tmux.conf.local ./ +``` + +The **.tmux.conf.local** file contains local settings and overrides. For example, I changed the default colors a bit and turned on the [Powerline][5] dividers. This snippet shows only the things I changed: + + +``` +tmux_conf_theme_24b_colour=true +tmux_conf_theme_focused_pane_bg='default' +tmux_conf_theme_pane_border_style=fat +tmux_conf_theme_left_separator_main='\uE0B0' +tmux_conf_theme_left_separator_sub='\uE0B1' +tmux_conf_theme_right_separator_main='\uE0B2' +tmux_conf_theme_right_separator_sub='\uE0B3' +#tmux_conf_battery_bar_symbol_full='◼' +#tmux_conf_battery_bar_symbol_empty='◻' +tmux_conf_battery_bar_symbol_full='♥' +tmux_conf_battery_bar_symbol_empty='·' +tmux_conf_copy_to_os_clipboard=true +set -g mouse on +``` + +Note that you do not need to have Powerline installed—you just need a font that supports the Powerline symbols. I use [Hack Nerd Font][6] for almost everything console-related since it is easy for me to read and has many, many useful extra symbols. You'll also note that I turn on operating system clipboard support and mouse support. + +Now, when tmux starts up, the status bar at the bottom provides a bit more information—and in exciting colors. **Ctrl**+**b** is still the "leader" key for entering commands, but some others have changed. Splitting panes horizontally (top/bottom) is now **Ctrl**+**b**+**-** and vertically is now **Ctrl**+**b**+**_**. With mouse mode turned on, you can click to switch between the panes and drag the dividers to resize them. Opening a new window is still **Ctrl**+**b**+**n**, and you can now click on the window name on the bottom bar to switch between them. Also, **Ctrl**+**b**+**e** will open up the **.tmux.conf.local** file for editing. When you exit the editor, tmux will reload the configuration without reloading anything else. Very useful. + +So far, I've only made some simple changes to functionality and visual display and added mouse support. Now I'll set it up to launch the apps I want in a way that makes sense and without having to reposition and resize them every time. For that, I'll use [tmuxinator][7]. Tmuxinator is a launcher for tmux that allows you to specify and manage layouts and autostart applications with a YAML file. To use it, start tmux and create panes with the things you want running in them. Then, open a new window with **Ctrl**+**b**+**n**, and execute **tmux list-windows**. You will get detailed information about the layout. + +![tmux layout information][8] + +Note the first line in the code above where I set up four panes with an application in each one.** **Save the output from when you run it for later. Now, run **tmuxinator new 20days** to create a layout named **20days**. This will bring up a text editor with the default layout file. It has a lot of useful stuff in it, and I encourage you to read up on all the options. Start by putting in the layout information above and what apps you want where: + + +``` +# /Users/ksonney/.config/tmuxinator/20days.yml +name: 20days +root: ~/ +windows: +   - mail: +      layout: d9da,208x60,0,0[208x26,0,0{104x26,0,0,0,103x26,105,0,5},208x33,0,27{104x33,0,27,1,103x33,105,27,4}]] @0 +      panes: +        - alot +        - abook +        - ikhal +        - todo.sh ls +20days +``` + +Be careful with the spaces! Like Python code, the spaces and indentation matter to how the file is interpreted. Save the file and then run **tmuxinator 20days**. You should get four panes with the [alot][9] mail program, [abook][10], ikhal (a shortcut to [khal][11] interactive), and anything in [todo.txt][12] with the tag **+20days**. + +![sample layout launched by tmuxinator][13] + +You'll also notice that the window on the bottom bar is labeled Mail. You can click on the name (along with other named windows) to jump to that view. Nifty, right? I set up a second window named Social with [Tuir][14], [Newsboat][15], an IRC client connected to [BitlBee][16], and [Rainbow Stream][17] in the same file. + +Tmux is my productivity powerhouse for keeping track of all the things, and with tmuxinator, I don't have to worry about constantly resizing, placing, and launching my applications. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/tmux-console + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://github.com/tmux/tmux +[3]: https://opensource.com/sites/default/files/uploads/productivity_15-1.png (tumux) +[4]: https://github.com/gpakosz/.tmux +[5]: https://github.com/powerline/powerline +[6]: https://www.nerdfonts.com/ +[7]: https://github.com/tmuxinator/tmuxinator +[8]: https://opensource.com/sites/default/files/uploads/productivity_15-2.png (tmux layout information) +[9]: https://opensource.com/article/20/1/organize-email-notmuch +[10]: https://opensource.com/article/20/1/sync-contacts-locally +[11]: https://opensource.com/article/20/1/open-source-calendar +[12]: https://opensource.com/article/20/1/open-source-to-do-list +[13]: https://opensource.com/sites/default/files/uploads/productivity_15-3.png (sample layout launched by tmuxinator) +[14]: https://opensource.com/article/20/1/open-source-reddit-client +[15]: https://opensource.com/article/20/1/open-source-rss-feed-reader +[16]: https://opensource.com/article/20/1/open-source-chat-tool +[17]: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream From c9d822b131fdeaf58cbb439a8b1d8c033d0ffe18 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 26 Jan 2020 09:19:05 +0800 Subject: [PATCH 0411/3057] Rename sources/tech/20200125 What 2020 brings for the developer, and more industry trends.md to sources/news/20200125 What 2020 brings for the developer, and more industry trends.md --- ...hat 2020 brings for the developer, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200125 What 2020 brings for the developer, and more industry trends.md (100%) diff --git a/sources/tech/20200125 What 2020 brings for the developer, and more industry trends.md b/sources/news/20200125 What 2020 brings for the developer, and more industry trends.md similarity index 100% rename from sources/tech/20200125 What 2020 brings for the developer, and more industry trends.md rename to sources/news/20200125 What 2020 brings for the developer, and more industry trends.md From 9f2a7520b7a153ac3ae20729dc1ba0684e2ce6cf Mon Sep 17 00:00:00 2001 From: laingke Date: Sun, 26 Jan 2020 16:49:36 +0800 Subject: [PATCH 0412/3057] 20200122-setting-up-passwordless-linux-logins-using-publicprivate-keys translating --- ... up passwordless Linux logins using public-private keys.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md b/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md index 2c61a4942b..54955ca562 100644 --- a/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md +++ b/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -198,7 +198,7 @@ via: https://www.networkworld.com/article/3514607/setting-up-passwordless-linux- 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 303716e43fa28d7b36fbf2ce9a9e99591e6c8998 Mon Sep 17 00:00:00 2001 From: laingke Date: Sun, 26 Jan 2020 17:53:16 +0800 Subject: [PATCH 0413/3057] 20200122-setting-up-passwordless-linux-logins-using-publicprivate-keys translated --- ... Linux logins using public-private keys.md | 69 ++++++++----------- 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md b/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md index 54955ca562..0e4a4de626 100644 --- a/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md +++ b/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md @@ -7,51 +7,40 @@ [#]: via: (https://www.networkworld.com/article/3514607/setting-up-passwordless-linux-logins-using-publicprivate-keys.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -Setting up passwordless Linux logins using public/private keys +使用公钥/私钥对设定免密的 Linux 登录方式 ====== -Using a set of public/private keys to allow you to log into a remote Linux system or run commands using ssh without a password can be very convenient, but setup is just tad tricky. Here's how and a script to help. -Ivanastar / Getty Images +使用一组公钥/私钥对让你不需要密码登录到远程 Linux 系统或使用 ssh 运行命令,这会非常方便,但是设置过程有点复杂。下面是帮助你的方法和脚本。 -Setting up an account on a [Linux][1] system that allows you to log in or run commands remotely without a password isn’t all that hard, but there are some tedious details that you need to get right if you want it to work. In this post, we’re going to run through the process and then show a script that can help manage the details. +在 [Linux][1] 系统上设置一个允许你无需密码即可远程登录或运行命令的帐户并不难,但是要使它正常工作,你还需要掌握一些繁琐的细节。在本文,我们将完成整个过程,然后给出一个可以帮助处理琐碎细节的脚本。 -Once set up, passwordless access is especially useful if you want to run ssh commands within a script, especially one that you might want to schedule to run automatically. +设置好之后,如果希望在脚本中运行 ssh 命令,尤其是希望配置自动运行的命令,那么免密访问特别有用。 -It’s important to note that you do not have to be using the same user account on both systems. In fact, you can use your public key for a number of accounts on a system or for different accounts on multiple systems. +需要注意的是,你不需要在两个系统上使用相同的用户帐户。实际上,你可以把公用密钥用于系统上的多个帐户或多个系统上的不同帐户。 -[][2] +设置方法如下。 -BrandPost Sponsored by HPE +### which system to start on?在哪个系统上启动? -[Take the Intelligent Route with Consumption-Based Storage][2] +首先,你需要从要发出命令的系统上着手。那就是你用来创建 ssh 密钥的系统。你还需要访问远程系统上的帐户并在其上运行这些命令。 -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. +为了使角色清晰明了,我们将场景中的第一个系统称为“boss”,因为它将发出要在另一个系统上运行的命令。 -Here’s how to set this up. - -### Which system to start on? - -First, you need to start on the system from which you want to issue commands. That's the system that you will use to create the ssh keys.  You also need to have access to the account on the remote system on which those commands will be run. - -To keep the roles clear, we’ll call that first system in our scenario the “boss” since it will issue commands to be run on the other system. - -Thus, the command prompt: - -[RELATED: Linux hardening: a 15-step checklist for a secure Linux server][3] +因此,命令提示符如下: ``` boss$ ``` -If you do not already have a public/private key pair set up for your account on the boss system, create one using a command like that shown below. Note that you can choose between the various encryption algorithms. (Either RSA or DSA is generally used.) Note that to access the system without typing a password, you will need to enter no password for the two prompts shown in the dialog below. +如果您还没有在 boss 系统上为你的帐户设置公钥/私钥对,请使用如下所示的命令创建一个密钥对。注意,你可以在各种加密算法之间进行选择。(一般使用RSA或DSA。)注意,要在不输入密码的情况下访问系统,您需要在下面的对话框中输入两个提示符的密码。 -If you already have a public/private key pair associated with this account, skip this step. +如果你已经有一个与此帐户关联的公钥/私钥对,请跳过此步骤。 ``` boss$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/myself/.ssh/id_rsa): -Enter passphrase (empty for no passphrase): <== just press the enter key -Enter same passphrase again: <== just press the enter key +Enter passphrase (empty for no passphrase): <== 按下回车键即可 +Enter same passphrase again: <== 按下回车键即可 Your identification has been saved in /home/myself/.ssh/id_rsa. Your public key has been saved in /home/myself/.ssh/id_rsa.pub. The key fingerprint is: @@ -70,18 +59,18 @@ The key's randomart image is: +----[SHA256]-----+ ``` -The command shown above will create both a public and a private key. What one encrypts, the other will decrypt. So, the relationship between these keys is critical and the private key should **never** be shared. Instead, it should stay in your .ssh folder on the boss system. +上面显示的命令将创建公钥和私钥。其中公钥用于加密,私钥用于解密。因此,这些密钥之间的关系是关键的,私有密钥**绝不**应该被共享。相反,它应该保存在 boss 系统的 .ssh 文件夹中。 -Notice that your public and private keys, on creation, will be saved in your .ssh folder. +注意,在创建时,你的公钥和私钥将会保存在 .ssh 文件夹中。 -The next step is to copy the **public** key to the system you want to access from the boss system without using a password. You can use **scp** to do this though, at this point, you’ll still need to enter your password. In this example, that system is called “target”. +下一步是将**公钥**复制到你希望从 boss 系统免密访问的系统。你可以使用 **scp** 命令来完成此操作,但此时你仍然需要输入密码。在本例中,该系统称为“target”。 ``` boss$ scp .ssh/id_rsa.pub myacct@target:/home/myaccount myacct@target's password: ``` -On the target system (the one on which the commands will be run), you will need to install your public key. If you don’t have a .ssh directory (e.g., if you’ve never used ssh on that system), running a command like this will set one up for you: +你需要安装公钥在 target 系统(将运行命令的系统)上。如果你没有 .ssh 目录(例如,你从未在该系统上使用过 ssh),运行这样的命令将为你设置一个目录: ``` target$ ssh localhost date @@ -92,33 +81,33 @@ drwxr-xr-x 6 myacct myacct 4096 Jan 19 11:49 .. -rw-r--r-- 1 myacct myacct 222 Jan 19 11:48 known_hosts ``` -Still on the target system, you then need to add the public key you transferred from the “boss” system to your .ssh/authorized_keys file. The command below will add the key to the end of the file if it exists already or create the file and add the key if the file does not exist. +仍然在目标系统上,你需要将从“boss”系统传输的公钥添加到 .ssh/authorized_keys 文件中。如果密钥已经存在,使用下面的命令将把它添加到文件的末尾;如果文件不存在,则创建文件并添加密钥。 ``` target$ cat id_rsa.pub >> .ssh/authorized_keys ``` -Next, you need to make sure that the permissions on your authorized_keys file are set to 600. If not, run the **chmod 600 .ssh/authorized_keys** command. +下一步,你需要确保你的 authorized_keys 文件权限为 600。如果还不是,执行命令 ```chmod 600 .ssh/authorized_keys```。 ``` target$ ls -l authorized_keys -rw------- 1 myself myself 569 Jan 19 12:10 authorized_keys ``` -Also check to be sure that permissions on your .ssh directory on the target system are set to 700. Fix the permissions with **chmod 700 .ssh** if needed. +还要检查目标系统上 .ssh 目录的权限是否设置为 700。如果需要,执行 ```chmod 700 .ssh``` 命令修改权限。 ``` target$ ls -ld .ssh drwx------ 2 myacct myacct 4096 Jan 14 15:54 .ssh ``` -At this point, you should be able to run a command remotely from your boss system to your target system without entering a password. This should work unless the target user account on the target system has an old public key for the same user and host as the one you’re trying to connect from. If so, you should be able to remove the earlier (and conflicting) entry. +此时,你应该能够从 boss 系统远程免密运行命令到目标系统。除非目标系统上的目标用户帐户拥有与你试图连接的用户和主机相同的旧公钥,否则这应该可以工作。如果是这样,你应该删除早期的(并冲突的)条目。 -### Using a script +### 使用脚本 -Using a script can make some work a lot easier. In the example script below, however, the one annoying problem that you’ll run into is that you’ll have to enter the target user’s password numerous times before the password-free access is configured. One option would be to break the script into two parts – the commands that need to be run on the boss system and the commands that need to be run on the target system. +使用脚本可以使某些工作变得更加容易。但是,在下面的示例脚本中,你会遇到的一个烦人的问题是,在配置免密访问权限之前,你必须多次输入目标用户的密码。一种选择是将脚本分为两部分——需要在 boss 系统上运行的命令和需要在 target 系统上运行的命令。 -Here’s the do-it-all version of the script: +这是“一步到位”版本的脚本: ``` #!/bin/bash @@ -162,7 +151,7 @@ echo testing -- if no password is requested, you are all set ssh $user@$REM /bin/hostname ``` -The script has been configured to tell you what it is doing each time you will have to enter a password. Interaction will look something like this: +脚本已经配置为在你每次必须输入密码时告诉你它正在做什么。交互看起来是这样的: ``` $ ./rem_login_setup @@ -181,16 +170,14 @@ testing -- if no password is requested, you are all set fruitfly ``` -After the scenario shown above, you'd be able to log into lola's account on fruitfly like this: +在上面的场景之后,你就可以像这样登录到 lola 的帐户: ``` $ ssh lola@fruitfly [lola@fruitfly ~]$ ``` -Once passwordless login is set up, you’ll both be able to log in from the boss system to the target system without a password and run arbitrary ssh commands. Running without a password in this way does not imply that your account is less secure. However, protecting your password on the boss system could become considerably more important depending on the nature of the target. - -Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. +一旦设置了免密登录,你就可以不需要键入密码从 boss 系统登录到 target 系统,并且运行任意的 ssh 命令。以这种免密的方式运行并不意味着你的帐户不安全。然而,根据target 系统的性质,保护您在 boss 系统上的密码可能变得更加重要。 -------------------------------------------------------------------------------- From f2af0e43a98396f6ed51d5d515dc42a768a21745 Mon Sep 17 00:00:00 2001 From: laingke Date: Sun, 26 Jan 2020 17:55:57 +0800 Subject: [PATCH 0414/3057] 20200122-setting-up-passwordless-linux-logins-using-publicprivate-keys move to translated --- ...ting up passwordless Linux logins using public-private keys.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20200122 Setting up passwordless Linux logins using public-private keys.md (100%) diff --git a/sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md b/translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md similarity index 100% rename from sources/tech/20200122 Setting up passwordless Linux logins using public-private keys.md rename to translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md From 68ca7e0157b0004d5d91d3fae7c57704aa0ecc2e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 26 Jan 2020 20:03:27 +0800 Subject: [PATCH 0415/3057] APL --- ...save your tasks - and your sanity - if SSH is interrupted.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md b/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md index 5de0f02b79..53d5f1cd45 100644 --- a/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md +++ b/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 06dec5a5d50f16c14d7176d75b9ac17e1bf76753 Mon Sep 17 00:00:00 2001 From: laingke Date: Sun, 26 Jan 2020 20:52:35 +0800 Subject: [PATCH 0416/3057] 20200115-webassembly translating --- .../20200115 Why everyone is talking about WebAssembly.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200115 Why everyone is talking about WebAssembly.md b/sources/tech/20200115 Why everyone is talking about WebAssembly.md index 80b5a83060..5350f911b9 100644 --- a/sources/tech/20200115 Why everyone is talking about WebAssembly.md +++ b/sources/tech/20200115 Why everyone is talking about WebAssembly.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -62,7 +62,7 @@ via: https://opensource.com/article/20/1/webassembly 作者:[Mike Bursell][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9ef8e9bf3749687df3d3c9ff51fed22cc785ebf8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 26 Jan 2020 21:21:08 +0800 Subject: [PATCH 0417/3057] TSL --- ...and your sanity - if SSH is interrupted.md | 119 ------------------ ...and your sanity - if SSH is interrupted.md | 107 ++++++++++++++++ 2 files changed, 107 insertions(+), 119 deletions(-) delete mode 100644 sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md create mode 100644 translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md diff --git a/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md b/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md deleted file mode 100644 index 53d5f1cd45..0000000000 --- a/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md +++ /dev/null @@ -1,119 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How the Linux screen tool can save your tasks – and your sanity – if SSH is interrupted) -[#]: via: (https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -How the Linux screen tool can save your tasks – and your sanity – if SSH is interrupted -====== -The Linux screen command can be a life-saver when you need to ensure long-running tasks don't get killed when an SSH session is interrupted. Here's how to use it. -Sandra Henry-Stocker - -If you’ve ever had to restart a time-consuming process because your SSH session was disconnected, you might be very happy to learn about an interesting tool that you can use to avoid this problem – the **screen** tool. - -Screen, which is a terminal multiplexor, allows you to run many terminal sessions within a single ssh session, detaching from them and reattaching them as needed. The process for doing this is surprising simple and involves only a handful of commands. - -**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][1] ]** - -To start a screen session, you simply type **screen** within your ssh session. You then start your long-running process, type **Ctrl+A Ctrl+D** to detach from the session and **screen -r** to reattach when the time is right. - -[][2] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][2] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -If you’re going to run more than one screen session, a better option is to give each session a meaningful name that will help you remember what task is being handled in it. Using this approach, you would name each session when you start it by using a command like this: - -``` -$ screen -S slow-build -``` - -Once you have multiple sessions running, reattaching to one then requires that you pick it from the list. In the commands below, we list the currently running sessions before reattaching one of them. Notice that initially both sessions are marked as being detached. - -Advertisement - -``` -$ screen -ls -There are screens on: - 6617.check-backups (09/26/2019 04:35:30 PM) (Detached) - 1946.slow-build (09/26/2019 02:51:50 PM) (Detached) -2 Sockets in /run/screen/S-shs -``` - -Reattaching to the session then requires that you supply the assigned name. For example: - -``` -$ screen -r slow-build -``` - -The process you left running should have continued processing while it was detached and you were doing some other work. If you ask about your screen sessions while using one of them, you should see that the session you’re currently reattached to is once again “attached.” - -``` -$ screen -ls -There are screens on: - 6617.check-backups (09/26/2019 04:35:30 PM) (Attached) - 1946.slow-build (09/26/2019 02:51:50 PM) (Detached) -2 Sockets in /run/screen/S-shs. -``` - -You can ask what version of screen you’re running with the **-version** option. - -``` -$ screen -version -Screen version 4.06.02 (GNU) 23-Oct-17 -``` - -### Installing screen - -If “which screen” doesn’t provide information on screen, it probably isn't installed on your system. - -``` -$ which screen -/usr/bin/screen -``` - -If you need to install it, one of the following commands is probably right for your system: - -``` -sudo apt install screen -sudo yum install screen -``` - -The screen tool comes in handy whenever you need to run time-consuming processes that could be interrupted if your SSH session for any reason disconnects. And, as you've just seen, it’s very easy to use and manage. - -Here's a recap of the commands used above: - -``` -screen -S start a session -Ctrl+A Ctrl+D detach from a session -screen -ls list sessions -screen -r reattach a session -``` - -While there is more to know about **screen**, including additional ways that you can maneuver between screen sessions, this should get you started using this handy tool. - -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.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.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua -[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md b/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md new file mode 100644 index 0000000000..1a21ab7cb8 --- /dev/null +++ b/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How the Linux screen tool can save your tasks – and your sanity – if SSH is interrupted) +[#]: via: (https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如果 SSH 被中断,Linux screen 工具如何拯救你的任务以及理智 +====== + +> 当你需要确保长时间运行的任务不会在 SSH 会话中断时被杀死时,Linux screen 命令可以成为救生员。以下是使用方法。 + +![](https://images.idgesg.net/images/article/2019/09/working_w_screen-shs-100812448-large.jpg) + +如果因 SSH 会话断开而不得不重启一个耗时的进程,那么你可能会很高兴了解一个有趣的工具,可以用来避免此问题:`screen` 工具。 + +`screen` 是一个终端多路复用器,它使你可以在单个 SSH 会话中运行多个终端会话,并随时从它们之中脱离或重新接驳。做到这一点的过程非常简单,仅涉及少数命令。 + +要启动 `screen` 会话,只需在 SSH 会话中键入 `screen`。 然后,你可以开始启动需要长时间运行的进程,并在适当的时候键入 `Ctrl + A Ctrl + D` 从会话中脱离,然后键入 `screen -r` 重新接驳。 + +如果你要运行多个 `screen` 会话,更好的选择是为每个会话指定一个有意义的名称,以帮助你记住正在处理的任务。使用这种方法,你可以在启动每个会话时使用如下命令命名: + +``` +$ screen -S slow-build +``` + +一旦运行了多个会话,要重新接驳到一个会话,需要从列表中选择它。在以下命令中,我们列出了当前正在运行的会话,然后再重新接驳其中一个。请注意,一开始这两个会话都被标记为已脱离。 + +``` +$ screen -ls +There are screens on: + 6617.check-backups (09/26/2019 04:35:30 PM) (Detached) + 1946.slow-build (09/26/2019 02:51:50 PM) (Detached) +2 Sockets in /run/screen/S-shs +``` + +然后,重新接驳到该会话要求你提供分配给会话的名称。例如: + +``` +$ screen -r slow-build +``` + +在脱离的会话中,保持运行状态的进程会继续进行处理,而你可以执行其他工作。如果你使用这些 `screen` 会话之一来查询 `screen` 会话情况,可以看到当前重新接驳的会话再次显示为 `Attached`。 + +``` +$ screen -ls +There are screens on: + 6617.check-backups (09/26/2019 04:35:30 PM) (Attached) + 1946.slow-build (09/26/2019 02:51:50 PM) (Detached) +2 Sockets in /run/screen/S-shs. +``` + +你可以使用 `-version` 选项查询正在运行的 `screen` 版本。 + +``` +$ screen -version +Screen version 4.06.02 (GNU) 23-Oct-17 +``` + +### 安装 screen + +如果 `which screen` 未在屏幕上提供信息,则可能你的系统上未安装该工具。 + +``` +$ which screen +/usr/bin/screen +``` + +如果你需要安装它,则以下命令之一可能适合你的系统: + +``` +sudo apt install screen +sudo yum install screen +``` + +当你需要运行耗时的进程时,如果你的 SSH 会话由于某种原因断开连接,则可能会中断这个耗时的进程,那么 `screen` 工具就会派上用场。而且,如你所见,它非常易于使用和管理。 + +以下是上面使用的命令的摘要: + +``` +screen -S 开始会话 +Ctrl+A Ctrl+D 从会话中脱离 +screen -ls 列出会话 +screen -r 重新接驳会话 +``` + +尽管还有更多关于 `screen` 的知识,包括可以在 `screen` 会话之间进行操作的其他方式,但这已经足够帮助你开始使用这个便捷的工具了。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 432ac402e1d5a34a852f8d861dd3f91a9ad888dc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 26 Jan 2020 21:28:30 +0800 Subject: [PATCH 0418/3057] PRF --- ...ve your tasks - and your sanity - if SSH is interrupted.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md b/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md index 1a21ab7cb8..aab83633d3 100644 --- a/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md +++ b/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How the Linux screen tool can save your tasks – and your sanity – if SSH is interrupted) @@ -95,7 +95,7 @@ via: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can- 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9216028c55acfbe265919ff0cb46496c62be92b2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 26 Jan 2020 21:29:09 +0800 Subject: [PATCH 0419/3057] PUB @wxy https://linux.cn/article-11822-1.html --- ...ve your tasks - and your sanity - if SSH is interrupted.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md (98%) diff --git a/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md b/published/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md similarity index 98% rename from translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md rename to published/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md index aab83633d3..f52dbd55f6 100644 --- a/translated/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md +++ b/published/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11822-1.html) [#]: subject: (How the Linux screen tool can save your tasks – and your sanity – if SSH is interrupted) [#]: via: (https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 88ddf5a0002c9a7d56cf08ea54b8dcec8d161abb Mon Sep 17 00:00:00 2001 From: laingke Date: Sun, 26 Jan 2020 22:56:14 +0800 Subject: [PATCH 0420/3057] 20200115-webassembly translated --- ...y everyone is talking about WebAssembly.md | 85 ------------------ ...y everyone is talking about WebAssembly.md | 86 +++++++++++++++++++ 2 files changed, 86 insertions(+), 85 deletions(-) delete mode 100644 sources/tech/20200115 Why everyone is talking about WebAssembly.md create mode 100644 translated/tech/20200115 Why everyone is talking about WebAssembly.md diff --git a/sources/tech/20200115 Why everyone is talking about WebAssembly.md b/sources/tech/20200115 Why everyone is talking about WebAssembly.md deleted file mode 100644 index 5350f911b9..0000000000 --- a/sources/tech/20200115 Why everyone is talking about WebAssembly.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (laingke) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why everyone is talking about WebAssembly) -[#]: via: (https://opensource.com/article/20/1/webassembly) -[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) - -Why everyone is talking about WebAssembly -====== -Learn more about the newest way to run any code in a web browser. -![Digital creative of a browser on the internet][1] - -If you haven’t heard of [WebAssembly][2] yet, then you will soon. It’s one of the industry’s best-kept secrets, but it’s everywhere. It’s supported by all the major browsers, and it’s coming to the server-side, too. It’s fast. It’s being used for gaming. It’s an open World Wide Web Consortium (W3C), the main international standards organization for the web, standard. It’s platform-neutral and can run on Linux, Macs, and Windows. - -"Wow," you may be saying, "this sounds like something I should learn to code in!" You’d be right, but you’d be wrong too; you don’t code in WebAssembly. Let’s take some time to learn about the technology that’s often fondly abbreviated to "Wasm." - -### Where did it come from? - -Going back about ten years, there was a growing recognition that the widely-used JavaScript wasn’t fast enough for many purposes. JavaScript was undoubtedly successful and convenient. It ran in any browser and enabled the type of dynamic web pages that we take for granted today. But it was a high-level language and wasn’t designed with compute-intensive workloads in mind. - -However, although engineers responsible for the leading web browsers were generally in agreement about the performance problem, they weren’t aligned on what to do about it. Two camps emerged. Google began its Native Client project and, later, its Portable Native Client variation, to focus on allowing games and other software written in C/C++ to run in a secure compartment within Chrome. Mozilla, meanwhile, won the backing of Microsoft for asm.js, an approach that updated the browser so it can run a low-level subset of JavaScript instructions very quickly (another project enabled the conversion of C/C++ code into these instructions). - -With neither camp gaining widespread adoption, the various parties agreed to join forces in 2015 around a new standard called WebAssembly that built on the basic approach taken by asm.js. [As CNET’s Stephen Shankland wrote at the time][3], "On today’s Web, the browser’s JavaScript translates those instructions into machine code. But with WebAssembly, the programmer does a lot of the work earlier in the process, producing a program that’s in between the two states. That frees the browser from a lot of the hard work of creating the machine code, but it also fulfills the promise of the Web—that software will run on any device with a browser regardless of the underlying hardware details." - -In 2017, Mozilla declared it to be a minimum viable product and brought it out of preview. All the main browsers had adopted it by the end of that year. [In December 2019][4], the WebAssembly Working Group published the three WebAssembly specifications as W3C recommendations. - -WebAssembly defines a portable binary code format for executable programs, a corresponding textual assembly language, and interfaces for facilitating interactions between such programs and their host environment. WebAssembly code runs within a low-level virtual machine that mimics the functionality of the many microprocessors upon which it can be run. Either through Just-In-Time (JIT) compilation or interpretation, the WebAssembly engine can perform at nearly the speed of code compiled for a native platform. - -### Why the interest now? - -Certainly, some of the recent interest in WebAssembly stems from that initial desire to run more compute-intensive code in browsers. Laptop users, in particular, are spending more and more of their time in a browser (or, in the case of Chromebooks, essentially all their time). This trend has created an urgency around removing barriers to running a broad range of applications within a browser. And one of those barriers is often some aspect of performance, which is what WebAssembly and its predecessors were originally conceived to address. - -However, WebAssembly isn’t just for browsers. In 2019, [Mozilla announced a project called WASI][5] (WebAssembly System Interface) to standardize how WebAssembly code interacts with operating systems outside of a browser context. With the combination of browser support for WebAssembly and WASI, compiled binaries will be able to run both within and without browsers, across different devices and operating systems, at near-native speeds. - -WebAssembly’s low overhead immediately makes it practical for use beyond browsers, but that’s arguably table stakes; there are obviously other ways to run applications that don’t introduce performance bottlenecks. Why use WebAssembly, specifically? - -One important reason is its portability. Widely used compiled languages like C++ and Rust are probably the ones most associated with WebAssembly today. However, [a wide range of other languages][6] compile to or have their virtual machines in WebAssembly. Furthermore, while WebAssembly [assumes certain prerequisites][7] for its execution environments, it is designed to execute efficiently on a variety of operating systems and instruction set architectures. WebAssembly code can, therefore, be written using a wide range of languages and run on a wide range of operating systems and processor types. - -Another WebAssembly advantage stems from the fact that code runs within a virtual machine. As a result, each WebAssembly module executes within a sandboxed environment, separated from the host runtime using fault isolation techniques. This implies, among other things, that applications execute in isolation from the rest of their host environment and can’t escape the sandbox without going through appropriate APIs. - -### WebAssembly in action - -What does all this mean in practice? - -One example of WebAssembly in action is [Enarx][8]. - -Enarx is a project that provides hardware independence for securing applications using Trusted Execution Environments (TEE). Enarx lets you securely deliver an application compiled into WebAssembly all the way into a cloud provider and execute it remotely. As Red Hat security engineer [Nathaniel McCallum puts it][9], "The way that we do this is, we take your application as inputs, and we perform an attestation process with the remote hardware. We validate that the remote hardware is, in fact, the hardware that it claims to be, using cryptographic techniques. The end result of that is not only an increased level of trust in the hardware that we’re speaking to; it’s also a session key, which we can then use to deliver encrypted code and data into this environment that we have just asked for cryptographic attestation on." - -Another example is OPA, the Open Policy Agent, which [announced][10] in November 2019 that you could [compile][11] their policy definition language, Rego, into WebAssembly. Rego lets you write logic to search and combine JSON/YAML data from different sources to ask questions like, "Is this API allowed?" - -OPA has been used to policy-enable software including, but not limited to, Kubernetes. Simplifying policy using tools like OPA [is considered an important step][12] for properly securing Kubernetes deployments across a variety of different environments. WebAssembly’s portability and built-in security features are a good match for these tools. - -Our last example is [Unity][13]. Remember, we mentioned at the beginning of the article that WebAssembly is used for gaming? Well, Unity, the cross-platform game engine, was an early adopter of WebAssembly, providing the first demo of Wasm running in browsers, and, since August 2018, [has used WebAssembly][14] as the output target for the Unity WebGL build target. - -These are just a few of the ways WebAssembly has already begun to make an impact. Find out more and keep up to date with all things Wasm at - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/webassembly - -作者:[Mike Bursell][a] -选题:[lujun9972][b] -译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mikecamel -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) -[2]: https://opensource.com/article/19/8/webassembly-speed-code-reuse -[3]: https://www.cnet.com/news/the-secret-alliance-that-could-give-the-web-a-massive-speed-boost/ -[4]: https://www.w3.org/blog/news/archives/8123 -[5]: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ -[6]: https://github.com/appcypher/awesome-wasm-langs -[7]: https://webassembly.org/docs/portability/ -[8]: https://enarx.io -[9]: https://enterprisersproject.com/article/2019/9/application-security-4-facts-confidential-computing-consortium -[10]: https://blog.openpolicyagent.org/tagged/webassembly -[11]: https://github.com/open-policy-agent/opa/tree/master/wasm -[12]: https://enterprisersproject.com/article/2019/11/kubernetes-reality-check-3-takeaways-kubecon -[13]: https://opensource.com/article/20/1/www.unity.com -[14]: https://blogs.unity3d.com/2018/08/15/webassembly-is-here/ diff --git a/translated/tech/20200115 Why everyone is talking about WebAssembly.md b/translated/tech/20200115 Why everyone is talking about WebAssembly.md new file mode 100644 index 0000000000..5da77c0d4d --- /dev/null +++ b/translated/tech/20200115 Why everyone is talking about WebAssembly.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why everyone is talking about WebAssembly) +[#]: via: (https://opensource.com/article/20/1/webassembly) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +为什么每个人都在谈论 WebAssembly +====== +了解有关在 Web 浏览器中运行任何代码的最新方法的更多信息。 +![Digital creative of a browser on the internet][1] + +如果你还没有听说过 [WebAssembly][2],那么你很快就会知道。这是业界保存最完好的秘密之一,但无处不在。所有主流的浏览器都支持它,并且它也将在服务器端使用。它很快。它被用于游戏。这是一个开放的万维网联盟(W3C),主要的国际网络标准组织。它与平台无关,可以在 Linux,Mac 和 Windows 上运行。 + +你可能会说:“哇,这听起来像是我应该学习编程的东西!” 你可能是对的,但你也可能是错的。你不需要用 WebAssembly 编码。让我们花一些时间来学习通常被缩写为“Wasm”的技术。 + +### 它从哪里来? + +大约十年前,人们越来越认识到,广泛使用的 JavaScript 不够快速,无法满足许多目的。JavaScript 无疑是成功和方便的。它可以在任何浏览器中运行,并启用了今天我们认为理所当然的动态网页类型。但这是一种高级语言,在设计时并没有考虑到计算密集型工作负载。 + +然而,尽管负责主流 web 浏览器的工程师们对性能问题的看法大体一致,但他们对如何解决这个问题却意见不一。两个阵营出现。谷歌开始了它的原生客户端Native Client项目,后来又推出了可移植原生客户端Portable Native Client变体,着重于允许用 C/C++ 编写的游戏和其它软件在 Chrome 的一个安全隔间中运行。与此同时,Mozilla 赢得了微软对 asm.js 的支持。该方法更新了浏览器,因此它可以非常快速地运行底层的 JavaScript 指令子集(另一个项目使 C/C++ 代码可以转换为这些指令)。 + +在这两个阵营都没有得到广泛采用的情况下,各方在 2015 年同意围绕一种称为 WebAssembly 的新标准,以 asm.js 所采用的基本方法为基础,共同努力。[如 CNET 的 Stephen Shankland 当时所写][3],“在当今的 Web 上,浏览器的 JavaScript 将这些指令转换为机器代码。但是,通过 WebAssembly,程序员可以在此过程的早期阶段完成很多工作,从而生成介于两种状态之间的程序。这使浏览器摆脱了创建机器代码的繁琐工作,但也实现了 Web 的承诺——该软件将在具有浏览器的任何设备上运行,而无需考虑基础硬件的详细信息。” + +在 2017 年,Mozilla 宣布了它的最小可行的产品,并使其脱离预览版。到该年年底,所有主流的浏览器都采用了它。[2019 年 12 月][4],WebAssembly 工作组发布了三个 W3C 推荐的 WebAssembly 规范。 + +WebAssembly 为可执行程序、相应的文本汇编语言以及用于促进此类程序与其主机环境之间的交互的接口定义了一种可移植的二进制代码格式。WebAssembly 代码在低级虚拟机中运行,该虚拟机模仿可以在其上运行的许多微处理器的功能。通过即时(JIT)编译或解释,WebAssembly 引擎可以以近乎原生平台编译代码的速度执行。 + +### 为什么现在感兴趣? + +当然,最近对 WebAssembly 感兴趣的部分原因是最初希望在浏览器中运行更多计算密集型代码。尤其是笔记本电脑用户,越来越多的时间都花在浏览器上(或者,对于 Chromebook 用户来说,基本上是所有时间)。这种趋势已经迫切需要消除在浏览器中运行各种应用程序的障碍。这些障碍之一通常是性能的某些方面,这正是 WebAssembly 及其前身最初旨在解决的问题。 + +但是,WebAssembly 并不仅仅适用于浏览器。在 2019 年,[Mozilla 宣布了一个名为 WASI][5](WebAssembly 系统接口)的项目,以标准化 WebAssembly 代码如何与浏览器上下文之外的操作系统进行交互。通过将浏览器对 WebAssembly 和 WASI 的支持结合在一起,编译后的二进制文件将能够以接近本机的速度跨不同的设备和操作系统在浏览器内外运行。 + +WebAssembly 的低开销立即使它可以在浏览器之外使用,但这无疑是赌注;显然,还有其它不会引入性能瓶颈的运行应用程序的方法。为什么要专门使用 WebAssembly? + +一个重要的原因是它的可移植性。如今,像 C++ 和 Rust 这样的广泛使用的编译语言可能是与 WebAssembly 关联最紧密的语言。但是,[各种各样的其他语言][6] 可以在 WebAssembly 中将其虚拟机编译或拥有它们的虚拟机。此外,尽管 WebAssembly 为其执行环境[假定了某些先决条件][7],但它被设计为在各种操作系统和指令集体系结构上有效执行。因此,WebAssembly 代码可以使用多种语言编写,并可以在多种操作系统和处理器类型上运行。 + +另一个 WebAssembly 优势源于这样一个事实:代码在虚拟机中运行。因此,每个 WebAssembly 模块都在沙盒环境中执行,并使用故障隔离技术将其与主机运行时分开。这意味着,对于其它部分而言,应用程序独立于其主机环境的其余部分执行,如果不调用适当的 API,就无法摆脱沙箱。 + +### WebAssembly 在行动 + +这一切在实践中意味着什么? + +WebAssembly 的一个例子是 [Enarx][8]。 + +Enarx 是一个提供硬件独立性的项目,可使用受信任的执行环境Trusted Execution Environments(TEE)保护应用程序的安全。Enarx 使你可以安全地将编译为 WebAssembly 的应用程序始终交付到云提供程序中,并远程执行它。正如 Red Hat 安全工程师 [Nathaniel McCallum 指出的那样][9]:“我们这样做的方式是,我们将你的应用程序作为输入,并使用远程硬件执行认证过程。我们使用加密技术验证了远程硬件实际上是它声称的硬件。最终的结果不仅是我们对硬件的信任度提高了;它也是一个会话密钥,我们可以使用它将加密的代码和数据传递到我们刚刚要求加密验证的环境中。” + +另一个例子是 OPA,开放政策代理,它在 2019 年 11 月[发布][10],你可以[编译][11]他们的政策定义语言,Rego,为 WebAssembly。 +Rego 允许你编写逻辑来搜索和组合来自不同来源的 JSON/YAML 数据,以询问诸如“是否允许使用此 API?”之类的问题。 + +OPA 已被用于支持策略的软件,包括但不限于 Kubernetes。使用 OPA 之类的工具简化策略[被认为是在各种不同环境中正确保护 Kubernetes 部署的重要步骤][12]。WebAssembly 的可移植性和内置的安全功能非常适合这些工具。 + +我们的最后一个例子是 [Unity][13]。还记得我们在文章开头提到过 WebAssembly 用于游戏吗?好吧,跨平台游戏引擎 Unity 是 WebAssembly 的较早采用者,它提供了在浏览器中运行的 Wasm 的首个演示,并且自 2018 年 8 月以来,[已使用 WebAssembly][14]作为 Unity WebGL 构建目标的输出目标。 + +这些只是 WebAssembly 已经开始产生影响的几种方式。你可以在 上查找更多信息并了解 Wasm 的所有最新信息。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/webassembly + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://opensource.com/article/19/8/webassembly-speed-code-reuse +[3]: https://www.cnet.com/news/the-secret-alliance-that-could-give-the-web-a-massive-speed-boost/ +[4]: https://www.w3.org/blog/news/archives/8123 +[5]: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ +[6]: https://github.com/appcypher/awesome-wasm-langs +[7]: https://webassembly.org/docs/portability/ +[8]: https://enarx.io +[9]: https://enterprisersproject.com/article/2019/9/application-security-4-facts-confidential-computing-consortium +[10]: https://blog.openpolicyagent.org/tagged/webassembly +[11]: https://github.com/open-policy-agent/opa/tree/master/wasm +[12]: https://enterprisersproject.com/article/2019/11/kubernetes-reality-check-3-takeaways-kubecon +[13]: https://opensource.com/article/20/1/www.unity.com +[14]: https://blogs.unity3d.com/2018/08/15/webassembly-is-here/ From 5633a1ad209ea0ab7a6109a9636d33039ee9b76a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 27 Jan 2020 00:52:49 +0800 Subject: [PATCH 0421/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200126=20Use?= =?UTF-8?q?=20Vim=20to=20send=20email=20and=20check=20your=20calendar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200126 Use Vim to send email and check your calendar.md --- ...m to send email and check your calendar.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 sources/tech/20200126 Use Vim to send email and check your calendar.md diff --git a/sources/tech/20200126 Use Vim to send email and check your calendar.md b/sources/tech/20200126 Use Vim to send email and check your calendar.md new file mode 100644 index 0000000000..fdb709aaef --- /dev/null +++ b/sources/tech/20200126 Use Vim to send email and check your calendar.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Vim to send email and check your calendar) +[#]: via: (https://opensource.com/article/20/1/vim-email-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use Vim to send email and check your calendar +====== +Manage your email and calendar right from your text editor in the +sixteenth in our series on 20 ways to be more productive with open +source in 2020. +![Calendar close up snapshot][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Doing (almost) all the things with Vim, part 1 + +I use two text editors regularly—[Vim][2] and [Emacs][3]. Why both? They have different use cases, and I'll talk about some of them in the next few articles in this series. + +![][4] + +OK, so why do everything in Vim? Because if there is one application that is on every machine I have access to, it's Vim. And if you are like me, you probably already spend a lot of time in Vim. So why not use it for _all the things_? + +Before that, though, you need to do some things. The first is to make sure you have Ruby support in Vim. You can check that with **vim --version | grep ruby**. If the result is not **+ruby**, that needs to be fixed. This can be tricky, and you should check your distribution's documentation for the right package to install. On MacOS, this is the official MacVim (not from Brew), and on most Linux distributions, this is either vim-nox or vim-gtk—NOT vim-gtk3. + +I use [Pathogen][5] to autoload my plugins and bundles. If you use [Vundle][6] or another Vim package manager, you'll need to adjust the commands below to work with it. + +#### Do your email in Vim + +A good starting place for making Vim a bigger part of your productivity plan is using it to send and receive email with [Notmuch][7] using [abook][8] to access your contact list. You need to install some things for this. All the sample code below is on Ubuntu, so you'll need to adjust for that if you are using a different distribution. Do the setup with: + + +``` +sudo apt install notmuch-vim ruby-mail +curl -o ~/.vim/plugin/abook --create-dirs +``` + +So far, so good. Now start Vim and execute **:NotMuch**. There may be some warnings due to the older version of the mail library **notmuch-vim** was written for, but in general, Vim will now be a full-featured Notmuch mail client. + +![Reading Mail in Vim][9] + +If you want to perform a search for a specific tag, type **\t**, enter the name of the tag, and press Enter. This will pull up a list of all messages with that tag. The **\s** key combination brings up a **Search:** prompt that will do a full search of the Notmuch database. Navigate the message list with the arrow keys, press Enter to display the selected item, and enter **\q** to exit the current view. + +To compose mail, use the **\c** keystroke. You will see a blank message. This is where the **abook.vim** plugin comes in. Hit **Esc** and enter **:AbookQuery <SomeName>**, where <SomeName> is a part of the name or email address you want to look for. You will get a list of entries in the abook database that match your search. Select the address you want by typing its number to add it to the email's address line. Finish typing and editing the email, press **Esc** to exit edit mode, and enter **,s** to send. + +If you want to change the default folder view when **:NotMuch** starts up, you can add the variable **g:notmuch_folders** to your **.vimrc** file: + + +``` +let g:notmuch_folders = [ +      \ [ 'new', 'tag:inbox and tag:unread' ], +      \ [ 'inbox', 'tag:inbox' ], +      \ [ 'unread', 'tag:unread' ], +      \ [ 'News', 'tag:@sanenews' ], +      \ [ 'Later', 'tag:@sanelater' ], +      \ [ 'Patreon', 'tag:@patreon' ], +      \ [ 'LivestockConservancy', 'tag:livestock-conservancy' ], +    \ ] +``` + +There are many more settings covered in the Notmuch plugin's documentation, including setting up keys for tags and using alternate mail programs. + +#### Consult your calendar in Vim + +![][10] + +Sadly, there do not appear to be any calendar programs for Vim that use the vCalendar or iCalendar formats. There is [Calendar.vim][11], which is very well done. Set up Vim to access your calendar with: + + +``` +cd ~/.vim/bundle +git clone [git@github.com][12]:itchyny/calendar.vim.git +``` + +Now, you can see your calendar in Vim by entering **:Calendar**. You can switch between year, month, week, day, and clock views with the **<** and **>** keys. If you want to start with a particular view, use the **-view=** flag to tell it which one you wish to see. You can also add a date to any of the views. For example, if I want to see what is going on the week of July 4, 2020, I would enter **:Calendar -view week 7 4 2020**. The help is pretty good and can be accessed with the **?** key. + +![][13] + +Calendar.vim also supports Google Calendar (which I need), but in December 2019 Google disabled the access for it. The author has posted a workaround in [the issue on +GitHub][14]. + +So there you have it, your mail, addresses, and calendars in Vim. But you aren't done yet; you'll do even more with Vim tomorrow! + +Vim offers great benefits to writers, regardless of whether they are technically minded or not. + +Need to keep your schedule straight? Learn how to do it using open source with these free... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/vim-email-calendar + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/emacs/ +[4]: https://opensource.com/sites/default/files/uploads/day16-image1.png +[5]: https://github.com/tpope/vim-pathogen +[6]: https://github.com/VundleVim/Vundle.vim +[7]: https://opensource.com/article/20/1/organize-email-notmuch +[8]: https://opensource.com/article/20/1/sync-contacts-locally +[9]: https://opensource.com/sites/default/files/uploads/productivity_16-2.png (Reading Mail in Vim) +[10]: https://opensource.com/sites/default/files/uploads/day16-image3.png +[11]: https://github.com/itchyny/calendar.vim +[12]: mailto:git@github.com +[13]: https://opensource.com/sites/default/files/uploads/day16-image4.png +[14]: https://github.com/itchyny/calendar.vim/issues/156 From 7fad82034332ac7d4552b67022ef46f21b16b3d9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 27 Jan 2020 00:53:20 +0800 Subject: [PATCH 0422/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200126=20What?= =?UTF-8?q?'s=20your=20favorite=20Linux=20distribution=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200126 What-s your favorite Linux distribution.md --- ...What-s your favorite Linux distribution.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sources/tech/20200126 What-s your favorite Linux distribution.md diff --git a/sources/tech/20200126 What-s your favorite Linux distribution.md b/sources/tech/20200126 What-s your favorite Linux distribution.md new file mode 100644 index 0000000000..029a4272e8 --- /dev/null +++ b/sources/tech/20200126 What-s your favorite Linux distribution.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's your favorite Linux distribution?) +[#]: via: (https://opensource.com/article/20/1/favorite-linux-distribution) +[#]: author: (Opensource.com https://opensource.com/users/admin) + +What's your favorite Linux distribution? +====== +Take our 7th annual poll to let us know your preference in Linux +distribution. +![Hand putting a Linux file folder into a drawer][1] + +What's your favorite Linux distribution? Take our 7th annual poll. Some have come and gone, but there are hundreds of [Linux distributions][2] alive and well today. The combination of distribution, package manager, and desktop creates an endless amount of customized environments for Linux users. + +We asked the community of writers what their favorite is and why. While there were some commonalities (Fedora and Ubuntu were popular choices for a variety of reasons), we heard a few surprises as well. Here are a few of their responses: + +"I use the Fedora distro! I love the community of people who work together to make an awesome operating system that showcases the greatest innovations in the free and open source software world." — Matthew Miller + +"I use Arch at home. As a gamer, I want easy access to the latest Wine versions and GFX drivers, as well as large amounts of control over my OS. Give me a rolling-release distro with every package at bleeding-edge." —Aimi Hobson + +"NixOS, with nothing coming close in the hobbyist niche." —Alexander Sosedkin + +"I have used every Fedora version as my primary work OS. Meaning, I started with the first one. Early on, I asked myself if there would ever come a time when I couldn't remember which number I was on. That time has arrived. What year is it, anyway?" —Hugh Brock + +"I usually have Ubuntu, CentOS, and Fedora boxes running around the house and the office. We depend on all of these distributions for various things. Fedora for speed and getting the latest versions of applications and libraries. Ubuntu for those that need easy of use with a large community of support. CentOS when we need a rock-solid server platform that just runs." —Steve Morris + +"My favorite? For the community, and how packages are built for the distribution (from source, not binaries), I choose Fedora. For pure breadth of packages available and elegance in how packages are defined and developed, I choose Debian. For documentation, I choose Arch. For newbies that ask, I used to recommend Ubuntu but now recommend Fedora." —Al Stone + +* * * + +We've been asking the community this question since 2014. With the exception of PCLinuxOS taking the lead in 2015, Ubuntu tends to be the fan-favorite from year to year. Other popular contenders have been Fedora, Debian, Mint, and Arch. Which distribution stands out to you in the new decade? If we didn't include your favorite in the list of choices, tell us about it in the comments.  + +Here's a look at your favorite Linux distributions throughout the last seven years. You can find this in our latest yearbook, [Best of a decade on Opensource.com][3]. To download the whole eBook, [click here][3]! + +![Poll results for favorite Linux distribution through the years][4] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/favorite-linux-distribution + +作者:[Opensource.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/admin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://distrowatch.com/ +[3]: https://opensource.com/downloads/2019-yearbook-special-edition +[4]: https://opensource.com/sites/default/files/pictures/linux-distributions-through-the-years.jpg (favorite Linux distribution through the years) From 501973fc5da016d6942468ee73bf346b9b9c03e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 27 Jan 2020 08:31:28 +0800 Subject: [PATCH 0423/3057] translating --- .../20200123 Wine 5.0 is Released- Here-s How to Install it.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md b/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md index 4c82b48a5d..3a06b5b5cb 100644 --- a/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md +++ b/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 44ca927bb7b9a004ba873e5379177a3b6b213fc1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 27 Jan 2020 12:54:04 +0800 Subject: [PATCH 0424/3057] PRF @laingke --- ...y everyone is talking about WebAssembly.md | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200115 Why everyone is talking about WebAssembly.md b/translated/tech/20200115 Why everyone is talking about WebAssembly.md index 5da77c0d4d..3f3bc274e8 100644 --- a/translated/tech/20200115 Why everyone is talking about WebAssembly.md +++ b/translated/tech/20200115 Why everyone is talking about WebAssembly.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Why everyone is talking about WebAssembly) @@ -9,51 +9,52 @@ 为什么每个人都在谈论 WebAssembly ====== -了解有关在 Web 浏览器中运行任何代码的最新方法的更多信息。 -![Digital creative of a browser on the internet][1] -如果你还没有听说过 [WebAssembly][2],那么你很快就会知道。这是业界保存最完好的秘密之一,但无处不在。所有主流的浏览器都支持它,并且它也将在服务器端使用。它很快。它被用于游戏。这是一个开放的万维网联盟(W3C),主要的国际网络标准组织。它与平台无关,可以在 Linux,Mac 和 Windows 上运行。 +> 了解有关在 Web 浏览器中运行任何代码的最新方法的更多信息。 -你可能会说:“哇,这听起来像是我应该学习编程的东西!” 你可能是对的,但你也可能是错的。你不需要用 WebAssembly 编码。让我们花一些时间来学习通常被缩写为“Wasm”的技术。 +![](https://img.linux.net.cn/data/attachment/album/202001/27/125343ch0hxdfbzibrihfn.jpg) + +如果你还没有听说过 [WebAssembly][2],那么你很快就会知道。这是业界最保密的秘密之一,但它无处不在。所有主流的浏览器都支持它,并且它也将在服务器端使用。它很快,它能用于游戏编程。这是主要的国际网络标准组织万维网联盟(W3C)的一个开放标准。 + +你可能会说:“哇,这听起来像是我应该学习编程的东西!”你可能是对的,但也是错的。你不需要用 WebAssembly 编程。让我们花一些时间来学习这种通常被缩写为“Wasm”的技术。 ### 它从哪里来? 大约十年前,人们越来越认识到,广泛使用的 JavaScript 不够快速,无法满足许多目的。JavaScript 无疑是成功和方便的。它可以在任何浏览器中运行,并启用了今天我们认为理所当然的动态网页类型。但这是一种高级语言,在设计时并没有考虑到计算密集型工作负载。 -然而,尽管负责主流 web 浏览器的工程师们对性能问题的看法大体一致,但他们对如何解决这个问题却意见不一。两个阵营出现。谷歌开始了它的原生客户端Native Client项目,后来又推出了可移植原生客户端Portable Native Client变体,着重于允许用 C/C++ 编写的游戏和其它软件在 Chrome 的一个安全隔间中运行。与此同时,Mozilla 赢得了微软对 asm.js 的支持。该方法更新了浏览器,因此它可以非常快速地运行底层的 JavaScript 指令子集(另一个项目使 C/C++ 代码可以转换为这些指令)。 +然而,尽管负责主流 web 浏览器的工程师们对性能问题的看法大体一致,但他们对如何解决这个问题却意见不一。出现了两个阵营,谷歌开始了它的原生客户端Native Client项目,后来又推出了可移植原生客户端Portable Native Client变体,着重于允许用 C/C++ 编写的游戏和其它软件在 Chrome 的一个安全隔间中运行。与此同时,Mozilla 赢得了微软对 asm.js 的支持。该方法更新了浏览器,因此它可以非常快速地运行 JavaScript 指令的低级子集(有另一个项目可以将 C/C++ 代码转换为这些指令)。 -在这两个阵营都没有得到广泛采用的情况下,各方在 2015 年同意围绕一种称为 WebAssembly 的新标准,以 asm.js 所采用的基本方法为基础,共同努力。[如 CNET 的 Stephen Shankland 当时所写][3],“在当今的 Web 上,浏览器的 JavaScript 将这些指令转换为机器代码。但是,通过 WebAssembly,程序员可以在此过程的早期阶段完成很多工作,从而生成介于两种状态之间的程序。这使浏览器摆脱了创建机器代码的繁琐工作,但也实现了 Web 的承诺——该软件将在具有浏览器的任何设备上运行,而无需考虑基础硬件的详细信息。” +由于这两个阵营都没有得到广泛采用,各方在 2015 年同意围绕一种称为 WebAssembly 的新标准,以 asm.js 所采用的基本方法为基础,联合起来。[如 CNET 的 Stephen Shankland 当时所写][3],“在当今的 Web 上,浏览器的 JavaScript 将这些指令转换为机器代码。但是,通过 WebAssembly,程序员可以在此过程的早期阶段完成很多工作,从而生成介于两种状态之间的程序。这使浏览器摆脱了创建机器代码的繁琐工作,但也实现了 Web 的承诺 —— 该软件将在具有浏览器的任何设备上运行,而无需考虑基础硬件的细节。” -在 2017 年,Mozilla 宣布了它的最小可行的产品,并使其脱离预览版。到该年年底,所有主流的浏览器都采用了它。[2019 年 12 月][4],WebAssembly 工作组发布了三个 W3C 推荐的 WebAssembly 规范。 +在 2017 年,Mozilla 宣布了它的最小可行的产品(MVP),并使其脱离预览版阶段。到该年年底,所有主流的浏览器都采用了它。[2019 年 12 月][4],WebAssembly 工作组发布了三个 W3C 推荐的 WebAssembly 规范。 -WebAssembly 为可执行程序、相应的文本汇编语言以及用于促进此类程序与其主机环境之间的交互的接口定义了一种可移植的二进制代码格式。WebAssembly 代码在低级虚拟机中运行,该虚拟机模仿可以在其上运行的许多微处理器的功能。通过即时(JIT)编译或解释,WebAssembly 引擎可以以近乎原生平台编译代码的速度执行。 +WebAssembly 定义了一种可执行程序的可移植二进制代码格式、相应的文本汇编语言以及用于促进此类程序与其宿主环境之间的交互接口。WebAssembly 代码在低级虚拟机中运行,这个可运行于许多微处理器之上的虚拟机可模仿这些处理器的功能。通过即时(JIT)编译或解释,WebAssembly 引擎可以以近乎原生平台编译代码的速度执行。 ### 为什么现在感兴趣? 当然,最近对 WebAssembly 感兴趣的部分原因是最初希望在浏览器中运行更多计算密集型代码。尤其是笔记本电脑用户,越来越多的时间都花在浏览器上(或者,对于 Chromebook 用户来说,基本上是所有时间)。这种趋势已经迫切需要消除在浏览器中运行各种应用程序的障碍。这些障碍之一通常是性能的某些方面,这正是 WebAssembly 及其前身最初旨在解决的问题。 -但是,WebAssembly 并不仅仅适用于浏览器。在 2019 年,[Mozilla 宣布了一个名为 WASI][5](WebAssembly 系统接口)的项目,以标准化 WebAssembly 代码如何与浏览器上下文之外的操作系统进行交互。通过将浏览器对 WebAssembly 和 WASI 的支持结合在一起,编译后的二进制文件将能够以接近本机的速度跨不同的设备和操作系统在浏览器内外运行。 +但是,WebAssembly 并不仅仅适用于浏览器。在 2019 年,[Mozilla 宣布了一个名为 WASI][5](WebAssembly 系统接口WebAssembly System Interface)的项目,以标准化 WebAssembly 代码如何与浏览器上下文之外的操作系统进行交互。通过将浏览器对 WebAssembly 和 WASI 的支持结合在一起,编译后的二进制文件将能够以接近原生的速度,跨不同的设备和操作系统在浏览器内外运行。 WebAssembly 的低开销立即使它可以在浏览器之外使用,但这无疑是赌注;显然,还有其它不会引入性能瓶颈的运行应用程序的方法。为什么要专门使用 WebAssembly? -一个重要的原因是它的可移植性。如今,像 C++ 和 Rust 这样的广泛使用的编译语言可能是与 WebAssembly 关联最紧密的语言。但是,[各种各样的其他语言][6] 可以在 WebAssembly 中将其虚拟机编译或拥有它们的虚拟机。此外,尽管 WebAssembly 为其执行环境[假定了某些先决条件][7],但它被设计为在各种操作系统和指令集体系结构上有效执行。因此,WebAssembly 代码可以使用多种语言编写,并可以在多种操作系统和处理器类型上运行。 +一个重要的原因是它的可移植性。如今,像 C++ 和 Rust 这样的广泛使用的编译语言可能是与 WebAssembly 关联最紧密的语言。但是,[各种各样的其他语言][6]可以编译为 WebAssembly 或拥有它们的 WebAssembly 虚拟机。此外,尽管 WebAssembly 为其执行环境[假定了某些先决条件][7],但它被设计为在各种操作系统和指令集体系结构上有效执行。因此,WebAssembly 代码可以使用多种语言编写,并可以在多种操作系统和处理器类型上运行。 -另一个 WebAssembly 优势源于这样一个事实:代码在虚拟机中运行。因此,每个 WebAssembly 模块都在沙盒环境中执行,并使用故障隔离技术将其与主机运行时分开。这意味着,对于其它部分而言,应用程序独立于其主机环境的其余部分执行,如果不调用适当的 API,就无法摆脱沙箱。 +另一个 WebAssembly 优势源于这样一个事实:代码在虚拟机中运行。因此,每个 WebAssembly 模块都在沙盒环境中执行,并使用故障隔离技术将其与宿主机运行时环境分开。这意味着,对于其它部分而言,应用程序独立于其宿主机环境的其余部分执行,如果不调用适当的 API,就无法摆脱沙箱。 -### WebAssembly 在行动 +### WebAssembly 现状 这一切在实践中意味着什么? -WebAssembly 的一个例子是 [Enarx][8]。 +如今在运作中的 WebAssembly 的一个例子是 [Enarx][8]。 -Enarx 是一个提供硬件独立性的项目,可使用受信任的执行环境Trusted Execution Environments(TEE)保护应用程序的安全。Enarx 使你可以安全地将编译为 WebAssembly 的应用程序始终交付到云提供程序中,并远程执行它。正如 Red Hat 安全工程师 [Nathaniel McCallum 指出的那样][9]:“我们这样做的方式是,我们将你的应用程序作为输入,并使用远程硬件执行认证过程。我们使用加密技术验证了远程硬件实际上是它声称的硬件。最终的结果不仅是我们对硬件的信任度提高了;它也是一个会话密钥,我们可以使用它将加密的代码和数据传递到我们刚刚要求加密验证的环境中。” +Enarx 是一个提供硬件独立性的项目,可使用受信任的执行环境Trusted Execution Environments(TEE)保护应用程序的安全。Enarx 使你可以安全地将编译为 WebAssembly 的应用程序始终交付到云服务商,并远程执行它。正如 Red Hat 安全工程师 [Nathaniel McCallum 指出的那样][9]:“我们这样做的方式是,我们将你的应用程序作为输入,并使用远程硬件执行认证过程。我们使用加密技术验证了远程硬件实际上是它声称的硬件。最终的结果不仅是我们对硬件的信任度提高了;它也是一个会话密钥,我们可以使用它将加密的代码和数据传递到我们刚刚要求加密验证的环境中。” -另一个例子是 OPA,开放政策代理,它在 2019 年 11 月[发布][10],你可以[编译][11]他们的政策定义语言,Rego,为 WebAssembly。 -Rego 允许你编写逻辑来搜索和组合来自不同来源的 JSON/YAML 数据,以询问诸如“是否允许使用此 API?”之类的问题。 +另一个例子是 OPA,开放策略代理Open Policy Agent,它[发布][10]于 2019 年 11 月,你可以[编译][11]他们的策略定义语言 Rego 为 WebAssembly。Rego 允许你编写逻辑来搜索和组合来自不同来源的 JSON/YAML 数据,以询问诸如“是否允许使用此 API?”之类的问题。 -OPA 已被用于支持策略的软件,包括但不限于 Kubernetes。使用 OPA 之类的工具简化策略[被认为是在各种不同环境中正确保护 Kubernetes 部署的重要步骤][12]。WebAssembly 的可移植性和内置的安全功能非常适合这些工具。 +OPA 已被用于支持策略的软件,包括但不限于 Kubernetes。使用 OPA 之类的工具来简化策略[被认为是在各种不同环境中正确保护 Kubernetes 部署的重要步骤][12]。WebAssembly 的可移植性和内置的安全功能非常适合这些工具。 -我们的最后一个例子是 [Unity][13]。还记得我们在文章开头提到过 WebAssembly 用于游戏吗?好吧,跨平台游戏引擎 Unity 是 WebAssembly 的较早采用者,它提供了在浏览器中运行的 Wasm 的首个演示,并且自 2018 年 8 月以来,[已使用 WebAssembly][14]作为 Unity WebGL 构建目标的输出目标。 +我们的最后一个例子是 [Unity][13]。还记得我们在文章开头提到过 WebAssembly 可用于游戏吗?好吧,跨平台游戏引擎 Unity 是 WebAssembly 的较早采用者,它提供了在浏览器中运行的 Wasm 的首个演示品,并且自 2018 年 8 月以来,[已将 WebAssembly][14]用作 Unity WebGL 构建目标的输出目标。 这些只是 WebAssembly 已经开始产生影响的几种方式。你可以在 上查找更多信息并了解 Wasm 的所有最新信息。 @@ -64,7 +65,7 @@ via: https://opensource.com/article/20/1/webassembly 作者:[Mike Bursell][a] 选题:[lujun9972][b] 译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 08d75831224b3fb961b231009a20eb6bb4bba42e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 27 Jan 2020 12:54:51 +0800 Subject: [PATCH 0425/3057] PUB @laingke https://linux.cn/article-11823-1.html --- .../20200115 Why everyone is talking about WebAssembly.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200115 Why everyone is talking about WebAssembly.md (99%) diff --git a/translated/tech/20200115 Why everyone is talking about WebAssembly.md b/published/20200115 Why everyone is talking about WebAssembly.md similarity index 99% rename from translated/tech/20200115 Why everyone is talking about WebAssembly.md rename to published/20200115 Why everyone is talking about WebAssembly.md index 3f3bc274e8..e8fdb04ce0 100644 --- a/translated/tech/20200115 Why everyone is talking about WebAssembly.md +++ b/published/20200115 Why everyone is talking about WebAssembly.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11823-1.html) [#]: subject: (Why everyone is talking about WebAssembly) [#]: via: (https://opensource.com/article/20/1/webassembly) [#]: author: (Mike Bursell https://opensource.com/users/mikecamel) From 6763227775c6eb152c157353903c1bcca59c72c8 Mon Sep 17 00:00:00 2001 From: laingke Date: Mon, 27 Jan 2020 13:35:05 +0800 Subject: [PATCH 0426/3057] 20200103-inter-process-communication-linux translating --- ...ucing the guide to inter-process communication in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md b/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md index c0b7eee940..1d0ad46667 100644 --- a/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md +++ b/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -162,7 +162,7 @@ via: https://opensource.com/article/20/1/inter-process-communication-linux 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 06dc5110d3f5c857f949a9426b9f495d3d139369 Mon Sep 17 00:00:00 2001 From: laingke Date: Mon, 27 Jan 2020 14:20:51 +0800 Subject: [PATCH 0427/3057] 20200103-inter-process-communication-linux translated --- ...to inter-process communication in Linux.md | 176 ------------------ ...to inter-process communication in Linux.md | 168 +++++++++++++++++ 2 files changed, 168 insertions(+), 176 deletions(-) delete mode 100644 sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md create mode 100644 translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md diff --git a/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md b/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md deleted file mode 100644 index 1d0ad46667..0000000000 --- a/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md +++ /dev/null @@ -1,176 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (laingke) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Introducing the guide to inter-process communication in Linux) -[#]: via: (https://opensource.com/article/20/1/inter-process-communication-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Introducing the guide to inter-process communication in Linux -====== -This free eBook gives seasoned and occasional coders insight into the -core concepts and mechanisms of inter-process communication (IPC) in -Linux. -![Inter-process Communication in Linux][1] - -Getting one software process to talk to another software process is a delicate balancing act. It can be a vital function for an application, though, so it's a problem any programmer embarking on a complex project has to solve. Whether your application needs to kick off a job being handled by someone else's software; to monitor an action being performed by a peripheral or over a network; or to detect a signal from some other source, when your software relies on something outside of its own code to know what to do next or when to do it, you need to think about inter-process communication (IPC). - -The Unix operating system accounted for this long ago, possibly because of an early expectation that software would originate from diverse sources. In the same tradition, Linux provides many of the same interfaces for IPC and some new ones. The Linux kernel features several IPC methods, and the [util-linux package][2] contains the **ipcmk**, **ipcrm**, **ipcs**, and **lsipc** commands for monitoring and managing IPC messages. - -### Show IPC information - -Before experimenting with IPC, you should know what IPC facilities are already on your system. The **lsipc** command provides that information. - - -``` -RESOURCE DESCRIPTION               LIMIT  USED  USE% -MSGMNI   Number of message queues  32000     0 0.00% -MSGMAX   Max size of message (byt.. 8192     -     - -MSGMNB   Default max size of queue 16384     -     - -SHMMNI   Shared memory segments     4096    79 1.93% -SHMALL   Shared memory pages       184[...] 25452 0.00% -SHMMAX   Max size of shared memory 18446744073692774399 -SHMMIN   Min size of shared memory     1     -     - -SEMMNI   Number of semaphore ident 32000     0 0.00% -SEMMNS   Total number of semaphore 1024000.. 0 0.00% -SEMMSL   Max semaphores per semap  32000     -     - -SEMOPM   Max number of operations p  500     -     - -SEMVMX   Semaphore max value       32767     -     - -``` - -You may notice that this sample listing includes three different types of IPC mechanisms, each available in the Linux kernel: messages (MSG), shared memory (SHM), and semaphores (SEM). You can view current activity in each of those subsystems with the **ipcs** command: - - -``` -$ ipcs - -\------ Message Queues Creators/Owners --- -msqid     perms     cuid      cgid  [...] - -\------ Shared Memory Segment Creators/Owners -shmid     perms    cuid    cgid  [...] -557056    700      seth    users [...] -3571713   700      seth    users [...] -2654210   600      seth    users [...] -2457603   700      seth    users [...] - -\------ Semaphore Arrays Creators/Owners --- -semid     perms     cuid      cgid  [...] -``` - -This shows that there currently are no messages or semaphore arrays, but a number of shared memory segments are in use. - -There's a simple example you can perform on your system so you can see one of these systems at work. It involves some C code, so you must have build tools on your system. The names of the packages you must install to be able to build from source code vary depending on your distro, so refer to your documentation for specifics. For example, on Debian-based distributions, you can learn about build requirements on the [BuildingTutorial][3] section of the wiki, and on Fedora-based distributions, refer to the [Installing software from source][4] section of the docs. - -### Create a message queue - -Your system has a default message queue already, but you can create your own using the **ipcmk** command: - - -``` -$ ipcmk --queue -Message queue id: 32764 -``` - -Write a simple IPC message sender, hard-coding in the queue ID for simplicity: - - -``` -#include <sys/ipc.h> -#include <sys/msg.h> -#include <stdio.h> -#include <string.h> - -struct msgbuffer { -  char text[24]; -} message; - -int main() { -    int msqid = 32764; -    strcpy(message.text,"opensource.com"); -    msgsnd(msqid, &message, sizeof(message), 0); -    printf("Message: %s\n",message.text); -    printf("Queue: %d\n",msqid); -    return 0; -        } -``` - -Compile the application and run it: - - -``` -$ gcc msgsend.c -o msg.bin -$ ./msg.bin -Message: opensource.com -Queue: 32769 -``` - -You just sent a message to your message queue. You can verify that with the **ipcs** command, using the **\--queue** option to limit output to the message queue: - - -``` -$ ipcs -q - -\------ Message Queues -------- -key        msqid   owner  perms  used-bytes  messages -0x7b341ab9 0       seth   666    0          0 -0x72bd8410 32764   seth   644    24         1 -``` - -You can also retrieve those messages with: - - -``` -#include <sys/ipc.h> -#include <sys/msg.h> -#include <stdio.h> - -struct msgbuffer { -    char text[24]; -} message; - -int main() { -    int msqid = 32764; -    msgrcv(msqid, &message, sizeof(message),0,0); -    printf("\nQueue: %d\n",msqid); -    printf("Got this message: %s\n", message.text); -    msgctl(msqid,IPC_RMID,NULL); -    return 0; -``` - -Compile and run with: - - -``` -$ gcc get.c -o get.bin -$ ./get.bin - -Queue: 32764 -Got this message: opensource.com -``` - -### Download [the eBook][5] - -This is just one example of the lessons available in Marty Kalin's [A guide to inter-process communication in Linux][5], the latest free (and Creative Commons) downloadable eBook from Opensource.com. In just a few short lessons, you will learn about POSIX methods of IPC from message queues, shared memory and semaphores, sockets, signals, and much more. Sit down with Marty's book, and you'll emerge a better-informed programmer. But it isn't just for seasoned coders—if all you ever write are shell scripts, there's plenty of practical knowledge about pipes (named and unnamed) and shared files, as well as important concepts you need to know when you use a shared file or an external message queue. - -If you're interested in making great software that's written to be dynamic and system-aware, you need to know about IPC. Let [this book][5] be your guide. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/inter-process-communication-linux - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_inter-process_communication_linux_520x292.png?itok=hPoen7oI (Inter-process Communication in Linux) -[2]: https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/ -[3]: https://wiki.debian.org/BuildingTutorial -[4]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html -[5]: https://opensource.com/downloads/guide-inter-process-communication-linux diff --git a/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md b/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md new file mode 100644 index 0000000000..b88af1f2ca --- /dev/null +++ b/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introducing the guide to inter-process communication in Linux) +[#]: via: (https://opensource.com/article/20/1/inter-process-communication-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 进程间通信介绍指南 +====== +这本免费的电子书使经验丰富的程序员更深入了解 Linux 中进程间通信(IPC)的核心概念和机制。 +![Inter-process Communication in Linux][1] + +让一个软件过程与另一个软件过程进行对话是一个微妙的平衡行为。但是,它对于应用程序而言可能是至关重要的功能,因此这是任何从事复杂项目的程序员都必须解决的问题。你的应用程序是否需要启动由其它软件处理的工作;监视外设或网络上正在执行的操作;或者检测来自其它来源的信号,当你的软件需要依赖其自身代码之外的东西来知道下一步做什么或什么时候做时,你就需要考虑进程间通信(IPC)。 + +Unix 操作系统在很久以前就说明了这一点,这可能是因为人们早就期望软件会来自各种来源。按照相同的传统,Linux 为 IPC 和一些新接口提供了许多相同的接口。Linux 内核具有几个 IPC 方法,[util-linux 包][2]包含 `ipcmk`、`ipcrm`、`ipcs` 和 `lsipc` 命令,用于监视和管理 IPC 消息。 + +### 显示进程间通信信息 + +在尝试 IPC 之前,你应该知道系统上已经有哪些 IPC 工具。`lsipc` 命令提供了该信息。 + +``` +RESOURCE DESCRIPTION LIMIT USED USE% +MSGMNI Number of message queues 32000 0 0.00% +MSGMAX Max size of message (byt.. 8192 - - +MSGMNB Default max size of queue 16384 - - +SHMMNI Shared memory segments 4096 79 1.93% +SHMALL Shared memory pages 184[...] 25452 0.00% +SHMMAX Max size of shared memory 18446744073692774399 +SHMMIN Min size of shared memory 1 - - +SEMMNI Number of semaphore ident 32000 0 0.00% +SEMMNS Total number of semaphore 1024000.. 0 0.00% +SEMMSL Max semaphores per semap 32000 - - +SEMOPM Max number of operations p 500 - - +SEMVMX Semaphore max value 32767 - - +``` + +你可能注意到,这个示例清单包含三种不同类型的 IPC 机制,每种机制在 Linux 内核中都是可用的:消息(MSG)、共享内存(SHM)和信号量(SEM)。你可以用 `ipcs` 命令查看每个子系统的当前活动: + +``` +$ ipcs + +\------ Message Queues Creators/Owners --- +msqid perms cuid cgid [...] + +\------ Shared Memory Segment Creators/Owners +shmid perms cuid cgid [...] +557056 700 seth users [...] +3571713 700 seth users [...] +2654210 600 seth users [...] +2457603 700 seth users [...] + +\------ Semaphore Arrays Creators/Owners --- +semid perms cuid cgid [...] +``` + +这表明当前没有消息或信号量数组,但是使用了一些共享内存段。 + +你可以在系统上执行一个简单的示例,这样就可以看到其中一个系统正在工作。它涉及到一些 C 代码,所以你必须在系统上有构建工具。必须安装才能从源代码构建的软件包的名称取决于发行版,因此请参考文档以获取详细信息。例如,在基于 Debian 的发行版上,你可以在 wiki 的[构建教程][3]部分了解构建需求,而在基于 Fedora 的发行版上,你可以参考文档的[从源代码安装软件][4]部分。 + +### 创建一个消息队列 + +你的系统已经有一个默认的消息队列,但是你可以使用 `ipcmk` 命令创建你自己的消息队列: + +``` +$ ipcmk --queue +Message queue id: 32764 +``` + +编写一个简单的 IPC 消息发送器,为了简单,在队列 ID 中硬编码: + +``` +#include +#include +#include +#include + +struct msgbuffer { + char text[24]; +} message; + +int main() { + int msqid = 32764; + strcpy(message.text,"opensource.com"); + msgsnd(msqid, &message, sizeof(message), 0); + printf("Message: %s\n",message.text); + printf("Queue: %d\n",msqid); + return 0; +} +``` + +编译应用程序并运行: + + +``` +$ gcc msgsend.c -o msg.bin +$ ./msg.bin +Message: opensource.com +Queue: 32769 +``` + +你刚刚向消息队列发送了一条消息。你可以使用 `ipcs` 命令验证这一点,使用 `\——queue` 选项将输出限制到消息队列: + + +``` +$ ipcs -q + +\------ Message Queues -------- +key msqid owner perms used-bytes messages +0x7b341ab9 0 seth 666 0 0 +0x72bd8410 32764 seth 644 24 1 +``` + +你也可以检索这些讯息: + +``` +#include +#include +#include + +struct msgbuffer { + char text[24]; +} message; + +int main() { + int msqid = 32764; + msgrcv(msqid, &message, sizeof(message),0,0); + printf("\nQueue: %d\n",msqid); + printf("Got this message: %s\n", message.text); + msgctl(msqid,IPC_RMID,NULL); + return 0; +``` + +编译并运行: + +``` +$ gcc get.c -o get.bin +$ ./get.bin + +Queue: 32764 +Got this message: opensource.com +``` + +### 下载[电子书][5] + +这只是 Marty Kalin 的 [Linux 内进程间通信指南][5]中课程的一个例子,这是可从 Opensource.com 下载的最新免费(和知识共享)电子书。在短短的几节课中,你将从消息队列、共享内存和信号量、套接字、信号等中了解 IPC 的 POSIX 方法。认真阅读 Marty 的书,您将成为一个消息灵通的程序员。而这不仅适用于经验丰富的编码人员,如果你编写的只是 shell 脚本,那么你将拥有有关管道(命名和未命名)和共享文件的大量实践知识,以及使用共享文件或外部消息队列时需要了解的重要概念。 + +如果你对制作具有动态和系统意识的优秀软件感兴趣,那么你需要了解 IPC。让[这本书][5]做你的向导。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/inter-process-communication-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_inter-process_communication_linux_520x292.png?itok=hPoen7oI (Inter-process Communication in Linux) +[2]: https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/ +[3]: https://wiki.debian.org/BuildingTutorial +[4]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html +[5]: https://opensource.com/downloads/guide-inter-process-communication-linux From 6056bbda6f2b4b227584e92903e70bbcf0db6b72 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 27 Jan 2020 18:25:12 +0800 Subject: [PATCH 0428/3057] translated --- ...n script to find bugs in your Overcloud.md | 178 ----------------- ...n script to find bugs in your Overcloud.md | 185 ++++++++++++++++++ 2 files changed, 185 insertions(+), 178 deletions(-) delete mode 100644 sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md create mode 100644 translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md diff --git a/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md deleted file mode 100644 index 5f19f114b4..0000000000 --- a/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md +++ /dev/null @@ -1,178 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use this Python script to find bugs in your Overcloud) -[#]: via: (https://opensource.com/article/20/1/logtool-root-cause-identification) -[#]: author: (Arkady Shtempler https://opensource.com/users/ashtempl) - -Use this Python script to find bugs in your Overcloud -====== -LogTool is a set of Python scripts that helps you investigate root -causes for problems in Overcloud nodes. -![Searching for code][1] - -OpenStack stores and manages a bunch of log files on its Overcloud nodes and Undercloud host. Therefore, it's not easy to use OSP log files to investigate a problem you're having, especially when you don't even know what could have caused the problem. - -If that's your situation, [LogTool][2] makes your life much easier! It saves you the time and work it would otherwise take to investigate the root cause manually. Based on a fuzzy string matching algorithm, LogTool provides all the unique error and warning messages that have occurred in the past. You can export these messages for a particular time period, such as 10 minutes ago, an hour ago, a day ago, and so on, based on timestamp in the log. - -LogTool is a set of Python scripts, and its main module, **PyTool.py**, is executed on the Undercloud host. Some operation modes use additional scripts that are executed directly on Overcloud nodes, such as exporting  errors and warnings from Overcloud logs. - -LogTool supports Python 2 and 3, and you can change the working directory according to your needs: [LogTool_Python2][3] or [LogTool_Python3][4]. - -### Operation modes - -#### 1\. Export errors and warnings from Overcloud logs - -This mode is used to extract all unique **ERROR** and **WARNING** messages from Overcloud nodes that took place in the past. As the user, you're prompted to provide the "since time" and debug level to be used for extraction of errors or warnings. For example, if something went wrong in the last 10 minutes, you're be able to extract error and warning messages for just that time period. - -This operation mode generates a directory containing a result file for each Overcloud node. A result file is a simple text file that is compressed (***.gz**) to reduce the time needed to download it from the Overcloud node. To convert a compressed file to a regular text file, you can use [zcat][5] or a similar tool. Also, some versions of Vi and any recent version of Emacs both support reading compressed data. The result file is divided into sections and contains a table of contents at the bottom. - -There are two kinds of log files LogTool detects on the fly: _Standard_ and _Not Standard_. In _Standard_, each log line has a known and defined structure: timestamp, debug level, msg, and so on. In _Not Standard_, the log's structure is unknown; it could be a third party's logs, for example. In the table of contents, you find a "Section name --> Line number" per section, for example: - - * **Raw Data - extracted Errors/Warnings from standard OSP logs since:** This section contains all extracted Error/Warning messages as-is without any modifications or changes. These messages are the raw data LogTool uses for fuzzy matching analysis. - * **Statistics - Number of Errors/Warnings per standard OSP log since:** In this section, you find the amount of Errors and Warnings per Standard log file. This may help you understand potential components used to search for the root cause of your issue. - * **Statistics - Unique messages, per STANDARD OSP log file since:** This section addresses unique Error and Warning messages since a timestamp you provide. For more details about each unique Error or Warning, search for the same message in the Raw Data section. - * **Statistics - Unique messages per NON STANDARD log file, since any time:** This section contains the unique messages in nonstandard log files. Unfortunately, LogTool cannot handle these log files in the same manner as Standard Log files; therefore, the "since time" you provide on extraction will be ignored, and you'll see all of the unique Errors/Warnings messages ever created. So first, scroll down to the table of contents at the bottom of the result file and review its sections—use the line indexes in the table of contents to jump to the relevant sections, where numbers 3, 4, and 5 are most important. - - - -#### 2\. Download all logs from Overcloud nodes - -Logs from all Overcloud nodes are compressed and downloaded to a local directory on your Undercloud host. - -#### 3\. Grep for a string in all Overcloud logs - -This mode "greps" (searches) a string provided by the user on all Overcloud logs. For example, you might want to see all logged messages for a specific request ID, such as the request ID for a "Create VM" that has failed. - -#### 4\. Check current CPU,RAM and Disk on Overcloud - -This mode displays the current CPU, RAM, and disk info on each Overcloud node. - -#### 5\. Execute user's script - -This enables users to run their own scripts on Overcloud nodes. For instance, say an Overcloud deployment failed, so you need to execute the same procedure on each Controller node to fix that. You can implement a "work around" script and to run it on Controllers using this mode. - -#### 6\. Download relevant logs only, by given timestamp - -This mode downloads only the Overcloud logs with _"Last Modified" > "given by user timestamp."_ For example, if you got an error 10 minutes ago, old log files won't be relevant, so downloading them is unnecessary. In addition, you can't (or shouldn't)  attach large files in some bug reporting tools, so this mode might help with making bug reports. - -#### 7\. Export errors and warnings from Undercloud logs - -This is the same as mode #1 above, but for Undercloud logs. - -#### 8\. Check Unhealthy dockers on the Overcloud - -This mode is used to search for unhealthy Dockers on nodes. - -#### 9\. Download OSP logs and run LogTool locally - -This mode allows you to download OSP logs from Jenkins or Log Storage (for example, **cougar11.scl.lab.tlv.redhat.com**) and to analyze the downloaded logs locally. - -#### 10\. Analyze deployment log on the Undercloud - -This mode may help you understand what went wrong during Overcloud or Undercloud deployment. Deployment logs are generated when the **\--log** option is used, for example, inside the **overcloud_deploy.sh** script; the problem is that such logs are not "friendly," and it's hard to understand what went wrong, especially when verbosity is set to **vv** or more, as this makes the log unreadable with a bunch of data inside it. This mode provides some details about all failed tasks. - -#### 11\. Analyze Gerrit(Zuul) failed gate logs - -This mode is used to analyze Gerrit(Zuul) log files. It automatically downloads all files from a remote Gerrit gate (HTTP download) and analyzes all files locally. - -### Installation - -LogTool is available on GitHub. Clone it to your Undercloud host with: - - -``` -`git clone https://github.com/zahlabut/LogTool.git` -``` - -Some external Python modules are also used by the tool: - -#### Paramiko - -This SSH module is usually installed on Undercloud by default. Use the following command to verify whether it's installed: - - -``` -`ls -a /usr/lib/python2.7/site-packages | grep paramiko` -``` - -If you need to install the module, on your Undercloud, execute the following commands: - - -``` -sudo easy_install pip -sudo pip install paramiko==2.1.1 -``` - -#### BeautifulSoup - -This HTML parser module is used only in modes where log files are downloaded using HTTP. It's used to parse the Artifacts HTML page to get all of the links in it. To install BeautifulSoup, enter this command: - - -``` -`pip install beautifulsoup4` -``` - -You can also use the [requirements.txt][6] file to install all the required modules by executing: - - -``` -`pip install -r requirements.txt` -``` - -### Configuration - -All required parameters are set directly inside the **PyTool.py** script. The defaults are: - - -``` -overcloud_logs_dir = '/var/log/containers' -overcloud_ssh_user = 'heat-admin' -overcloud_ssh_key = '/home/stack/.ssh/id_rsa' -undercloud_logs_dir ='/var/log/containers' -source_rc_file_path='/home/stack/' -``` - -### Usage - -This tool is interactive, so to start it, just enter: - - -``` -cd LogTool -python PyTool.py -``` - -### Troubleshooting LogTool - -Two log files are created on runtime: Error.log and Runtime.log*.* Please add the contents of both in the description of the issue you'd like to open. - -### Limitations - -LogTool is hardcoded to handle files up to 500 MB. - -### LogTool_Python3 script - -Get it at [github.com/zahlabut/LogTool][2] - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/logtool-root-cause-identification - -作者:[Arkady Shtempler][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ashtempl -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) -[2]: https://github.com/zahlabut/LogTool -[3]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python2 -[4]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python3 -[5]: https://opensource.com/article/19/2/getting-started-cat-command -[6]: https://github.com/zahlabut/LogTool/blob/master/LogTool_Python3/requirements.txt diff --git a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md new file mode 100644 index 0000000000..b8c1393b2b --- /dev/null +++ b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this Python script to find bugs in your Overcloud) +[#]: via: (https://opensource.com/article/20/1/logtool-root-cause-identification) +[#]: author: (Arkady Shtempler https://opensource.com/users/ashtempl) + +用 Python 脚本发现 Overcloud 中的问题 +====== +LogTool 是一组 Python 脚本,可帮助你找出 Overcloud 节点中问题的根本原因。 +![Searching for code][1] + +OpenStack 在其 Overcloud 节点和 Undercloud 主机上存储和管理了一堆日志文件。因此,使用 OSP 日志文件来排查遇到的问题并不是一件容易的事,尤其在你甚至都不知道是什么原因导致问题时。 + +如果你正处于这种情况,那么 [LogTool][2] 可以使你的生活变得更加轻松!它会为你节省本需要人工排查问题所需的时间和精力。 LogTool 基于模糊字符串匹配算法,可提供过去发生的所有唯一错误和警告信息。你可以根据日志中的时间戳导出特定时间段(例如10分钟前,一个小时前,一天前等)的这些信息。 + +LogTool 是一组 Python 脚本,其主要模块 PyTool.py 在 Undercloud 主机上执行。某些操作模式使用直接在Overcloud 节点上执行的其他脚本,例如从 Overcloud 日志中导出错误和警告信息。 + +LogTool 支持 Python 2 和 Python 3,你可以根据需要更改工作目录:[LogTool_Python2][3] or [LogTool_Python3][4]. + +### 操作方式 + +#### 1\. 从 Overcloud 日志中导出错误和警告信息 + +此模式用于从过去发生的 Overcloud 节点中提取 **错误** 和 **警告** 信息。作为用户,系统将提示你“开始时间”和“调试级别”,以用于提取错误或警告消息。例如,如果在过去10分钟内出了问题,你则可以只提取该时间段内的错误和警告消息。 + + +此操作模式将为每个 Overcloud 节点生成一个包含结果文件的目录。结果文件是经过压缩(***.gz**)的简单文本文件,以减少从 Overcloud 节点下载所需的时间。将压缩文件转换为常规文本文件,可以使用 zcat 或类似工具。此外,Vi 的某些版本和 Emacs 的任何最新版本均支持读取压缩数据。结果文件分为几部分,并在底部包含目录。 + + +LogTool 可以即时检测两种日志文件:标准和非标准。在标准文件中,每条日志行都有一个已知的和已定义的结构:时间戳,调试级别,信息等等。在非标准文件中,日志的结构未知。例如,它可能是第三方的日志。在目录中,你可以找到每个部分的"名称 --> 行号" 例如: + + + * **原始数据 - 从标准 OSP 日志中提取的错误/警告消息:** 这部分包含所有提取的错误/警告消息,没有任何修改或更改。这些消息是 LogTool 用于模糊匹配分析的原始数据。 + + * **统计信息 - 每个标准 OSP 日志的错误/警告信息数量:** 在此部分,你将找到每个标准日志文件的错误和警告数量。这些信息可以帮助你了解用于排查问题根本原因的潜在组件。 + + * **统计信息 - 每个标准 OSP 日志文件的唯一消息:** 这部分提供指定时间戳内的唯一的错误和警告消息。有关每个唯一错误或警告的更多详细信息,请在“原始数据”部分中查找相同的消息。 + + * **统计信息 - 每个非标准日志文件在任意时间的唯一消息:** 此部分包含非标准日志文件中的唯一消息。遗憾的是,LogTool 无法像标准日志文件那样的处理方式处理这些日志文件。因此,在你提取“特定时间”的日志信息时会被忽略,你会看到过去创建的所有唯一的错误/警告消息。因此,首先,向下滚动到结果文件底部的目录并查看其部分-使用目录中的行索引跳到相关部分,其中第3、4和5行的信息最重要。 + + + +#### 2\. 从 Overcloud 节点下载所有日志 + +所有 Overcloud 节点的日志将被压缩并下载到 Undercloud 主机上的本地目录。 + +#### 3\. 所有 Overcloud 日志中使用 Grep 搜索字符串 + + +该模式中使用“greps”来搜索由用户在所有 Overcloud 日志上提供的字符串。例如,你可能希望查看特定请求的所有日志消息,例如,“创建VM”的失败的请求ID。 + +#### 4\. 检查 Overcloud 上当前的 CPU,RAM 和磁盘使用情况 + +该模式显示每个 Overcloud 节点上的当前 CPU,RAM 和磁盘信息。 + +#### 5\. 执行用户脚本 + +该模式使用户可以在 Overcloud 节点上运行自己的脚本。例如,假设 Overcloud 部署失败,你就需要在每个Controller 节点上执行相同的过程来修复该问题。你可以实现“替代方法”脚本,并使用此模式在 Controller 上运行它。 + +#### 6\. 仅按给定的时间戳下载相关日志 + +此模式仅下载 Overcloud 上 “给定的时间戳”的“上次修改时间”的日志。例如,如果10分钟前出现错误,则与旧日志文件就没有关系,因此无需下载。此外,你不能(或不应)在某些错误报告工具中附加大文件,因此此模式可能有助于编写错误报告。 + +#### 7\. 从 Undercloud 日志中导出错误和警告信息 + +这与上面的模式#1相同。 + +#### 8\. 在 Overcloud 上检查不健康的 docker + +此模式用于在节点上搜索不正常的 Docker。 + +#### 9\. 下载 OSP 日志并在本地运行 LogTool + +此模式允许你从 Jenkins 或 Log Storage 下载 OSP 日志 (例如, **cougar11.scl.lab.tlv.redhat.com**),并在本地分析。 + +#### 10\. 在 Undercloud 上分析部署日志 + + +此模式可以帮助你了解 Overcloud 或 Undercloud 部署过程中出了什么问题。例如,在**overcloud_deploy.sh** 脚本中,使用 **\--log**选项时会生成部署日志;此类日志的问题是“不友好”,你很难理解是什么出了问题,尤其是当详细程度设置为**vv** 或更高时,使得日志中的数据难以读取。此模式提供有关所有失败任务的详细信息。 + +#### 11\. 分析 Gerrit(Zuul)失败的日志 + +此模式用于分析 Gerrit(Zuul)日志文件。它会自动从远程 Gerrit 门下载所有文件(HTTP下载)并在本地进行分析。 + +### 安装 + +GitHub 上有 LogTool,使用以下命令将其克隆到你的 Undercloud 主机: + + +``` +`git clone https://github.com/zahlabut/LogTool.git` +``` + +该工具还使用了一些外部 Python 模块: + +#### Paramiko + +默认情况下,SSH 模块通常会安装在 Undercloud 上。使用以下命令来验证是否已安装: + + +``` +`ls -a /usr/lib/python2.7/site-packages | grep paramiko` +``` + +如果需要安装模块,请在 Undercloud 上执行以下命令: + + +``` +sudo easy_install pip +sudo pip install paramiko==2.1.1 +``` + +#### BeautifulSoup + +此 HTML 解析器模块仅在使用 HTTP 下载日志文件的模式下使用。它用于解析 Artifacts HTML 页面以获取其中的所有链接。安装 BeautifulSoup,请输入以下命令: + +``` +`pip install beautifulsoup4` +``` + +你还可以通过执行以下命令使用[requirements.txt][6]文件安装所有必需的模块: + + +``` +`pip install -r requirements.txt` +``` + +### 配置 + + +所有必需的参数都直接在**PyTool.py**脚本中设置。默认值为: + +``` +overcloud_logs_dir = '/var/log/containers' +overcloud_ssh_user = 'heat-admin' +overcloud_ssh_key = '/home/stack/.ssh/id_rsa' +undercloud_logs_dir ='/var/log/containers' +source_rc_file_path='/home/stack/' +``` + +### 用法 + +此工具是交互式的,因此要启动它,只需输入: + + +``` +cd LogTool +python PyTool.py +``` + +### 排除 LogTool 故障 + + +在运行时会创建两个日志文件:Error.log 和 Runtime.log*.* 请在你要打开的问题的描述中添加两者的内容。 + +### 局限性 + +LogTool 进行硬编码以处理最大500 MB 的文件。 + +### LogTool_Python3 脚本 + +在 [github.com/zahlabut/LogTool][2] 获取。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/logtool-root-cause-identification + +作者:[Arkady Shtempler][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ashtempl +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://github.com/zahlabut/LogTool +[3]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python2 +[4]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python3 +[5]: https://opensource.com/article/19/2/getting-started-cat-command +[6]: https://github.com/zahlabut/LogTool/blob/master/LogTool_Python3/requirements.txt From d63930c4dc5b95e50a604b78e368d69419a453e6 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 27 Jan 2020 18:49:22 +0800 Subject: [PATCH 0429/3057] translated From 7e92c4c9bc9c6810088f63935ac001153c9f31cb Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 27 Jan 2020 18:52:50 +0800 Subject: [PATCH 0430/3057] translated --- ...0117 Use this Python script to find bugs in your Overcloud.md | 1 - 1 file changed, 1 deletion(-) diff --git a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md index b8c1393b2b..82ac2b8da6 100644 --- a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md +++ b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md @@ -42,7 +42,6 @@ LogTool 可以即时检测两种日志文件:标准和非标准。在标准文 * **统计信息 - 每个非标准日志文件在任意时间的唯一消息:** 此部分包含非标准日志文件中的唯一消息。遗憾的是,LogTool 无法像标准日志文件那样的处理方式处理这些日志文件。因此,在你提取“特定时间”的日志信息时会被忽略,你会看到过去创建的所有唯一的错误/警告消息。因此,首先,向下滚动到结果文件底部的目录并查看其部分-使用目录中的行索引跳到相关部分,其中第3、4和5行的信息最重要。 - #### 2\. 从 Overcloud 节点下载所有日志 所有 Overcloud 节点的日志将被压缩并下载到 Undercloud 主机上的本地目录。 From 356077306dbe99d676ddcf036f8dd2ebfa346d9f Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 27 Jan 2020 18:54:31 +0800 Subject: [PATCH 0431/3057] Update 20200117 Use this Python script to find bugs in your Overcloud.md --- ...0117 Use this Python script to find bugs in your Overcloud.md | 1 - 1 file changed, 1 deletion(-) diff --git a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md index 82ac2b8da6..eb2b7609b6 100644 --- a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md +++ b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md @@ -129,7 +129,6 @@ sudo pip install paramiko==2.1.1 ### 配置 - 所有必需的参数都直接在**PyTool.py**脚本中设置。默认值为: ``` From 4df8003a85368999c21de0c0eaf80824f1a993b9 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 27 Jan 2020 18:58:44 +0800 Subject: [PATCH 0432/3057] Update 20200117 Use this Python script to find bugs in your Overcloud.md --- ...0117 Use this Python script to find bugs in your Overcloud.md | 1 - 1 file changed, 1 deletion(-) diff --git a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md index eb2b7609b6..7ee1142f8e 100644 --- a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md +++ b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md @@ -143,7 +143,6 @@ source_rc_file_path='/home/stack/' 此工具是交互式的,因此要启动它,只需输入: - ``` cd LogTool python PyTool.py From d17cd544d35574715dfdf05434e511697f31bae5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 27 Jan 2020 23:09:09 +0800 Subject: [PATCH 0433/3057] PRF --- ...e for programming hardware abstractions.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index 98215f6a9f..ffee4807f9 100644 --- a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -7,25 +7,25 @@ [#]: via: (https://opensource.com/article/20/1/c-vs-rust-abstractions) [#]: author: (Dan Pittman https://opensource.com/users/dan-pittman) -C 还是 Rust:选择哪个用于编程硬件抽象 +C 还是 Rust:选择哪个用于硬件抽象编程 ====== > 在 Rust 中使用类型级编程可以使硬件抽象更加安全。 ![Tools illustration][1] -Rust 是一种日益流行的编程语言,被视为硬件接口的最佳选择。通常会将其与 C 的抽象级别进行比较。本文介绍了 Rust 如何以多种方式处理按位运算,并提供了既安全又易于使用的解决方案。 +Rust 是一种日益流行的编程语言,被视为硬件接口的最佳选择。通常会将其与 C 的抽象级别相比较。本文介绍了 Rust 如何通过多种方式处理按位运算,并提供了既安全又易于使用的解决方案。 -语言 | 源自 | 官方说明 | 总览 +语言 | 诞生于 | 官方描述 | 总览 ---|---|---|--- C | 1972 年 | C 是一种通用编程语言,具有表达式简约、现代的控制流和数据结构,以及丰富的运算符集等特点。(来源:[CS 基础知识] [2])| C 是(一种)命令式语言,旨在以相对简单的方式进行编译,从而提供对内存的低级访问。(来源:[W3schools.in] [3]) -Rust | 2010 年 | 一种使所有人都能构建可靠、高效的软件的语言(来源:[Rust 网站] [4])| Rust 是一种专注于安全性(尤其是安全并发性)的多范式系统编程语言。(来源:[维基百科] [5]) +Rust | 2010 年 | 一种赋予所有人构建可靠、高效的软件的能力的语言(来源:[Rust 网站] [4])| Rust 是一种专注于安全性(尤其是安全并发性)的多范式系统编程语言。(来源:[维基百科] [5]) ### 在 C 语言中对寄存器值进行按位运算 -在系统编程领域,你可能经常需要编写硬件驱动程序或直接与内存映射的设备进行交互,而这些交互几乎总是通过硬件提供的内存映射的寄存器来完成的。通常,你通过对某些固定宽度的数字类型进行按位运算来与这些寄存器进行交互。 +在系统编程领域,你可能经常需要编写硬件驱动程序或直接与内存映射设备进行交互,而这些交互几乎总是通过硬件提供的内存映射寄存器来完成的。通常,你通过对某些固定宽度的数字类型进行按位运算来与这些寄存器进行交互。 -例如,假设一个具有三个字段的 8 位寄存器: +例如,假设一个 8 位寄存器具有三个字段: ``` +----------+------+-----------+---------+ @@ -34,17 +34,17 @@ Rust | 2010 年 | 一种使所有人都能构建可靠、高效的软件的语    5-7       2-4        1          0 ``` -字段名称下方的数字规定了该字段在寄存器中使用的位。要启用该寄存器,你将写入值 `1`(以二进制表示为`0000_0001`)来设置 `Enabled` 字段的位。但是,通常情况下,你也不想干扰寄存器中的现有配置。假设你要在设备上启用中断功能,但也要确保设备保持启用状态。为此,必须将 `Interrupt` 字段的值与 `Enabled` 字段的值结合起来。你可以通过按位操作来做到这一点: +字段名称下方的数字规定了该字段在寄存器中使用的位。要启用该寄存器,你将写入值 `1`(以二进制表示为 `0000_0001`)来设置 `Enabled` 字段的位。但是,通常情况下,你也不想干扰寄存器中的现有配置。假设你要在设备上启用中断功能,但也要确保设备保持启用状态。为此,必须将 `Interrupt` 字段的值与 `Enabled` 字段的值结合起来。你可以通过按位操作来做到这一点: ``` 1 | (1 << 1) ``` -通过将 1 和 2(左移 `1` 一位得到)进行“或”运算得到二进制值 `0000_0011` 。你可以将其写入寄存器,使其保持启用状态,但也允许中断。 +通过将 1 和 2(`1` 左移一位得到)进行“或”(`|`)运算得到二进制值 `0000_0011` 。你可以将其写入寄存器,使其保持启用状态,但也启用中断功能。 -有很多事情要记住,特别是当你要为一个完整的系统处理可能有数百个之多的寄存器时。实际上,你可以使用助记符来执行此操作,助记符可跟踪字段在寄存器中的位置以及字段的宽度(即它的上边界是什么?) +你的头脑中要记住很多事情,特别是当你要在一个完整的系统上和可能有数百个之多的寄存器打交道时。在实践上,你可以使用助记符来执行此操作,助记符可跟踪字段在寄存器中的位置以及字段的宽度(即它的上边界是什么) -这是这些助记符之一的示例。它们是 C 语言的宏,用右侧的代码替换它们的出现的地方。这是上面列出的寄存器的简写。`&` 的左侧是该字段的位置,而右侧则限制该字段的位: +下面是这些助记符之一的示例。它们是 C 语言的宏,用右侧的代码替换它们的出现的地方。这是上面列出的寄存器的简写。`&` 的左侧是该字段的起始位置,而右侧则限制该字段所占的位: ``` #define REG_ENABLED_FIELD(x) (x << 0) & 1 @@ -52,7 +52,7 @@ Rust | 2010 年 | 一种使所有人都能构建可靠、高效的软件的语 #define REG_KIND_FIELD(x) (x << 2) & (7 << 2) ``` -然后,你将使用这些通过类似以下方式来抽象化寄存器值的操作: +然后,你可以使用这些来抽象化寄存器值的操作,如下所示: ``` void set_reg_val(reg* u8, val u8); @@ -62,7 +62,7 @@ fn enable_reg_with_interrupt(reg* u8) { } ``` -这就是现在的做法。实际上,这就是大多数驱动程序出现在 Linux 内核中的方式。 +这就是现在的做法。实际上,这就是大多数驱动程序在 Linux 内核中的使用方式。 有没有更好的办法?如果能够基于对现代编程语言研究得出新的类型系统,就可能能够获得安全性和可表达性的好处。也就是说,如何使用更丰富、更具表现力的类型系统来使此过程更安全、更持久? @@ -77,7 +77,7 @@ fn enable_reg_with_interrupt(reg* u8) {    5-7       2-4        1          0 ``` -你可能想如何用 Rust 类型来表示它? +你想如何用 Rust 类型来表示它呢? 你将以类似的方式开始,为每个字段的*偏移*定义常量(即,距最低有效位有多远)及其掩码。*掩码*是一个值,其二进制表示形式可用于更新或读取寄存器内部的字段: @@ -92,7 +92,7 @@ const KIND_MASK: u8 = 7 << 2; const KIND_OFFSET: u8 = 2; ``` -接下来,你将声明一个 `Field` 类型,并进行操作以将给定值转换为与其位置相关的值以供在寄存器内使用: +接下来,你将声明一个 `Field` 类型并进行操作,将给定值转换为与其位置相关的值,以供在寄存器内使用: ``` struct Field { @@ -124,15 +124,15 @@ fn enable_register(&mut reg) { } ``` -使用 Rust,你可以使用数据结构来表示字段,将它们附加到特定的寄存器,并在与硬件交互时提供简洁明了的人机工程学。这个例子使用了 Rust 提供的最基本的功能。无论如何,添加的结构都会减轻上述 C 示例中的某些密度。现在,字段是个已命名的事物,而不是从模糊的按位运算符派生而来的数字,并且寄存器是具有状态的类型 —— 这在硬件上多了一层抽象。 +使用 Rust,你可以使用数据结构来表示字段,将它们附加到特定的寄存器,并在与硬件交互时提供简洁明了的工效。这个例子使用了 Rust 提供的最基本的功能。无论如何,添加的结构都会减轻上述 C 示例中的某些晦涩的地方。现在,字段是个带有名字的事物,而不是从模糊的按位运算符派生而来的数字,并且寄存器是具有状态的类型 —— 这在硬件上多了一层抽象。 ### 一个易用的 Rust 实现 -用 Rust 重写的第一个版本很好,但是并不理想。你必须记住要带上掩码和偏移量,并且要手工进行临时计算,这容易出错。人类不擅长精确且重复的任务 —— 我们往往会感到疲劳或失去专注力,这会导致错误。一次一个寄存器地手动记录掩码和偏移量几乎可以肯定会很糟糕。这是最好留给机器的任务。 +用 Rust 重写的第一个版本很好,但是并不理想。你必须记住要带上掩码和偏移量,并且要手工进行临时计算,这容易出错。人类不擅长精确且重复的任务 —— 我们往往会感到疲劳或失去专注力,这会导致错误。一次一个寄存器地手动记录掩码和偏移量几乎可以肯定会以糟糕的结局而告终。这是最好留给机器的任务。 -其次,从结构上进行思考:如果有一种方法可以让字段的类型携带掩码和偏移信息呢?如果你要在访问硬件寄存器并与之交互的实现过程中就能发现错误,而不是在运行时才发现,该怎么办?也许你可以依靠一种通常用于在编译时解决问题的策略,例如类型。 +其次,从结构上进行思考:如果有一种方法可以让字段的类型携带掩码和偏移信息呢?如果可以在编译时就发现所实现的硬件寄存器的访问和交互中存在错误,而不是在运行时才发现,该怎么办?也许你可以依靠一种常用的策略在编译时解决问题,例如类型。 -你可以使用 [typenum][6] 来修改前面的示例,该库在类型级别提供数字和算术。在这里,你将使用掩码和偏移量对 `Field` 类型进行参数化,使其可用于任何 `Field` 实例,而不必在调用站点中将其包括在内: +你可以使用 [typenum][6] 来修改前面的示例,该库在类型级别提供数字和算术。在这里,你将使用掩码和偏移量对 `Field` 类型进行参数化,使其可用于任何 `Field` 实例,而无需将其包括在调用处: ``` #[macro_use] @@ -175,7 +175,7 @@ fn enable_register(&mut reg) { } ``` -看起来不错,但是……如果你对给定的值是否*适合*某个字段犯了错误,会发生什么?考虑一个简单的输入错误,你在其中放置了 `10` 而不是 `1`: +看起来不错,但是……如果你在给定的值是否*适合*字段方面犯了错误,会发生什么?考虑一个简单的输入错误,你在其中放置了 `10` 而不是 `1`: ``` fn enable_register(&mut reg) { @@ -219,11 +219,11 @@ impl Field { @@ -252,7 +252,7 @@ impl Field Date: Tue, 28 Jan 2020 09:47:52 +0800 Subject: [PATCH 0434/3057] Translating --- ...to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md b/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md index 869e8b1d79..889155174e 100644 --- a/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md +++ b/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f95e330888af9cef038122a9460f032b43718a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 28 Jan 2020 10:03:28 +0800 Subject: [PATCH 0435/3057] Translated --- ...0 is Released- Here-s How to Install it.md | 119 ------------------ ...0 is Released- Here-s How to Install it.md | 119 ++++++++++++++++++ 2 files changed, 119 insertions(+), 119 deletions(-) delete mode 100644 sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md create mode 100644 translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md diff --git a/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md b/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md deleted file mode 100644 index 3a06b5b5cb..0000000000 --- a/sources/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md +++ /dev/null @@ -1,119 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Wine 5.0 is Released! Here’s How to Install it) -[#]: via: (https://itsfoss.com/wine-5-release/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Wine 5.0 is Released! Here’s How to Install it -====== - -_**Brief: A new major release of Wine is here. With Wine 5.0, running Windows applications and games on Linux is further improved.**_ - -With some efforts, you can [run Windows applications on Linux][1] using Wine. Wine is a tool that you may try when you must use a software that is available only on Windows. It supports a number of such software. - -A new major release for Wine has landed i.e Wine 5.0, almost after a year of its 4.0 release. - -Wine 5.0 release introduces a couple of major features and a lot of significant changes/improvements. In this article, I’ll highlight what’s new and also mention the installation instructions. - -### What’s New In Wine 5.0? - -![][2] - -The key changes in 5.0 release as mentioned in their [official announcement][3]: - - * Builtin modules in PE format. - * Multi-monitor support. - * XAudio2 reimplementation. - * Vulkan 1.1 support. - * Microsoft Installer (MSI) Patch Files are supported. - * Performance improvements. - - - -So, with Vulkan 1.1 support and multi-monitor support – Wine 5.0 release is a big deal. - -In addition to the key highlights, you can also expect better controller support in the new version considering thousands of changes/improvements involved in the new release. - -It is also worth noting that this release is being dedicated to the memory of **Józef Kucia** (_lead developer of the vkd3d project_) - -They’ve also mentioned this in their [release notes][4]: - -> This release is dedicated to the memory of Józef Kucia, who passed away in August 2019 at the young age of 30. Józef was a major contributor to Wine’s Direct3D implementation, and the lead developer of the vkd3d project. His skills and his kindness are sorely missed by all of us. - -### How to install Wine 5.0 on Ubuntu and Linux Mint - -Note - -_If you have Wine installed before, you should remove it completely to avoid any conflict (as you wish). Also, the WineHQ key repository key was changed recently, you should refer to its_ [_download page_][5] _for additional instructions on that according to your Linux distribution._ - -The source for Wine 5.0 is available on its [official website][3]. You can read more about [building wine][6] in order to make it work. Arch-based users should be getting it soon. - -Here’ I’ll show you the steps to install Wine 5.0 on Ubuntu and other Ubuntu-based distributions. - -First, remove existing Wine install with this command: - -``` -sudo apt remove winehq-stable wine-stable wine1.6 -``` - -Download the official Wine repository key and add it: - -``` -wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - -``` - -_**Now the next step involves adding the repository and for that, you need to [know your Ubuntu version][7] first.**_ - -For **Ubuntu 19.10**, add this repository: - -``` -sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ eoan main' -``` - -If you are using **Ubuntu 18.04** or **Linux Mint 19.x**, use this command to add the repository: - -``` -sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' -``` - -For **Ubuntu 16.04 and Linux Mint 18.x series**, you can use this command: - -``` -sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main' -``` - -Now that you have added the correct repository, you can install Wine 5.0 using this command: - -``` -sudo apt update && sudo apt install --install-recommends winehq-stable -``` - -**Wrapping Up** - -Have you tried the latest Wine 5.0 release yet? If yes, what improvements do you see in action? - -Let me know your thoughts on the new release in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/wine-5-release/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/use-windows-applications-linux/ -[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/wine_5.png?ssl=1 -[3]: https://www.winehq.org/news/2020012101 -[4]: https://www.winehq.org/announce/5.0 -[5]: https://wiki.winehq.org/Download -[6]: https://wiki.winehq.org/Building_Wine -[7]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ diff --git a/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md b/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md new file mode 100644 index 0000000000..24c1077236 --- /dev/null +++ b/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Wine 5.0 is Released! Here’s How to Install it) +[#]: via: (https://itsfoss.com/wine-5-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Wine 5.0 发布了!这里是如何安装它的方法 +====== + +_**简介:在这里,Wine 的一个新的主要版本发布。使用 Wine 5.0 ,在 Linux 上运行 Windows 应用程序和游戏得到进一步改进。**_ + +因为一些努力,你可以使用 Wine [在 Linux 上运行 Windows 应用程序][1] 。Wine 是一个当你必需使用一个仅在 Windows 上可用的软件时你可以尝试的工具。它支持许多这样的软件。 + +Wine 的一个新的主要发布版本已经降临,即 Wine 5.0 ,几乎在它的 4.0 发布一年之后。 + +Wine 5.0 发布版本引进了几个主要的特色和很多有重大意义的更改/改进。我将重点介绍新的特色是什么,并且也将提到安装说明。 + +### 在 Wine 5.0 中有什么新的特色? + +![][2] + +在 5.0 发布版本中的关键更改,正如在他们的[官方声明][3]所述一样: + + * PE 格式的内置模块。 + * 多监视器支持。 + * XAudio2 重新实施。 + * Vulkan 1.1 支持。 + * 支持微软安装程序(MSI)补丁文件。 + * 性能改进。 + + + +因此,随着 Vulkan 1.1 和多监视器的支持 – Wine 5.0 发布版本是一件大事。 + +除了关键强调以外,就在新的版本中包含成千上万的更改/改进而言,你同样可以期待在新的版本中有更好的控制器支持。 + +这个发布版本致力于纪念 **Józef Kucia** (_vkd3d 项目的首席开发人员_)也是值得注意的 + +他们也已经在[发布说明][4]中提到这一点: + +> 这个发布版本致力于纪念 Józef Kucia ,他在 2019 年 8 月去世,年仅 30 岁。Józef 是 Wine 的 Direct3D 实施的一个主要贡献者,并且是 vkd3d 项目的首席开发人员。我们都非常怀念他的技能和善良。 + +### 如何在 Ubuntu 和 Linux Mint 上安装 Wine 5.0 + +注意 + +_如果你在以前安装过 Wine ,你应该将其完全移除,以避免一些冲突(像你希望的一样)。此外,WineHQ 秘钥存储库最近已被更改,对于额外的操作指南,你可以根据你的 Linux 发行版来参考它的_ [_下载页面_][5]。_ + +Wine 5.0 的源码可在它的[官方网站][3]上获得。为了使其工作,你可以阅读更多关于[构建 wine][6]的信息。基于 Arch 的用户应该很快就会得到它。 + +在这里,我将向你展示在 Ubuntu 和其它基于 Ubuntu 的发行版上安装 Wine 5.0 的步骤。 + +首先,使用这个命令来移除现存的 Wine 安装: + +``` +sudo apt remove winehq-stable wine-stable wine1.6 +``` + +下载并添加官方 Wine 存储库秘钥: + +``` +wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - +``` + +_**现在,接下来的步骤需要添加存储库,为此, 你需要首先[知道你的 Ubuntu 版本][7]。**_ + +对于 **Ubuntu 19.10** ,添加这个存储库: + +``` +sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ eoan main' +``` + +如果你正在使用 **Ubuntu 18.04** 或 **Linux Mint 19.x** ,使用这个命令来添加存储库: + +``` +sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' +``` + +对于 **Ubuntu 16.04 和 Linux Mint 18.x 系列** ,你可以使用这个命令: + +``` +sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main' +``` + +现在,你已经添加了正确的存储库,你可以使用这个命令来安装 Wine 5.0 : + +``` +sudo apt update && sudo apt install --install-recommends winehq-stable +``` + +**总结** + +你尝试过最新的 Wine 5.0 发布版本吗?如果是的话,在运行中你看到什么改进? + +在下面的评论区域,让我知道你对新的发布版本的看法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/wine-5-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/use-windows-applications-linux/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/wine_5.png?ssl=1 +[3]: https://www.winehq.org/news/2020012101 +[4]: https://www.winehq.org/announce/5.0 +[5]: https://wiki.winehq.org/Download +[6]: https://wiki.winehq.org/Building_Wine +[7]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ From aa8840bd82eab656d16349a80a885df01075a430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 28 Jan 2020 10:08:19 +0800 Subject: [PATCH 0436/3057] Translating --- .../20191022 How to Go About Linux Boot Time Optimisation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md b/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md index 9e99bcdb7c..7d5721625b 100644 --- a/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md +++ b/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3e5cef3f4a46bbae2e70aafdf700659f455a3b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 28 Jan 2020 10:09:36 +0800 Subject: [PATCH 0437/3057] Translating --- ...115 Root User in Ubuntu- Important Things You Should Know.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md b/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md index 247391ff82..f58ada5c58 100644 --- a/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md +++ b/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0826a4308b02a3c9254ceaec09c443b613e64128 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 28 Jan 2020 12:22:46 +0800 Subject: [PATCH 0438/3057] TSL --- ...e for programming hardware abstractions.md | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index ffee4807f9..9250524c2f 100644 --- a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -124,13 +124,13 @@ fn enable_register(&mut reg) { } ``` -使用 Rust,你可以使用数据结构来表示字段,将它们附加到特定的寄存器,并在与硬件交互时提供简洁明了的工效。这个例子使用了 Rust 提供的最基本的功能。无论如何,添加的结构都会减轻上述 C 示例中的某些晦涩的地方。现在,字段是个带有名字的事物,而不是从模糊的按位运算符派生而来的数字,并且寄存器是具有状态的类型 —— 这在硬件上多了一层抽象。 +使用 Rust,你可以使用数据结构来表示字段,将它们与特定的寄存器联系起来,并在与硬件交互时提供简洁明了的工效。这个例子使用了 Rust 提供的最基本的功能。无论如何,添加的结构都会减轻上述 C 示例中的某些晦涩的地方。现在,字段是个带有名字的事物,而不是从模糊的按位运算符派生而来的数字,并且寄存器是具有状态的类型 —— 这在硬件上多了一层抽象。 ### 一个易用的 Rust 实现 用 Rust 重写的第一个版本很好,但是并不理想。你必须记住要带上掩码和偏移量,并且要手工进行临时计算,这容易出错。人类不擅长精确且重复的任务 —— 我们往往会感到疲劳或失去专注力,这会导致错误。一次一个寄存器地手动记录掩码和偏移量几乎可以肯定会以糟糕的结局而告终。这是最好留给机器的任务。 -其次,从结构上进行思考:如果有一种方法可以让字段的类型携带掩码和偏移信息呢?如果可以在编译时就发现所实现的硬件寄存器的访问和交互中存在错误,而不是在运行时才发现,该怎么办?也许你可以依靠一种常用的策略在编译时解决问题,例如类型。 +其次,从结构上进行思考:如果有一种方法可以让字段的类型携带掩码和偏移信息呢?如果可以在编译时就发现硬件寄存器的访问和交互的实现代码中存在错误,而不是在运行时才发现,该怎么办?也许你可以依靠一种在编译时解决问题的常用策略,例如类型。 你可以使用 [typenum][6] 来修改前面的示例,该库在类型级别提供数字和算术。在这里,你将使用掩码和偏移量对 `Field` 类型进行参数化,使其可用于任何 `Field` 实例,而无需将其包括在调用处: @@ -175,7 +175,7 @@ fn enable_register(&mut reg) { } ``` -看起来不错,但是……如果你在给定的值是否*适合*字段方面犯了错误,会发生什么?考虑一个简单的输入错误,你在其中放置了 `10` 而不是 `1`: +看起来不错,但是……如果你在给定的值是否*适合*该字段方面犯了错误,会发生什么?考虑一个简单的输入错误,你在其中放置了 `10` 而不是 `1`: ``` fn enable_register(&mut reg) { @@ -183,7 +183,7 @@ fn enable_register(&mut reg) { } ``` -在上面的代码中,预期结果是什么?好吧,代码会将启用位设置为 0,因为 `10&1 = 0`。那真不幸;最好在尝试写入之前知道你要写入字段的值是否适合该字段。事实上,我会考虑放弃错误字段值的高位*未定义行为*(喘气)。 +在上面的代码中,预期结果是什么?好吧,代码会将启用位设置为 0,因为 `10&1 = 0`。那真不幸;最好在尝试写入之前知道你要写入字段的值是否适合该字段。事实上,我认为截掉错误字段值的高位是一种 1*未定义的行为*(哈)。 ### 出于安全考虑使用 Rust @@ -219,11 +219,11 @@ impl Field { @@ -252,7 +252,7 @@ impl Field, typenum::B0>, typenum::B1>, typenum::B0>, typenum::B0> as typenum::IsLessOrEqual, typenum::B0>, typenum::B1>, typenum::B0>>>::Output == typenum::B1` @@ -415,9 +415,9 @@ error[E0271]: type mismatch resolving `疯了,地狱了,不要再忍受了Mad As Hell And Wasn't Going To Take It Anymore》,并做了一个小工具 `tnfilt`,从这种命名空间的二进制 cons 单元的痛苦中解脱出来。`tnfilt` 将 cons 单元格式的表示法替换为可让人看懂的十进制数字。我们认为其他人也会遇到类似的困难,所以我们分享了 [tnfilt][14]。你可以像这样使用它: ``` $ cargo build 2>&1 | tnfilt @@ -429,22 +429,22 @@ $ cargo build 2>&1 | tnfilt error[E0271]: type mismatch resolving `>::Output == typenum::B1` ``` -现在*这*很有意义! +现在*这*才有意义! ### 结论 -当与软件中的硬件进行交互时,普遍使用内存映射寄存器,并且有无数种方法来描述这些交互,每种方法在易用性和安全性上都有不同的权衡。我们发现使用类型级编程来获取内存映射寄存器交互的编译时检查为我们提供了制作更安全软件的必要信息。该代码可在 [bounded-registers][15] crate(Rust包)中找到。 +当在软件与硬件进行交互时,普遍使用内存映射寄存器,并且有无数种方法来描述这些交互,每种方法在易用性和安全性上都有不同的权衡。我们发现使用类型级编程来取得内存映射寄存器交互的编译时检查可以为我们提供制作更安全软件的必要信息。该代码可在 [bounded-registers][15] crate(Rust 包)中找到。 -我们的团队从安全性较高的一面开始,然后尝试找出如何将易用滑块移近易用端。从这些雄心壮志中,“边界寄存器”就诞生了,我们在 Auxon 冒险中遇到遇到内存映射设备的任何时候都可以使用它。 +我们的团队从安全性较高的一面开始,然后尝试找出如何将易用性滑块移近易用端。从这些雄心壮志中,“边界寄存器”就诞生了,我们在 Auxon 公司的冒险中遇到内存映射设备的任何时候都可以使用它。 * * * [^1]: 从技术上讲,从定义上看,从寄存器字段读取的值只能在规定的范围内,但是我们当中没有一个人生活在一个纯净的世界中,而且你永远都不知道外部系统发挥作用时会发生什么。你是在这里接受硬件之神的命令,因此与其强迫你进入“可能的恐慌”状态,还不如给你提供处理“这将永远不会发生”的机会。 -[^2]: `get_field` 看起来有点奇怪。我正在专门查看 `Field::Read` 部分。`Field` 是一种类型,你需要该类型的实例才能传递给 `get_field`。更干净的 API 可能类似于:`regs.rx.get_field::();`但是请记住,`Field` 是类型的同义词,它具有固定的宽度、偏移量等索引。要像这样对 `get_field` 进行参数化,你需要使用更高级的类型。 +[^2]: `get_field` 看起来有点奇怪。我正在专门查看 `Field::Read` 部分。`Field` 是一种类型,你需要该类型的实例才能传递给 `get_field`。更干净的 API 可能类似于:`regs.rx.get_field::();` 但是请记住,`Field` 是一种具有固定的宽度、偏移量等索引的类型的同义词。要像这样对 `get_field` 进行参数化,你需要使用更高级的类型。 * * * -此内容最初出现在 [Auxon Engineering 博客] [16]上,并经许可进行编辑和重新发布。 +此内容最初发布在 [Auxon Engineering 博客][16]上,并经许可进行编辑和重新发布。 -------------------------------------------------------------------------------- From d0ee13e5455bb8e30baf5923dd15a3d7d1b756aa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 28 Jan 2020 12:35:43 +0800 Subject: [PATCH 0439/3057] PRF @wxy --- ...Which to choose for programming hardware abstractions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index 9250524c2f..9c504f2c63 100644 --- a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (C vs. Rust: Which to choose for programming hardware abstractions) @@ -12,7 +12,7 @@ C 还是 Rust:选择哪个用于硬件抽象编程 > 在 Rust 中使用类型级编程可以使硬件抽象更加安全。 -![Tools illustration][1] +![](https://img.linux.net.cn/data/attachment/album/202001/28/123350k2w4mr3tp7crd4m2.jpg) Rust 是一种日益流行的编程语言,被视为硬件接口的最佳选择。通常会将其与 C 的抽象级别相比较。本文介绍了 Rust 如何通过多种方式处理按位运算,并提供了既安全又易于使用的解决方案。 @@ -453,7 +453,7 @@ via: https://opensource.com/article/20/1/c-vs-rust-abstractions 作者:[Dan Pittman][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ee8392676be727ebffa843d8ca1a096a37077311 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 28 Jan 2020 12:36:11 +0800 Subject: [PATCH 0440/3057] PUB @wxy https://linux.cn/article-11825-1.html --- ...- Which to choose for programming hardware abstractions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md (99%) diff --git a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/published/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md similarity index 99% rename from translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md rename to published/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index 9c504f2c63..dcdbc98b5a 100644 --- a/translated/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/published/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11825-1.html) [#]: subject: (C vs. Rust: Which to choose for programming hardware abstractions) [#]: via: (https://opensource.com/article/20/1/c-vs-rust-abstractions) [#]: author: (Dan Pittman https://opensource.com/users/dan-pittman) From e8e118e81a1ff74efa5d6d33260f83ad15bb419b Mon Sep 17 00:00:00 2001 From: laingke Date: Tue, 28 Jan 2020 13:01:19 +0800 Subject: [PATCH 0441/3057] 20200102-javastream translating --- ...00102 Data streaming and functional programming in Java.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200102 Data streaming and functional programming in Java.md b/sources/tech/20200102 Data streaming and functional programming in Java.md index 0349de9072..c3e914001b 100644 --- a/sources/tech/20200102 Data streaming and functional programming in Java.md +++ b/sources/tech/20200102 Data streaming and functional programming in Java.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -474,7 +474,7 @@ via: https://opensource.com/article/20/1/javastream 作者:[Marty Kalin][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6489c1205015ae9a9da1682d928c4f8e925e9214 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 28 Jan 2020 14:15:15 +0800 Subject: [PATCH 0442/3057] PRF @robsean --- ...0 is Released- Here-s How to Install it.md | 128 ++++++++++++------ 1 file changed, 87 insertions(+), 41 deletions(-) diff --git a/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md b/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md index 24c1077236..78f0909d4a 100644 --- a/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md +++ b/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md @@ -1,97 +1,141 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Wine 5.0 is Released! Here’s How to Install it) [#]: via: (https://itsfoss.com/wine-5-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Wine 5.0 发布了!这里是如何安装它的方法 +Wine 5.0 发布了! ====== -_**简介:在这里,Wine 的一个新的主要版本发布。使用 Wine 5.0 ,在 Linux 上运行 Windows 应用程序和游戏得到进一步改进。**_ +> Wine 的一个新的主要版本发布了。使用 Wine 5.0,在 Linux 上运行 Windows 应用程序和游戏的体验得到进一步改进。 -因为一些努力,你可以使用 Wine [在 Linux 上运行 Windows 应用程序][1] 。Wine 是一个当你必需使用一个仅在 Windows 上可用的软件时你可以尝试的工具。它支持许多这样的软件。 +通过一些努力,你可以使用 Wine [在 Linux 上运行 Windows 应用程序][1]。当你必须使用一个仅在 Windows 上可用的软件时,Wine 是一个可以尝试的工具。它支持许多这样的软件。 -Wine 的一个新的主要发布版本已经降临,即 Wine 5.0 ,几乎在它的 4.0 发布一年之后。 +Wine 的一个新的主要发布版本已经降临,即 Wine 5.0,几乎距它的 4.0 发布一年之后。 -Wine 5.0 发布版本引进了几个主要的特色和很多有重大意义的更改/改进。我将重点介绍新的特色是什么,并且也将提到安装说明。 +Wine 5.0 发布版本引进了几个主要特性和很多显著的更改/改进。在这篇文章中,我将重点介绍新的特性是什么,并且也将提到安装说明。 -### 在 Wine 5.0 中有什么新的特色? +### 在 Wine 5.0 中有什么新的特性? ![][2] -在 5.0 发布版本中的关键更改,正如在他们的[官方声明][3]所述一样: +如他们的[官方声明][3]所述,这是 5.0 发布版本中的关键更改: - * PE 格式的内置模块。 - * 多监视器支持。 - * XAudio2 重新实施。 - * Vulkan 1.1 支持。 - * 支持微软安装程序(MSI)补丁文件。 - * 性能改进。 +* PE 格式的内置模块。 +* 支持多显示器。 +* 重新实现了 XAudio2。 +* 支持 Vulkan 1.1。 +* 支持微软安装程序(MSI)补丁文件。 +* 性能提升。 +因此,随着 Vulkan 1.1 和对多显示器的支持 —— Wine 5.0 发布版本是一件大事。 +除了上面强调的这些关键内容以外,在新的版本中包含成千上万的更改/改进中,你还可以期待对控制器的支持更好。 -因此,随着 Vulkan 1.1 和多监视器的支持 – Wine 5.0 发布版本是一件大事。 - -除了关键强调以外,就在新的版本中包含成千上万的更改/改进而言,你同样可以期待在新的版本中有更好的控制器支持。 - -这个发布版本致力于纪念 **Józef Kucia** (_vkd3d 项目的首席开发人员_)也是值得注意的 +值得注意的是,此版本特别纪念了 **Józef Kucia**(vkd3d 项目的首席开发人员)。 他们也已经在[发布说明][4]中提到这一点: -> 这个发布版本致力于纪念 Józef Kucia ,他在 2019 年 8 月去世,年仅 30 岁。Józef 是 Wine 的 Direct3D 实施的一个主要贡献者,并且是 vkd3d 项目的首席开发人员。我们都非常怀念他的技能和善良。 +> 这个发布版本特别纪念了 Józef Kucia,他于 2019 年 8 月去世,年仅 30 岁。Józef 是 Wine 的 Direct3D 实现的一个主要贡献者,并且是 vkd3d 项目的首席开发人员。我们都非常怀念他的技能和友善。 ### 如何在 Ubuntu 和 Linux Mint 上安装 Wine 5.0 -注意 +> 注意: -_如果你在以前安装过 Wine ,你应该将其完全移除,以避免一些冲突(像你希望的一样)。此外,WineHQ 秘钥存储库最近已被更改,对于额外的操作指南,你可以根据你的 Linux 发行版来参考它的_ [_下载页面_][5]。_ +> 如果你在以前安装过 Wine,你应该将其完全移除,以(如你希望的)避免一些冲突。此外,WineHQ 存储库的密钥最近已被更改,针对你的 Linux 发行版的更多的操作指南,你可以参考它的[下载页面][5]。 -Wine 5.0 的源码可在它的[官方网站][3]上获得。为了使其工作,你可以阅读更多关于[构建 wine][6]的信息。基于 Arch 的用户应该很快就会得到它。 +Wine 5.0 的源码可在它的[官方网站][3]上获得。为了使其工作,你可以阅读更多关于[构建 Wine][6] 的信息。基于 Arch 的用户应该很快就会得到它。 -在这里,我将向你展示在 Ubuntu 和其它基于 Ubuntu 的发行版上安装 Wine 5.0 的步骤。 +在这里,我将向你展示在 Ubuntu 和其它基于 Ubuntu 的发行版上安装 Wine 5.0 的步骤。请耐心,并按照步骤一步一步安装和使用 Wine。这里涉及几个步骤。 -首先,使用这个命令来移除现存的 Wine 安装: +请记住,Wine 安装了太多软件包。你会看到大量的软件包列表,下载大小约为 1.3 GB。 + +### 在 Ubuntu 上安装 Wine 5.0(不适用于 Linux Mint) + +首先,使用这个命令来移除现存的 Wine: ``` -sudo apt remove winehq-stable wine-stable wine1.6 +sudo apt remove winehq-stable wine-stable wine1.6 wine-mono wine-geco winetricks ``` -下载并添加官方 Wine 存储库秘钥: +然后确保添加 32 位体系结构支持: + +``` +sudo dpkg --add-architecture i386 +``` + +下载并添加官方 Wine 存储库密钥: ``` wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - ``` -_**现在,接下来的步骤需要添加存储库,为此, 你需要首先[知道你的 Ubuntu 版本][7]。**_ +现在,接下来的步骤需要添加存储库,为此, 你需要首先[知道你的 Ubuntu 版本][7]。 -对于 **Ubuntu 19.10** ,添加这个存储库: +对于 **Ubuntu 18.04 和 19.04**,用这个 PPA 添加 FAudio 依赖, **Ubuntu 19.10** 不需要它: ``` -sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ eoan main' +sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport ``` -如果你正在使用 **Ubuntu 18.04** 或 **Linux Mint 19.x** ,使用这个命令来添加存储库: +现在使用此命令添加存储库: ``` -sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' +sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu $(lsb_release -cs) main" ``` -对于 **Ubuntu 16.04 和 Linux Mint 18.x 系列** ,你可以使用这个命令: - -``` -sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main' -``` - -现在,你已经添加了正确的存储库,你可以使用这个命令来安装 Wine 5.0 : +现在你已经添加了正确的存储库,可以使用以下命令安装 Wine 5.0: ``` sudo apt update && sudo apt install --install-recommends winehq-stable ``` -**总结** +请注意,尽管[在软件包列表中将 Wine 5 列为稳定版][8],但你仍可能会看到 winehq-stable 的 wine 4.0.3。也许它不会传播到所有地理位置。从今天早上开始,我可以看到 Wine 5.0。 + +### 在 Linux Mint 19.1、19.2 和 19.3 中安装 Wine 5.0 + +正如一些读者通知我的那样,[apt-add 存储库命令][9]不适用于 Linux Mint 19.x 系列。 + +这是添加自定义存储库的另一种方法。你必须执行与 Ubuntu 相同的步骤。如删除现存的 Wine 包: + +``` +sudo apt remove winehq-stable wine-stable wine1.6 wine-mono wine-geco winetricks +``` + +添加 32 位支持: + +``` +sudo dpkg --add-architecture i386 +``` + +然后添加 GPG 密钥: + +``` +wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - +``` + +添加 FAudio 依赖: + +``` +sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport +``` + +现在为 Wine 存储库创建一个新条目: + +``` +sudo sh -c "echo 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' >> /etc/apt/sources.list.d/winehq.list" +``` + +更新软件包列表并安装Wine: + +``` +sudo apt update && sudo apt install --install-recommends winehq-stable +``` + +### 总结 你尝试过最新的 Wine 5.0 发布版本吗?如果是的话,在运行中你看到什么改进? @@ -104,7 +148,7 @@ via: https://itsfoss.com/wine-5-release/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -117,3 +161,5 @@ via: https://itsfoss.com/wine-5-release/ [5]: https://wiki.winehq.org/Download [6]: https://wiki.winehq.org/Building_Wine [7]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[8]: https://dl.winehq.org/wine-builds/ubuntu/dists/bionic/main/binary-amd64/ +[9]: https://itsfoss.com/add-apt-repository-command-not-found/ From 0f6c9206e83df2770d447759b8f2f1562a74ee2b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 28 Jan 2020 14:15:50 +0800 Subject: [PATCH 0443/3057] PUB @robsean https://linux.cn/article-11827-1.html --- ...20200123 Wine 5.0 is Released- Here-s How to Install it.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200123 Wine 5.0 is Released- Here-s How to Install it.md (98%) diff --git a/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md b/published/20200123 Wine 5.0 is Released- Here-s How to Install it.md similarity index 98% rename from translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md rename to published/20200123 Wine 5.0 is Released- Here-s How to Install it.md index 78f0909d4a..683f033104 100644 --- a/translated/tech/20200123 Wine 5.0 is Released- Here-s How to Install it.md +++ b/published/20200123 Wine 5.0 is Released- Here-s How to Install it.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11827-1.html) [#]: subject: (Wine 5.0 is Released! Here’s How to Install it) [#]: via: (https://itsfoss.com/wine-5-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From bd0cd29fdfa9daea6b126db74f8056f26552f3e3 Mon Sep 17 00:00:00 2001 From: alim0x Date: Tue, 28 Jan 2020 16:26:54 +0800 Subject: [PATCH 0444/3057] [translated]20191108 My Linux story- Learning Linux in the 90s --- ... Linux story- Learning Linux in the 90s.md | 61 ------------------- ... Linux story- Learning Linux in the 90s.md | 60 ++++++++++++++++++ 2 files changed, 60 insertions(+), 61 deletions(-) delete mode 100644 sources/talk/20191108 My Linux story- Learning Linux in the 90s.md create mode 100644 translated/talk/20191108 My Linux story- Learning Linux in the 90s.md diff --git a/sources/talk/20191108 My Linux story- Learning Linux in the 90s.md b/sources/talk/20191108 My Linux story- Learning Linux in the 90s.md deleted file mode 100644 index 11ba748cc8..0000000000 --- a/sources/talk/20191108 My Linux story- Learning Linux in the 90s.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (alim0x) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (My Linux story: Learning Linux in the 90s) -[#]: via: (https://opensource.com/article/19/11/learning-linux-90s) -[#]: author: (Mike Harris https://opensource.com/users/mharris) - -My Linux story: Learning Linux in the 90s -====== -This is the story of how I learned Linux before the age of WiFi, when -distributions came in the form of a CD. -![Sky with clouds and grass][1] - -Most people probably don't remember where they, the computing industry, or the everyday world were in 1996. But I remember that year very clearly. I was a sophomore in high school in the middle of Kansas, and it was the start of my journey into free and open source software (FOSS). - -I'm getting ahead of myself here. I was interested in computers even before 1996. I was born and raised on my family's first Apple ][e, followed many years later by the IBM Personal System/2. (Yes, there were definitely some generational skips along the way.) The IBM PS/2 had a very exciting feature: a 1200 baud Hayes modem. - -I don't remember how, but early on, I got the phone number of a local [BBS][2]. Once I dialed into it, I could get a list of other BBSes in the local area, and my adventure into networked computing began. - -In 1995, the people [lucky enough][3] to have a home internet connection spent less than 30 minutes a month using it. That internet was nothing like our modern services that operate over satellite, fiber, CATV coax, or any version of copper lines. Most homes dialed in with a modem, which tied up their phone line. (This was also long before cellphones were pervasive, and most people had just one home phone line.) I don't think there were many independent internet service providers (ISPs) back then, although that may have depended upon where you were located, so most people got service from a handful of big names, including America Online, CompuServe, and Prodigy. - -And the service you did get was very slow; even at dial-up's peak evolution at 56K, you could only expect to get a maximum of about 3.5 Kbps. If you wanted to try Linux, downloading a 200MB to 800MB ISO image or (more realistically) a disk image set was a dedication to time, determination, and lack of phone usage. - -I went with the easier route: In 1996, I ordered a "tri-Linux" CD set from a major Linux distributor. These tri-Linux disks provided three distributions; mine included Debian 1.1 (the first stable release of Debian), Red Hat Linux 3.0.3, and Slackware 3.1 (nicknamed Slackware '96). As I recall, the discs were purchased from an online store called [Linux Systems Labs][4]. The online store doesn't exist now, but in the 90s and early 00s, such distributors were common. And so were multi-disc sets of Linux. This one's from 1998 but gives you an idea of what they involved: - -![A tri-linux CD set][5] - -![A tri-linux CD set][6] - -On a fateful day in the summer of 1996, while living in a new and relatively rural city in Kansas, I made my first attempt at installing and working with Linux. Throughout the summer of '96, I tried all three distributions on that tri-Linux CD set. They all ran beautifully on my mom's older Pentium 75MHz computer. - -I ended up choosing [Slackware][7] 3.1 as my preferred distribution, probably more because of the terminal's appearance than the other, more important reasons one should consider before deciding on a distribution. - -I was up and running. I was connecting to an "off-brand" ISP (a local provider in the area), dialing in on my family's second phone line (ordered to accommodate all my internet use). I was in heaven. I had a dual-boot (Microsoft Windows 95 and Slackware 3.1) computer that worked wonderfully. I was still dialing into the BBSes that I knew and loved and playing online BBS games like Trade Wars, Usurper, and Legend of the Red Dragon. - -I can remember spending days upon days of time in #Linux on EFNet (IRC), helping other users answer their Linux questions and interacting with the moderation crew. - -More than 20 years after taking my first swing at using the Linux OS at home, I am now entering my fifth year as a consultant for Red Hat, still using Linux (now Fedora) as my daily driver, and still on IRC helping people looking to use Linux. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/learning-linux-90s - -作者:[Mike Harris][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mharris -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass) -[2]: https://en.wikipedia.org/wiki/Bulletin_board_system -[3]: https://en.wikipedia.org/wiki/Global_Internet_usage#Internet_users -[4]: https://web.archive.org/web/19961221003003/http://lsl.com/ -[5]: https://opensource.com/sites/default/files/20191026_142009.jpg (A tri-linux CD set) -[6]: https://opensource.com/sites/default/files/20191026_142020.jpg (A tri-linux CD set) -[7]: http://slackware.com diff --git a/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md b/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md new file mode 100644 index 0000000000..ea0847761d --- /dev/null +++ b/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (alim0x) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Linux story: Learning Linux in the 90s) +[#]: via: (https://opensource.com/article/19/11/learning-linux-90s) +[#]: author: (Mike Harris https://opensource.com/users/mharris) + +我的 Linux 故事:在 90 年代学习 Linux +====== +这是一个关于我如何在 WiFi 时代之前学习 Linux 的故事,那时的发行版还以 CD 的形式出现。 +![Sky with clouds and grass][1] + +大部分人可能不记得 1996 年时计算产业或日常生活世界的样子。但我很清楚地记得那一年。我那时候是堪萨斯中部一所高中的二年级学生,那是我的自由与开源软件(FOSS)旅程的开端。 + +我从这里开始进步。我在 1996 年之前就开始对计算机感兴趣。我出生并成长于我家的第一台 Apple ][e,然后多年之后是 IBM Personal System/2。(是的,在这过程中有一些代际的跨越。)IBM PS/2 有一个非常激动人心的特性:一个 1200 波特的 Hayes 调制解调器。 + +我不记得是怎样了,但在那不久之前,我得到了一个本地 [BBS][2] 的电话号码。一旦我拨号进去,我可以得到本地的一些其他 BBS 的列表,我的网络探险就此开始了。 + +在 1995 年,[足够幸运][3]的人拥有了家庭互联网连接,每月可以使用不到 30 分钟。这个互联网不像我们现代的服务那样,通过卫星、光纤、有线电视同轴电缆或任何版本的铜线提供。大多数家庭通过一个调制解调器拨号,它连接到他们的电话线上。(这时离移动电话无处不在的时代还早得很,大多数人只有一部家庭电话。)尽管这还要取决你所在的位置,但我不认为那时有很多独立的互联网服务提供商(ISP),所以大多数人从仅有的几家大公司获得服务,包括 America Online,CompuServe 以及 Prodigy。 + +你获取到的服务速率非常低,甚至在拨号上网演变的顶峰 56K,你也只能期望得到最高 3.5Kbps 的速率。如果你想要尝试 Linux,下载一个 200MB 到 800MB 的 ISO 镜像或(更加切合实际的)磁盘镜像要贡献出时间,决心,以及面临电话不可用的情形。 + +我走了一条简单一点的路:在 1996 年,我从一家主要的 Linux 分发商订购了一套“tri-Linux”CD。这些光盘提供了三个发行版,我的这套包含了 Debian 1.1 (Debian 的第一个稳定版本),Red Hat Linux 3.0.3 以及 Slackware 3.1(代号 Slackware '96)。据我回忆,这些光盘是从一家叫做 [Linux Systems Labs][4] 的在线商店购买的。这家在线商店如今已经不存在了,但在 90 年代和 00 年代早期,这样的分发商很常见。对于多光盘 Linux 套件也是如此。这是 1998 年的一套光盘,你可以了解到他们都包含了什么: + +![A tri-linux CD set][5] + +![A tri-linux CD set][6] + +在 1996 年夏天一个命中注定般的日子,那时我住在堪萨斯一个新的并且相对较为乡村的城市,我做出了安装并使用 Linux 的第一次尝试。在 1996 年的整个夏天,我尝试了那套三 Linux CD 套件里的全部三个发行版。他们都在我母亲的老 Pentium 75MHz 电脑上完美运行。 + +我最终选择了 [Slackware][7] 3.1 作为我喜欢的发行版,相比其他发行版可能更多的是因为它的终端的外观,这是决定选择一个发行版前需要考虑的重要因素。 + +我将系统设置完毕并运行了起来。我连接到一家“杂牌”ISP(一家这个区域的本地服务商),通过我家的第二条电话线拨号(为了满足我的所有互联网使用而订购)。那就像在天堂一样。我有一台完美运行的双系统(Microsoft Windows 95 和 Slackware 3.1)电脑。我依然拨号进入我所知道和喜爱的 BBS,游玩在线 BBS 游戏,比如 Trade Wars,Usurper 以及 Legend of the Red Dragon。 + +我能够记得花在 EFNet(IRC)上 #Linux 频道的一天天时光,帮助其他用户,回答他们的 Linux 问题以及和审核人员互动。 + +在我第一次在家尝试使用 Linux 系统的 20 多年后,我现在正进入作为 Red Hat 顾问的第五年,仍然在使用 Linux(现在是 Fedora)作为我的日常系统,并且依然在 IRC 上帮助想要使用 Linux 的人们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/learning-linux-90s + +作者:[Mike Harris][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/mharris +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass) +[2]: https://en.wikipedia.org/wiki/Bulletin_board_system +[3]: https://en.wikipedia.org/wiki/Global_Internet_usage#Internet_users +[4]: https://web.archive.org/web/19961221003003/http://lsl.com/ +[5]: https://opensource.com/sites/default/files/20191026_142009.jpg (A tri-linux CD set) +[6]: https://opensource.com/sites/default/files/20191026_142020.jpg (A tri-linux CD set) +[7]: http://slackware.com From c86d2bf7e564e4267d671d41997d2b9bdd9c74a2 Mon Sep 17 00:00:00 2001 From: lixin <56751837+lixin555@users.noreply.github.com> Date: Tue, 28 Jan 2020 23:32:10 +0800 Subject: [PATCH 0445/3057] lixin555 is translating lixin555 is translating --- .../20190503 Mirror your System Drive using Software RAID.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190503 Mirror your System Drive using Software RAID.md b/sources/tech/20190503 Mirror your System Drive using Software RAID.md index 1b5936dfa0..e72f3a5722 100644 --- a/sources/tech/20190503 Mirror your System Drive using Software RAID.md +++ b/sources/tech/20190503 Mirror your System Drive using Software RAID.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lixin555) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -272,7 +272,7 @@ via: https://fedoramagazine.org/mirror-your-system-drive-using-software-raid/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lixin555](https://github.com/lixin555) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 06071a54cfe5dcd1a56a8441626d537903ee70eb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 00:57:16 +0800 Subject: [PATCH 0446/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=20Ansi?= =?UTF-8?q?ble=20Playbooks=20Quick=20Start=20Guide=20with=20Examples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200129 Ansible Playbooks Quick Start Guide with Examples.md --- ...aybooks Quick Start Guide with Examples.md | 349 ++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 sources/tech/20200129 Ansible Playbooks Quick Start Guide with Examples.md diff --git a/sources/tech/20200129 Ansible Playbooks Quick Start Guide with Examples.md b/sources/tech/20200129 Ansible Playbooks Quick Start Guide with Examples.md new file mode 100644 index 0000000000..93b17b0fd3 --- /dev/null +++ b/sources/tech/20200129 Ansible Playbooks Quick Start Guide with Examples.md @@ -0,0 +1,349 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ansible Playbooks Quick Start Guide with Examples) +[#]: via: (https://www.2daygeek.com/ansible-playbooks-quick-start-guide-with-examples/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Ansible Playbooks Quick Start Guide with Examples +====== + +We have already written two articles about Ansible, this is the third article. + +If you are new to Ansible, I advise you to read the two topics below, which will teach you the basics of Ansible and what it is. + + * **Part-1: [How to Install and Configure Ansible on Linux][1]** + * **Part-2: [Ansible ad-hoc Command Quick Start Guide][2]** + + + +If you have finished them, you will feel the continuity as you read this article. + +### What is the Ansible Playbook? + +Playbooks are much more powerful and completely different way than ad-hoc command mode. + +It uses the **“/usr/bin/ansible-playbook”** binary. It provides rich features to make complex task easier. + +Playbooks are very useful if you want to run a task often. + +Also, this is useful if you want to perform multiple tasks at the same time on the group of server. + +Playbooks are written in YAML language. YAML stands for Ain’t Markup Language, which is easier for humans to read and write than other common data formats such as XML or JSON. + +The Ansible Playbook Flow Chart below will tell you its detailed structure. + +![][3] + +### Understanding the Ansible Playbooks Terminology + + * **Control Node:** The machine where Ansible is installed. It is responsible for managing client nodes. + * **Managed Nodes:** List of hosts managed by the control node + * **Playbook:** A Playbook file contains a set of procedures used to automate a task. + * **Inventory:** The inventory file contains information about the servers you manage. + * **Task:** Each play has multiple tasks, tasks that are executed one by one against a given machine (it a host or multiple host or a group of host). + * **Module:** Modules are a unit of code that is used to gather information from the client node. + * **Role:** Roles are ways to automatically load some vars_files, tasks, and handlers based on known file structure. + * **Play:** Each playbook has multiple plays, and a play is the implementation of a particular automation from beginning to end. + * **Handlers:** This helps you reduce any service restart in a play. Lists of handler tasks are not really different from regular tasks, and changes are notified by notifiers. If the handler does not receive any notification, it will not work. + + + +### How Does the Basic Playbook looks Like? + +Here’s how the basic playbook looks. + +``` +--- [YAML file should begin with a three dash] +- name: [Description about a script] + hosts: group [Add a host or host group] + become: true [It requires if you want to run a task as a root user] + tasks: [What action do you want to perform under task] + - name: [Enter the module options] + module: [Enter a module, which you want to perform] + module_options-1: value [Enter the module options] + module_options-2: value + . + module_options-N: value +``` + +### How to Understand Ansible Output + +The Ansible Playbook output comes with 4 colors, see below for color definitions. + + * **Green:** **ok –** If that is correct, the associated task data already exists and configured as needed. + * **Yellow: changed –** Specific data has updated or modified according to the needs of the tasks. + * **Red: FAILED –** If there is any problem while doing a task, it returns a failure message, it may be anything and you need to fix it accordingly. + * **White:** It comes with multiple parameters + + + +To do so, create a playbook directory to keep them all in one place. + +``` +$ sudo mkdir /etc/ansible/playbooks +``` + +### Playbook-1: Ansible Playbook to Install Apache Web Server on RHEL Based Systems + +This sample playbook allows you to install the Apache web server on a given target node. + +``` +$ sudo nano /etc/ansible/playbooks/apache.yml + +--- +- hosts: web + become: yes + name: "Install and Configure Apache Web server" + tasks: + - name: "Install Apache Web Server" + yum: + name: httpd + state: latest + - name: "Ensure Apache Web Server is Running" + service: + name: httpd + state: started +``` + +``` +$ ansible-playbook apache1.yml +``` + +![][3] + +### How to Understand Playbook Execution in Ansible + +To check the syntax error, run the following command. If it finds no error, it only shows the given file name. If it detects any error, you will get an error as follows, but the contents may differ based on your input file. + +``` +$ ansible-playbook apache1.yml --syntax-check + +ERROR! Syntax Error while loading YAML. + found a tab character that violate indentation +The error appears to be in '/etc/ansible/playbooks/apache1.yml': line 10, column 1, but may +be elsewhere in the file depending on the exact syntax problem. +The offending line appears to be: + state: latest +^ here +There appears to be a tab character at the start of the line. + +YAML does not use tabs for formatting. Tabs should be replaced with spaces. +For example: + - name: update tooling + vars: + version: 1.2.3 +# ^--- there is a tab there. +Should be written as: + - name: update tooling + vars: + version: 1.2.3 +# ^--- all spaces here. +``` + +Alternatively, you can check your ansible-playbook content from online using the following url @ [YAML Lint][4] + +Run the following command to perform a **“Dry Run”**. When you run a ansible-playbook with the **“–check”** option, it does not make any changes to the remote machine. Instead, it will tell you what changes they have made rather than create them. + +``` +$ ansible-playbook apache.yml --check + +PLAY [Install and Configure Apache Webserver] ******************************************************************** + +TASK [Gathering Facts] ******************************************************************************************* +ok: [node2.2g.lab] +ok: [node1.2g.lab] + +TASK [Install Apache Web Server] ********************************************************************************* +changed: [node2.2g.lab] +changed: [node1.2g.lab] + +TASK [Ensure Apache Web Server is Running] *********************************************************************** +changed: [node1.2g.lab] +changed: [node2.2g.lab] + +PLAY RECAP ******************************************************************************************************* +node1.2g.lab : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 +node2.2g.lab : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 +``` + +If you want detailed information about your ansible playbook implementation, use the **“-vv”** verbose option. It shows what it really does to gather this information. + +``` +$ ansible-playbook apache.yml --check -vv + +ansible-playbook 2.9.2 + config file = /etc/ansible/ansible.cfg + configured module search path = ['/home/daygeek/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] + ansible python module location = /usr/lib/python3.8/site-packages/ansible + executable location = /usr/bin/ansible-playbook + python version = 3.8.1 (default, Jan 8 2020, 23:09:20) [GCC 9.2.0] +Using /etc/ansible/ansible.cfg as config file + +PLAYBOOK: apache.yml ***************************************************************************************************** +1 plays in apache.yml + +PLAY [Install and Configure Apache Webserver] **************************************************************************** + +TASK [Gathering Facts] *************************************************************************************************** +task path: /etc/ansible/playbooks/apache.yml:2 +ok: [node2.2g.lab] +ok: [node1.2g.lab] +META: ran handlers + +TASK [Install Apache Web Server] ***************************************************************************************** +task path: /etc/ansible/playbooks/apache.yml:6 +changed: [node2.2g.lab] => {"changed": true, "msg": "Check mode: No changes made, but would have if not in check mod +e", "rc": 0, "results": ["Installed: httpd"]} +changed: [node1.2g.lab] => {"changed": true, "changes": {"installed": ["httpd"], "updated": []}, "msg": "", "obsolet +es": {"urw-fonts": {"dist": "noarch", "repo": "@anaconda", "version": "2.4-16.el7"}}, "rc": 0, "results": []} + +TASK [Ensure Apache Web Server is Running] ******************************************************************************* +task path: /etc/ansible/playbooks/apache.yml:10 +changed: [node1.2g.lab] => {"changed": true, "msg": "Service httpd not found on host, assuming it will exist on full run"} +changed: [node2.2g.lab] => {"changed": true, "msg": "Service httpd not found on host, assuming it will exist on full run"} +META: ran handlers +META: ran handlers + +PLAY RECAP *************************************************************************************************************** +node1.2g.lab : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 +node2.2g.lab : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 +``` + +### Playbook-2: Ansible Playbook to Install Apache Web Server on Ubuntu Based Systems + +This sample playbook allows you to install the Apache web server on a given target node. + +``` +$ sudo nano /etc/ansible/playbooks/apache-ubuntu.yml + +--- +- hosts: web + become: yes + name: "Install and Configure Apache Web Server" + tasks: + - name: "Install Apache Web Server" + yum: + name: apache2 + state: latest + + - name: "Start the Apache Web Server" + service: + name: apaceh2 + state: started + + - name: "Enable mod_rewrite module" + apache2_module: + name: rewrite + state: present + + notify: + - start apache + + handlers: + - name: "Ensure Apache Web Server is Running" + service: + name: apache2 + state: restarted + enabled: yes +``` + +### Playbook-3: Ansible Playbook to Install a List of Packages on Red Hat Based Systems + +This sample playbook allows you to install a list of packages on a given target node. + +**Method-1:** + +``` +$ sudo nano /etc/ansible/playbooks/packages-redhat.yml + +--- +- hosts: web + become: yes + name: "Install a List of Packages on Red Hat Based System" + tasks: + - name: "Installing a list of packages" + yum: + name: + - curl + - httpd + - nano + - htop +``` + +**Method-2:** + +``` +$ sudo nano /etc/ansible/playbooks/packages-redhat-1.yml + +--- +- hosts: web + become: yes + name: "Install a List of Packages on Red Hat Based System" + tasks: + - name: "Installing a list of packages" + yum: name={{ item }} state=latest + with_items: + - curl + - httpd + - nano + - htop +``` + +**Method-3: Using Array Variable** + +``` +$ sudo nano /etc/ansible/playbooks/packages-redhat-2.yml + +--- +- hosts: web + become: yes + name: "Install a List of Packages on Red Hat Based System" + vars: + packages: [ 'curl', 'git', 'htop' ] + tasks: + - name: Install a list of packages + yum: name={{ item }} state=latest + with_items: "{{ packages }}" +``` + +### Playbook-4: Ansible Playbook to Install Updates on Linux Systems + +This sample playbook allows you to install updates on your Linux systems, running Red Hat and Debian-based client nodes. + +``` +$ sudo nano /etc/ansible/playbooks/security-update.yml + +--- +- hosts: web + become: yes + name: "Install Security Update" + tasks: + - name: "Installing Security Update on Red Hat Based System" + yum: name=* update_cache=yes security=yes state=latest + when: ansible_facts['distribution'] == "CentOS" + + - name: "Installing Security Update on Ubuntu Based System" + apt: upgrade=dist update_cache=yes + when: ansible_facts['distribution'] == "Ubuntu" +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/ansible-playbooks-quick-start-guide-with-examples/ + +作者:[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/install-configure-ansible-automation-tool-linux-quick-start-guide/ +[2]: https://www.2daygeek.com/ansible-ad-hoc-command-quick-start-guide-with-examples/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: http://www.yamllint.com/ From 475869c5a8f6af61dd6288f28f83ba5206cc72bc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 00:57:58 +0800 Subject: [PATCH 0447/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200127=20Buil?= =?UTF-8?q?d=20your=20own=20cloud=20with=20Fedora=2031=20and=20Nextcloud?= =?UTF-8?q?=20Server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md --- ...oud with Fedora 31 and Nextcloud Server.md | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md diff --git a/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md b/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md new file mode 100644 index 0000000000..69b8ad9e06 --- /dev/null +++ b/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md @@ -0,0 +1,226 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build your own cloud with Fedora 31 and Nextcloud Server) +[#]: via: (https://fedoramagazine.org/build-your-own-cloud-with-fedora-31-and-nextcloud-server/) +[#]: author: (storyteller https://fedoramagazine.org/author/storyteller/) + +Build your own cloud with Fedora 31 and Nextcloud Server +====== + +![][1] + +[Nextcloud][2] is a software suite for storing and syncing your data across multiple devices. You can learn more about Nextcloud Server’s features from [https://github.com/nextcloud/server][3]. + +This article demonstrates how to build a personal cloud using Fedora and Nextcloud in a few simple steps. For this tutorial you will need a dedicated computer or a virtual machine running Fedora 31 server edition and an internet connection. + +### Step 1: Install the prerequisites + +Before installing and configuring Nextcloud, a few prerequisites must be satisfied. + +First, install Apache web server: + +``` +# dnf install httpd +``` + +Next, install PHP and some additional modules. Make sure that the PHP version being installed meets [Nextcloud’s requirements][4]: + +``` +# dnf install php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-pecl-redis php-opcache php-imagick php-zip php-process +``` + +After PHP is installed enable and start the Apache web server: + +``` +# systemctl enable --now httpd +``` + +Next, allow _HTTP_ traffic through the firewall: + +``` +# firewall-cmd --permanent --add-service=http +# firewall-cmd --reload +``` + +Next, install the MariaDB server and client: + +``` +# dnf install mariadb mariadb-server +``` + +Then enable and start the MariaDB server: + +``` +# systemctl enable --now mariadb +``` + +Now that MariaDB is running on your server, you can run the _mysql_secure_installation_ command to secure it: + +``` +# mysql_secure_installation + +NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL + MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP + CAREFULLY! + +In order to log into MariaDB to secure it, we'll need the +current password for the root user. If you've just installed +MariaDB, and you haven't set the root password yet, the password +will be blank, so you should just press enter here. + +Enter current password for root (enter for none): +OK, successfully used password, moving on... + +Setting the root password ensures that nobody can log into +the MariaDB root user without the proper authorization. + +Set root password? [Y/n] +New password: Your_Password_Here +Re-enter new password: Your_Password_Here + +Password updated successfully! + +Reloading privilege tables... + ... Success! + +By default, a MariaDB installation has an anonymous user, +allowing anyone to log into MariaDB without having to have +a user account created for them. This is intended only for +testing, and to make the installation go a bit smoother. You +should remove them before moving into a production environment. + +Remove anonymous users? [Y/n] + ... Success! + +Normally, root should only be allowed to connect from +'localhost'. This ensures that someone cannot guess at the +root password from the network. + +Disallow root login remotely? [Y/n] + ... Success! + +By default, MariaDB comes with a database named 'test' that +anyone can access. This is also intended only for testing, and +should be removed before moving into a production environment. + +Remove test database and access to it? [Y/n] + + - Dropping test database... + ... Success! + + - Removing privileges on test database... + ... Success! + +Reloading the privilege tables will ensure that all changes +made so far will take effect immediately. + +Reload privilege tables now? [Y/n] + ... Success! + +Cleaning up... + +All done! If you've completed all of the above steps, your +MariaDB installation should now be secure. + +Thanks for using MariaDB! +``` + +Next, create a dedicated user and database for your Nextcloud instance: + +``` +# mysql -p +> create database nextcloud; +> create user 'nc_admin'@'localhost' identified by 'SeCrEt'; +> grant all privileges on nextcloud.* to 'nc_admin'@'localhost'; +> flush privileges; +> exit; +``` + +### Step 2: Install Nextcloud Server + +Now that the prerequisites for your Nextcloud installation have been satisfied, download and unzip [the Nextcloud archive][5]: + +``` +# wget https://download.nextcloud.com/server/releases/nextcloud-17.0.2.zip +# unzip nextcloud-17.0.2.zip -d /var/www/html/ +``` + +Next, create a data folder and grant Apache read and write access to the _nextcloud_ directory tree: + +``` +# mkdir /var/www/html/nextcloud/data +# chown -R apache:apache /var/www/html/nextcloud +``` + +SELinux must be configured to work with Nextcloud. The basic commands are those bellow, but a lot more, by features used on nexcloud installation, are posted here: [Nextcloud SELinux configuration][6] + +``` +# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?' +# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/apps(/.*)?' +# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?' +# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.user.ini' +# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?' +# restorecon -Rv '/var/www/html/nextcloud/' +``` + +### Step 3: Configure N**extclou**d + +Nextcloud can be configured using its web interface or from the command line. + +#### Using the web interface + +From your favorite browser, access __ and fill the fields: + +![][7] + +#### Using the command line + +From the command line, just enter the following, substituting the values you used when you created a dedicated Nextcloud user in MariaDB earlier: + +``` +# sudo -u apache php occ maintenance:install --data-dir /var/www/html/nextcloud/data/ --database "mysql" --database-name "nextcloud" --database-user "nc_admin" --database-pass "DB_SeCuRe_PaSsWoRd" --admin-user "admin" --admin-pass "Admin_SeCuRe_PaSsWoRd" +``` + +### Final Notes + + * I used the _http_ protocol, but Nextcloud also works over _https_. I might write a follow-up about securing Nextcloud in a future article. + * I disabled SELinux, but your server will be more secure if you configure it. + * The recommend PHP memory limit for Nextcloud is 512M. To change it, edit the _memory_limit_ variable in the _/etc/php.ini_ configuration file and restart your _httpd_ service. + * By default, the web interface can only be accessed using the __ URL. If you want to allow access using other domain names, [you can do so by editing the _/var/www/html/nextcloud/config/config.php_ file][8]. The * character can be used to bypass the domain name restriction and allow the use of any URL that resolves to one of your server’s IP addresses. + + + +``` +'trusted_domains' => + array ( + 0 => 'localhost', + 1 => '*', + ), +``` + +_— Updated on January 28th, 2020 to include SELinux configuration —_ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/build-your-own-cloud-with-fedora-31-and-nextcloud-server/ + +作者:[storyteller][a] +选题:[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/storyteller/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/nextcloud-1-816x345.png +[2]: https://nextcloud.com/ +[3]: https://github.com/nextcloud/server#nextcloud-server- +[4]: https://docs.nextcloud.com/server/17/admin_manual/installation/system_requirements.html#server +[5]: https://nextcloud.com/install/#instructions-server +[6]: https://docs.nextcloud.com/server/17/admin_manual/installation/selinux_configuration.html +[7]: https://fedoramagazine.org/wp-content/uploads/2019/11/image.png +[8]: https://help.nextcloud.com/t/adding-a-new-trusted-domain/26 From b079c802edfc1ac53d9908a73b598324da20903b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 00:59:24 +0800 Subject: [PATCH 0448/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200127=20Buil?= =?UTF-8?q?ding=20Zero=20Trust=20authentication=20for=20multi-cloud=20appl?= =?UTF-8?q?ication=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200127 Building Zero Trust authentication for multi-cloud application services.md --- ...on for multi-cloud application services.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20200127 Building Zero Trust authentication for multi-cloud application services.md diff --git a/sources/tech/20200127 Building Zero Trust authentication for multi-cloud application services.md b/sources/tech/20200127 Building Zero Trust authentication for multi-cloud application services.md new file mode 100644 index 0000000000..009b39108f --- /dev/null +++ b/sources/tech/20200127 Building Zero Trust authentication for multi-cloud application services.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building Zero Trust authentication for multi-cloud application services) +[#]: via: (https://www.linux.com/articles/building-zero-trust-authentication-for-multi-cloud-application-services/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Building Zero Trust authentication for multi-cloud application services +====== + +[![][1]][2] + +[![][1]][2] + +One of the fundamental challenges organizations have about multi-cloud and hybrid cloud environments, is how to easily establish secure communication across different clouds and environments. Cloud providers have their own identity and access management solutions, such as AWS IAM, to manage what access an instance should and should not have. But as soon as the applications or services  need to communicate from AWS to GCP or from AWS to their on-prem infrastructure, it becomes a challenge because it’s AWS-specific and not interoperable. Engineering and operations teams need something secure that could work across environments and at the same time should not add any friction to the deployment cycles + +This is the problem [Scytale][3], a is trying to address with Secure Production Identity Framework for Everyone ([SPIFFE][4]) and SPIFFE Runtime Environment ([SPIRE][5]). Both of these open-source  projects originated at Scytale but now are part of  the Cloud Native Computing Foundation (CNCF). These projects have grown in popularity within the cloud native community and have seen contributions from organizations such as Amazon, Bloomberg, Google, Pinterest, Square , Uber and more. + +“Scytale is the primary driver of these projects that offer ‘interoperable identity’ between different cloud providers and different platforms,” Evan Gilman, Senior Engineer at Scytale.io and co-author of _[Zero Trust Networks][6]_. “From the commercial angle, we have built solutions to help organizations adopt these projects faster and  extend their functionalities to address the needs of enterprise customers .” + +**Vendor and technology neutral identity solution** +The passport analogy best explains interoperable identity. Passports from different countries all look different, but they all have the same size and meet the same specifications. They all have a picture of the passport holder at the same spot, they all have a barcode at the bottom. Regardless of what country issued the passport, it works across the globe. + +A “country” can be a particular software stack, platform, or a cloud provider. Regardless of the environment, the identities that exist within and between those silos can communicate. + +Interoperable identity becomes even more critical in the multi-cloud and hybrid cloud deployments, as they raise this fundamental challenge of how users secure communication across those boundaries. + +“We are bringing in a platform-agnostic service identity that is not specific to a cloud provider, platform, and technology,” said Gilman. It levels the playing field and allows users to talk across boundaries. Users won’t talk in AWS or GCP specifics; they communicate on the SPIFFE level. “SPIFFE provides users with what is sometimes referred to as a secure dial tone: you pick up the phone, it rings the other side irrespective of where it’s running and what platform it’s running on,” added Gilman. + +**SPIFFE based service** authentication **foundational for zero trust networks** +SPIFFE is a standard, a set of documents whereas SPIRE is the software implementation of that standard. SPIRE implements the SPIFFE specifications and enables workloads or services to get these “passports” as soon as they boot, in a way that is very reliable, scalable, and highly automated. This identity centric authentication is also critical for building a zero trust-based security model  , which removes reliance on networks to deliver trustworthy information. + +“Networks have been historically fairly manipulable. So instead we build systems in such a way that it doesn’t rely on that network to deliver trustworthy information,” said Gilman, “We use protocols and strong authentication and authorization to try to mitigate any kind of business that might happen on the wire. It also mitigates what we call lateral movement. So if a neighbor is compromised, just because you’re attached to the same network, that should not mean that you should gain access that you would not have otherwise.” + +Gilman explains, “Part of the SPIFFE specification set deals with what we call ‘federation’. There is usually a centralized authority that issues these identities. In reality, there are different companies that have their own authorities. Even different software stacks have their own authorities. There is a need to bridge these gaps.” + +That’s where the SPIFFE Federation enters the picture. It swaps these cryptographic keys between different domains. It allows users with different identity providers to communicate effortlessly. + +One key design principle of the SPIFFE Federation is that it is compatible with OIDC, which is a similar identity federation spec, but is more focused around users. It allows for server-to-server and service-to-service communication. Any existing OIDC can take advantage of it and pass one of its SPIFFE identity documents to a public cloud like AWS, which will be able to validate it using this OIDC SPIFFE Federation mechanism. + +While SPIFFE as a specification doesn’t change, SPIRE has a monthly release cadence. It continues to add new features on a regular basis. + +The latest release introduced integration with the AWS Private CA Manager, which means that SPIRE deployments living inside AWS can use it to protect the sign-in keys for identities. These identities are cryptographically backed so there is a key that is used to sign these identities. One of the biggest challenges is to secure these sign-in keys. Being able to bury that key inside the AWS service, which is backed by hardware protection, is an incredible feature. + +The community is also working on a feature called Nested SPIRE, which allows users to have multiple SPIRE server clusters that form a tree and chain up to each other. + +Together, these new features give a lot of flexibility in terms of architecting for failure modes and failure domains, and architecting around different security domains. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/building-zero-trust-authentication-for-multi-cloud-application-services/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2020/01/buffer-1143485_1920-1068x638.jpg (passport) +[2]: https://www.linux.com/wp-content/uploads/2020/01/buffer-1143485_1920.jpg +[3]: https://scytale.io/ +[4]: https://spiffe.io/ +[5]: https://spiffe.io/spire/ +[6]: https://www.amazon.com/Zero-Trust-Networks-Building-Untrusted/dp/1491962194 From cae653c69b2e520ad6b83a69ff5469a165315f95 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:04:35 +0800 Subject: [PATCH 0449/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=20What?= =?UTF-8?q?=20Amazon=20Kindle=3F=20Here=E2=80=99s=20an=20Open=20Source=20e?= =?UTF-8?q?Book=20Reader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200129 What Amazon Kindle- Here-s an Open Source eBook Reader.md --- ...dle- Here-s an Open Source eBook Reader.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20200129 What Amazon Kindle- Here-s an Open Source eBook Reader.md diff --git a/sources/tech/20200129 What Amazon Kindle- Here-s an Open Source eBook Reader.md b/sources/tech/20200129 What Amazon Kindle- Here-s an Open Source eBook Reader.md new file mode 100644 index 0000000000..7106bb596b --- /dev/null +++ b/sources/tech/20200129 What Amazon Kindle- Here-s an Open Source eBook Reader.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What Amazon Kindle? Here’s an Open Source eBook Reader) +[#]: via: (https://itsfoss.com/open-book/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What Amazon Kindle? Here’s an Open Source eBook Reader +====== + +When it comes to an eBook reader, the choices are limited. The market is dominated by [Amazon's proprietary Kindle][1] along with a few other options like Kobo, Nook and Onyx. + +An interesting news for open source enthusiasts is that a developer, [Joey Castillo][2], is working on creating an open source eBook reader appropriately named Open Book. + +### Open Book: An open source eBook reader + +![][3] + +The [Open Book][4] aims to be a simple ‘open’ device that “anyone with a soldering iron can build for themselves”. + +It’s hackable so if you are into DIY stuff and you have some knowledge, you may tweak it to your liking. For example, Joey use [TensorFlow Lite][5] to give voice commands for flipping the pages on Open Book. You can do things like this on your own on this open hardware device. + +> Voice commands on the [#OpenBook][6] with [#TensorFlowLite][7]. When I added a mic amp for voice, I considered this a “someday” feature; I didn’t imagine one could hack it together in an evening! Major credit to [@adafruit][8]; their TFL Arduino port makes this possible. [pic.twitter.com/PfXZx99A9y][9] +> +> — joey castillo (@josecastillo) [December 13, 2019][10] + +If that kind of scares you because you are not really into tinkering with hardware, I have a good news for you. Open Book was named winner of [Hackaday’s Take Flight with Feather contest][11]! + +This means that when the hardware is ready, you should be able to purchase it from [DigiKey][12]. You should be able to fit the device as an eBook reader or experiment with it, if you feel like doing it. + +It kind of reminds me of [Game Shell][13], a single board computer based retro gaming console that could be tinkered into many other things. + +### Open Book specifications + +![][14] + +There are two versions of Open Book: Open Book Feather and E-Book Feather Wing. The eBook wing does less than the Open Book Feather, mainly because it’s limited to using only the pins available via the Feather header. + +You may guess from the name that the project uses [Adafruit’s Feather development boards][15]. + +Here are the main specifications for the Open Book (both versions): + + * 4.2 inch, 400 x 300 pixel ePaper display + * SAMD51 ARM Cortex-M4 32-bit processor + * 7 buttons for navigation (directional pad, select button and page turn buttons) + * status LED lights + * A microSD card reader + * Headphone jack + + + +The display seems a bit small, isn’t it? + +### Open Book release, pricing and availability + +![][16] + +Open Book is the winner of [Take Flight with Feather competition by Hackaday][11]. This means that at least 100 Open Book boards will be manufactured and made available for purchase. + +[Liliputing][17] noted that [Adafruit][18] will be handling the manufacturing, and [Digi-Key][19] will eventually be selling Open Book boards. + +At this point, it’s not clear how much will it cost and exactly when it will be available. + +Remember that it’s an open source project. You can find all the circuit designs, source code on its GitHub page and if you have the skills, get the required hardware components and build an Open Book on your own. + +[Open Book on GitHub][4] + +Otherwise, wait for a couple of months (hopefully) for the release of the Open Book boards and then go about experimenting with the device. + +If you like the project and want to support it, you can help [Joey on Pateron][20]. You can follow the updates on the Open Book on the Patreon page, [Joey’s mailing list][21] or Joey’s [Twitter account][2]. + +_Do you think the project has potential? Would you buy one when it is available? What do you think of it?_ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-book/ + +作者:[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.amazon.com/dp/B07DLPWYB7?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Amazon's proprietary Kindle) +[2]: https://twitter.com/josecastillo +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/open-book-under-development-feature.jpeg?ssl=1 +[4]: https://github.com/joeycastillo/The-Open-Book +[5]: https://www.tensorflow.org/lite +[6]: https://twitter.com/hashtag/OpenBook?src=hash&ref_src=twsrc%5Etfw +[7]: https://twitter.com/hashtag/TensorFlowLite?src=hash&ref_src=twsrc%5Etfw +[8]: https://twitter.com/adafruit?ref_src=twsrc%5Etfw +[9]: https://t.co/PfXZx99A9y +[10]: https://twitter.com/josecastillo/status/1205549284403355648?ref_src=twsrc%5Etfw +[11]: https://hackaday.io/contest/168107-take-flight-with-feather +[12]: https://www.digikey.com/ +[13]: https://itsfoss.com/gameshell-console/ +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/open-book-board.jpg?ssl=1 +[15]: https://www.adafruit.com/feather +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/open-book-demo.jpeg?ssl=1 +[17]: https://liliputing.com/2020/01/the-open-book-ereader-will-be-a-real-thing-you-can-buy-eventually.html +[18]: https://www.adafruit.com/ +[19]: https://www.digikey.com/en/resources/beta-1 +[20]: https://www.patreon.com/joeycastillo +[21]: http://eepurl.com/gKOpQ9 From 74aab96c7fa9e100b9e53350249677dd8d64e715 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:05:03 +0800 Subject: [PATCH 0450/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=20Jopl?= =?UTF-8?q?in:=20The=20True=20Open=20Source=20Evernote=20Alternative?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200129 Joplin- The True Open Source Evernote Alternative.md --- ...e True Open Source Evernote Alternative.md | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 sources/tech/20200129 Joplin- The True Open Source Evernote Alternative.md diff --git a/sources/tech/20200129 Joplin- The True Open Source Evernote Alternative.md b/sources/tech/20200129 Joplin- The True Open Source Evernote Alternative.md new file mode 100644 index 0000000000..61d48785af --- /dev/null +++ b/sources/tech/20200129 Joplin- The True Open Source Evernote Alternative.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Joplin: The True Open Source Evernote Alternative) +[#]: via: (https://itsfoss.com/joplin/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Joplin: The True Open Source Evernote Alternative +====== + +_**Brief: Joplin is an open source note taking and to-do application. You can organize notes into notebooks and tag them. Joplin also provides a web-clipper to save articles from the internet.**_ + +### Joplin: Open source note organizer + +![][1] + +If you like [Evernote][2], you won’t be too uncomfortable with the open source software, [Joplin][3]. + +Joplin is an excellent open source note taking application with plenty of features. You can take notes, make to-do list and sync your notes across devices by linking it with cloud services like Dropbox and NextCloud. The synchronization is protected with end to end encryption. + +Joplin also has a web clipper that allows you to save webpages as notes. The web clipper is available for Firefox and Chrome/Chromium browsers. + +Joplin makes the switch from Evernote easier by allowing importing Evernote files in Enex format. + +Since you own the data, you can export all your files either in Joplin format or in the raw format. + +### Features of Joplin + +![][4] + +Here’s a list of all the features Joplin provides: + + * Save notes into notebooks and sub-notebooks for better organization + * Create to-do list + * Notes can be tagged and searched + * Offline first, so the entire data is always available on the device even without an internet connection + * Markdown notes with pictures, math notation and checkboxes support + * File attachment support + * Application available for desktop, mobile and terminal (CLI) + * [Web Clipper][5] for Firefox and Chrome + * End To End Encryption + * Keeps note history + * Notes sorting based on name, time etc + * Synchronisation with various [cloud services][6] like [Nextcloud][7], Dropbox, WebDAV and OneDrive + * Import files from Evernote + * Export JEX files (Joplin Export format) and raw files. + * Support notes, to-dos, tags and notebooks. + * Goto Anything feature. + * Support for notifications in mobile and desktop applications. + * Geo-location support. + * Supports multiple languages + * External editor support – open notes in your favorite external editor with one click in Joplin. + + + +**Recommended Read:** + +![][8] + +#### [EncryptPad – Encrypted Text Editor For Linux][9] + +Looking for a text editor with encryption in Linux? Meet EncryptPad, a text editor with built-in encryption. + +### Installing Joplin on Linux and other platforms + +![][10] + +[Joplin][11] is a cross-platform application available for Linux, macOS and Windows. On the mobile, you can [get the APK file][12] to install it on Android and Android-based ROMs. You can also [get it from the Google Play store][13]. + +For Linux, you can [use AppImage][14] file for Joplin and run the application as an executable. You’ll have to give execute permission to the downloaded file. + +[Download Joplin][15] + +### Experiencing Joplin + +Notes in Joplin use markdown but you don’t have to know markdown notations to use it. The editor has a top panel that lets you graphically choose the bullet points, headings, images, link etc. + +Though Joplin provides many interesting features, you have to fiddle around on your own to check things out. For example, the web clipper is not enabled by default and I had to figure out how to do it. + +You have to enable the clipper from the desktop application. From the top menu, go to Tools->Options. You’ll find the Web Clipper option here: + +![Enable Web Clipper from the desktop application first][16] + +The web clipper is not as smart as Evernote’s web clipper that allows to clip portion of a web article graphically. However, you still have good enough options here. + +It is an open source software under active development and I do hope that it gets more improvement over the time. + +**Conclusion** + +If you are looking for a good note taking application with web-clipper feature, do give Joplin a try. And if you like it and would continue using, try to help Joplin development by making a donation or improving its code and documentation. I made a sweet little [donation][17] of 25 Euro on behalf of It’s FOSS. + +If you have used Joplin in the past or still using it, how’s your experience with it? If you use some other note taking application, would you switch to Joplin? Feel free to share your views. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/joplin/ + +作者:[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/2020/01/joplin_logo.png?ssl=1 +[2]: https://evernote.com/ +[3]: https://joplinapp.org/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/joplin_featured.jpg?ssl=1 +[5]: https://joplinapp.org/clipper/ +[6]: https://itsfoss.com/cloud-services-linux/ +[7]: https://nextcloud.com/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/encryptpad-text-editor-with-encryption.jpg?fit=800%2C450&ssl=1 +[9]: https://itsfoss.com/encryptpad-encrypted-text-editor-linux/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/joplin_ubuntu.jpg?ssl=1 +[11]: https://github.com/laurent22/joplin +[12]: https://itsfoss.com/download-apk-ubuntu/ +[13]: https://play.google.com/store/apps/details?id=net.cozic.joplin&hl=en_US +[14]: https://itsfoss.com/use-appimage-linux/ +[15]: https://github.com/laurent22/joplin/releases +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/joplin_web_clipper.jpg?ssl=1 +[17]: https://itsfoss.com/donations-foss/ From 98b2548752d61501bcd491aaa874f209f5b3d2ed Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:05:43 +0800 Subject: [PATCH 0451/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200128=20Send?= =?UTF-8?q?=20email=20and=20check=20your=20calendar=20with=20Emacs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200128 Send email and check your calendar with Emacs.md --- ...mail and check your calendar with Emacs.md | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 sources/tech/20200128 Send email and check your calendar with Emacs.md diff --git a/sources/tech/20200128 Send email and check your calendar with Emacs.md b/sources/tech/20200128 Send email and check your calendar with Emacs.md new file mode 100644 index 0000000000..48be7e8e45 --- /dev/null +++ b/sources/tech/20200128 Send email and check your calendar with Emacs.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Send email and check your calendar with Emacs) +[#]: via: (https://opensource.com/article/20/1/emacs-mail-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Send email and check your calendar with Emacs +====== +Manage your email and view your schedule with the Emacs text editor in +the eighteenth in our series on 20 ways to be more productive with open +source in 2020. +![Document sending][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Doing (almost) all the things with Emacs, part 1 + +Two days ago, I shared that I use both [Vim][2] and [Emacs][3] regularly, and on days [16][4] and [17][5] of this series, I explained how to do almost everything in Vim. Now, it's time for Emacs! + +![Mail and calendar in Emacs][6] + +Before I get too far, I should explain two things. First, I'm doing everything here using the default Emacs configuration, not [Spacemacs][7], which I have [written about][8]. Why? Because I will be using the default keyboard mappings so that you can refer back to the documentation and not have to translate things from "native Emacs" to Spacemacs. Second, I'm not setting up Org mode in this series. Org mode almost needs an entire series on its own, and, while it is very powerful, the setup can be quite complex. + +#### Configure Emacs + +Configuring Emacs is a little bit more complicated than configuring Vim, but in my opinion, it is worth it in the long run. Start by creating a configuration file and opening it in Emacs: + + +``` +mkdir ~/.emacs.d +emacs ~/.emacs.d/init.el +``` + +Next, add some additional package sources to the built-in package manager. Add the following to **init.el**: + + +``` +(package-initialize) +(add-to-list 'package-archives '("melpa" . "")) +(add-to-list 'package-archives '("org" . "") t) +(add-to-list 'package-archives '("gnu" . "")) +(package-refresh-contents) +``` + +Save the file with **Ctrl**+**x** **Ctrl**+**s**, exit with **Ctrl**+**x** **Ctrl**+**c**, and restart Emacs. It will download all the package lists at startup, and then you should be ready to install things with the built-in package manager. Start by typing **Meta**+**x** to bring up a command prompt (the **Meta** key is the **Alt** key on most keyboards or **Option** on MacOS). At the command prompt, type **package-list-packages** to bring up a list of packages you can install. Go through the list and select the following packages with the **i** key: + + +``` +bbdb +bbdb-vcard +calfw +calfw-ical +notmuch +``` + +Once the packages are selected, press **x** to install them. Depending on your internet connection, this could take a while. You may see some compile errors, but it's safe to ignore them. Once it completes, open **~/.emacs.d/init.el** with the key combination **Ctrl**+**x** **Ctrl**+**f**, and add the following lines to the file after **(package-refresh-packages)** and before **(custom-set-variables**. Emacs uses the **(custom-set-variables** line internally, and you should never, ever modify anything below it. Lines beginning with **;;** are comments. + + +``` +;; Set up bbdb +(require 'bbdb) +(bbdb-initialize 'message) +(bbdb-insinuate-message) +(add-hook 'message-setup-hook 'bbdb-insinuate-mail) +;; set up calendar +(require 'calfw) +(require 'calfw-ical) +;; Set this to the URL of your calendar. Google users will use +;; the Secret Address in iCalendar Format from the calendar settings +(cfw:open-ical-calendar "") +;; Set up notmuch +(require 'notmuch) +;; set up mail sending using sendmail +(setq send-mail-function (quote sendmail-send-it)) +(setq user-mail-address "[myemail@mydomain.com][9]" +      user-full-name "My Name") +``` + +Now you are ready to start Emacs with your setup! Save the **init.el** file (**Ctrl**+**x** **Ctrl**+**s**), exit Emacs (**Ctrl**+**x** **Ctrl**+**c**), and then restart it. It will take a little longer to start this time. + +#### Read and write email in Emacs with Notmuch + +Once you are at the Emacs splash screen, you can start reading your email with [Notmuch][10]. Type **Meta**+**x notmuch**, and you'll get Notmuch's Emacs interface. + +![Reading mail with Notmuch][11] + +All the items in bold type are links to email views. You can access them with either a mouse click or by tabbing between them and pressing **Return** or **Enter**. You can use the search bar to + +search Notmuch's database using the [same syntax][12] as you use on Notmuch's command line. If you want, you can save any searches for later use with the **[save]** button, and they will be added to the list at the top of the screen. If you follow one of the links, you will get a list of the relevant email messages. You can navigate the list with the **Arrow** keys, and press **Enter** on the message you want to read. Pressing **r** will reply to a message, **f** will forward the message, and **q** will exit the current screen. + +You can write a new message by typing **Meta**+**x compose-mail**. Composing, replying, and forwarding all bring up the mail writing interface. When you are done writing your email, press **Ctrl**+**c Ctrl**+**c** to send it. If you decide you don't want to send it, press **Ctrl**+**c Ctrl**+**k** to kill the message compose buffer (window). + +#### Autocomplete email addresses in Emacs with BBDB + +![Composing a message with BBDB addressing][13] + +But what about your address book? That's where [BBDB][14] comes in. But first, import all your addresses from [abook][15] by opening a command line and running the following export command: + + +``` +`abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses` +``` + +Once Emacs starts, run **Meta**+**x bbdb-vcard-import-file**. It will prompt you for the file name you want to import, which is **~/all-my-addresses.vcf**. After the import finishes, when you compose a message, you can start typing a name and use **Tab** to search and autocomplete the "To" field. BBDB will also open a buffer for the contact so you can make sure it's the correct one. + +Why do it this way when you already have each address as a **vcf.** file from [vdirsyncer][16]? If you are like me, you have a LOT of addresses, and doing them one at a time is a lot of work. This way, you can take everything you have in abook and make one big file. + +#### View your calendar in Emacs with calfw + +![calfw calendar][17] + +Finally, you can use Emacs to look at your calendar. In the configuration section above, you installed the [calfw][18] package and added lines to tell it where to find the calendars to load. Calfw is short for the Calendar Framework for Emacs, and it supports many calendar formats. Since I use Google calendar, that is the link I put into my config. Your calendar will auto-load at startup, and you can view it by switching the **cfw-calendar** buffer with the **Ctrl**+**x**+**b** command. + +Calfw offers views by the day, week, two weeks, and month. You can select the view from the top of the calendar and navigate your calendar with the **Arrow** keys. Unfortunately, calfw can only view calendars, so you'll still need to use something like [khal][19] or a web interface to add, delete, and modify events. + +So there you have it: mail, calendars, and addresses in Emacs. Tomorrow I'll do even more. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/emacs-mail-calendar + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ (Document sending) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/emacs/ +[4]: https://opensource.com/article/20/1/vim-email-calendar +[5]: https://opensource.com/article/20/1/vim-task-list-reddit-twitter +[6]: https://opensource.com/sites/default/files/uploads/productivity_18-1.png (Mail and calendar in Emacs) +[7]: https://www.spacemacs.org/ +[8]: https://opensource.com/article/19/12/spacemacs +[9]: mailto:myemail@mydomain.com +[10]: https://notmuchmail.org/ +[11]: https://opensource.com/sites/default/files/uploads/productivity_18-2.png (Reading mail with Notmuch) +[12]: https://opensource.com/article/20/1/organize-email-notmuch +[13]: https://opensource.com/sites/default/files/uploads/productivity_18-3.png (Composing a message with BBDB addressing) +[14]: https://www.jwz.org/bbdb/ +[15]: https://opensource.com/article/20/1/sync-contacts-locally +[16]: https://opensource.com/article/20/1/open-source-calendar +[17]: https://opensource.com/sites/default/files/uploads/productivity_18-4.png (calfw calendar) +[18]: https://github.com/kiwanami/emacs-calfw +[19]: https://khal.readthedocs.io/en/v0.9.2/index.html From 7e61c0b24faa3656f7051fde71f1eef49b839f59 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:06:50 +0800 Subject: [PATCH 0452/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200128=20How?= =?UTF-8?q?=20I=20had=20a=20nerdy=20date=20night=20with=20StreetComplete?= =?UTF-8?q?=20quests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200128 How I had a nerdy date night with StreetComplete quests.md --- ...y date night with StreetComplete quests.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/tech/20200128 How I had a nerdy date night with StreetComplete quests.md diff --git a/sources/tech/20200128 How I had a nerdy date night with StreetComplete quests.md b/sources/tech/20200128 How I had a nerdy date night with StreetComplete quests.md new file mode 100644 index 0000000000..73f163fc01 --- /dev/null +++ b/sources/tech/20200128 How I had a nerdy date night with StreetComplete quests.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I had a nerdy date night with StreetComplete quests) +[#]: via: (https://opensource.com/article/20/1/streetcomplete-crowdsource-maps) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +How I had a nerdy date night with StreetComplete quests +====== +Find an adventure in your own backyard with this fun app. +![A map with a route highlighted][1] + +StreetComplete is an Android app that makes it fun and easy to contribute to open data by completing quests. + +Quests are used to fill in incomplete or inaccurate information on [OpenStreetMap][2], an open data project dedicated to mapping the world through crowdsourcing. Anyone can contribute to the map and, thanks to free culture and open source licenses, that data can then be used by anyone for anything, from video games to custom map applications and artwork. + +![hands holding phone][3] + +My first intro to StreetComplete was on a charmingly unique date night with my partner. Instead of dinner and a movie, we explored the streets of our town, both the familiar and unfamiliar, answering questions about features of topography, shopfronts, pedestrian crossing, and more. We got to see our town in a new light, and we felt we were ultimately helping others discover it along with us. + +If this sounds like something you’d like to get involved with, it’s super simple to get started. Just follow the steps below: + + 1. [Download the app][4] to your phone from F-Droid or Google Play. It’s licensed under GPLv3. + 2. Allow StreetComplete to access your device’s location. + 3. Click the menu in the upper right corner, and select Settings. + 4. In the Settings menu, select Authorize OSM access. This will open OpenStreetMap in your browser, where you can register for an account or login if you already have one. + 5. Authorize access to your account. + + + +Now you’re ready to go! + +### Completing quests + +To complete quests, walk around the area of your choosing. Quests appear as pins on the map. Symbols inside pins denote the type of task, such as a wheelchair for an accessibility quest or leaf for a plant-based quest. Quests involve simple questions about various features, with clear multiple choice answers and visuals when necessary. + +Quests can be chosen at random, though the app will question your response if you try to complete a quest when you are not nearby. I live in a small town, so I especially enjoyed quests that required us to ask questions of shop owners because it allowed us to connect with the community in real life while contributing to the global community online. + +![StreetComplete map image][5] + +If you live in a mobile deadzone or have a limited mobile plan, you can still have fun questing for map data; StreetComplete has an offline mode. To use it, activate the offline download option in the app settings menu. Once your region has downloaded, perform a search for nearby quests, then go out and explore. + +When you are back online, the data you’ve input as quest responses are uploaded to the OpenStreetMap servers. + +StreetComplete is a great way to investigate new areas or even locations you may already be somewhat familiar with. With its graphical, flat design and simple quests, it makes a perfect activity for couples, friends, and families to complete together. + +Maps touch our lives daily. Whether you are trying to find a nearby point of interest or directions... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/streetcomplete-crowdsource-maps + +作者:[Jess Weichler][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/map_route_location_gps_path.png?itok=RwtS4DsU (A map with a route highlighted) +[2]: https://www.openstreetmap.org +[3]: https://opensource.com/sites/default/files/uploads/image1_street.png (hands holding phone) +[4]: https://github.com/westnordost/StreetComplete +[5]: https://opensource.com/sites/default/files/uploads/image2_street.jpeg (StreetComplete map image) From 16da5754741caa2e4e59a305f2a38d7da659106a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:07:18 +0800 Subject: [PATCH 0453/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200128=20How?= =?UTF-8?q?=20I=20teach=20physics=20using=20open=20source=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200128 How I teach physics using open source tools.md --- ...I teach physics using open source tools.md | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 sources/tech/20200128 How I teach physics using open source tools.md diff --git a/sources/tech/20200128 How I teach physics using open source tools.md b/sources/tech/20200128 How I teach physics using open source tools.md new file mode 100644 index 0000000000..a1e695781d --- /dev/null +++ b/sources/tech/20200128 How I teach physics using open source tools.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I teach physics using open source tools) +[#]: via: (https://opensource.com/article/20/1/teach-physics-open-source) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +How I teach physics using open source tools +====== +A roundup of open source tools ideal for teaching physics (and other +subjects). +![Person reading a book and digital copy][1] + +The nice aspect of being a physicist and a researcher is the openness of our community. There is a lot of collaboration and sharing of ideas (especially during coffee breaks). We also tend to share the software we write. Since we are very picky about algorithms, we want to modify other people’s code to fix the obvious errors that we find. It feels frustrating when I have to use proprietary tools since I cannot understand their inner workings. Having grown up professionally in such an environment, open source has been my go-to solution for all the software I use. + +When I became the regular teacher of the Physics and Biophysics course at the [medical school][2] at my [university][3], I decided to use only open source software to prepare my lectures. Here is my experience so far and the solutions I found. + +### Study material + +Teaching is not easy. You should first understand the subject and then figure out how to communicate with somebody that knows nothing about the subject; therefore, it is of paramount importance to study the subject in depth and prepare the lectures well in advance. There are countless books about physics, but there are also some interesting, freely available resources. Most of these do not count as open source, as they cannot be modified, but they are useful anyways. + + * [HyperPhysics][4] may have an outdated look, but it is a treasure trove of interesting concepts and insights by Carl R. Nave, Department of Physics and Astronomy Georgia State University. + * [Open Source Physics][5] has a fabulous collection of applets and support material. I met some of the maintainers at various conferences, and they are remarkable people. + * [OpenStax][6] is a nonprofit educational initiative based at Rice University that publishes textbooks that are free online. They have a good library and several works about physics in their [scientific section][7]. + * [Open Textbook Library][8] provides a catalog of free textbooks with a [physics section][9] as well. Some of the titles have reviews by users. + * [Motion Mountain][10] is a collection of books about physics in general by C. Schiller that has also been translated into several languages. + * [Light and Matter][11] is another collection of writings about different aspects of physics, all authored by B. Crowell of Fullerton College, CA. + * [Wikipedia][12], what more can I say? + + + +### Lecturing style + +Before preparing my support material, I had to decide whether I preferred to use the blackboard or slideshows during the lectures. I opted to use both with the idea of showing hard-to-draw graphics in the slideshows and writing down equations on the blackboard. Eventually, the slideshows became much more prevalent. I use them as the draft of my lecture, helping me to keep track of what I want to say. I also added the mathematical proofs that I want to show to have a correct reference during the lecture. + +Instead of using a blackboard, I ended up using a [graphics tablet][13] for all the notes I write during the lectures. I use the tablet for three main purposes: to draw additional drawings to explain myself better, to write down equations and proofs, and to write down the key messages that I want my students to remember. Even if what I write is already on the slideshows, actually writing it by hand during the lectures gives the students the time to write it down in their notes. After the lectures, I share, on my website, both the slideshows and my notes. + +![Figure: Example of notes taken during class with the graphics tablet and Krita][14] + +Figure: Example of notes taken during class with the graphics tablet and Krita + +### Material preparation + +#### Slideshows + +Since math is the language of physics, I needed a practical way to write down equations in my slideshows. Probably, the best tool for that is [LaTeX][15], but it was designed to typeset books and not slides. Luckily, there is the [Beamer class][16] that allows you to typeset slideshows with LaTeX. The resulting file is a very portable PDF. The layout is nice and clean and forces me not to overstuff each slide. From the same source code, I can prepare two versions of the file. The lecture version follows the guidelines of the university’s [corporate identity][17] (_i.e.,_ with a thick red border), while the handout version has a cleaner layout (_e.g.,_ without the thick borders), thus allowing it to be printed without wasting printer toner. I have also seen students taking notes directly on the PDFs of the handouts on their tablets and computers. + +The only drawback of using LaTeX and Beamer is the impossibility of embedding videos in the produced presentation. I, therefore, have to keep as a separate file the occasional videos that I show during class. + +![Figure: Examples of slides created with LaTeX and Beamer][18] + +Figure: Examples of slides created with LaTeX and Beamer + +![Figure: Examples of slides created with LaTeX and Beamer][19] + +Figure: Examples of slides created with LaTeX and Beamer + +#### Images and diagrams + +Something that I am careful about is the licensing of the graphics I use. As such, I never use graphics that do not allow me to redistribute my modifications. I drew most of the images in my slideshows. If I use other people’s work, I always reference it in my slide. + +I prefer to use [vector graphics][20] whenever practicable because they can be easily modified and adjusted afterward. I use the exceptional [Inkscape][21] for my vector graphics. On the other hand, for my [raster graphics][22], I use [GIMP][23]. When I need a 3D looking diagram, I use [Blender][24] to draw the scene; then I trace the rendered image with Inkscape to convert it to vectorial. I recently discovered [FreeCAD][25], which has the striking feature that it can directly export the 3D scene to some vectorial format. I can then adjust the image with Inkscape without having to trace the raster image. + +In all my diagrams, I am trying to keep a consistent look, and therefore I limit myself to a 10-[color palette][26], both from [d3][27] and [matplotlib][28]. I also use the same palette in my slides to highlight quantities in reference to the illustrations. To produce [plots][29] and [graphs][30], I write Python scripts and employ the matplotlib graphical library. + +![Figure: Diagram example created with Inkscape by tracing a Blender 3D diagram][31] + +Figure: Diagram example created with Inkscape by tracing a Blender 3D diagram + +#### Multimedia support + +I have prepared a few pages with applets that demonstrate some phenomena that I describe during my lectures (e.g., [modeling radioactive decay with dice][32]). I opted to offer these applets on my institutional webpage to easily reach all the students instead of requiring them to install software to run them. The necessary choice was to employ [JavaScript][33] and some supporting libraries, such as [jQuery][34] for compatibility between browsers, [MathJax][35] for typesetting math in the webpages, or [d3][27] for graphics display. Since my institution does not provide the capability of writing dynamic webpages, I am using [Jekyll][36], which is a static site generator. Jekyll allows me to have a consistent look and feel across all the pages without having to write HTML code. + +![Figure: Dice modeling radioactive decay, image of the interactive simulation][37] + +Figure: Dice modeling radioactive decay, image of the [interactive simulation][32] + +### Lecturing software + +Since my slideshows are PDF files, to show them during the lecture, I use the [default document viewer][38] of my [GNOME 3][39] desktop environment. There is also the alternative of using [Okular][40], which allows annotating the PDFs, but I prefer not to use it, as the annotations would not be carried over to the handouts. In conjunction with the graphical tablet, I use the excellent painting program [Krita][41]. I use the image layers as new pages of my notes. This approach is more practical during the lecture than creating a series of new files. I can also duplicate layers and edit them or load vectorial images and draw over them. Krita has the possibility of writing custom [Python plugins][42], so I prepared a script that exports a PDF file with a new page for each layer. + +![Figure: Screenshot of Krita used in class to write notes][43] + +Figure: Screenshot of Krita used in class to write notes + +When we go through exercises in class, I use the calculator [Qalculate][44] to obtain numerical results. Its particular feature is that it can perform calculations with units associated with the numbers. I can focus more on the exercise resolution than on the units’ conversions. This is a double-edged sword, though, as the students would not learn how to do the conversions themselves. Therefore, I normally start to use Qalculate halfway through the course. [wxMaxima][45] can also support exercise resolution, symbolically solving some difficult equations. + +![Figure: Screenshot of Qalculate][46] + +Figure: Screenshot of Qalculate + +### Video lectures + +Sometimes I offer streaming lectures on YouTube, or I upload a video with additional mini-lectures. It has happened that the students have wanted a more in-depth explanation of some subjects. Offering these as a video allows them to take their time to listen and understand the subjects. For these videos, I use [OBS studio][47], which can record or directly stream videos to YouTube. OBS can put on the video scene the screen image and some additional video sources, such as a web camera. To edit the videos, I have been using [OpenShot][48]. + +![Figure: Screenshot of OBS studio recording the screen][49] + +Figure: Screenshot of OBS studio recording the screen + +### Conclusions + +This is the set of open source tools that I have been using to prepare and support my lectures. Over the years, I changed some of them whenever I discovered some better fitting tools or if I changed my lecturing style. To be frank, due to laziness, one of the requirements for all the tools is that they have to be easily installable. I use [Fedora][50] on my laptop, and its repository has packages for all this software. On the [CentOS][51] installation of my desktop computer, I had worse luck. For instance, Krita and OBS are available only through [Flatpak][52]. + +Writing this article just made me realize how many tools I am actively using for my lectures. Maybe there are some all-in-one solutions, such as [LibreOffice Impress][53], but I am very satisfied with the results I am getting. Besides, all this software has other useful applications. + +Leave comments if you have questions. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/teach-physics-open-source + +作者:[Cristiano L. Fontana][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://www.medicinachirurgia.unipd.it/ +[3]: https://www.unipd.it/ +[4]: http://hyperphysics.phy-astr.gsu.edu/ +[5]: https://www.compadre.org/osp/ +[6]: https://openstax.org/ +[7]: https://openstax.org/subjects/science +[8]: https://open.umn.edu/opentextbooks +[9]: https://open.umn.edu/opentextbooks/subjects/physics +[10]: http://www.motionmountain.net/ +[11]: http://www.lightandmatter.com/ +[12]: https://en.wikipedia.org/wiki/Main_Page +[13]: https://en.wikipedia.org/wiki/Graphics_tablet +[14]: https://opensource.com/sites/default/files/uploads/circuit_notes_0.jpg (Figure: Example of notes taken during class with the graphics tablet and Krita) +[15]: https://www.latex-project.org/ +[16]: https://github.com/josephwright/beamer +[17]: https://en.wikipedia.org/wiki/Corporate_identity +[18]: https://opensource.com/sites/default/files/uploads/slide_laplace.png (Figure: Examples of slides created with LaTeX and Beamer) +[19]: https://opensource.com/sites/default/files/uploads/slide_faraday.png (Figure: Examples of slides created with LaTeX and Beamer) +[20]: https://en.wikipedia.org/wiki/Vector_graphics +[21]: https://inkscape.org/ +[22]: https://en.wikipedia.org/wiki/Raster_graphics +[23]: https://www.gimp.org/ +[24]: https://www.blender.org/ +[25]: https://www.freecadweb.org/ +[26]: https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md#category10 +[27]: https://d3js.org/ +[28]: https://matplotlib.org/ +[29]: https://en.wikipedia.org/wiki/Plot_(graphics) +[30]: https://en.wikipedia.org/wiki/Graph_of_a_function +[31]: https://opensource.com/sites/default/files/uploads/electromagnetic_wave.png (Figure: Diagram example created with Inkscape by tracing a Blender 3D diagram) +[32]: http://www2.pd.infn.it/~fontana/project/teaching/2018/01/02/dice-decay.html +[33]: https://en.wikipedia.org/wiki/JavaScript +[34]: https://jquery.com/ +[35]: https://www.mathjax.org/ +[36]: https://jekyllrb.com/ +[37]: https://opensource.com/sites/default/files/uploads/dice_decay.png (Figure: Dice modeling radioactive decay, image of the interactive simulation) +[38]: https://wiki.gnome.org/Apps/Evince +[39]: https://www.gnome.org/gnome-3/ +[40]: https://okular.kde.org/ +[41]: https://krita.org/en/ +[42]: https://docs.krita.org/en/user_manual/python_scripting.html +[43]: https://opensource.com/sites/default/files/uploads/krita_screenshot_0.png (Figure: Screenshot of Krita used in class to write notes) +[44]: https://qalculate.github.io/ +[45]: https://wxmaxima-developers.github.io/wxmaxima/ +[46]: https://opensource.com/sites/default/files/uploads/qalculate_screenshot.png (Figure: Screenshot of Qalculate) +[47]: https://obsproject.com/ +[48]: https://www.openshot.org/ +[49]: https://opensource.com/sites/default/files/uploads/obs_screenshot.png (Figure: Screenshot of OBS studio recording the screen) +[50]: https://getfedora.org/ +[51]: https://www.centos.org/ +[52]: https://flatpak.org/ +[53]: https://www.libreoffice.org/discover/impress/ From 77f28a5cbc77096859a67bc72cf170aa74e58845 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:07:50 +0800 Subject: [PATCH 0454/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200128=20Comm?= =?UTF-8?q?unication=20superstars:=20A=20model=20for=20understanding=20you?= =?UTF-8?q?r=20organization's=20approach=20to=20new=20technologies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md --- ...nization-s approach to new technologies.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/tech/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md diff --git a/sources/tech/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md b/sources/tech/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md new file mode 100644 index 0000000000..632c290741 --- /dev/null +++ b/sources/tech/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Communication superstars: A model for understanding your organization's approach to new technologies) +[#]: via: (https://opensource.com/open-organization/20/1/communication-technology-superstars) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Communication superstars: A model for understanding your organization's approach to new technologies +====== +Adopting new communication technologies can make your organization more +open. But are your people ready? +![Different cell phones][1] + +Multiple books in [the _Open Organization_ series][2] discuss the many ways new communication technologies are changing the nature of both work and management. I've seen these changes firsthand during my nearly three decades working for Japanese corporations. Over time, I've been able to classify and characterize some of the impacts these technologies—particularly new telecommunication technologies and social media—are having on daily life in many organizations. And in April 2016, I shared those observations in an article called _[How new communication technologies are affecting peer-to-peer engagement][3]_. + +But a lot can change in a little under four years. + +[The Open Organization Ambassadors][4] have learned a great deal about the ways open principles are impacting organizational practices. In particular, we've developed an [Open Organization Definition][5] that specifies the five principles that distinguish open organizations from other types of organization—namely, more transparency, more inclusivity, greater adaptability, deeper collaboration and a sense of purpose teams/community. I've also delivered [a presentation on this topic][6] several times since 2016 and learned new insights along the way. So I'd like to update this article with a few comments that reflect those findings. And then, in a follow-up article, I'd like to offer readers some guidelines on how _they_ can determine their organization's level of comfort with communication technology and use it to increase their success relative to industry competitors. + +Simply put: New communication technologies are affecting the way peer-to-peer decision-making practices function in organizations today. And that's affecting several important organizational dimensions: peers' transparency with each other when making decisions, the sense of inclusivity between members in decisions-making activities, their adaptability when situations change, their ability to collaborate with more individuals in the decision-making process, and their ability to build teams, groups, and communities to decide how to achieve their goals. + +### Four approaches to communication technology + +In Japan, I see companies that heavily promote today's communication technologies, as well as some that avoid them. Imagine four types of companies currently making use of today's communication technologies as they compete with other firms. These technologies are key, because they influence the environment in which certain peer-to-peer communities must work. It affects their collaboration and transparency with each other, their inclusivity with members they couldn't consider before because of location, their adaptability in a crisis, and their ability to build a sense of community among their members. This, in turn, affects members' enthusiasm, desire, and engagement—so _investment_ and _utilization_ are critical considerations. In fact, we can actually chart the four types of technology-adopters according to those two variables: investment and utilization. + +Some companies are underinvested in new communication technologies, considering their needs and the relatively lower costs of these technologies today. And what they _do_ have, they're not using to capacity. I call these companies communication technology **"slow movers" (low investment/low utilization)**. Others buy whatever is available at any cost, but don't fully put what they've purchased to full use. I call these communication technology **"fashion followers" (high investment/low utilization)**. Still other companies invest in the very minimum amount of communication technology, but what they do have they use to full capacity. I call these communication technology **"conservative investors" (low investment/high utilization)**. Lastly, there are some companies that invest heavily in communication technology and work very hard to put it to full use. I call these communication technology **"communication superstars" (high investment/high utilization)**. + +These "communication superstars" have the ideal environment for peer-to-peer, front-line discussions and decision making. They have greater collaboration and transparency with each other. They include members on their teams that they wouldn't (or couldn't) consider before because of location. They are more adaptable in a crisis. And they have the ability to build a stronger sense of community among their members. Unfortunately, in Japan, particularly among smaller companies, I'd say more than 70 percent are "slow movers" or "conservative investors." If companies would pay more attention to investing in communication technology, and simultaneously increase their efforts at training staff to use the technology to its full potential, then peer-to-peer, front-line employees could explode with creativity and better leverage all five of the open organization principles I mentioned above. + +New communication technologies are affecting the way peer-to-peer decision-making practices function in organizations today. + +These technologies affect four aspects of information today: volume, speed, quality, and distribution. + +### Increased capacity for decision-making (volume) + +In "communication superstar" environments, communication technologies can actually increase the amount of information that can be made available quickly. Gone are the days in which only researchers or professors have access to in-depth information. Now, front-line people can obtain volumes of information if they know what they're looking for. With more and greater in-depth information in communication superstar company environments, front-line people working there can have more educated discussions, leading to greater inclusivity and collaboration, which can allow them to make the types of decisions that only top management (supported by consultants and researchers) could have made in the past. + +### Faster pace of decision-making and execution (speed) + +New technologies in these "communication superstar" companies are leading to quicker information acquisition, feedback, and flow between the front-line members in the organizations, even if they are very widely disbursed. + +Using the metaphor of adjusting the temperature of water coming out of a faucet, I would describe the effect this way: If you move the handle but the temperature changes very slowly, then finding the temperature you want becomes difficult, because the pace of temperature change is very slow, and differences between settings are difficult to determine. But if you move the handle and water temperature change is more immediate, you'll find that getting the correct temperature is much easier; you're moving quicker and making more rapid adjustments. + +The same logic applies to peer-to-peer discussions and feedback. I have a five-minute-to-twenty-four-hour goal when replying to my worldwide customers. That means that if I receive an email from a customer (something that arrives on my desktop computer at home, my desktop computer in the office, or on my mobile phone), I like to reply within five minutes. This really surprises customers, as they're probably still sitting in front of their computer! In the worst case, I try to reply within 24 hours. This gives me a competitive advantage when attempting to get customers to work with me. Front-line, peer-to-peer communities in these "communication superstar" companies can have that same competitive advantage in making quality decisions and executing them faster. The capacity for speedier replies allows us to make more adjustments quicker. It keeps both employees and customers involved, motivated and engaged. They become more transparent with information, include members they hadn't considered before. They can adapt more rapidly when redirection is required. They can collaborate at a more in-depth level and can build tighter, more trusting project communities. Information arriving too slowly can cause people to "turn off" and direct their attention elsewhere. This weakens the passion, dedication, and engagement of the project. + +### Toward wiser decisions (quality) + +Information not only travels more quickly when the business communication channels are adequate, but it's also subjected to more scrutiny through greater group collaboration and inclusivity. People can share second opinions and gather additional empirical data using these technologies. Furthermore, new communication technologies allow employees and managers to deliver data in new ways. With my years in sales training around the world, I've learned that using multiple visual aids, infographics, and so forth have greatly enhanced communication when English language barriers could have impeded it. All this can lead to high levels of peer-to-peer, front-line engagement, as up-to-date status reports can be quickly distributed and easily understood, making everyone more responsive. + +New technologies in these "communication superstar" companies are leading to quicker information acquisition, feedback, and flow between the front-line members in the organizations, even if they are very widely disbursed. + +### Maximal reach (distribution) + +Not long ago, teammates had to be physically close to one another and know each other well in order to communicate successfully. That's no longer the case, as communication channels can be developed with people literally all over the world. This has led to greater global inclusivity and collaboration. Good communication is the outcome of developing a trusting relationship. For me, building trust with people I've never met face-to-face has taken a bit longer, but I've done it with modern technology. Developing trust this way has led to great peer-to-peer transparency. + +Let me explain. Good communication starts with initial contact, whether meeting someone in person or virtually (via social media or some telecommunication format). Over some period of time and through several exchanges, a relationship starts to develop, and a level of trust is reached. People evaluate one another's character and integrity, and they also judge each other's competence and skills. With this deepening of trust over time, greater communication and collaboration can evolve. At that point, open and in-depth discussions and transparency on very difficult, complex, and sometimes uncomfortable topics can take place. With the ability to communicate at that level, peer-to-peer discussions and decisions can be made. With today's communication technology, greater information exchange can be made among a group of widely disbursed members leading to an expanded team community. I currently have approximately 20 customers around the world. Some I have never met in person; most I have just met in person once. Being stationed in Japan can make regular get-togethers with Europeans and Americans rather difficult. Fortunately, with today's communication technology, I can find solutions for many problems without physically getting together, as I have built a trusting relationship with them. + +### Concluding comments + +With all the benefits of this "communication superstar" working environment, in open organizations that promote peer-to-peer discussions, decision-making and management, I recommend the other three groups to move in that direction. The "slow movers" more than likely have managerial barriers to open information exchange. They should be convinced of the benefits of a more opened organization and the value of greater information exchange. If they don't improve their communication environment, they may lose their competitive advantage. The "fashion followers" should more carefully study their communication needs and time their investments with their in-company training capacities. The "conservative investors" should study their communication bottlenecks and find the technologies that are available to eliminate them. That's the path to super-stardom. + +As I mentioned at the beginning of this article, it's important to determine exactly which of these categories a company falls into with regard to communication technology ["slow movers" (low investment/low utilization), "fashion followers" (high investment/low utilization), "conservative investors" (low investment/high utilization) or "communication superstars" (high investment/high utilization)] against their competitors. Therefore, I would like to address that issue in a future article. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/1/communication-technology-superstars + +作者:[Ron McFarland][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_mobilemashup3.png?itok=v1gVY8RJ (Different cell phones) +[2]: https://opensource.com/open-organization/resources/book-series +[3]: https://opensource.com/open-organization/16/4/how-new-communication-technologies-are-affecting-peer-peer-engagement +[4]: https://opensource.com/open-organization/resources/meet-ambassadors +[5]: https://opensource.com/open-organization/resources/open-org-definition +[6]: https://www.slideshare.net/RonMcFarland1/competitive-advantage-through-digital-investment-utilization?qid=9fbb4c4b-f2c2-4468-9f0a-3ebaa6efc91d&v=&b=&from_search=1 From 6300e18b48e8aebe88f570b86144a1486baca51c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:09:25 +0800 Subject: [PATCH 0455/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200127=20Use?= =?UTF-8?q?=20Vim=20to=20manage=20your=20task=20list=20and=20access=20Redd?= =?UTF-8?q?it=20and=20Twitter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md --- ...task list and access Reddit and Twitter.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 sources/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md diff --git a/sources/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md b/sources/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md new file mode 100644 index 0000000000..30d51d321a --- /dev/null +++ b/sources/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Vim to manage your task list and access Reddit and Twitter) +[#]: via: (https://opensource.com/article/20/1/vim-task-list-reddit-twitter) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use Vim to manage your task list and access Reddit and Twitter +====== +Handle your to-do list and get social from the text editor in the +seventeenth in our series on 20 ways to be more productive with open +source in 2020. +![Chat via email][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Doing (almost) all the things with Vim, part 2 + +In [yesterday's article][2], you started reading mail and checking your calendars with Vim. Today, you're going to do even more. First, you'll take care of your task tracking, and then you'll get social, directly in the Vim text editor. + +#### Track your to-do's in Vim with todo.txt-vim + +![to-dos and Twitter with Vim][3] + +Editing a text-based to-do file with Vim is a natural fit, and the [todo.txt-vim][4] package makes it even easier. Start by installing the todo.txt-vim package: + + +``` +git clone ~/.vim/bundle/todo.txt-vim +vim ~/path/to/your/todo.txt +``` + +Todo.txt-vim automatically recognizes files ending in todo.txt and done.txt as [todo.txt][5] files. It adds key bindings specific to the todo.txt format. You can mark things "done" with **\x**, set them to the current date with **\d**, and change the priority with **\a**, **\b**, and **\c**. You can bump the priorities up (**\k**) or down (**\j**) and sort (**\s**) based on project (**\s+**), context (**\s@**), or date (**\sd**). And when you are finished, you can close and save the file like normal. + +The todo.txt-vim package is a great addition to the [todo.sh program][6] I wrote about a few days ago, and with the [todo edit][7] add-on, it can really supercharge your to-do list tracking. + +#### Read Reddit in Vim with vim-reddit + +![Reddit in Vim][8] + +Vim also has a nice add-on for [Reddit][9] called [vim-reddit][10]. It isn't as nice as [Tuir][11], but for a quick review of the latest posts, it works really well. Start by installing the bundle: + + +``` +git clone ~/.vim/bundle/vim-reddit +vim +``` + +Now type **:Reddit** and the Reddit frontpage will load. You can load a specific subreddit with **:Reddit name**. Once the article list is onscreen, navigate with the arrow keys or scroll with the mouse. Pressing **o** will open the article in Vim (unless it is a media post, in which case it opens a browser), and pressing **c** brings up the comments. If you want to go right to the page, press **O** instead of **o**. Going back a screen is as easy as **u**. And when you are done with Reddit, type **:bd**. The only drawback is vim-reddit cannot log in or post new stories or comments. Then again, sometimes that is a good thing. + +#### Tweet from Vim with twitvim + +![Twitter in Vim][12] + +And last, we have [twitvim][13], a Vim package for reading and posting to Twitter. This one takes a bit more to set up. Start by installing twitvim from GitHub: + + +``` +`git clone https://github.com/twitvim/twitvim.git ~/.vim/bundle/twitvim` +``` + +Now you need to edit the **.vimrc** file and set some options. These help the plugin know which libraries it can use to talk to Twitter. Run **vim --version** and see what languages have a **+** next to them—those languages are supported by your copy of Vim. + +![Enabled and Disabled things in vim][14] + +Since mine says **+perl -python +python3**, I know I can enable Perl and Python 3, but not Python 2 (python). + + +``` +" TwitVim Settings +let twitvim_enable_perl = 1 +" let twitvim_enable_python = 1 +let twitvim_enable_python3 = 1 +``` + +Now you can start up Vim and log into Twitter by running **:SetLoginTwitter**, which launches a browser window asking you to authorize VimTwit as an application with access to your account. Once you enter + +the supplied PIN into Vim, you're good to go. + +Twitvim's commands are not as simple as in the other packages. To load up the timeline of your friends and followers, type in **:FriendsTwitter**. To list your mentions and replies, use **:MentionsTwitter**. Posting a new tweet is **:PosttoTwitter <Your message>**. You can scroll through the list and reply to a specific tweet by typing **\r**, and you can start a direct message with someone using **\d**. + +And there you have it; you're doing (almost) all the things in Vim! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/vim-task-list-reddit-twitter + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://opensource.com/article/20/1/send-email-and-check-your-calendar-vim +[3]: https://opensource.com/sites/default/files/uploads/productivity_17-1.png (to-dos and Twitter with Vim) +[4]: https://github.com/freitass/todo.txt-vim +[5]: http://todotxt.org +[6]: https://opensource.com/article/20/1/open-source-to-do-list +[7]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory#edit-open-in-text-editor +[8]: https://opensource.com/sites/default/files/uploads/productivity_17-2.png (Reddit in Vim) +[9]: https://reddit.com +[10]: https://github.com/DougBeney/vim-reddit +[11]: https://opensource.com/article/20/1/open-source-reddit-client +[12]: https://opensource.com/sites/default/files/uploads/productivity_17-3.png (Twitter in Vim) +[13]: https://github.com/twitvim/twitvim +[14]: https://opensource.com/sites/default/files/uploads/productivity_17-4.png (Enabled and Disabled things in vim) From ab1eb0c02f52593b257292a11c1a6245d4d68855 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:10:04 +0800 Subject: [PATCH 0456/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200127=20Mana?= =?UTF-8?q?ging=20processes=20on=20Linux=20with=20kill=20and=20killall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200127 Managing processes on Linux with kill and killall.md --- ...rocesses on Linux with kill and killall.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20200127 Managing processes on Linux with kill and killall.md diff --git a/sources/tech/20200127 Managing processes on Linux with kill and killall.md b/sources/tech/20200127 Managing processes on Linux with kill and killall.md new file mode 100644 index 0000000000..339d97f307 --- /dev/null +++ b/sources/tech/20200127 Managing processes on Linux with kill and killall.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing processes on Linux with kill and killall) +[#]: via: (https://opensource.com/article/20/1/linux-kill-killall) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Managing processes on Linux with kill and killall +====== +Know how to terminate processes and reclaim system resources with the +ps, kill, and killall commands. +![Penguin with green background][1] + +In Linux, every program and daemon is a "process." Most processes represent a single running program. Other programs can fork off other processes, such as processes to listen for certain things to happen and then respond to them. And each process requires a certain amount of memory and processing power. The more processes you have running, the more memory and CPU cycles you'll need. On older systems, like my seven-year-old laptop, or smaller computers, like the Raspberry Pi, you can get the most out of your system if you keep an eye on what processes you have running in the background. + +You can get a list of running processes with the **ps** command. You'll usually want to give **ps** some options to show more information in its output. I like to use the **-e** option to see every process running on my system, and the **-f** option to get full details about each process. Here are some examples: + + +``` +$ ps +    PID TTY          TIME CMD +  88000 pts/0    00:00:00 bash +  88052 pts/0    00:00:00 ps +  88053 pts/0    00:00:00 head + +[/code] [code] + +$ ps -e | head +    PID TTY          TIME CMD +      1 ?        00:00:50 systemd +      2 ?        00:00:00 kthreadd +      3 ?        00:00:00 rcu_gp +      4 ?        00:00:00 rcu_par_gp +      6 ?        00:00:02 kworker/0:0H-events_highpri +      9 ?        00:00:00 mm_percpu_wq +     10 ?        00:00:01 ksoftirqd/0 +     11 ?        00:00:12 rcu_sched +     12 ?        00:00:00 migration/0 + +[/code] [code] + +$ ps -ef | head +UID          PID    PPID  C STIME TTY          TIME CMD +root           1       0  0 13:51 ?        00:00:50 /usr/lib/systemd/systemd --switched-root --system --deserialize 36 +root           2       0  0 13:51 ?        00:00:00 [kthreadd] +root           3       2  0 13:51 ?        00:00:00 [rcu_gp] +root           4       2  0 13:51 ?        00:00:00 [rcu_par_gp] +root           6       2  0 13:51 ?        00:00:02 [kworker/0:0H-kblockd] +root           9       2  0 13:51 ?        00:00:00 [mm_percpu_wq] +root          10       2  0 13:51 ?        00:00:01 [ksoftirqd/0] +root          11       2  0 13:51 ?        00:00:12 [rcu_sched] +root          12       2  0 13:51 ?        00:00:00 [migration/0] +``` + +The last example shows the most detail. On each line, the UID (user ID) shows the user that owns the process. The PID (process ID) represents the numerical ID of each process, and PPID (parent process ID) shows the ID of the process that spawned this one. In any Unix system, processes count up from PID 1, the first process to run once the kernel starts up. Here, **systemd** is the first process, which spawned **kthreadd**. And **kthreadd** created other processes including **rcu_gp**, **rcu_par_gp**, and a bunch of other ones. + +### Process management with the kill command + +The system will take care of most background processes on its own, so you don't need to worry about them. You should only have to get involved in managing any processes that you create, usually by running applications. While many applications run one process at a time (think about your music player or terminal emulator or game), other applications might create background processes. Some of these might keep running when you exit the application so they can get back to work quickly the next time you start the application. + +Process management is an issue when I run Chromium, the open source base for Google's Chrome browser. Chromium works my laptop pretty hard and fires off a lot of extra processes. Right now, I can see these Chromium processes running with only five tabs open: + + +``` +$ ps -ef | fgrep chromium +jhall      66221   [...]  /usr/lib64/chromium-browser/chromium-browser [...] +jhall      66230   [...]  /usr/lib64/chromium-browser/chromium-browser [...] +[...] +jhall      66861   [...]  /usr/lib64/chromium-browser/chromium-browser [...] +jhall      67329   65132  0 15:45 pts/0    00:00:00 grep -F chromium +``` + +I've omitted some lines, but there are 20 Chromium processes and one **grep** process that is searching for the string "chromium." + + +``` +$ ps -ef | fgrep chromium | wc -l +21 +``` + +But after I exit Chromium, those processes remain open. How do you shut them down and reclaim the memory and CPU that those processes are taking up? + +The **kill** command lets you terminate a process. In the simplest case, you tell **kill** the PID of what you want to stop. For example, to terminate each of these processes, I would need to execute the **kill** command against each of the 20 Chromium process IDs. One way to do that is with a command line that gets the Chromium PIDs and another that runs **kill** against that list: + + +``` +$ ps -ef | fgrep /usr/lib64/chromium-browser/chromium-browser | awk '{print $2}' +66221 +66230 +66239 +66257 +66262 +66283 +66284 +66285 +66324 +66337 +66360 +66370 +66386 +66402 +66503 +66539 +66595 +66734 +66848 +66861 +69702 + +$ ps -ef | fgrep /usr/lib64/chromium-browser/chromium-browser | awk '{print $2}' > /tmp/pids +$ kill $( cat /tmp/pids) +``` + +Those last two lines are the key. The first command line generates a list of process IDs for the Chromium browser. The second command line runs the **kill** command against that list of process IDs. + +### Introducing the killall command + +A simpler way to stop a bunch of processes all at once is to use the **killall** command. As you might guess by the name, **killall** terminates all processes that match a name. That means we can use this command to stop all of our rogue Chromium processes. This is as simple as: + + +``` +`$ killall /usr/lib64/chromium-browser/chromium-browser` +``` + +But be careful with **killall**. This command can terminate any process that matches what you give it. That's why I like to first use **ps -ef** to check my running processes, then run **killall** against the exact path to the command that I want to stop. + +You might also want to use the **-i** or **\--interactive** option to ask **killall** to prompt you before it stops each process. + +**killall** also supports options to select processes that are older than a specific time using the **-o** or **\--older-than** option. This can be helpful if you discover a set of rogue processes that have been running unattended for several days, for example. Or you can select processes that are younger than a specific time, such as runaway processes you recently started. Use the **-y** or **\--younger-than** option to select these processes. + +### Other ways to manage processes + +Process management can be an important part of system maintenance. In my early career as a Unix and Linux systems administrator, the ability to kill escaped jobs was a useful tool to keep systems running properly. You may not need to kill rogue processes in a modern Linux desktop, but knowing **kill** and **killall** can help you when things eventually go awry. + +You can also look for other ways to manage processes. In my case, I didn't really need to use **kill** or **killall** to stop the background Chromium processes after I exited the browser. There's a simple setting in Chromium to control that: + +![Chromium background processes setting][2] + +Still, it's always a good idea to keep an eye on what processes are running on your system and know how to manage them when needed. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/linux-kill-killall + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://opensource.com/sites/default/files/uploads/chromium-settings-continue-running.png (Chromium background processes setting) From c79db94a1654811cbc006d4e394788e0a10b1ce4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:11:13 +0800 Subject: [PATCH 0457/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200127=20How?= =?UTF-8?q?=20to=20get=20started=20with=20test-driven=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200127 How to get started with test-driven development.md --- ...et started with test-driven development.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20200127 How to get started with test-driven development.md diff --git a/sources/tech/20200127 How to get started with test-driven development.md b/sources/tech/20200127 How to get started with test-driven development.md new file mode 100644 index 0000000000..2986deee9a --- /dev/null +++ b/sources/tech/20200127 How to get started with test-driven development.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to get started with test-driven development) +[#]: via: (https://opensource.com/article/20/1/test-driven-development) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +How to get started with test-driven development +====== +Learn when, what, and how to test in a TDD system. +![Penguin driving a car with a yellow background][1] + +I am often approached by software developers who are on board with the switch to test-driven development (TDD). They understand that describing expectations first and then writing code to meet those expectations is the best way to write software. And they agree that writing tests first does not introduce any overhead since they must write tests anyway. Still, they find themselves stuck, not being clear on what to test, when to test it, and how to test it. This article will answer those questions. + +### First, an analogy + +Imagine you're working on a team that has been asked to build a race car. The goal is to deliver a product that will enable a crew to drive the car from one city (say, Portland, Oregon) to another city (say, Seattle, Washington). + +Your team could go about designing and building that car in several different ways. One way would be to handcraft a unique, monolithic vehicle where all parts are home-grown and tightly coupled. Another way would be to use only prefabricated parts and stitch them together. And there are many other permutations of these two extreme approaches. + +Suppose your team goes with hand-building the constituent components of the race car. A car needs a battery to run. For the purposes of this analogy, focus on the custom-made car battery. How would you go about testing it? + +### Testing strategies + +One way to the test custom-made car battery would be to hire a testing crew, ship the car with the battery to Portland, and then get the testing crew to drive the car from Portland to Seattle. If the car arrives in Seattle, you can confirm that, yes, the car battery functions as expected. + +Another way to test the custom-made car battery would be to install it in the car and see if the engine turns over. If the engine starts, you can confirm that, yes, the car battery functions as expected. + +Still another way would be to use a voltmeter and connect the positive (+) and the negative (-) terminals to see if the voltmeter registers voltage output in the range of 12.6 to 14.7 volts. If it does, you can confirm that, yes, the car battery functions as expected. + +The above three hypothetical examples illustrate how different ways of testing the car battery align with three categories of testing strategies: + + 1. Employing the testing crew to drive the car from Portland to Seattle aligns with the **system or end-to-end testing strategy**. + 2. Installing the battery in the car and verifying if the engine starts aligns with the **integration testing strategy**. + 3. Measuring the voltage output of the car battery to verify if it falls within the expected range aligns with the **unit testing strategy**. + + + +### TDD is all about unit testing + +I hope these examples provide simple guiding principles for discerning between unit, integration, and system end-to-end testing. + +Keeping those guidelines in mind, it is very important _never_ to include integration nor system tests in your TDD practice. In TDD, the expected outcomes are always micro-outcomes. Measuring the voltage output of a car battery is a good example of a micro-outcome. A car battery is a unit of functionality that cannot easily be broken down into a few smaller units of functionality. As such, it is a perfect candidate for writing a unit test (i.e., describing the expected measurable output). + +You could also write a description of your expectations in the form of: "I expect the car engine to start on the event of turning the key." However, that description wouldn't qualify as a unit test. Why? Because the car is not at a sufficiently low level of granularity. In software engineering parlance, the car does not embody the [single responsibility principle][2] (SRP). + +And of course, while you could also write a description of your expectation in the form of: "I expect the car, which begins its journey in Portland, to arrive in Seattle after x number of hours," that description wouldn't qualify as a unit test. Many aspects of the car's journey from Portland to Seattle could be measured, so such end-to-end descriptions should never be part of TDD. + +### Simulating real conditions + +In the case of a car battery, just by using a simple voltmeter, you can simulate the operational environment of a car battery. You don't have to go into the expense of providing a full-blown experience (e.g., a fully functional car, a long and treacherous trip from Portland to Seattle) to be convinced that, indeed, your car battery functions as expected. + +That's the beauty of unit testing's simplicity. It's easy to simulate, easy to measure, easy to leave the exercise being convinced that everything works as expected. + +So what is it that enables this magic? The answer is simple—the _absence of dependencies_. A car battery does not depend on anything related to the automobile. Nor does it depend on anything related to the road trip from Portland to Seattle. Keep in mind that as your decomposed system components become less and less dependent on other components, your solution gets more and more reliable. + +### Conclusion + +The art of software engineering consists of the ability to decompose complex systems into small constituent elements. Each individual element must be reduced to the smallest possible surface. Once you reach that point in your process of decomposing a system, you can quite easily focus your attention on describing your expectations about the output of each unit. You can do that by following a formalized pattern, in which you first describe the _preconditions_ (i.e., given that such-and-such values are present), the _action_ (i.e., given that such-and-such _event_ arrives), and the _outcome_ or the _post-condition_ (i.e., you expect such-and-such values to be measurable). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/test-driven-development + +作者:[Alex Bunardzic][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alex-bunardzic +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://en.wikipedia.org/wiki/Single_responsibility_principle From 0e2d087f633bea34a28504af9cfec830a712d4c8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:15:41 +0800 Subject: [PATCH 0458/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200127=20IBM?= =?UTF-8?q?=20Power-based=20cloud=20instances=20available=E2=80=A6=20from?= =?UTF-8?q?=20Google?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200127 IBM Power-based cloud instances available- from Google.md --- ... cloud instances available- from Google.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/talk/20200127 IBM Power-based cloud instances available- from Google.md diff --git a/sources/talk/20200127 IBM Power-based cloud instances available- from Google.md b/sources/talk/20200127 IBM Power-based cloud instances available- from Google.md new file mode 100644 index 0000000000..95ba1965c7 --- /dev/null +++ b/sources/talk/20200127 IBM Power-based cloud instances available- from Google.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IBM Power-based cloud instances available… from Google) +[#]: via: (https://www.networkworld.com/article/3516409/ibm-power-based-cloud-instances-available-from-google.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +IBM Power-based cloud instances available… from Google +====== +IBM’s high-performance RISC processors are now available to Google Cloud Platform users as a service. +Oak Ridge National Laboratory + +IBM and Google may be competitors in the cloud platform business, but that doesn't prevent them from working together. Google is partnering with IBM to offer "Power Systems as a service" on its Google Cloud platform. + +IBM’s Power processor line is the last man standing in the RISC/Unix war, surviving Sun Microsystems’ SPARC and HP’s PA-RISC. Along with mainframes it’s the last server hardware business IBM has, having divested its x86 server line in 2014. + +IBM already sells cloud instances of Power to its IBM Cloud customers, so this is just an expansion of existing offerings to a competitor with a considerable data center footprint. Google said that customers can run Power-based workloads on GCP on all of its operating systems save mainframes — AIX, IBM i, and Linux on IBM Power. + +This gives GCP customers the option of moving legacy IT systems running on IBM Power Systems to a hybrid cloud and the option of using Google or IBM, which have their respective strengths. IBM is focused on IBM customers, while Google is more focused on containerization, AI and ML, and low latency. + +IBM gains because its customers now have a second option, and customers like choice. GCP wins because it gives the company access to legacy IBM customers, something it never had as a relatively new company. It has no on-premises legacy, after all. + +"For organizations using a hybrid cloud strategy, especially, IBM Power Systems are an important tool. Because of their performance and ability to support mission critical workloads—such as SAP applications and Oracle databases—enterprise customers have been consistently looking for options to run IBM Power Systems in the cloud," wrote Kevin Ichhpurani, GCP's corporate vice president of global ecosystem in a [blog post][1] announcing the deal. + +"IBM Power Systems for Google Cloud offers a path to do just that, providing the best of both the cloud and on-premise worlds. You can run enterprise workloads like SAP and Oracle on the IBM Power servers that you’ve come to trust, while starting to take advantage of all the technical capabilities and favorable economics that Google Cloud offers," Ichhpurani added. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Ichhpurani also noted several other benefits for customers: + + * Integrated billing: GCP customers can deploy the solution through the Google Cloud Marketplace and get a single bill for their GCP and IBM Power use. + * Private API access: IBM Power resources can access Google Cloud’s Private API Access technology securely and at low latency + * Integrated customer support: Customer support for both GCP and IBM have a single point of contact for any issues. + * Rapid deployment: An intuitive new management console enables quick ramp-up and rapid deployment of the solution. + + + +IBM Power is available to GCP customers now. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3516409/ibm-power-based-cloud-instances-available-from-google.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://cloud.google.com/blog/products/gcp/ibm-power-systems-now-available-on-google-cloud +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 7e292b03352af58e854c36c2ac58f524c7c8bd3b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 29 Jan 2020 01:18:46 +0800 Subject: [PATCH 0459/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200127=20Some?= =?UTF-8?q?=20Useful=20Probability=20Facts=20for=20Systems=20Programming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200127 Some Useful Probability Facts for Systems Programming.md --- ...obability Facts for Systems Programming.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 sources/talk/20200127 Some Useful Probability Facts for Systems Programming.md diff --git a/sources/talk/20200127 Some Useful Probability Facts for Systems Programming.md b/sources/talk/20200127 Some Useful Probability Facts for Systems Programming.md new file mode 100644 index 0000000000..143516dd21 --- /dev/null +++ b/sources/talk/20200127 Some Useful Probability Facts for Systems Programming.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some Useful Probability Facts for Systems Programming) +[#]: via: (https://theartofmachinery.com/2020/01/27/systems_programming_probability.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Some Useful Probability Facts for Systems Programming +====== + +Probability problems come up a lot in systems programming, and I’m using that term loosely to mean everything from operating systems programming and networking, to building large online services, to creating virtual worlds like in games. Here’s a bunch of rough-and-ready probability rules of thumb that are deeply related and have many practical applications when designing systems. + +## (\frac{1}{N}) chance tried (N) times + +Retries are everywhere in systems programming. For example, imagine you’re designing a world for a roleplaying game. When monsters in one particular forest are defeated, they have a small chance of dropping some special item. Suppose that chance is (\frac{1}{10}). Basic probability says that players are expected to need 10 victories before gaining a special item. But in probability, “expected value” is just a kind of average value, and there’s no guarantee that players will get the item even if they do win 10 battles. + +What’s a player’s chance of getting at least one special item after 10 battles? Let’s just try getting a computer to calculate the probability of getting at least one success for (N) tries at a (\frac{1}{N}) chance, for a range of values of (N): + +![Plot of probability of at least one success after trying a 1/N chance N times. The probability starts at 100% and drops, but quickly flattens out to a value just below 65%.][1] + +Eyeballing the graph, it looks like the probability is roughly constant for (N) greater than about 3. In fact, it converges on (1 - e^{- 1}), where (e) is Euler’s constant, 2.718281828459… This number (along with (e^{- 1})) is extremely common in engineering, so here’s a table of practical values: + +exp(-1.0) | 1.0-exp(-1.0) +---|--- +36.7% | 63.2% +A bit over a third | A bit under two thirds + +So, if you don’t need an exact answer (and you often don’t) you could just say that if the drop probability is (\frac{1}{10}), most players will get a special item within 10 battles, but (close enough) about a third won’t. Because the monster battles are statistically independent, we can make a rough guess that about 1 in 9 players still won’t have a special item after 20 battles. Also, roughly 60% won’t after 5 battles because (0.6 \times 0.6 = 0.36), so 60% is close to the square root of 36.7%. + +> If you have (\frac{1}{N}) chance of success, then you’re more likely than not to have succeeded after (N) tries, but the probability is only about two thirds (or your favourite approximation to (1 - e^{- 1})). The value of (N) doesn’t affect the approximation much as long as it’s at least 3. + +Here’s the proof: The chance of the player failing to get a special item after all (10) battles is ((\frac{9}{10})^{10} = .349), so the chance of getting at least one is (1 - .349 = .651). More generally, the chance of succeeding at least once is (1 - (1 - \frac{1}{N})^{N}), which converges on (1 - e^{- 1}) (by [one of the definitions of (e)][2]). + +By the way, this rule is handy for quick mental estimates in board games, too. Suppose a player needs to get at least one 6 from rolling 8 six-sided dice. What’s probability of failure? It’s about (\frac{1}{3}) for the first 6 dice, and (\frac{5}{6} \times \frac{5}{6}) for the remaining two, so all up it’s about (\frac{1}{3} \times \frac{25}{36} \approx \frac{8}{36} \approx \frac{1}{4}). A calculator says ((\frac{5}{6})^{8} = .233), so the rough approximation was good enough for gameplay. + +## (N) balls in (N) buckets + +I’ll state this one up front: + +> Suppose you throw (N) balls randomly (independently and one at a time) into (N) buckets. On average, a bit over a third ((e^{- 1})) of the buckets will stay empty, a bit over a third ((e^{- 1}) again) will have exactly one ball, and the remaining quarter or so ((1 - 2e^{- 1})) will contain multiple balls. + +The balls-and-buckets abstract model has plenty of concrete engineering applications. For example, suppose you have a load balancer randomly assigning requests to 12 backends. If 12 requests come in during some time window, on average about 4 of the backends will be idle, only about 4 will have a balanced single-request load, and the remaining (average) 3 or 4 will be under higher load. Of course, all of these are averages, and there’ll be fluctuations in practice. + +As another example, if a hash table has (N) slots, then if you put (N) different values into it, about a third of the slots will still be empty and about a quarter of the slots will have collisions. + +If an online service has a production incident once every 20 days on average, then (assuming unrelated incidents) just over a third of 20-day periods will be dead quiet, just over a third will have the “ideal” single incident, while a quarter of 20-day periods will be extra stressful. In the real world, production incidents are even more tightly clustered because they’re not always independent. + +This rule of thumb also hints at why horizontally scaled databases tend to have hot and cold shards, and why low-volume businesses (like consulting) can suffer from feast/famine patterns of customer demand. + +Random allocation is much more unbalanced than we intuitively expect. A famous example comes from World War II when, late in the war, the Germans launched thousands of V-1 and V-2 flying bombs at London. Hitting a city with a rocket from across the Channel already required pushing 1940s technology to new limits, but several British analysts looked at maps of bomb damage and concluded that the Germans were somehow targetting specific areas of London, implying an incredible level of technological advancement. In 1946, however, an actuary did the proper statistical analysis and said that, no, [the clustering of bomb damage was simply what you’d expect from random chance][3]. (That analysis is based on the [Poisson distribution][4], and the ratios in the rule for (N) balls and (N) buckets can be calculated from a Poisson distribution with (\lambda = \frac{N}{N} = 1).) + +![25 points uniformly randomly placed on a 5x5 grid, showing spurious clustering. 8 boxes are empty, 10 boxes contain one point and 7 boxes contain two or more points.][5] + +Random allocation only balances out when the number of “balls” is much larger than the number of “buckets”, i.e., when averaging over a large number of items, or a long time period. That’s one of the many reasons that engineering solutions that work well for large-scale FAANG companies can be problematic when used by companies that are orders of magnitude smaller. + +Proving the third-third-quarter rule is pretty easy if you look at just one bucket. Each of the (N) balls represents a (\frac{1}{N}) chance of adding a ball to the bucket, so the chance of the bucket staying empty is just the (e^{- 1} \approx 36.7%) from the first rule. Linearity of expectation means we can combine the results for each bucket and say that 36.7% of _all_ buckets are expected to be empty, even though the bucket counts aren’t independent. Also, there are (N) possible ways of exactly one ball landing in the bucket, and each way requires one ball to fall in (with probability (\frac{1}{N})) and the other (N - 1) balls to miss (with probability (1 - \frac{1}{N})). So the probably of exactly one ball falling in is (\left. N \times \frac{1}{N} \times (1 - \frac{1}{N})^{N - 1}\rightarrow e^{- 1} \right.). + +### Fixed points of random permutations + +I don’t think this rule has as many practical applications as the (N) balls/buckets rule, but it’s kind of a freebie. + +Think of a battle game in which 6 players start from 6 spawn/home points. If the players play a second round, what’s the chance that someone starts from the same point? Mathematically, that’s asking about the chance of a random permutation having a “fixed point”. + +> If a group of things are randomly shuffled, a bit of over a third ((e^{- 1})) of the time there’ll be no fixed points, a bit of over a third ((e^{- 1})) of the time there’ll be just one fixed point, and the remaining quarter or so of the time there’ll be two or more. + +The number of fixed points in a random shuffle happens to approximate the same distribution as the number of balls in the buckets before, which can be [proven from first principles using the inclusion-exclusion principle][6]. But there’s an even simpler proof for a related fact: + +> A random permutation has exactly one fixed point on average, regardless of size. + +If there are (N) things, each one has a (\frac{1}{N}) chance of ending up in its original location after the shuffle, so on average there’ll be (N \times \frac{1}{N} = 1) fixed points. Note that it’s impossible to get exactly one fixed point by shuffling a two element set (try it!) but 1 is still the average of 2 and 0. (“Average” doesn’t always mean what we want it to mean.) + +That proof might seem too simple, but it’s a demonstration of how powerful linearity of expectation is. Trying to calculate statistics for permutations can be tricky because the places any item can go depend on the places all the other items have gone. Linearity of expectation means we don’t have to care about all the interactions as long as we only need to know the average. The average isn’t always the most useful statistic to calculate, but it’s often the easiest by far. + +## The coupon collector’s problem + +Let’s look at [the common “loot box” mechanism][7]. Specifically, suppose there are 10 collector items (say, one for each hero in a franchise) that are sold in blind boxes. Let’s take the fairest case in which there are no rare items and each item has an equal (\frac{1}{10}) chance of being in a given box. How many boxes will a collector buy on average before getting a complete set? This is the called the coupon collector’s problem, and for 10 items the answer is about 29. + +> The answer to the coupon collector’s problem is a bit more than (N\ln N) (add (\frac{N}{2}) for some more accuracy). + +((\ln N) is (\log) base (e), or just `log(N)` in most programming languages.) + +The coupon collector’s problem hints at why the loot box mechanism is so powerful. The (N) balls in (N) buckets rule tells us that the collector will have about two thirds of the items after buying 10 boxes. It feels like the collector is most of the way there, and it would be a shame to give up and let so much progress go to waste, but actually 10 boxes is only about a third of the expected number of boxes needed. That’s a simplistic model, but item rarity, variation of box type and (in computer games) making some items “unlockable” by completing sets of other items (or fulfilling other dependencies) only make it easier to get collectors to buy more than they originally expect. + +The (N\ln N) rule is very rough, so here’s a plot for comparison: + +![Plot of approximations to the coupon collector's problem. N ln N underestimates significantly, but has the right growth rate. N ln N + N/2 still underestimates slightly, but the error is less than 10%. The 1:1 slope N is also included to show that, beyond small values of N, multiple times N purchases are needed to get all items on average.][8] + +The exact value is rarely needed, but it’s useful to know that you’ll quickly need multiple times (N) trials to get all (N) hits. Any application of the (N) balls/buckets rule naturally extends to a coupon collector’s problem (e.g., on average you’ll need to put over (N\ln N) items into a hash table before all (N) slots are full) but the coupon collector’s problem comes up in other places, too. Often it’s tempting to use randomness to solve a problem statelessly, and then you find yourself doing a coupon collector problem. A cool example is [the FizzleFade effect in the classic 90s first-person shooter Wolfenstein 3D][9]. When the player character died, the screen would fill up with red pixels in what looks like random order. A simple and obvious way to implement that would be to plot red pixels at random coordinates in a loop, but filling the screen that way would be boring. With (320 \times 200 = 64000) pixels, most (~63.2%) of the screen would be filled red after 64000 iterations, but then the player would have to wait over (\ln(64000) \approx 11) times longer than that watching the last patches of screen fade away. The developers of Wolfenstein had to come up with a way to calculate a pseudo-random permutation of pixels on the screen, without explicitly storing the permutation in memory. + +Here’s a loose explanation of where the (\ln N) factor comes from: We know already that any pixel has approximately (\frac{1}{e}) chance of not being coloured by any batch of (N) pixel plots. So, after a batch of (N) pixel plots, the number of unfilled pixels goes down by a factor of (e) on average. If we assume we can multiply the average because it’s close enough to the geometric mean, the number of unfilled pixels will drop from (N) to something like (\frac{N}{e^{k}}) after (k) batches. That means the number of batches needed to go from (N) unfilled pixels to 1 is something like (\ln N), from the basic definition of logarithms. + +In the computer age it’s easy to get an answer once we know we have a specific probability problem to solve. But rough rules like the ones in this post are still useful during the design phase, or for getting an intuitive understanding for why a system behaves the way it does. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/01/27/systems_programming_probability.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://theartofmachinery.com/images/systems_programming_probability/one_on_n_tried_n_times.svg +[2]: https://en.wikipedia.org/wiki/Characterizations_of_the_exponential_function#Characterizations +[3]: https://www.cambridge.org/core/journals/journal-of-the-institute-of-actuaries/article/an-application-of-the-poisson-distribution/F75111847FDA534103BD4941BD96A78E +[4]: https://en.wikipedia.org/wiki/Poisson_distribution +[5]: https://theartofmachinery.com/images/systems_programming_probability/london_v1_simulation.svg +[6]: https://golem.ph.utexas.edu/category/2019/11/random_permutations_part_1.html +[7]: https://www.pcgamer.com/au/the-evolution-of-loot-boxes/ +[8]: https://theartofmachinery.com/images/systems_programming_probability/coupon_collector.svg +[9]: http://fabiensanglard.net/fizzlefade/index.php From 5d61850718995399fb18c9162b22fac64233accb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 29 Jan 2020 13:12:21 +0800 Subject: [PATCH 0460/3057] PRF @heguangzhi --- ...ome loot in your Python platformer game.md | 583 +++++++++--------- 1 file changed, 292 insertions(+), 291 deletions(-) diff --git a/translated/tech/20200102 Put some loot in your Python platformer game.md b/translated/tech/20200102 Put some loot in your Python platformer game.md index 14d2715438..a22c330ade 100644 --- a/translated/tech/20200102 Put some loot in your Python platformer game.md +++ b/translated/tech/20200102 Put some loot in your Python platformer game.md @@ -1,60 +1,61 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Put some loot in your Python platformer game) [#]: via: (https://opensource.com/article/20/1/loot-python-platformer-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Put some loot in your Python platformer game 在你的 Python 平台类游戏中放一些奖励 ====== -这部分是关于在使用 Python 的 Pygame 模块开发视频游戏给你的玩家提供收集的宝物和经验值的内容。 -![Hearts, stars, and dollar signs][1] +> 这部分是关于在使用 Python 的 Pygame 模块开发的视频游戏总给你的玩家提供收集的宝物和经验值的内容。 -这是正在进行的关于使用 [Python 3][2]的[Pygame][3]模块创建视频游戏的系列文章的第9部分。以前的文章有: +![](https://img.linux.net.cn/data/attachment/album/202001/29/131158jkwnhgd1nnawzn86.jpg) - * [通过构建一个简单的骰子游戏学习如何用 Python 编程][4] - * [使用 Pygame 模块用 Python 构建游戏框架][5] - * [如何在 Python 游戏中添加玩家][6] - * [使用 Pygame 移动你的游戏角色][7] - * [没有恶棍的哪里来的英雄?如何在您的 Python 游戏中添加一个][8] - * [在你的 Python 游戏中模拟重力][9] - * [将跳跃添加到您的 Python 平台游戏中][10] +这是正在进行的关于使用 [Python 3][2] 的 [Pygame][3] 模块创建视频游戏的系列文章的第十部分。以前的文章有: + + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][4] + * [使用 Python 和 Pygame 模块构建一个游戏框架][5] + * [如何在你的 Python 游戏中添加一个玩家][6] + * [用 Pygame 使你的游戏角色移动起来][7] + * [如何向你的 Python 游戏中添加一个敌人][8] + * [在 Pygame 游戏中放置平台][13] + * [在你的 Python 游戏中模拟引力][9] + * [为你的 Python 平台类游戏添加跳跃功能][10] * [使你的 Python 游戏玩家能够向前和向后跑][11] 如果你已经阅读了本系列的前几篇文章,那么你已经了解了编写游戏的所有基础知识。现在你可以在这些基础上,创造一个全功能的游戏。当你第一次学习时,遵循本系列代码示例,这样的“用例”是有帮助的,但是,用例也会约束你。现在是时候运用你学到的知识,以新的方式应用它们了。 如果说,说起来容易做起来难,这篇文章展示了一个如何将你已经了解的内容用于新目的的例子中。具体来说,就是它涵盖了如何使用你以前的课程中已经了解到的来实现奖励系统。 -在大多数电子游戏中,你有机会在游戏世界中获得“奖励”或收集到宝物和其他物品。奖励通常会增加你的分数或者你的健康指数,或者为你的下一次任务提供信息。 +在大多数电子游戏中,你有机会在游戏世界中获得“奖励”或收集到宝物和其他物品。奖励通常会增加你的分数或者你的生命值,或者为你的下一次任务提供信息。 游戏中包含的奖励类似于编程平台。像平台一样,奖励没有用户控制,随着游戏世界的滚动进行,并且必须检查与玩家的碰撞。 ### 创建奖励函数 -奖励和平台非常相似,你甚至不需要奖励类。您可以重用 **Platform** 类,并将结果称为奖励。 +奖励和平台非常相似,你甚至不需要一个奖励的类。你可以重用 `Platform` 类,并将结果称为“奖励”。 -由于奖励类型和位置可能因关卡不同而不同,如果你还没有一个新的功能,请在你的 **Level** 中创建一个名为 **Level** 的新功能。因为奖励物品不是平台,你也必须创建一个新的 **loot_list** 组,然后添加奖励物品。与平台、地面和敌人一样,该组用于检查玩家碰撞: +由于奖励类型和位置可能因关卡不同而不同,如果你还没有,请在你的 `Level` 中创建一个名为 `loot` 的新函数。因为奖励物品不是平台,你也必须创建一个新的 `loot_list` 组,然后添加奖励物品。与平台、地面和敌人一样,该组用于检查玩家碰撞: ``` -    def loot(lvl,lloc): -        if lvl == 1: -            loot_list = pygame.sprite.Group() -            loot = Platform(300,ty*7,tx,ty, 'loot_1.png') -            loot_list.add(loot) + def loot(lvl,lloc): + if lvl == 1: + loot_list = pygame.sprite.Group() + loot = Platform(300,ty*7,tx,ty, 'loot_1.png') + loot_list.add(loot) -        if lvl == 2: -            print(lvl) + if lvl == 2: + print(lvl) -        return loot_list + return loot_list ``` -你可以随意添加任意数量的奖励对象;记住把每一个都加到你的奖励清单上。***Platform** 类的参数是奖励图标的X位置、Y位置、宽度和高度(通常最容易让你的奖励图标保持和所有其他方块一样的大小),以及你想要用作的奖励图标。奖励的放置可以和贴图平台一样复杂,所以使用创建关卡时需要创建关卡设计文档。 +你可以随意添加任意数量的奖励对象;记住把每一个都加到你的奖励清单上。`Platform` 类的参数是奖励图标的 X 位置、Y 位置、宽度和高度(通常让你的奖励精灵保持和所有其他方块一样的大小最为简单),以及你想要用作的奖励的图片。奖励的放置可以和贴图平台一样复杂,所以使用创建关卡时需要的关卡设计文档。 -在脚本的 **Setup** 部分调用新的奖励函数。在下面的代码中,前三行是上下文,所以只需添加第四行: +在脚本的设置部分调用新的奖励函数。在下面的代码中,前三行是上下文,所以只需添加第四行: ``` enemy_list = Level.bad( 1, eloc ) @@ -91,7 +92,6 @@ loot_list = Level.loot(1,tx,ty) 要向后滚动,请添加最后两行: - ```         for e in enemy_list:             e.rect.x += scroll @@ -103,11 +103,11 @@ loot_list = Level.loot(1,tx,ty) ### 检测碰撞 -就像平台和敌人一样,你可以检查奖励物品和玩家之间的碰撞。逻辑与其他碰撞相同,除了撞击不会(必然)影响重力或健康。取而代之的是,命中会导致奖励物品会消失并增加玩家的分数。 +就像平台和敌人一样,你可以检查奖励物品和玩家之间的碰撞。逻辑与其他碰撞相同,除了撞击不会(必然)影响重力或生命值。取而代之的是,命中会导致奖励物品会消失并增加玩家的分数。 -当你的玩家触摸到一个奖励对象时,你可以从 **奖励列表** 中移除该对象。这意味着当你的主循环在 **loot_list** 中重绘所有奖励物品时,它不会重绘那个特定的对象,所以看起来玩家已经获得了奖励物品。 +当你的玩家触摸到一个奖励对象时,你可以从 `loot_list` 中移除该对象。这意味着当你的主循环在 `loot_list` 中重绘所有奖励物品时,它不会重绘那个特定的对象,所以看起来玩家已经获得了奖励物品。 -在 **Player** 类的 **update** 函数中的平台碰撞检测之上添加以下代码(最后一行仅用于上下文): +在 `Player` 类的 `update` 函数中的平台碰撞检测之上添加以下代码(最后一行仅用于上下文): ```                 loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) @@ -119,7 +119,7 @@ loot_list = Level.loot(1,tx,ty)         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) ``` -当碰撞发生时,你不仅要把奖励从它的组中移除,还要给你的玩家一个分数提升。你还没有创建分数变量,所以请将它添加到你的玩家属性中,该属性是在***Player** 类的**__init__**函数中创建的。在下面的代码中,前两行是上下文,所以只需添加分数变量: +当碰撞发生时,你不仅要把奖励从它的组中移除,还要给你的玩家一个分数提升。你还没有创建分数变量,所以请将它添加到你的玩家属性中,该属性是在 `Player` 类的 `__init__` 函数中创建的。在下面的代码中,前两行是上下文,所以只需添加分数变量: ```         self.frame = 0 @@ -127,7 +127,7 @@ loot_list = Level.loot(1,tx,ty)         self.score = 0 ``` -当在主循环中调用**update**函数时,需要包括**loot_list**: +当在主循环中调用 `update` 函数时,需要包括 `loot_list`: ```         player.gravity() @@ -136,7 +136,7 @@ loot_list = Level.loot(1,tx,ty) 如你所见,你已经掌握了所有的基本知识。你现在要做的就是用新的方式使用你所知道的。 -在下一篇文章中还有一些提示,但是与此同时,用你学到的知识来制作一些简单的单层游戏。限制你试图创造的东西的范围是很重要的,这样你就不会埋没自己。这也使得最终的成品看起来和感觉上更容易完成。 +在下一篇文章中还有一些提示,但是与此同时,用你学到的知识来制作一些简单的单关卡游戏。限制你试图创造的东西的范围是很重要的,这样你就不会埋没自己。这也使得最终的成品看起来和感觉上更容易完成。 以下是迄今为止你为这个 Python 平台编写的所有代码: @@ -154,7 +154,7 @@ loot_list = Level.loot(1,tx,ty) # GNU All-Permissive License # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved.  This file is offered as-is, +# notice and this notice are preserved. This file is offered as-is, # without any warranty. import pygame @@ -166,221 +166,221 @@ Objects ''' class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     -    def __init__(self,xloc,yloc,imgw,imgh,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)).convert() -        self.image.convert_alpha() -        self.rect = self.image.get_rect() -        self.rect.y = yloc -        self.rect.x = xloc + # x location, y location, img width, img height, img file + def __init__(self,xloc,yloc,imgw,imgh,img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)).convert() + self.image.convert_alpha() + self.rect = self.image.get_rect() + self.rect.y = yloc + self.rect.x = xloc class Player(pygame.sprite.Sprite): -    ''' -    Spawn a player -    ''' -    def __init__(self): -        pygame.sprite.Sprite.__init__(self) -        self.movex = 0 -        self.movey = 0 -        self.frame = 0 -        self.health = 10 -        self.collide_delta = 0 -        self.jump_delta = 6 -        self.score = 1 -        self.images = [] -        for i in range(1,9): -            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() -            img.convert_alpha() -            img.set_colorkey(ALPHA) -            self.images.append(img) -            self.image = self.images[0] -            self.rect  = self.image.get_rect() + ''' + Spawn a player + ''' + def __init__(self): + pygame.sprite.Sprite.__init__(self) + self.movex = 0 + self.movey = 0 + self.frame = 0 + self.health = 10 + self.collide_delta = 0 + self.jump_delta = 6 + self.score = 1 + self.images = [] + for i in range(1,9): + img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() + img.convert_alpha() + img.set_colorkey(ALPHA) + self.images.append(img) + self.image = self.images[0] + self.rect = self.image.get_rect() -    def jump(self,platform_list): -        self.jump_delta = 0 + def jump(self,platform_list): + self.jump_delta = 0 -    def gravity(self): -        self.movey += 3.2 # how fast player falls -        -        if self.rect.y > worldy and self.movey >= 0: -            self.movey = 0 -            self.rect.y = worldy-ty -        -    def control(self,x,y): -        ''' -        control player movement -        ''' -        self.movex += x -        self.movey += y -        -    def update(self): -        ''' -        Update sprite position -        ''' -        -        self.rect.x = self.rect.x + self.movex -        self.rect.y = self.rect.y + self.movey + def gravity(self): + self.movey += 3.2 # how fast player falls + + if self.rect.y > worldy and self.movey >= 0: + self.movey = 0 + self.rect.y = worldy-ty + + def control(self,x,y): + ''' + control player movement + ''' + self.movex += x + self.movey += y + + def update(self): + ''' + Update sprite position + ''' + + self.rect.x = self.rect.x + self.movex + self.rect.y = self.rect.y + self.movey -        # moving left -        if self.movex < 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[self.frame//ani] + # moving left + if self.movex < 0: + self.frame += 1 + if self.frame > ani*3: + self.frame = 0 + self.image = self.images[self.frame//ani] -        # moving right -        if self.movex > 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[(self.frame//ani)+4] + # moving right + if self.movex > 0: + self.frame += 1 + if self.frame > ani*3: + self.frame = 0 + self.image = self.images[(self.frame//ani)+4] -        # collisions -        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) -        for enemy in enemy_hit_list: -            self.health -= 1 -            #print(self.health) + # collisions + enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) + for enemy in enemy_hit_list: + self.health -= 1 + #print(self.health) -        loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) -        for loot in loot_hit_list: -            loot_list.remove(loot) -            self.score += 1 -            print(self.score) + loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) + for loot in loot_hit_list: + loot_list.remove(loot) + self.score += 1 + print(self.score) -        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) -        for p in plat_hit_list: -            self.collide_delta = 0 # stop jumping -            self.movey = 0 -            if self.rect.y > p.rect.y: -                self.rect.y = p.rect.y+ty -            else: -                self.rect.y = p.rect.y-ty -            -        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) -        for g in ground_hit_list: -            self.movey = 0 -            self.rect.y = worldy-ty-ty -            self.collide_delta = 0 # stop jumping -            if self.rect.y > g.rect.y: -                self.health -=1 -                print(self.health) -                -        if self.collide_delta < 6 and self.jump_delta < 6: -            self.jump_delta = 6*2 -            self.movey -= 33  # how high to jump -            self.collide_delta += 6 -            self.jump_delta    += 6 -            + plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) + for p in plat_hit_list: + self.collide_delta = 0 # stop jumping + self.movey = 0 + if self.rect.y > p.rect.y: + self.rect.y = p.rect.y+ty + else: + self.rect.y = p.rect.y-ty + + ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) + for g in ground_hit_list: + self.movey = 0 + self.rect.y = worldy-ty-ty + self.collide_delta = 0 # stop jumping + if self.rect.y > g.rect.y: + self.health -=1 + print(self.health) + + if self.collide_delta < 6 and self.jump_delta < 6: + self.jump_delta = 6*2 + self.movey -= 33 # how high to jump + self.collide_delta += 6 + self.jump_delta += 6 + class Enemy(pygame.sprite.Sprite): -    ''' -    Spawn an enemy -    ''' -    def __init__(self,x,y,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)) -        self.movey = 0 -        #self.image.convert_alpha() -        #self.image.set_colorkey(ALPHA) -        self.rect = self.image.get_rect() -        self.rect.x = x -        self.rect.y = y -        self.counter = 0 + ''' + Spawn an enemy + ''' + def __init__(self,x,y,img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)) + self.movey = 0 + #self.image.convert_alpha() + #self.image.set_colorkey(ALPHA) + self.rect = self.image.get_rect() + self.rect.x = x + self.rect.y = y + self.counter = 0 -                -    def move(self): -        ''' -        enemy movement -        ''' -        distance = 80 -        speed = 8 + + def move(self): + ''' + enemy movement + ''' + distance = 80 + speed = 8 -        self.movey += 3.2 -        -        if self.counter >= 0 and self.counter <= distance: -            self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: -            self.rect.x -= speed -        else: -            self.counter = 0 -        -        self.counter += 1 + self.movey += 3.2 + + if self.counter >= 0 and self.counter <= distance: + self.rect.x += speed + elif self.counter >= distance and self.counter <= distance*2: + self.rect.x -= speed + else: + self.counter = 0 + + self.counter += 1 -        if not self.rect.y >= worldy-ty-ty: -            self.rect.y += self.movey + if not self.rect.y >= worldy-ty-ty: + self.rect.y += self.movey -        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) -        for p in plat_hit_list: -            self.movey = 0 -            if self.rect.y > p.rect.y: -                self.rect.y = p.rect.y+ty -            else: -                self.rect.y = p.rect.y-ty + plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) + for p in plat_hit_list: + self.movey = 0 + if self.rect.y > p.rect.y: + self.rect.y = p.rect.y+ty + else: + self.rect.y = p.rect.y-ty -        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) -        for g in ground_hit_list: -            self.rect.y = worldy-ty-ty + ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) + for g in ground_hit_list: + self.rect.y = worldy-ty-ty -        + class Level(): -    def bad(lvl,eloc): -        if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group -            -        if lvl == 2: -            print("Level " + str(lvl) ) + def bad(lvl,eloc): + if lvl == 1: + enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy + enemy_list = pygame.sprite.Group() # create enemy group + enemy_list.add(enemy) # add enemy to group + + if lvl == 2: + print("Level " + str(lvl) ) -        return enemy_list + return enemy_list -    def loot(lvl,tx,ty): -        if lvl == 1: -            loot_list = pygame.sprite.Group() -            loot = Platform(200,ty*7,tx,ty, 'loot_1.png') -            loot_list.add(loot) + def loot(lvl,tx,ty): + if lvl == 1: + loot_list = pygame.sprite.Group() + loot = Platform(200,ty*7,tx,ty, 'loot_1.png') + loot_list.add(loot) -        if lvl == 2: -            print(lvl) + if lvl == 2: + print(lvl) -        return loot_list + return loot_list -    def ground(lvl,gloc,tx,ty): -        ground_list = pygame.sprite.Group() -        i=0 -        if lvl == 1: -            while i < len(gloc): -                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') -                ground_list.add(ground) -                i=i+1 + def ground(lvl,gloc,tx,ty): + ground_list = pygame.sprite.Group() + i=0 + if lvl == 1: + while i < len(gloc): + ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') + ground_list.add(ground) + i=i+1 -        if lvl == 2: -            print("Level " + str(lvl) ) + if lvl == 2: + print("Level " + str(lvl) ) -        return ground_list + return ground_list -    def platform(lvl,tx,ty): -        plat_list = pygame.sprite.Group() -        ploc = [] -        i=0 -        if lvl == 1: -            ploc.append((20,worldy-ty-128,3)) -            ploc.append((300,worldy-ty-256,3)) -            ploc.append((500,worldy-ty-128,4)) + def platform(lvl,tx,ty): + plat_list = pygame.sprite.Group() + ploc = [] + i=0 + if lvl == 1: + ploc.append((20,worldy-ty-128,3)) + ploc.append((300,worldy-ty-256,3)) + ploc.append((500,worldy-ty-128,4)) -            while i < len(ploc): -                j=0 -                while j <= ploc[i][2]: -                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') -                    plat_list.add(plat) -                    j=j+1 -                print('run' + str(i) + str(ploc[i])) -                i=i+1 + while i < len(ploc): + j=0 + while j <= ploc[i][2]: + plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') + plat_list.add(plat) + j=j+1 + print('run' + str(i) + str(ploc[i])) + i=i+1 -        if lvl == 2: -            print("Level " + str(lvl) ) + if lvl == 2: + print("Level " + str(lvl) ) -        return plat_list + return plat_list ''' Setup @@ -389,12 +389,12 @@ worldx = 960 worldy = 720 fps = 40 # frame rate -ani = 4  # animation cycles +ani = 4 # animation cycles clock = pygame.time.Clock() pygame.init() main = True -BLUE  = (25,25,200) +BLUE = (25,25,200) BLACK = (23,23,23 ) WHITE = (254,254,254) ALPHA = (0,255,0) @@ -419,9 +419,9 @@ tx = 64 #tile size ty = 64 #tile size i=0 -while i <= (worldx/tx)+tx: -    gloc.append(i*tx) -    i=i+1 +while i <= (worldx/tx)+tx: + gloc.append(i*tx) + i=i+1 enemy_list = Level.bad( 1, eloc ) ground_list = Level.ground( 1,gloc,tx,ty ) @@ -432,69 +432,69 @@ loot_list = Level.loot(1,tx,ty) Main loop ''' while main == True: -    for event in pygame.event.get(): -        if event.type == pygame.QUIT: -            pygame.quit(); sys.exit() -            main = False + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit(); sys.exit() + main = False -        if event.type == pygame.KEYDOWN: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                print("LEFT") -                player.control(-steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                print("RIGHT") -                player.control(steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                print('jump') + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_LEFT or event.key == ord('a'): + print("LEFT") + player.control(-steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + print("RIGHT") + player.control(steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + print('jump') -        if event.type == pygame.KEYUP: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                player.control(steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                player.control(-steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                player.jump(plat_list) + if event.type == pygame.KEYUP: + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(-steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + player.jump(plat_list) -            if event.key == ord('q'): -                pygame.quit() -                sys.exit() -                main = False + if event.key == ord('q'): + pygame.quit() + sys.exit() + main = False -    # scroll the world forward -    if player.rect.x >= forwardx: -        scroll = player.rect.x - forwardx -        player.rect.x = forwardx -        for p in plat_list: -            p.rect.x -= scroll -        for e in enemy_list: -            e.rect.x -= scroll -        for l in loot_list: -            l.rect.x -= scroll -                -    # scroll the world backward -    if player.rect.x <= backwardx: -        scroll = backwardx - player.rect.x -        player.rect.x = backwardx -        for p in plat_list: -            p.rect.x += scroll -        for e in enemy_list: -            e.rect.x += scroll -        for l in loot_list: -            l.rect.x += scroll + # scroll the world forward + if player.rect.x >= forwardx: + scroll = player.rect.x - forwardx + player.rect.x = forwardx + for p in plat_list: + p.rect.x -= scroll + for e in enemy_list: + e.rect.x -= scroll + for l in loot_list: + l.rect.x -= scroll + + # scroll the world backward + if player.rect.x <= backwardx: + scroll = backwardx - player.rect.x + player.rect.x = backwardx + for p in plat_list: + p.rect.x += scroll + for e in enemy_list: + e.rect.x += scroll + for l in loot_list: + l.rect.x += scroll -    world.blit(backdrop, backdropbox)     -    player.gravity() # check gravity -    player.update() -    player_list.draw(world) #refresh player position -    enemy_list.draw(world)  # refresh enemies -    ground_list.draw(world)  # refresh enemies -    plat_list.draw(world)   # refresh platforms -    loot_list.draw(world)   # refresh loot + world.blit(backdrop, backdropbox) + player.gravity() # check gravity + player.update() + player_list.draw(world) #refresh player position + enemy_list.draw(world) # refresh enemies + ground_list.draw(world) # refresh enemies + plat_list.draw(world) # refresh platforms + loot_list.draw(world) # refresh loot -    for e in enemy_list: -        e.move() -    pygame.display.flip() -    clock.tick(fps) + for e in enemy_list: + e.move() + pygame.display.flip() + clock.tick(fps) ``` -------------------------------------------------------------------------------- @@ -504,7 +504,7 @@ via: https://opensource.com/article/20/1/loot-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -513,12 +513,13 @@ via: https://opensource.com/article/20/1/loot-python-platformer-game [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_lovemoneyglory2.png?itok=AvneLxFp (Hearts, stars, and dollar signs) [2]: https://www.python.org/ [3]: https://www.pygame.org/news -[4]: https://opensource.com/article/17/10/python-101 -[5]: https://opensource.com/article/17/12/game-framework-python -[6]: https://opensource.com/article/17/12/game-python-add-a-player -[7]: https://opensource.com/article/17/12/game-python-moving-player -[8]: https://opensource.com/article/18/5/pygame-enemy -[9]: https://opensource.com/article/19/11/simulate-gravity-python -[10]: https://opensource.com/article/19/12/jumping-python-platformer-game -[11]: https://opensource.com/article/19/12/python-platformer-game-run +[4]: https://linux.cn/article-9071-1.html +[5]: https://linux.cn/article-10850-1.html +[6]: https://linux.cn/article-10858-1.html +[7]: https://linux.cn/article-10874-1.html +[8]: https://linux.cn/article-10883-1.html +[9]: https://linux.cn/article-11780-1.html +[10]: https://linux.cn/article-11790-1.html +[11]: https://linux.cn/article-11819-1.html [12]: https://opensource.com/sites/default/files/uploads/pygame-loot.jpg (Loot in Python platformer) +[13]: https://linux.cn/article-10902-1.html From d06326c26576a9d7ce26320c460952d6636a84c4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 29 Jan 2020 13:13:05 +0800 Subject: [PATCH 0461/3057] PUB @heguangzhi https://linux.cn/article-11828-1.html --- .../20200102 Put some loot in your Python platformer game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200102 Put some loot in your Python platformer game.md (99%) diff --git a/translated/tech/20200102 Put some loot in your Python platformer game.md b/published/20200102 Put some loot in your Python platformer game.md similarity index 99% rename from translated/tech/20200102 Put some loot in your Python platformer game.md rename to published/20200102 Put some loot in your Python platformer game.md index a22c330ade..e379cc1307 100644 --- a/translated/tech/20200102 Put some loot in your Python platformer game.md +++ b/published/20200102 Put some loot in your Python platformer game.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11828-1.html) [#]: subject: (Put some loot in your Python platformer game) [#]: via: (https://opensource.com/article/20/1/loot-python-platformer-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From af91cf44c8ee8bc072f881fc87df0f9ea21a0953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 29 Jan 2020 13:34:30 +0800 Subject: [PATCH 0462/3057] Translated --- ...imezone in Ubuntu Linux -Beginner-s Tip.md | 130 ------------------ ...imezone in Ubuntu Linux -Beginner-s Tip.md | 130 ++++++++++++++++++ 2 files changed, 130 insertions(+), 130 deletions(-) delete mode 100644 sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md create mode 100644 translated/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md diff --git a/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md b/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md deleted file mode 100644 index 889155174e..0000000000 --- a/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md +++ /dev/null @@ -1,130 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Set or Change Timezone in Ubuntu Linux [Beginner’s Tip]) -[#]: via: (https://itsfoss.com/change-timezone-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Set or Change Timezone in Ubuntu Linux [Beginner’s Tip] -====== - -[When you install Ubuntu][1], it asks you to set timezone. If you chose a wrong timezone or if you have moved to some other part of the world, you can easily change it later. - -### How to change Timezone in Ubuntu and other Linux distributions - -There are two ways to change the timezone in Ubuntu. You can use the graphical settings or use the timedatectl command in the terminal. You may also change the /etc/timezone file directly but I won’t advise that. - -I’ll show you both graphical and terminal way in this beginner’s tutorial: - - * [Change timezone in Ubuntu via GUI][2] (suitable for desktop users) - * [Change timezone in Ubuntu via command line][3] (works for both desktop and servers) - - - -![][4] - -#### Method 1: Change Ubuntu timezone via terminal - -[Ubuntu][5] or any other distributions using systemd can use the timedatectl command to set timezone in Linux terminal. - -You can check the current date and timezone setting using timedatectl command without any option: - -``` -[email protected]:~$ timedatectl - Local time: Sat 2020-01-18 17:39:52 IST - Universal time: Sat 2020-01-18 12:09:52 UTC - RTC time: Sat 2020-01-18 12:09:52 - Time zone: Asia/Kolkata (IST, +0530) - System clock synchronized: yes -systemd-timesyncd.service active: yes - RTC in local TZ: no -``` - -As you can see in the output above, my system uses Asia/Kolkata. It also tells me that it is 5:30 hours ahead of GMT. - -To set a timezone in Linux, you need to know the exact timezone. You must use the correct format of the timezone (which is Continent/City). - -To get the timezone list, use the _list-timezones_ option of _timedatectl_ command: - -``` -timedatectl list-timezones -``` - -It will show you a huge list of the available time zones. - -![Timezones List][6] - -You can use the up and down arrow or PgUp and PgDown key to move between the pages. - -You may also grep the output and search for your timezone. For example, if you are looking for time zones in Europe, you may use: - -``` -timedatectl list-timezones | grep -i europe -``` - -Let’s say you want to set the timezone to Paris. The timezone value to be used here is Europe/Paris: - -``` -timedatectl set-timezone Europe/Paris -``` - -It won’t show any success message but the timezone is changed instantly. You don’t need to restart or log out. - -Keep in mind that though you don’t need to become root user and use sudo with the command but your account still need to have admin rights in order to change the timezone. - -You can verify the changed time and timezone by using the [date command][7]: - -``` -[email protected]:~$ date -Sat Jan 18 13:56:26 CET 2020 -``` - -#### Method 2: Change Ubuntu timezone via GUI - -Press the super key (Windows key) and search for Settings: - -![Applications Menu Settings][8] - -Scroll down a little and look for Details in the left sidebar: - -![Go to Settings -> Details][9] - -In Details, you’ll fine Date & Time in the left sidebar. Here, you should turn off Automatic Time Zone option (if it is enabled) and then click on the Time Zone: - -![In Details -> Date & Time, turn off the Automatic Time Zone][10] - -When you click the Time Zone, it will open an interactive map and you can click on the geographical location of your choice and close the window. - -![Select a timezone][11] - -You don’t have to do anything other than closing this map after selecting the new timezone. No need to logout or [shutdown Ubuntu][12]. - -I hope this quick tutorial helped you to change timezone in Ubuntu and other Linux distributions. If you have questions or suggestions, please let me know. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/change-timezone-ubuntu/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/install-ubuntu/ -[2]: tmp.bHvVztzy6d#change-timezone-gui -[3]: tmp.bHvVztzy6d#change-timezone-command-line -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/Ubuntu_Change-_Time_Zone.png?ssl=1 -[5]: https://ubuntu.com/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/timezones_in_ubuntu.jpg?ssl=1 -[7]: https://linuxhandbook.com/date-command/ -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?ssl=1 -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/settings_detail_ubuntu.jpg?ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu.jpg?ssl=1 -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu_2.jpg?ssl=1 -[12]: https://itsfoss.com/schedule-shutdown-ubuntu/ diff --git a/translated/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md b/translated/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md new file mode 100644 index 0000000000..fb342a2101 --- /dev/null +++ b/translated/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Set or Change Timezone in Ubuntu Linux [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/change-timezone-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu Linux 中设置或更改时区 [初学者技巧] +====== + +[当你安装 Ubuntu 时][1],它要求你设置时区。如果你选择一个错误的时区,或者你移动到世界的一些其它地方,你可以很容易地在以后更改它。 + +### 如何在 Ubuntu 和其它 Linux 发行版中更改时区 + +这里有两种方法来更改 Ubuntu 中的时区。你可以使用图形化设置或在终端中使用 timedatectl 命令。你也可以直接更改 /etc/timezone 文件,但是我不建议这样做。 + +在这篇初学者教程中,我将向你展示图形化和终端两种方法: + + * [通过 GUI 更改 Ubuntu 中的时区][2] (适合桌面用户) + * [通过命令行更改 Ubuntu 中的时区][3] (桌面和服务器都工作) + + + +![][4] + +#### 方法 1: 通过终端更改 Ubuntu 时区 + +[Ubuntu][5] 或一些使用 systemd 的其它发行版可以在 Linux 终端中使用 timedatectl 命令来设置时区。 + +你可以使用没有任何参数的 timedatectl 命令来检查当前是日期和时区设置: + +``` +[email protected]:~$ timedatectl + Local time: Sat 2020-01-18 17:39:52 IST + Universal time: Sat 2020-01-18 12:09:52 UTC + RTC time: Sat 2020-01-18 12:09:52 + Time zone: Asia/Kolkata (IST, +0530) + System clock synchronized: yes +systemd-timesyncd.service active: yes + RTC in local TZ: no +``` + +正如你在上面的输出中所看,我的系统使用 Asia/Kolkata 。它也告诉我现在比世界时早 5 小时 30 分钟。 + +为在 Linux 中设置时区,你需要知道准确的时区。你必需使用时区的正确的格式 (时区格式是 大陆/城市)。 + +为获取时区列表,使用 _timedatectl_ 命令的 _list-timezones_ 参数: + +``` +timedatectl list-timezones +``` + +它将向你显示大量可用的时区列表。 + +![Timezones List][6] + +你可以使用向上箭头和向下箭头或 PgUp 和 PgDown 键来在页面之间移动。 + +你也可以 grep 输出,并搜索你的时区。例如,假如你正在寻找欧洲的时区,你可以使用: + +``` +timedatectl list-timezones | grep -i europe +``` + +比方说,你想设置时区为巴黎。在这里,使用的时区值的 Europe/Paris : + +``` +timedatectl set-timezone Europe/Paris +``` + +它虽然不显示任何成功信息,但是时区会立即更改。你不需要重新启动或注销。 + +记住,虽然你不需要成为 root 用户,并且对命令使用 sudo ,但是你的账户仍然需要拥有管理器权限来更改时区。 + +你可以使用 [date 命令][7] 来验证更改的时间好时区: + +``` +[email protected]:~$ date +Sat Jan 18 13:56:26 CET 2020 +``` + +#### 方法 2: 通过 GUI 更改 Ubuntu 时区 + +按下 super 键 (Windows 键) ,并搜索设置: + +![Applications Menu Settings][8] + +在左侧边栏中,向下滚动一点,查看详细信息: + +![Go to Settings -> Details][9] + +在详细信息中,你将在左侧边栏中找到 日期和时间 。在这里,你应该关闭自动时区选项(如果它已经被启用),然后在时区上单击: + +![In Details -> Date & Time, turn off the Automatic Time Zone][10] + +当你单击时区时,它将打开一个交互式地图,你可以在你选择的地理位置上单击,关闭窗口。 + +![Select a timezone][11] + +在选择新的时区后,除了关闭这个地图后,你不必做任何事情。不需要注销或 [关闭 Ubuntu][12] 。 + +我希望这篇快速教程能帮助你在 Ubuntu 和其它 Linux 发行版中更改时区。如果你有问题或建议,请告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/change-timezone-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-ubuntu/ +[2]: tmp.bHvVztzy6d#change-timezone-gui +[3]: tmp.bHvVztzy6d#change-timezone-command-line +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/Ubuntu_Change-_Time_Zone.png?ssl=1 +[5]: https://ubuntu.com/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/timezones_in_ubuntu.jpg?ssl=1 +[7]: https://linuxhandbook.com/date-command/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/settings_detail_ubuntu.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu.jpg?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu_2.jpg?ssl=1 +[12]: https://itsfoss.com/schedule-shutdown-ubuntu/ From 7b5fd655ee61d5a9303f07ad4cd260ef95030884 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 29 Jan 2020 14:10:13 +0800 Subject: [PATCH 0463/3057] PRF @laingke --- ... Linux logins using public-private keys.md | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md b/translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md index 0e4a4de626..f98da38ced 100644 --- a/translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md +++ b/translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Setting up passwordless Linux logins using public/private keys) @@ -9,21 +9,24 @@ 使用公钥/私钥对设定免密的 Linux 登录方式 ====== -使用一组公钥/私钥对让你不需要密码登录到远程 Linux 系统或使用 ssh 运行命令,这会非常方便,但是设置过程有点复杂。下面是帮助你的方法和脚本。 + +> 使用一组公钥/私钥对让你不需要密码登录到远程 Linux 系统或使用 ssh 运行命令,这会非常方便,但是设置过程有点复杂。下面是帮助你的方法和脚本。 + +![](https://images.idgesg.net/images/article/2020/01/cso_lock_question_mark-shaped_keyhole_amid_binary_network_circuits_digital_transformation_by_ivanastar_getty_images_1200x800-100826595-large.jpg) 在 [Linux][1] 系统上设置一个允许你无需密码即可远程登录或运行命令的帐户并不难,但是要使它正常工作,你还需要掌握一些繁琐的细节。在本文,我们将完成整个过程,然后给出一个可以帮助处理琐碎细节的脚本。 -设置好之后,如果希望在脚本中运行 ssh 命令,尤其是希望配置自动运行的命令,那么免密访问特别有用。 +设置好之后,如果希望在脚本中运行 `ssh` 命令,尤其是希望配置自动运行的命令,那么免密访问特别有用。 需要注意的是,你不需要在两个系统上使用相同的用户帐户。实际上,你可以把公用密钥用于系统上的多个帐户或多个系统上的不同帐户。 设置方法如下。 -### which system to start on?在哪个系统上启动? +### 在哪个系统上启动? -首先,你需要从要发出命令的系统上着手。那就是你用来创建 ssh 密钥的系统。你还需要访问远程系统上的帐户并在其上运行这些命令。 +首先,你需要从要发出命令的系统上着手。那就是你用来创建 `ssh` 密钥的系统。你还需要可以访问远程系统上的帐户并在其上运行这些命令。 -为了使角色清晰明了,我们将场景中的第一个系统称为“boss”,因为它将发出要在另一个系统上运行的命令。 +为了使角色清晰明了,我们将场景中的第一个系统称为 “boss”,因为它将发出要在另一个系统上运行的命令。 因此,命令提示符如下: @@ -31,7 +34,7 @@ boss$ ``` -如果您还没有在 boss 系统上为你的帐户设置公钥/私钥对,请使用如下所示的命令创建一个密钥对。注意,你可以在各种加密算法之间进行选择。(一般使用RSA或DSA。)注意,要在不输入密码的情况下访问系统,您需要在下面的对话框中输入两个提示符的密码。 +如果你还没有在 boss 系统上为你的帐户设置公钥/私钥对,请使用如下所示的命令创建一个密钥对。注意,你可以在各种加密算法之间进行选择。(一般使用 RSA 或 DSA。)注意,要在不输入密码的情况下访问系统,你需要在下面的对话框中的两个提示符出不输入密码。 如果你已经有一个与此帐户关联的公钥/私钥对,请跳过此步骤。 @@ -59,18 +62,18 @@ The key's randomart image is: +----[SHA256]-----+ ``` -上面显示的命令将创建公钥和私钥。其中公钥用于加密,私钥用于解密。因此,这些密钥之间的关系是关键的,私有密钥**绝不**应该被共享。相反,它应该保存在 boss 系统的 .ssh 文件夹中。 +上面显示的命令将创建公钥和私钥。其中公钥用于加密,私钥用于解密。因此,这些密钥之间的关系是关键的,私有密钥**绝不**应该被共享。相反,它应该保存在 boss 系统的 `.ssh` 文件夹中。 -注意,在创建时,你的公钥和私钥将会保存在 .ssh 文件夹中。 +注意,在创建时,你的公钥和私钥将会保存在 `.ssh` 文件夹中。 -下一步是将**公钥**复制到你希望从 boss 系统免密访问的系统。你可以使用 **scp** 命令来完成此操作,但此时你仍然需要输入密码。在本例中,该系统称为“target”。 +下一步是将**公钥**复制到你希望从 boss 系统免密访问的系统。你可以使用 `scp` 命令来完成此操作,但此时你仍然需要输入密码。在本例中,该系统称为 “target”。 ``` boss$ scp .ssh/id_rsa.pub myacct@target:/home/myaccount myacct@target's password: ``` -你需要安装公钥在 target 系统(将运行命令的系统)上。如果你没有 .ssh 目录(例如,你从未在该系统上使用过 ssh),运行这样的命令将为你设置一个目录: +你需要安装公钥在 target 系统(将运行命令的系统)上。如果你没有 `.ssh` 目录(例如,你从未在该系统上使用过 `ssh`),运行这样的命令将为你设置一个目录: ``` target$ ssh localhost date @@ -81,20 +84,20 @@ drwxr-xr-x 6 myacct myacct 4096 Jan 19 11:49 .. -rw-r--r-- 1 myacct myacct 222 Jan 19 11:48 known_hosts ``` -仍然在目标系统上,你需要将从“boss”系统传输的公钥添加到 .ssh/authorized_keys 文件中。如果密钥已经存在,使用下面的命令将把它添加到文件的末尾;如果文件不存在,则创建文件并添加密钥。 +仍然在目标系统上,你需要将从“boss”系统传输的公钥添加到 `.ssh/authorized_keys` 文件中。如果该文件已经存在,使用下面的命令将把它添加到文件的末尾;如果文件不存在,则创建该文件并添加密钥。 ``` target$ cat id_rsa.pub >> .ssh/authorized_keys ``` -下一步,你需要确保你的 authorized_keys 文件权限为 600。如果还不是,执行命令 ```chmod 600 .ssh/authorized_keys```。 +下一步,你需要确保你的 `authorized_keys` 文件权限为 600。如果还不是,执行命令 `chmod 600 .ssh/authorized_keys`。 ``` target$ ls -l authorized_keys -rw------- 1 myself myself 569 Jan 19 12:10 authorized_keys ``` -还要检查目标系统上 .ssh 目录的权限是否设置为 700。如果需要,执行 ```chmod 700 .ssh``` 命令修改权限。 +还要检查目标系统上 `.ssh` 目录的权限是否设置为 700。如果需要,执行 `chmod 700 .ssh` 命令修改权限。 ``` target$ ls -ld .ssh @@ -177,7 +180,7 @@ $ ssh lola@fruitfly [lola@fruitfly ~]$ ``` -一旦设置了免密登录,你就可以不需要键入密码从 boss 系统登录到 target 系统,并且运行任意的 ssh 命令。以这种免密的方式运行并不意味着你的帐户不安全。然而,根据target 系统的性质,保护您在 boss 系统上的密码可能变得更加重要。 +一旦设置了免密登录,你就可以不需要键入密码从 boss 系统登录到 target 系统,并且运行任意的 `ssh` 命令。以这种免密的方式运行并不意味着你的帐户不安全。然而,根据 target 系统的性质,保护你在 boss 系统上的密码可能变得更加重要。 -------------------------------------------------------------------------------- @@ -186,7 +189,7 @@ via: https://www.networkworld.com/article/3514607/setting-up-passwordless-linux- 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 54dd9dd0eed1a89660ae71ce071c8a1200cca6eb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 29 Jan 2020 14:12:08 +0800 Subject: [PATCH 0464/3057] Rename sources/tech/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md to sources/talk/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md --- ...erstanding your organization-s approach to new technologies.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md (100%) diff --git a/sources/tech/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md b/sources/talk/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md similarity index 100% rename from sources/tech/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md rename to sources/talk/20200128 Communication superstars- A model for understanding your organization-s approach to new technologies.md From b627720a648e4335aa840f6a4ebe3aec7ff7026f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 29 Jan 2020 14:14:07 +0800 Subject: [PATCH 0465/3057] PUB @laingke https://linux.cn/article-11830-1.html --- ...p passwordless Linux logins using public-private keys.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200122 Setting up passwordless Linux logins using public-private keys.md (97%) diff --git a/translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md b/published/20200122 Setting up passwordless Linux logins using public-private keys.md similarity index 97% rename from translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md rename to published/20200122 Setting up passwordless Linux logins using public-private keys.md index f98da38ced..89f54a6b45 100644 --- a/translated/tech/20200122 Setting up passwordless Linux logins using public-private keys.md +++ b/published/20200122 Setting up passwordless Linux logins using public-private keys.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11830-1.html) [#]: subject: (Setting up passwordless Linux logins using public/private keys) [#]: via: (https://www.networkworld.com/article/3514607/setting-up-passwordless-linux-logins-using-publicprivate-keys.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) @@ -12,7 +12,7 @@ > 使用一组公钥/私钥对让你不需要密码登录到远程 Linux 系统或使用 ssh 运行命令,这会非常方便,但是设置过程有点复杂。下面是帮助你的方法和脚本。 -![](https://images.idgesg.net/images/article/2020/01/cso_lock_question_mark-shaped_keyhole_amid_binary_network_circuits_digital_transformation_by_ivanastar_getty_images_1200x800-100826595-large.jpg) +![](https://img.linux.net.cn/data/attachment/album/202001/29/141343ldps4muy4kp64k4l.jpg) 在 [Linux][1] 系统上设置一个允许你无需密码即可远程登录或运行命令的帐户并不难,但是要使它正常工作,你还需要掌握一些繁琐的细节。在本文,我们将完成整个过程,然后给出一个可以帮助处理琐碎细节的脚本。 From e10ed7653fff555d5287cc9abcfac109bee1197f Mon Sep 17 00:00:00 2001 From: laingke Date: Wed, 29 Jan 2020 17:22:45 +0800 Subject: [PATCH 0466/3057] 20200102-javastream translated --- ...ming and functional programming in Java.md | 496 ------------------ ...ming and functional programming in Java.md | 455 ++++++++++++++++ 2 files changed, 455 insertions(+), 496 deletions(-) delete mode 100644 sources/tech/20200102 Data streaming and functional programming in Java.md create mode 100644 translated/tech/20200102 Data streaming and functional programming in Java.md diff --git a/sources/tech/20200102 Data streaming and functional programming in Java.md b/sources/tech/20200102 Data streaming and functional programming in Java.md deleted file mode 100644 index c3e914001b..0000000000 --- a/sources/tech/20200102 Data streaming and functional programming in Java.md +++ /dev/null @@ -1,496 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (laingke) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Data streaming and functional programming in Java) -[#]: via: (https://opensource.com/article/20/1/javastream) -[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) - -Data streaming and functional programming in Java -====== -Learn how to use the stream API and functional programming constructs in -Java 8. -![computer screen ][1] - -When Java SE 8 (aka core Java 8) was introduced in 2014, it introduced changes that fundamentally impact programming in it. The changes have two closely linked parts: the stream API and the functional programming constructs. This article uses code examples, from the basics through advanced features, to introduce each part and illustrate the interplay between them. - -### The basics - -The stream API is a concise and high-level way to iterate over the elements in a data sequence. The packages **java.util.stream** and **java.util.function** house the new libraries for the stream API and related functional programming constructs. Of course, a code example is worth a thousand words. - -The code segment below populates a **List** with about 2,000 random integer values: - - -``` -[Random][2] rand = new [Random][2](); -List<Integer> list = new ArrayList<Integer>();           // empty list -for (int i = 0; i < 2048; i++) list.add(rand.nextInt()); // populate it -``` - -Another **for** loop could be used to iterate over the populated list to collect the even values into another list. The stream API is a cleaner way to do the same: - - -``` -[List][3] <Integer> evens = list -   .stream()                      // streamify the list -   .filter(n -> (n & 0x1) == 0)   // filter out odd values -   .collect(Collectors.toList()); // collect even values -``` - -The example has three functions from the stream API: - - * The **stream** function can turn a **Collection** into a stream, which is a conveyor belt of values accessible one at a time. The streamification is lazy (and therefore efficient) in that the values are produced as needed rather than all at once. - - * The **filter** function determines which streamed values, if any, get through to the next stage in the processing pipeline, the **collect** stage. The **filter** function is _higher-order_ in that its argument is a function—in this example, a lambda, which is an unnamed function and at the center of Java's new functional programming constructs. - -The lambda syntax departs radically from traditional Java: - - -``` -`n -> (n & 0x1) == 0` -``` - -The arrow (a minus sign followed immediately by a greater-than sign) separates the argument list on the left from the function's body on the right. The argument **n** is not explicitly typed, although it could be; in any case, the compiler figures out that **n** is an **Integer**. If there were multiple arguments, these would be enclosed in parentheses and separated by commas. - -The body, in this example, checks whether an integer's lowest-order (rightmost) bit is a zero, which indicates an even value. A filter should return a boolean value. There is no explicit **return** in the function's body, although there could be. If the body has no explicit **return**, then the body's last expression is the returned value. In this example, written in the spirit of lambda programming, the body consists of the single, simple boolean expression **(n & 0x1) == 0**. - - * The **collect** function gathers the even values into a list whose reference is **evens**. As an example below illustrates, the **collect** function is thread-safe and, therefore, would work correctly even if the filtering operation was shared among multiple threads. - - - - -### Convenience functions and easy multi-threading - -In a production environment, a data stream might have a file or a network connection as its source. For learning the stream API, Java provides types such as **IntStream**, which can generate streams with elements of various types. Here is an **IntStream** example: - - -``` -IntStream                         // integer stream -   .range(1, 2048)                // generate a stream of ints in this range -   .parallel()                    // partition the data for multiple threads -   .filter(i -> ((i & 0x1) > 0))  // odd parity? pass through only odds -   .forEach([System][4].out::println); // print each -``` - -The **IntStream** type includes a **range** function that generates a stream of integer values within a specified range, in this case, from 1 through 2,048, with increments of 1. The **parallel** function automatically partitions the work to be done among multiple threads, each of which does the filtering and printing. (The number of threads typically matches the number of CPUs on the host system.) The argument to the **forEach** function is a _method reference_, in this case, a reference to the **println** method encapsulated in **System.out**, which is of type **PrintStream**. The syntax for method and constructor references will be discussed shortly. - -Because of the multi-threading, the integer values are printed in an arbitrary order overall but in sequence within a given thread. For example, if thread T1 prints 409 and 411, then T1 does so in the order 409–411, but some other thread might print 2,045 beforehand. The threads behind the **parallel** call execute concurrently, and the order of their output is therefore indeterminate. - -### The map/reduce pattern - -The _map/reduce_ pattern has become popular in processing large datasets. A map/reduce macro operation is built from two micro-operations. The data first are scattered (_mapped_) among various workers, and the separate results then are gathered together—perhaps as a single value, which would be the _reduction_. Reduction can take different forms, as the following examples illustrate. - -Instances of the **Number** class below represent integer values with either **EVEN** or **ODD** parity: - - -``` -public class [Number][5] { -    enum Parity { EVEN, ODD } -    private int value; -    public [Number][5](int n) { setValue(n); } -    public void setValue(int value) { this.value = value; } -    public int getValue() { return this.value; } -    public Parity getParity() { -        return ((value & 0x1) == 0) ? Parity.EVEN : Parity.ODD; -    } -    public void dump() { -        [System][4].out.format("Value: %2d (parity: %s)\n", getValue(), -                          (getParity() == Parity.ODD ? "odd" : "even")); -    } -} -``` - -The following code illustrates map/reduce with a **Number** stream, thereby showing that the stream API can handle not only primitive types such as **int** and **float** but programmer-defined class types as well. - -In the code segment below, a list of random integer values is streamified using the **parallelStream** rather than the **stream** function. The **parallelStream** variant, like the **parallel** function introduced earlier, does automatic multithreading. - - -``` -final int howMany = 200; -[Random][2] r = new [Random][2](); -[Number][5][ ] nums = new [Number][5][howMany]; -for (int i = 0; i < howMany; i++) nums[i] = new [Number][5](r.nextInt(100)); -List<Number> listOfNums = [Arrays][6].asList(nums);  // listify the array - -[Integer][7] sum4All = listOfNums -   .parallelStream()           // automatic multi-threading -   .mapToInt([Number][5]::getValue) // method reference rather than lambda -   .sum();                     // reduce streamed values to a single value -[System][4].out.println("The sum of the randomly generated values is: " + sum4All); -``` - -The higher-order **mapToInt** function could take a lambda as an argument, but in this case, it takes a method reference instead, which is **Number::getValue**. The **getValue** method expects no arguments and returns its **int** value for a given **Number** instance. The syntax is uncomplicated: the class name **Number** followed by a double colon and the method's name. Recall the earlier **System.out::println** example, which has the double colon after the **static** field **out** in the **System** class. - -The method reference **Number::getValue** could be replaced by the lambda below. The argument **n** is one of the **Number** instances in the stream: - - -``` -`mapToInt(n -> n.getValue())` -``` - -In general, lambdas and method references are interchangeable: if a higher-order function such as **mapToInt** can take one form as an argument, then this function could take the other as well. The two functional programming constructs have the same purpose—to perform some customized operation on data passed in as arguments. Choosing between the two is often a matter of convenience. For example, a lambda can be written without an encapsulating class, whereas a method cannot. My habit is to use a lambda unless the appropriate encapsulated method is already at hand. - -The **sum** function at the end of the current example does the reduction in a thread-safe manner by combining the partial sums from the **parallelStream** threads. However, the programmer is responsible for ensuring that, in the course of the multi-threading induced by the **parallelStream** call, the programmer's own function calls (in this case, to **getValue**) are thread-safe. - -The last point deserves emphasis. Lambda syntax encourages the writing of _pure functions_, which are functions whose return values depend only on the arguments, if any, passed in; a pure function has no side effects such as updating a **static** field in a class. Pure functions are thereby thread-safe, and the stream API works best if the functional arguments passed to higher-order functions, such as **filter** and **map**, are pure functions. - -For finer-grained control, there is another stream API function, named **reduce**, that could be used for summing the values in the **Number** stream: - - -``` -[Integer][7] sum4AllHarder = listOfNums -   .parallelStream()                           // multi-threading -   .map([Number][5]::getValue)                      // value per Number -   .reduce(0, (sofar, next) -> sofar + next);  // reduction to a sum -``` - -This version of the **reduce** function takes two arguments, the second of which is a function: - - * The first argument (in this case, zero) is the _identity_ value, which serves as the initial value for the reduction operation and as the default value should the stream run dry during the reduction. - * The second argument is the _accumulator_, in this case, a lambda with two arguments: the first argument (**sofar**) is the running sum, and the second argument (**next**) is the next value from the stream. The running sum and next value then are added to update the accumulator. Keep in mind that both the **map** and the **reduce** functions now execute in a multi-threaded context because of the **parallelStream** call at the start. - - - -In the examples so far, stream values are collected and then reduced, but, in general, the **Collectors** in the stream API can accumulate values without reducing them to a single value. The collection activity can produce arbitrarily rich data structures, as the next code segment illustrates. The example uses the same **listOfNums** as the preceding examples: - - -``` -Map<[Number][5].Parity, List<Number>> numMap = listOfNums -   .parallelStream() -   .collect(Collectors.groupingBy([Number][5]::getParity)); - -List<Number> evens = numMap.get([Number][5].Parity.EVEN); -List<Number> odds = numMap.get([Number][5].Parity.ODD); -``` - -The **numMap** in the first line refers to a **Map** whose key is a **Number** parity (**ODD** or **EVEN**) and whose value is a **List** of **Number** instances with values having the designated parity. Once again, the processing is multi-threaded through the **parallelStream** call, and the **collect** call then assembles (in a thread-safe manner) the partial results into the single **Map** to which **numMap** refers. The **get** method then is called twice on the **numMap**, once to get the **evens** and a second time to get the **odds**. - -The utility function **dumpList** again uses the higher-order **forEach** function from the stream API: - - -``` -private void dumpList([String][8] msg, List<Number> list) { -   [System][4].out.println("\n" + msg); -   list.stream().forEach(n -> n.dump()); // or: forEach(Number::dump) -} -``` - -Here is a slice of the program's output from a sample run: - - -``` -The sum of the randomly generated values is: 3322 -The sum again, using a different method:     3322 - -Evens: - -Value: 72 (parity: even) -Value: 54 (parity: even) -... -Value: 92 (parity: even) - -Odds: - -Value: 35 (parity: odd) -Value: 37 (parity: odd) -... -Value: 41 (parity: odd) -``` - -### Functional constructs for code simplification - -Functional constructs, such as method references and lambdas, fit nicely into the stream API. These constructs represent a major simplification of higher-order functions in Java. Even in the bad old days, Java technically supported higher-order functions through the **Method** and **Constructor** types, instances of which could be passed as arguments to other functions. These types were used—but rarely in production-grade Java precisely because of their complexity. Invoking a **Method**, for example, requires either an object reference (if the method is non-**static**) or at least a class identifier (if the method is **static**). The arguments for the invoked **Method** then are passed to it as **Object** instances, which may require explicit downcasting if polymorphism (another complexity!) is not in play. By contrast, lambdas and method references are easy to pass as arguments to other functions. - -The new functional constructs have uses beyond the stream API, however. Consider a Java GUI program with a button for the user to push, for example, to get the current time. The event handler for the button push might be written as follows: - - -``` -[JButton][9] updateCurrentTime = new [JButton][9]("Update current time"); -updateCurrentTime.addActionListener(new [ActionListener][10]() { -   @Override -   public void actionPerformed([ActionEvent][11] e) { -      currentTime.setText(new [Date][12]().toString()); -   } -}); -``` - -This short code segment is a challenge to explain. Consider the second line in which the argument to the method **addActionListener** begins as follows: - - -``` -`new ActionListener() {` -``` - -This seems wrong in that **ActionListener** is an **abstract** interface, and **abstract** types cannot be instantiated with a call to **new**. However, it turns out that something else entirely is being instantiated: an unnamed inner class that implements this interface. If the code above were encapsulated in a class named **OldJava**, then this unnamed inner class would be compiled as **OldJava$1.class**. The **actionPerformed** method is overridden in the unnamed inner class. - -Now consider this refreshing change with the new functional constructs: - - -``` -`updateCurrentTime.addActionListener(e -> currentTime.setText(new Date().toString()));` -``` - -The argument **e** in the lambda is an **ActionEvent** instance, and the lambda's body is a simple call to **setText** on the button. - -### Functional interfaces and composition - -The lambdas used so far have been written in place. For convenience, however, there can be references to lambdas just as there are to encapsulated methods. The following series of short examples illustrate this. - -Consider this interface definition: - - -``` -@FunctionalInterface // optional, usually omitted -interface BinaryIntOp { -    abstract int compute(int arg1, int arg2); // abstract could be dropped -} -``` - -The annotation **@FunctionalInterface** applies to any interface that declares a _single_ abstract method; in this case, **compute**. Several standard interfaces (e.g., the **Runnable** interface with its single declared method, **run**) fit the bill. In this example, **compute** is the declared method. The interface can be used as the target type in a reference declaration: - - -``` -BinaryIntOp div = (arg1, arg2) -> arg1 / arg2; -div.compute(12, 3); // 4 -``` - -The package **java.util.function** provides various functional interfaces. Some examples follow. - -The code segment below introduces the parameterized **Predicate** functional interface. In this example, the type **Predicate<String>** with parameter **String** can refer to either a lambda with a **String** argument or a **String** method such as **isEmpty**. In general, a _predicate_ is a function that returns a boolean value. - - -``` -Predicate<String> pred = [String][8]::isEmpty; // predicate for a String method -[String][8][ ] strings = {"one", "two", "", "three", "four"}; -[Arrays][6].asList(strings) -   .stream() -   .filter(pred)                  // filter out non-empty strings -   .forEach([System][4].out::println); // only the empty string is printed -``` - -The **isEmpty** predicate evaluates to **true** just in case a string's length is zero; hence, only the empty string makes it through to the **forEach** stage in the pipeline. - -The next code segments illustrate how simple lambdas or method references can be composed into richer ones. Consider this series of assignments to references of the **IntUnaryOperator** type, which takes an integer argument and returns an integer value: - - -``` -IntUnaryOperator doubled = n -> n * 2; -IntUnaryOperator tripled = n -> n * 3; -IntUnaryOperator squared = n -> n * n; -``` - -**IntUnaryOperator** is a **FunctionalInterface** whose single declared method is **applyAsInt**. The three references **doubled**, **tripled**, and **squared** now can be used standalone or in various compositions: - - -``` -int arg = 5; -doubled.applyAsInt(arg); // 10 -tripled.applyAsInt(arg); // 15 -squared.applyAsInt(arg); // 25 -``` - -Here are some sample compositions: - - -``` -int arg = 5; -doubled.compose(squared).applyAsInt(arg); // doubled-the-squared: 50 -tripled.compose(doubled).applyAsInt(arg); // tripled-the-doubled: 30 -doubled.andThen(squared).applyAsInt(arg); // doubled-andThen-squared: 100 -squared.andThen(tripled).applyAsInt(arg); // squared-andThen-tripled: 75 -``` - -Compositions could be done with in-place lambdas, but the references make the code cleaner. - -### Constructor references - -Constructor references are yet another of the functional programming constructs, but these references are useful in more subtle contexts than lambdas and method references. Once again, a code example seems the best way to clarify. - -Consider this [POJO][13] class: - - -``` -public class BedRocker { // resident of Bedrock -    private [String][8] name; -    public BedRocker([String][8] name) { this.name = name; } -    public [String][8] getName() { return this.name; } -    public void dump() { [System][4].out.println(getName()); } -} -``` - -The class has a single constructor, which requires a **String** argument. Given an array of names, the goal is to generate an array of **BedRocker** elements, one per name. Here is the code segment that uses functional constructs to do so: - - -``` -[String][8][ ] names = {"Fred", "Wilma", "Peebles", "Dino", "Baby Puss"}; - -Stream<BedRocker> bedrockers = [Arrays][6].asList(names).stream().map(BedRocker::new); -BedRocker[ ] arrayBR = bedrockers.toArray(BedRocker[]::new); - -[Arrays][6].asList(arrayBR).stream().forEach(BedRocker::dump); -``` - -At a high level, this code segment transforms names into **BedRocker** array elements. In detail, the code works as follows. The **Stream** interface (in the package **java.util.stream**) can be parameterized, in this case, to generate a stream of **BedRocker** items named **bedrockers**. - -The **Arrays.asList** utility again is used to streamify an array, **names**, with each stream item then passed to the **map** function whose argument now is the constructor reference **BedRocker::new**. This constructor reference acts as an object factory by generating and initializing, on each call, a **BedRocker** instance. After the second line executes, the stream named **bedrockers** consists of five **BedRocker** items. - -The example can be clarified further by focusing on the higher-order **map** function. In a typical case, a mapping transforms a value of one type (e.g., an **int**) into a different value of the _same_ type (e.g., an integer's successor): - - -``` -`map(n -> n + 1) // map n to its successor` -``` - -In the **BedRocker** example, however, the transformation is more dramatic because a value of one type (a **String** representing a name) is mapped to a value of a _different_ type, in this case, a **BedRocker** instance with the string as its name. The transformation is done through a constructor call, which is enabled by the constructor reference: - - -``` -`map(BedRocker::new) // map a String to a BedRocker` -``` - -The value passed to the constructor is one of the names in the **names** array. - -The second line of this code example also illustrates the by-now-familiar transformation of an array first into a **List** and then into a **Stream**: - - -``` -`Stream bedrockers = Arrays.asList(names).stream().map(BedRocker::new);` -``` - -The third line goes the other way—the stream **bedrockers** is transformed into an array by invoking the **toArray** method with the _array_ constructor reference **BedRocker[]::new**: - - -``` -`BedRocker[ ] arrayBR = bedrockers.toArray(BedRocker[]::new);` -``` - -This constructor reference does not create a single **BedRocker** instance, but rather an entire array of these: the constructor reference is now **BedRocker[]::new** rather than **BedRocker::new**. For confirmation, the **arrayBR** is transformed into a **List**, which again is streamified so that **forEach** can be used to print the **BedRocker** names: - - -``` -Fred -Wilma -Peebles -Dino -Baby Puss -``` - -The example's subtle transformations of data structures are done with but few lines of code, underscoring the power of various higher-order functions that can take a lambda, a method reference, or a constructor reference as an argument - -### Currying - -To _curry_ a function is to reduce (typically by one) the number of explicit arguments required for whatever work the function does. (The term honors the logician Haskell Curry.) In general, functions are easier to call and are more robust if they have fewer arguments. (Recall some nightmarish function that expects a half-dozen or so arguments!) Accordingly, currying should be seen as an effort to simplify a function call. The interface types in the **java.util.function** package are suited for currying, as the next example shows. - -References of the **IntBinaryOperator** interface type are for functions that take two integer arguments and return an integer value: - - -``` -IntBinaryOperator mult2 = (n1, n2) -> n1 * n2; -mult2.applyAsInt(10, 20); // 200 -mult2.applyAsInt(10, 30); // 300 -``` - -The reference name **mult2** underscores that two explicit arguments are required, in this example, 10 and 20. - -The previously introduced **IntUnaryOperator** is simpler than an **IntBinaryOperator** because the former requires just one argument, whereas the latter requires two arguments. Both return an integer value. The goal, therefore, is to curry the two-argument **IntBinraryOperator** named **mult2** into a one-argument **IntUnaryOperator** version **curriedMult2**. - -Consider the type **IntFunction<R>**. A function of this type takes an integer argument and returns a result of type **R**, which could be another function—indeed, an **IntBinaryOperator**. Having a lambda return another lambda is straightforward: - - -``` -`arg1 -> (arg2 -> arg1 * arg2) // parentheses could be omitted` -``` - -The full lambda starts with **arg1,** and this lambda's body—and returned value—is another lambda, which starts with **arg2**. The returned lambda takes just one argument (**arg2**) but returns the product of two numbers (**arg1** and **arg2**). The following overview, followed by the code, should clarify. - -Here is an overview of how **mult2** can be curried: - - * A lambda of type **IntFunction<IntUnaryOperator>** is written and called with an integer value such as 10. The returned **IntUnaryOperator** caches the value 10 and thereby becomes the curried version of **mult2**, in this example, **curriedMult2**. - * The **curriedMult2** function then is called with a single explicit argument (e.g., 20), which is multiplied with the cached argument (in this case, 10) to produce the product returned. - - - -Here are the details in code: - - -``` -// Create a function that takes one argument n1 and returns a one-argument -// function n2 -> n1 * n2 that returns an int (the product n1 * n2). -IntFunction<IntUnaryOperator> curriedMult2Maker = n1 -> (n2 -> n1 * n2); -``` - -Calling the **curriedMult2Maker** generates the desired **IntUnaryOperator** function: - - -``` -// Use the curriedMult2Maker to get a curried version of mult2. -// The argument 10 is n1 from the lambda above. -IntUnaryOperator curriedMult2 = curriedMult2Maker2.apply(10); -``` - -The value 10 is now cached in the **curriedMult2** function so that the explicit integer argument in a **curriedMult2** call will be multiplied by 10: - - -``` -curriedMult2.applyAsInt(20); // 200 = 10 * 20 -curriedMult2.applyAsInt(80); // 800 = 10 * 80 -``` - -The cached value can be changed at will: - - -``` -curriedMult2 = curriedMult2Maker.apply(50); // cache 50 -curriedMult2.applyAsInt(101);               // 5050 = 101 * 50 -``` - -Of course, multiple curried versions of **mult2**, each an **IntUnaryOperator**, can be created in this way. - -Currying takes advantage of a powerful feature about lambdas: a lambda is easily written to return whatever type of value is needed, including another lambda. - -### Wrapping up - -Java remains a class-based object-oriented programming language. But with the stream API and its supporting functional constructs, Java takes a decisive (and welcomed) step toward functional languages such as Lisp. The result is a Java better suited to process the massive data streams so common in modern programming. This step in the functional direction also makes it easier to write clear, concise Java in the pipeline style highlighted in previous code examples: - - -``` -dataStream -   .parallelStream() // multi-threaded for efficiency -   .filter(...)      // stage 1 -   .map(...)         // stage 2 -   .filter(...)      // stage 3 -   ... -   .collect(...);    // or, perhaps, reduce: stage N -``` - -The automatic multi-threading, illustrated with the **parallel** and **parallelStream** calls, is built upon Java's fork/join framework, which supports _task stealing_ for efficiency. Suppose that the thread pool behind a **parallelStream** call consists of eight threads and that the **dataStream** is partitioned eight ways. Some thread (e.g., T1) might work faster than another (e.g., T7), which means that some of T7's tasks ought to be moved into T1's work queue. This happens automatically at runtime. - -The programmer's chief responsibility in this easy multi-threading world is to write thread-safe functions passed as arguments to the higher-order functions that dominate in the stream API. Lambdas, in particular, encourage the writing of pure—and, therefore, thread-safe—functions. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/javastream - -作者:[Marty Kalin][a] -选题:[lujun9972][b] -译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mkalindepauledu -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/features_solutions_command_data.png?itok=4_VQN3RK (computer screen ) -[2]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random -[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+list -[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system -[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+number -[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+arrays -[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer -[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string -[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+jbutton -[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionlistener -[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent -[12]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+date -[13]: https://en.wikipedia.org/wiki/Plain_old_Java_object diff --git a/translated/tech/20200102 Data streaming and functional programming in Java.md b/translated/tech/20200102 Data streaming and functional programming in Java.md new file mode 100644 index 0000000000..fe114a73ef --- /dev/null +++ b/translated/tech/20200102 Data streaming and functional programming in Java.md @@ -0,0 +1,455 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data streaming and functional programming in Java) +[#]: via: (https://opensource.com/article/20/1/javastream) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +Java 中的数据流和函数式编程 +====== +学习如何使用 Java 8 中的流 API 和函数式编程结构。 +![computer screen ][1] + +当 Java SE 8(又名核心 Java 8)在 2014 年被推出时,它引入了一些从根本上影响 IT 编程的更改。这些更改中有两个紧密相连的部分:流API和功能编程构造。本文使用代码示例,从基础到高级特性,介绍每个部分并说明它们之间的相互作用。 + +### 基础特性 + +流 API 是在数据序列中迭代元素的简洁而高级的方法。包 `java.util.stream` 和 `java.util.function` 包含用于流 API 和相关函数式编程构造的新库。当然,一个代码示例胜过千言万语。 + +下面的代码段用大约 2,000 个随机整数值填充了一个 `List`: + +``` +Random rand = new Random2(); +List list = new ArrayList(); // 空 list +for (int i = 0; i < 2048; i++) list.add(rand.nextInt()); // 填充它 +``` + +另一个 `for` 循环可用于遍历填充 list,以将偶数值收集到另一个 list 中。流 API 提供了一种更简洁的方法来执行此操作: + +``` +List evens = list + .stream() // 流化 list + .filter(n -> (n & 0x1) == 0) // 过滤出奇数值 + .collect(Collectors.toList()); // 收集偶数值 +``` + +这个例子有三个来自流 API 的函数: + +> `stream` 函数可以将**集合**转换为流,而流是一个每次可访问一个值的传送带。流化是惰性的(因此也是高效的),因为值是根据需要产生的,而不是一次性产生的。 + +> `filter` 函数确定哪些流的值(如果有的话)通过了处理管道中的下一个阶段,即 `collect` 阶段。`filter` 函数是 _高阶的higher-order_,因为它的参数是一个函数 —— 在这个例子中是一个 lambda 表达式,它是一个未命名的函数,并且是 Java 新的函数式编程结构的核心。 + +lambda 语法与传统的 Java 完全不同: + +``` +`n -> (n & 0x1) == 0` +``` + +箭头(一个减号后面紧跟着一个大于号)将左边的参数列表与右边的函数体分隔开。参数 `n` 虽未明确输入,但可以显式输入。在任何情况下,编译器都会计算出 `n` 是 `Integer`。如果有多个参数,这些参数将被括在括号中,并用逗号分隔。 + +在本例中,函数体检查一个整数的最低顺序(最右)位是否为零,以表示为偶数。过滤器应返回一个布尔值。尽管可以,但函数的主体中没有显式的 `return`。如果主体没有显式的 `return`,则主体的最后一个表达式是返回值。在这个例子中,主体按照 lambda 编程的思想编写,由一个简单的布尔表达式 `(n & 0x1) == 0` 组成。 + +> `collect` 函数将偶数值收集到引用为 `evens` 的 list 中。如下例所示,`collect` 函数是线程安全的,因此,即使在多个线程之间共享了过滤操作,该函数也可以正常工作。 + +### 方便的功能和轻松实现多线程 + +在生产环境中,数据流的源可能是文件或网络连接。为了学习流 API, Java 提供了诸如 `IntStream` 这样的类型,它可以用各种类型的元素生成流。这里有一个 `IntStream` 的例子: + +``` +IntStream // 整型流 + .range(1, 2048) // 生成此范围内的整型流 + .parallel() // 为多个线程分区数据 + .filter(i -> ((i & 0x1) > 0)) // 奇偶校验 - 只允许奇数通过 + .forEach(System.out::println); // 打印每个值 +``` + +`IntStream` 类型包括一个 `range` 函数,该函数在指定的范围内生成一个整数值流,在本例中,以 1 为增量,从 1 递增到 2,048。`parallel` 函数自动工作划分到多个线程中,在各个线程中进行过滤和打印。(线程数通常与主机系统上的 CPU 数量匹配。)函数 `forEach` 参数是一个_方法引用_,在本例中是对封装在 `System.out` 中的 `println` 方法的引用,方法输出类型为 `PrintStream`。方法和构造器引用的语法将在稍后讨论。 + +由于具有多线程,因此整数值整体上以任意顺序打印,但在给定线程中按顺序打印。例如,如果线程 T1 打印 409 和 411,那么 T1 将按照顺序 409-411 打印,但是其它某个线程可能会预先打印 2,045。`parallel` 调用后面的线程是并发执行的,因此它们的输出顺序是不确定的。 + +### map/reduce 模式 + +_map/reduce_ 模式在处理大型数据集方面已变得很流行。一个 map/reduce 宏操作由两个微操作构成。首先,将数据分散(_mapped_)到各个工作程序中,然后将单独的结果收集在一起 —— 也可能收集统计起来成为一个值,即 _reduction_。Reduction 可以采用不同的形式,如以下示例所示。 + +下面 `Number` 类的实例用 **EVEN** 或 **ODD** 表示有奇偶校验的整数值: + +``` +public class Number { + enum Parity { EVEN, ODD } + private int value; + public Number(int n) { setValue(n); } + public void setValue(int value) { this.value = value; } + public int getValue() { return this.value; } + public Parity getParity() { + return ((value & 0x1) == 0) ? Parity.EVEN : Parity.ODD; + } + public void dump() { + System.out.format("Value: %2d (parity: %s)\n", getValue(), + (getParity() == Parity.ODD ? "odd" : "even")); + } +} +``` + +下面的代码演示了带有 `Number` 流进行 map/reduce 的情形,从而表明流 API 不仅可以处理 `int` 和 `float` 等基本类型,还可以处理程序员自定义的类类型。 + +在下面的代码段中,使用了 `parallelStream` 而不是 `stream` 函数对随机整数值列表进行流化处理。与前面介绍的 `parallel` 函数一样,`parallelStream` 变体也可以自动执行多线程。 + +``` +final int howMany = 200; +Random r = new Random(); +Number[] nums = new Number[howMany]; +for (int i = 0; i < howMany; i++) nums[i] = new Number(r.nextInt(100)); +List listOfNums = Arrays.asList(nums); // 将数组转化为 list + +Integer sum4All = listOfNums + .parallelStream() // 自动执行多线程 + .mapToInt(Number::getValue) // 使用方法引用,而不是 lambda + .sum(); // 将流值计算出和值 +System.out.println("The sum of the randomly generated values is: " + sum4All); +``` + +高阶的 `mapToInt` 函数可以接受一个 lambda 作为参数,但在本例中,它接受一个方法引用,即 `Number::getValue`。`getValue` 方法不需要参数,它返回给定的 `Number` 实例的 `int` 值。语法并不复杂:类名 `Number` 后跟一个双冒号和方法名。回想一下先前的例子 `System.out::println`,它在 `System` 类中的 `static` 属性 `out` 后面有一个双冒号。 + +方法引用 `Number::getValue` 可以用下面的 lambda 表达式替换。参数 `n` 是流中的 `Number` 实例中的之一: + +``` +`mapToInt(n -> n.getValue())` +``` + +通常,lambdas 和方法引用是可互换的:如果像 `mapToInt` 这样的高阶函数可以采用一种形式作为参数,那么这个函数也可以采用另一种形式。这两个函数式编程结构具有相同的目的 —— 对作为参数传入的数据执行一些自定义操作。在两者之间进行选择通常是为了方便。例如,lambda 可以在没有封装类的情况下编写,而方法则不能。。我的习惯是使用 lambda,除非已经有了适当的封装方法。 + +当前示例末尾的 `sum` 函数通过结合来自 `parallelStream` 线程的部分和,以线程安全的方式进行归约。但是,程序员有责任确保在 `parallelStream` 调用引发的多线程过程中,程序员自己的函数调用(在本例中为 `getValue`)是线程安全的。 + +最后一点值得强调。lambda 语法鼓励编写 _纯函数pure function_,即函数的返回值仅取决于传入的参数(如果有);纯函数没有副作用,例如更新类中的 `static` 字段。因此,纯函数是线程安全的,并且如果传递给高阶函数的函数参数(例如 `filter` 和 `map` )是纯函数,则流 API 效果最佳。 + +对于更细粒度的控制,有另一个流 API 函数,名为 `reduce`,可用于对 `Number` 流中的值求和: + +``` +Integer sum4AllHarder = listOfNums + .parallelStream() // 多线程 + .map(Number::getValue) // 每个 Number 的值 + .reduce(0, (sofar, next) -> sofar + next); // 求和 +``` + +此版本的 `reduce` 函数带有两个参数,第二个参数是一个函数: + +> 第一个参数(在这种情况下为零)是 _特征_ 值,该值用作求和操作的初始值,并且在求和过程中流结束时用作默认值。 + +> 第二个参数是 _累加器_,在本例中,这个 lambda 表达式有两个参数:第一个参数(`sofar`)是正在运行的和,第二个参数(`next`)是来自流的下一个值。运行总和以及下一个值相加,然后更新累加器。请记住,由于开始时调用了 `parallelStream`,因此 `map` 和 `reduce` 函数现在都在多线程上下文中执行。 + +在到目前为止的示例中,流值被收集,然后被归并,但是,通常情况下,流 API 中的 `Collectors` 可以累积值,而不需要将它们减少到单个值。正如下一个代码段所示,收集活动可以生成任意丰富的数据结构。该示例使用与前面示例相同的 `listOfNums`: + +``` +Map> numMap = listOfNums + .parallelStream() + .collect(Collectors.groupingBy(Number::getParity)); + +List evens = numMap.get(Number.Parity.EVEN); +List odds = numMap.get(Number.Parity.ODD); +``` + +第一行中的 `numMap` 指的是一个 `Map`,它的键是一个 `Number` 奇偶校验位(**ODD** 或 **EVEN**),其值是一个具有指定奇偶校验位值的 `Number` 实例的`List`。同样,通过 `parallelStream` 调用进行多线程处理,然后 `collect` 调用(以线程安全的方式)将部分结果组装到 `numMap` 引用的 `Map` 中。然后,在 `numMap` 上调用 `get` 方法两次,一次获取 `evens`,第二次获取 `odds`。 + +实用函数 `dumpList` 再次使用来自流 API 的高阶 `forEach` 函数: + +``` +private void dumpList(String msg, List list) { + System.out.println("\n" + msg); + list.stream().forEach(n -> n.dump()); // 或者使用 forEach(Number::dump) +} +``` + +这是示例运行中程序输出的一部分: + +``` +The sum of the randomly generated values is: 3322 +The sum again, using a different method: 3322 + +Evens: + +Value: 72 (parity: even) +Value: 54 (parity: even) +... +Value: 92 (parity: even) + +Odds: + +Value: 35 (parity: odd) +Value: 37 (parity: odd) +... +Value: 41 (parity: odd) +``` + +### 用于代码简化的函数式结构 + +函数式结构(如方法引用和 lambdas)非常适合在流 API 中使用。这些构造代表了 Java 中对高阶函数的主要简化。即使在糟糕的过去,Java 也通过 `Method` 和 `Constructor` 类型在技术上支持高阶函数,这些类型的实例可以作为参数传递给其它函数。由于其复杂性,这些类型在生产级 Java 中很少使用。例如,调用 `Method` 需要对象引用(如果方法是非**静态**的)或至少一个类标识符(如果方法是**静态**的)。然后,被调用的 `Method` 的参数作为**对象**实例传递给它,如果没有发生多态(那会出现另一种复杂性!),则可能需要显式向下转换。相比之下,lambda 和方法引用很容易作为参数传递给其它函数。 + +但是,新的函数式结构在流 API 之外具有其它用途。考虑一个 Java GUI 程序,该程序带有一个供用户按下的按钮,例如,按下以获取当前时间。按钮按下的事件处理程序可能编写如下: + +``` +JButton updateCurrentTime = new JButton("Update current time"); +updateCurrentTime.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + currentTime.setText(new Date().toString()); + } +}); +``` + +这个简短的代码段很难解释。关注第二行,其中方法 `addActionListener` 的参数开始如下: + +``` +`new ActionListener() {` +``` + +这似乎是错误的,因为 `ActionListener` 是一个**抽象**接口,而**抽象**类型不能通过调用 `new` 实例化。但是,事实证明,还有其它一些实例被实例化了:一个实现此接口的未命名内部类。如果上面的代码封装在名为 `OldJava` 的类中,则该未命名的内部类将被编译为 `OldJava$1.class`。`actionPerformed` 方法在这个未命名的内部类中被重写。 + +现在考虑使用新的函数式结构进行这个令人耳目一新的更改: + +``` +`updateCurrentTime.addActionListener(e -> currentTime.setText(new Date().toString()));` +``` + +lambda 表达式中的参数 `e` 是一个 `ActionEvent` 实例,而 lambda 的主体是对按钮上的 `setText` 的简单调用。 + +### 函数式接口和函数组合 + +到目前为止,使用的 lambda 已经写好了。但是,为了方便起见,我们可以像引用封装方法一样引用 lambda 表达式。以下一系列简短示例说明了这一点。 + +考虑以下接口定义: + +``` +@FunctionalInterface // 可选,通常省略 +interface BinaryIntOp { + abstract int compute(int arg1, int arg2); // abstract 声明可以被删除 +} +``` + +注释 `@FunctionalInterface` 适用于声明 _唯一_ 抽象方法的任何接口;在本例中,这个抽象接口是 `compute`。一些标准接口,(例如具有唯一声明方法 `run` 的 `Runnable` 接口)同样符合这个要求。在此示例中,`compute` 是已声明的方法。该接口可用作引用声明中的目标类型: + +``` +BinaryIntOp div = (arg1, arg2) -> arg1 / arg2; +div.compute(12, 3); // 4 +``` + +包 `java.util.function` 提供各种函数式接口。以下是一些示例。 + +下面的代码段介绍了参数化的 `Predicate` 函数式接口。在此示例中,带有参数 `String` 的 `Predicate` 类型可以引用具有 `String` 参数的 lambda 表达式或诸如 `isEmpty` 之类的 `String` 方法。通常情况下,_predicate_ 是一个返回布尔值的函数。 + +``` +Predicate pred = String::isEmpty; // String 方法的 predicate 声明 +String[] strings = {"one", "two", "", "three", "four"}; +Arrays.asList(strings) + .stream() + .filter(pred) // 过滤掉非空字符串 + .forEach(System.out::println); // 只打印空字符串 +``` + +在字符串长度为零的情况下,`isEmpty` predicate 判定结果为 `true`。 因此,只有空字符串才能进入管道的 `forEach` 阶段。 + +下一段代码将演示如何将简单的 lambda 或方法引用组合成更丰富的 lambda 或方法引用。考虑这一系列对 `IntUnaryOperator` 类型的引用的赋值,它接受一个整型参数并返回一个整型值: + +``` +IntUnaryOperator doubled = n -> n * 2; +IntUnaryOperator tripled = n -> n * 3; +IntUnaryOperator squared = n -> n * n; +``` + +`IntUnaryOperator` 是一个 `FunctionalInterface`,其唯一声明的方法为 `applyAsInt`。现在可以单独使用或以各种组合形式使用这三个引用 `doubled`、`tripled` 和 `squared`: + +``` +int arg = 5; +doubled.applyAsInt(arg); // 10 +tripled.applyAsInt(arg); // 15 +squared.applyAsInt(arg); // 25 +``` + +以下是一些函数组合的样例: + +``` +int arg = 5; +doubled.compose(squared).applyAsInt(arg); // 5 求 2 次方后乘 2:50 +tripled.compose(doubled).applyAsInt(arg); // 5 乘 2 后再乘 3:30 +doubled.andThen(squared).applyAsInt(arg); // 5 乘 2 后求 2 次方:100 +squared.andThen(tripled).applyAsInt(arg); // 5 求 2 次方后乘 3:75 +``` + +函数组合可以直接使用 lambda 表达式实现,但是引用使代码更简洁。 + +### 构造器引用 + +构造器引用是另一种函数式编程构造,而这些引用在比 lambda 和方法引用更微妙的上下文中非常有用。再一次重申,代码示例似乎是最好的解释方式。 + +考虑这个 [POJO][13] 类: + +``` +public class BedRocker { // 基岩的居民 + private String name; + public BedRocker(String name) { this.name = name; } + public String getName() { return this.name; } + public void dump() { System.out.println(getName()); } +} +``` + +该类只有一个构造函数,它需要一个 `String` 参数。给定一个名字数组,目标是生成一个 `BedRocker` 元素数组,每个名字代表一个元素。下面是使用了函数式结构的代码段: + +``` +String[] names = {"Fred", "Wilma", "Peebles", "Dino", "Baby Puss"}; + +Stream bedrockers = Arrays.asList(names).stream().map(BedRocker::new); +BedRocker[] arrayBR = bedrockers.toArray(BedRocker[]::new); + +Arrays.asList(arrayBR).stream().forEach(BedRocker::dump); +``` + +在较高的层次上,这个代码段将名字转换为 `BedRocker` 数组元素。具体来说,代码如下所示。`Stream` 接口(在包 `java.util.stream` 中)可以被参数化,而在本例中,生成了一个名为 `bedrockers` 的 `BedRocker` 流。 + +`Arrays.asList` 实用程序再次用于流化一个数组 `names`,然后将流的每一项传递给 `map` 函数,该函数的参数现在是构造器引用 `BedRocker::new`。这个构造器引用通过在每次调用时生成和初始化一个 `BedRocker` 实例来充当一个对象工厂。在第二行执行之后,名为 `bedrockers` 的流由五项 `BedRocker` 组成。 + +这个例子可以通过关注高阶 `map` 函数来进一步阐明。在通常情况下,一个映射将一个类型的值(例如,一个 `int`)转换为另一个 _相同_ 类型的值(例如,一个整数的后继): + +``` +map(n -> n + 1) // 将 n 映射到其后继 +``` + +然而,在 `BedRocker` 这个例子中,转换更加戏剧化,因为一个类型的值(代表一个名字的 `String`)被映射到一个 _不同_ 类型的值,在这个例子中,就是一个 `BedRocker` 实例,这个字符串就是它的名字。转换是通过一个构造器调用来完成的,它是由构造器引用来实现的: + +``` +`map(BedRocker::new) // 将 String 映射到 BedRocker +``` + +传递给构造器的值是 `names` 数组中的其中一项。 + +此代码示例的第二行还演示了一个你目前已经非常熟悉的转换:先将数组先转换成 `List`,然后再转换成 `Stream`: + +``` +`Stream bedrockers = Arrays.asList(names).stream().map(BedRocker::new);` +``` + +第三行则是另一种方式 —— 流 `bedrockers` 通过使用_数组_构造器引用 `BedRocker[]::new` 调用 `toArray` 方法: + +``` +`BedRocker[ ] arrayBR = bedrockers.toArray(BedRocker[]::new);` +``` + +该构造器引用不会创建单个 `BedRocker` 实例,而是创建这些实例的整个数组:该构造器引用现在为 `BedRocker[]:new`,而不是 `BedRocker::new`。为了进行确认,将 `arrayBR` 转换为 `List`,再次对其进行流式处理,以便可以使用 `forEach` 来打印 `BedRocker` 的名字。 + +``` +Fred +Wilma +Peebles +Dino +Baby Puss +``` + +该示例对数据结构的微妙转换仅用几行代码即可完成,从而突出了可以将 lambda,方法引用或构造器引用作为参数的各种高阶函数的功能。 + +### 柯里化Currying + +_柯里化_ 函数是指减少函数执行任何工作所需的显式参数的数量(通常减少到一个)。(该术语是为了纪念逻辑学家 Haskell Curry。)一般来说,函数的参数越少,调用起来就越容易,也更健壮。(回想一下一些需要半打左右参数的噩梦般的函数!)因此,应将柯里化视为简化函数调用的一种尝试。`java.util.function` 包中的接口类型适合于柯里化,如以下示例所示。 + +引用的 `IntBinaryOperator` 接口类型是为函数接受两个整型参数,并返回一个整型值: + +``` +IntBinaryOperator mult2 = (n1, n2) -> n1 * n2; +mult2.applyAsInt(10, 20); // 200 +mult2.applyAsInt(10, 30); // 300 +``` + +引用 `mult2` 强调了需要两个显式参数,在本例中是 10 和 20。 + +前面介绍的 `IntUnaryOperator` 比 `IntBinaryOperator` 简单,因为前者只需要一个参数,而后者则需要两个参数。两者均返回整数值。因此,目标是将名为 `mult2` 的两个参数 `IntBinraryOperator` 柯里化成一个单一的 `IntUnaryOperator` 版本 `curriedMult2`。 + +考虑 `IntFunction` 类型。此类型的函数采用整型参数,并返回类型为 `R` 的结果,该结果可以是另一个函数 —— 更准确地说,是 `IntBinaryOperator`。让一个 lambda 返回另一个 lambda 很简单: + +``` +arg1 -> (arg2 -> arg1 * arg2) // 括号可以省略 +``` + +完整的 lambda 以 `arg1,` 开头,而该 lambda 的主体以及返回的值是另一个以 `arg2` 开头的 lambda。返回的 lambda 仅接受一个参数(`arg2`),但返回了两个数字的乘积(`arg1` 和 `arg2`)。下面的概述,再加上代码,应该可以更好地进行说明。 + +以下是如何柯里化 `mult2` 的概述: + +> 类型为 `IntFunction` 的 lambda 被写入并调用,其整型值为 10。返回的 `IntUnaryOperator` 缓存了值 10,因此变成了已柯里化版本的 `mult2`,在本例中为 `curriedMult2`。 + +> 然后使用单个显式参数(例如,20)调用 `curriedMult2` 函数,该参数与缓存的参数(在本例中为 10)相乘以生成返回的乘积。。 + +这是代码的详细信息: + +``` +// 创建一个接受一个参数 n1 并返回一个单参数 n2 -> n1 * n2 的函数,该函数返回一个(n1 * n2 乘积的)整型数。 +IntFunction curriedMult2Maker = n1 -> (n2 -> n1 * n2); +``` + +调用 `curriedMult2Maker` 生成所需的 `IntUnaryOperator` 函数: + +``` +// 使用 curriedMult2Maker 获取已柯里化版本的 mult2。 +// 参数 10 是上面的 lambda 的 n1。 +IntUnaryOperator curriedMult2 = curriedMult2Maker2.apply(10); +``` + +值 10 现在缓存在 `curriedMult2` 函数中,以便 `curriedMult2` 调用中的显式整型参数乘以 10: + +``` +curriedMult2.applyAsInt(20); // 200 = 10 * 20 +curriedMult2.applyAsInt(80); // 800 = 10 * 80 +``` + +缓存的值可以随意更改: + +``` +curriedMult2 = curriedMult2Maker.apply(50); // 缓存 50 +curriedMult2.applyAsInt(101); // 5050 = 101 * 50 +``` + +当然,可以通过这种方式创建多个已柯里化版本的 `mult2`,每个版本都有一个 `IntUnaryOperator`。 + +柯里化充分利用了 lambda 的强大功能:可以很容易地编写 lambda 表达式来返回需要的任何类型的值,包括另一个 lambda。 + +### 总结 + +Java 仍然是基于类的面向对象的编程语言。但是,借助流 API 及其支持的函数式构造,Java 向函数式语言(例如 Lisp)迈出了决定性的(同时也是受欢迎的)一步。结果是 Java 更适合处理现代编程中常见的海量数据流。在函数式方向上的这一步还使以在前面的代码示例中突出显示的管道的方式编写清晰简洁的 Java 代码更加容易: + +``` +dataStream + .parallelStream() // 多线程以提高效率 + .filter(...) // 阶段 1 + .map(...) // 阶段 2 + .filter(...) // 阶段 3 + ... + .collect(...); // 或者,也可以进行归约:阶段 N +``` + +自动多线程,以 `parallel` 和 `parallelStream` 调用为例,建立在 Java 的 fork/join 框架上,该框架支持 _任务窃取task stealing_ 以提高效率。假设 `parallelStream` 调用后面的线程池由八个线程组成,并且 `dataStream` 被八种方式分区。某个线程(例如,T1)可能比另一个线程(例如,T7)工作更快,这意味着应该将 T7 的某些任务移到 T1 的工作队列中。这会在运行时自动发生。 + +在这个简单的多线程世界中,程序员的主要职责是编写线程安全函数,这些函数作为参数传递给在流 API 中占主导地位的高阶函数。 尤其是 lambda 鼓励编写纯函数(因此是线程安全的)函数。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/javastream + +作者:[Marty Kalin][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mkalindepauledu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/features_solutions_command_data.png?itok=4_VQN3RK (computer screen ) +[2]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random +[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+list +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+number +[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+arrays +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+jbutton +[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionlistener +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent +[12]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+date +[13]: https://en.wikipedia.org/wiki/Plain_old_Java_object From 7bc0bcc843a69e71c8f674ddc7e9fac71e0b08c2 Mon Sep 17 00:00:00 2001 From: laingke Date: Wed, 29 Jan 2020 17:38:57 +0800 Subject: [PATCH 0467/3057] =?UTF-8?q?20200122-article-11830-1=20=E9=94=99?= =?UTF-8?q?=E5=AD=97=E4=BF=AE=E6=94=B9=EF=BC=8C=E2=80=9C=E5=87=BA=E2=80=9D?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E2=80=9C=E5=A4=84=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ng up passwordless Linux logins using public-private keys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20200122 Setting up passwordless Linux logins using public-private keys.md b/published/20200122 Setting up passwordless Linux logins using public-private keys.md index 89f54a6b45..711473cdfa 100644 --- a/published/20200122 Setting up passwordless Linux logins using public-private keys.md +++ b/published/20200122 Setting up passwordless Linux logins using public-private keys.md @@ -34,7 +34,7 @@ boss$ ``` -如果你还没有在 boss 系统上为你的帐户设置公钥/私钥对,请使用如下所示的命令创建一个密钥对。注意,你可以在各种加密算法之间进行选择。(一般使用 RSA 或 DSA。)注意,要在不输入密码的情况下访问系统,你需要在下面的对话框中的两个提示符出不输入密码。 +如果你还没有在 boss 系统上为你的帐户设置公钥/私钥对,请使用如下所示的命令创建一个密钥对。注意,你可以在各种加密算法之间进行选择。(一般使用 RSA 或 DSA。)注意,要在不输入密码的情况下访问系统,你需要在下面的对话框中的两个提示符处不输入密码。 如果你已经有一个与此帐户关联的公钥/私钥对,请跳过此步骤。 From d65ff790f026ab0a6fc2a5be931284bd643c7344 Mon Sep 17 00:00:00 2001 From: laingke Date: Wed, 29 Jan 2020 17:53:42 +0800 Subject: [PATCH 0468/3057] =?UTF-8?q?Revert=20"20200122-article-11830-1=20?= =?UTF-8?q?=E9=94=99=E5=AD=97=E4=BF=AE=E6=94=B9=EF=BC=8C=E2=80=9C=E5=87=BA?= =?UTF-8?q?=E2=80=9D=E6=94=B9=E4=B8=BA=E2=80=9C=E5=A4=84=E2=80=9D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 7bc0bcc --- ...ng up passwordless Linux logins using public-private keys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20200122 Setting up passwordless Linux logins using public-private keys.md b/published/20200122 Setting up passwordless Linux logins using public-private keys.md index 711473cdfa..89f54a6b45 100644 --- a/published/20200122 Setting up passwordless Linux logins using public-private keys.md +++ b/published/20200122 Setting up passwordless Linux logins using public-private keys.md @@ -34,7 +34,7 @@ boss$ ``` -如果你还没有在 boss 系统上为你的帐户设置公钥/私钥对,请使用如下所示的命令创建一个密钥对。注意,你可以在各种加密算法之间进行选择。(一般使用 RSA 或 DSA。)注意,要在不输入密码的情况下访问系统,你需要在下面的对话框中的两个提示符处不输入密码。 +如果你还没有在 boss 系统上为你的帐户设置公钥/私钥对,请使用如下所示的命令创建一个密钥对。注意,你可以在各种加密算法之间进行选择。(一般使用 RSA 或 DSA。)注意,要在不输入密码的情况下访问系统,你需要在下面的对话框中的两个提示符出不输入密码。 如果你已经有一个与此帐户关联的公钥/私钥对,请跳过此步骤。 From d59e7c5e9f2219478ab34e3f27fb30a088c16380 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Wed, 29 Jan 2020 18:56:34 +0800 Subject: [PATCH 0469/3057] translated --- ...117 Use this Python script to find bugs in your Overcloud.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md index 7ee1142f8e..c6e7d17955 100644 --- a/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md +++ b/translated/tech/20200117 Use this Python script to find bugs in your Overcloud.md @@ -41,7 +41,6 @@ LogTool 可以即时检测两种日志文件:标准和非标准。在标准文 * **统计信息 - 每个非标准日志文件在任意时间的唯一消息:** 此部分包含非标准日志文件中的唯一消息。遗憾的是,LogTool 无法像标准日志文件那样的处理方式处理这些日志文件。因此,在你提取“特定时间”的日志信息时会被忽略,你会看到过去创建的所有唯一的错误/警告消息。因此,首先,向下滚动到结果文件底部的目录并查看其部分-使用目录中的行索引跳到相关部分,其中第3、4和5行的信息最重要。 - #### 2\. 从 Overcloud 节点下载所有日志 所有 Overcloud 节点的日志将被压缩并下载到 Undercloud 主机上的本地目录。 @@ -170,6 +169,7 @@ via: https://opensource.com/article/20/1/logtool-root-cause-identification 译者:[Morisun029](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) + 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/ashtempl From 4b57bf886d56c28a3a99d3f66bf8885814fa4ed4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 29 Jan 2020 21:38:33 +0800 Subject: [PATCH 0470/3057] PRF @alim0x --- ... Linux story- Learning Linux in the 90s.md | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md b/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md index ea0847761d..8830fa539f 100644 --- a/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md +++ b/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (alim0x) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (My Linux story: Learning Linux in the 90s) @@ -9,34 +9,36 @@ 我的 Linux 故事:在 90 年代学习 Linux ====== -这是一个关于我如何在 WiFi 时代之前学习 Linux 的故事,那时的发行版还以 CD 的形式出现。 -![Sky with clouds and grass][1] + +> 这是一个关于我如何在 WiFi 时代之前学习 Linux 的故事,那时的发行版还以 CD 的形式出现。 + +![](https://img.linux.net.cn/data/attachment/album/202001/29/213829t00wmwu2w0z502zg.jpg) 大部分人可能不记得 1996 年时计算产业或日常生活世界的样子。但我很清楚地记得那一年。我那时候是堪萨斯中部一所高中的二年级学生,那是我的自由与开源软件(FOSS)旅程的开端。 -我从这里开始进步。我在 1996 年之前就开始对计算机感兴趣。我出生并成长于我家的第一台 Apple ][e,然后多年之后是 IBM Personal System/2。(是的,在这过程中有一些代际的跨越。)IBM PS/2 有一个非常激动人心的特性:一个 1200 波特的 Hayes 调制解调器。 +我从这里开始进步。我在 1996 年之前就开始对计算机感兴趣。我在我家的第一台 Apple ][e 上启蒙成长,然后多年之后是 IBM Personal System/2。(是的,在这过程中有一些代际的跨越。)IBM PS/2 有一个非常激动人心的特性:一个 1200 波特的 Hayes 调制解调器。 我不记得是怎样了,但在那不久之前,我得到了一个本地 [BBS][2] 的电话号码。一旦我拨号进去,我可以得到本地的一些其他 BBS 的列表,我的网络探险就此开始了。 -在 1995 年,[足够幸运][3]的人拥有了家庭互联网连接,每月可以使用不到 30 分钟。这个互联网不像我们现代的服务那样,通过卫星、光纤、有线电视同轴电缆或任何版本的铜线提供。大多数家庭通过一个调制解调器拨号,它连接到他们的电话线上。(这时离移动电话无处不在的时代还早得很,大多数人只有一部家庭电话。)尽管这还要取决你所在的位置,但我不认为那时有很多独立的互联网服务提供商(ISP),所以大多数人从仅有的几家大公司获得服务,包括 America Online,CompuServe 以及 Prodigy。 +在 1995 年,[足够幸运][3]的人拥有了家庭互联网连接,每月可以使用不到 30 分钟。那时的互联网不像我们现代的服务那样,通过卫星、光纤、有线电视同轴电缆或任何版本的铜线提供。大多数家庭通过一个调制解调器拨号,它连接到他们的电话线上。(这时离移动电话无处不在的时代还早得很,大多数人只有一部家庭电话。)尽管这还要取决你所在的位置,但我不认为那时有很多独立的互联网服务提供商(ISP),所以大多数人从仅有的几家大公司获得服务,包括 America Online,CompuServe 以及 Prodigy。 -你获取到的服务速率非常低,甚至在拨号上网演变的顶峰 56K,你也只能期望得到最高 3.5Kbps 的速率。如果你想要尝试 Linux,下载一个 200MB 到 800MB 的 ISO 镜像或(更加切合实际的)磁盘镜像要贡献出时间,决心,以及面临电话不可用的情形。 +你能获取到的服务速率非常低,甚至在拨号上网革命性地达到了顶峰的 56K,你也只能期望得到最高 3.5Kbps 的速率。如果你想要尝试 Linux,下载一个 200MB 到 800MB 的 ISO 镜像或(更加切合实际的)一套软盘镜像要贡献出时间、决心,以及减少电话的使用。 -我走了一条简单一点的路:在 1996 年,我从一家主要的 Linux 分发商订购了一套“tri-Linux”CD。这些光盘提供了三个发行版,我的这套包含了 Debian 1.1 (Debian 的第一个稳定版本),Red Hat Linux 3.0.3 以及 Slackware 3.1(代号 Slackware '96)。据我回忆,这些光盘是从一家叫做 [Linux Systems Labs][4] 的在线商店购买的。这家在线商店如今已经不存在了,但在 90 年代和 00 年代早期,这样的分发商很常见。对于多光盘 Linux 套件也是如此。这是 1998 年的一套光盘,你可以了解到他们都包含了什么: +我走了一条简单一点的路:在 1996 年,我从一家主要的 Linux 发行商订购了一套 “tri-Linux” CD 集。这些光盘提供了三个发行版,我的这套包含了 Debian 1.1(Debian 的第一个稳定版本)、Red Hat Linux 3.0.3 以及 Slackware 3.1(代号 Slackware '96)。据我回忆,这些光盘是从一家叫做 [Linux Systems Labs][4] 的在线商店购买的。这家在线商店如今已经不存在了,但在 90 年代和 00 年代早期,这样的发行商很常见。这些是多光盘 Linux 套件。这是 1998 年的一套光盘,你可以了解到他们都包含了什么: ![A tri-linux CD set][5] ![A tri-linux CD set][6] -在 1996 年夏天一个命中注定般的日子,那时我住在堪萨斯一个新的并且相对较为乡村的城市,我做出了安装并使用 Linux 的第一次尝试。在 1996 年的整个夏天,我尝试了那套三 Linux CD 套件里的全部三个发行版。他们都在我母亲的老 Pentium 75MHz 电脑上完美运行。 +在 1996 年夏天一个命中注定般的日子,那时我住在堪萨斯一个新的并且相对较为乡村的城市,我做出了安装并使用 Linux 的第一次尝试。在 1996 年的整个夏天,我尝试了那套三张 Linux CD 套件里的全部三个发行版。他们都在我母亲的老 Pentium 75MHz 电脑上完美运行。 -我最终选择了 [Slackware][7] 3.1 作为我喜欢的发行版,相比其他发行版可能更多的是因为它的终端的外观,这是决定选择一个发行版前需要考虑的重要因素。 +我最终选择了 [Slackware][7] 3.1 作为我的首选发行版,相比其它发行版可能更多的是因为它的终端的外观,这是决定选择一个发行版前需要考虑的重要因素。 -我将系统设置完毕并运行了起来。我连接到一家“杂牌”ISP(一家这个区域的本地服务商),通过我家的第二条电话线拨号(为了满足我的所有互联网使用而订购)。那就像在天堂一样。我有一台完美运行的双系统(Microsoft Windows 95 和 Slackware 3.1)电脑。我依然拨号进入我所知道和喜爱的 BBS,游玩在线 BBS 游戏,比如 Trade Wars,Usurper 以及 Legend of the Red Dragon。 +我将系统设置完毕并运行了起来。我连接到一家 “不太知名的” ISP(一家这个区域的本地服务商),通过我家的第二条电话线拨号(为了满足我的所有互联网使用而订购)。那就像在天堂一样。我有一台完美运行的双系统(Microsoft Windows 95 和 Slackware 3.1)电脑。我依然拨号进入我所知道和喜爱的 BBS,游玩在线 BBS 游戏,比如 Trade Wars、Usurper 以及 Legend of the Red Dragon。 -我能够记得花在 EFNet(IRC)上 #Linux 频道的一天天时光,帮助其他用户,回答他们的 Linux 问题以及和审核人员互动。 +我能够记得在 EFNet(IRC)上 #Linux 频道上渡过的日子,帮助其他用户,回答他们的 Linux 问题以及和版主们互动。 -在我第一次在家尝试使用 Linux 系统的 20 多年后,我现在正进入作为 Red Hat 顾问的第五年,仍然在使用 Linux(现在是 Fedora)作为我的日常系统,并且依然在 IRC 上帮助想要使用 Linux 的人们。 +在我第一次在家尝试使用 Linux 系统的 20 多年后,已经是我进入作为 Red Hat 顾问的第五年,我仍然在使用 Linux(现在是 Fedora)作为我的日常系统,并且依然在 IRC 上帮助想要使用 Linux 的人们。 -------------------------------------------------------------------------------- @@ -45,7 +47,7 @@ via: https://opensource.com/article/19/11/learning-linux-90s 作者:[Mike Harris][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 0215d826b928946a8858d2c0dab357c15a6e4e51 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 29 Jan 2020 21:39:53 +0800 Subject: [PATCH 0471/3057] PUB @alim0x https://linux.cn/article-11831-1.html --- .../20191108 My Linux story- Learning Linux in the 90s.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md b/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md index 8830fa539f..f31ae62e4f 100644 --- a/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md +++ b/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (alim0x) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11831-1.html) [#]: subject: (My Linux story: Learning Linux in the 90s) [#]: via: (https://opensource.com/article/19/11/learning-linux-90s) [#]: author: (Mike Harris https://opensource.com/users/mharris) From 3ae890212279cb49123cce302545eecc68845b23 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 30 Jan 2020 00:53:05 +0800 Subject: [PATCH 0472/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=204=20?= =?UTF-8?q?cool=20new=20projects=20to=20try=20in=20COPR=20for=20January=20?= =?UTF-8?q?2020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200129 4 cool new projects to try in COPR for January 2020.md --- ...rojects to try in COPR for January 2020.md | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 sources/tech/20200129 4 cool new projects to try in COPR for January 2020.md diff --git a/sources/tech/20200129 4 cool new projects to try in COPR for January 2020.md b/sources/tech/20200129 4 cool new projects to try in COPR for January 2020.md new file mode 100644 index 0000000000..58a64cdc70 --- /dev/null +++ b/sources/tech/20200129 4 cool new projects to try in COPR for January 2020.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for January 2020) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-january-2020/) +[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) + +4 cool new projects to try in COPR for January 2020 +====== + +![][1] + +COPR is a [collection][2] 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. + +This article presents a few new and interesting projects in COPR. If you’re new to using COPR, see the [COPR User Documentation][3] for how to get started. + +### Contrast + +[Contrast][4] is a small app used for checking contrast between two colors and to determine if it meets the requirements specified in [WCAG][5]. The colors can be selected either using their RGB hex codes or with a color picker tool. In addition to showing the contrast ratio, Contrast displays a short text on a background in selected colors to demonstrate comparison. + +![][6] + +#### Installation instructions + +The [repo][7] currently provides contrast for Fedora 31 and Rawhide. To install Contrast, use these commands: + +``` +sudo dnf copr enable atim/contrast +sudo dnf install contrast +``` + +### Pamixer + +[Pamixer][8] is a command-line tool for adjusting and monitoring volume levels of sound devices using PulseAudio. You can display the current volume of a device and either set it directly or increase/decrease it, or (un)mute it. Pamixer can list all sources and sinks. + +#### Installation instructions + +The [repo][9] currently provides Pamixer for Fedora 31 and Rawhide. To install Pamixer, use these commands: + +``` +sudo dnf copr enable opuk/pamixer +sudo dnf install pamixer +``` + +### PhotoFlare + +[PhotoFlare][10] is an image editor. It has a simple and well-arranged user interface, where most of the features are available in the toolbars. PhotoFlare provides features such as various color adjustments, image transformations, filters, brushes and automatic cropping, although it doesn’t support working with layers. Also, PhotoFlare can edit pictures in batches, applying the same filters and transformations on all pictures and storing the results in a specified directory. + +![][11] + +#### Installation instructions + +The [repo][12] currently provides PhotoFlare for Fedora 31. To install Photoflare, use these commands: + +``` +sudo dnf copr enable adriend/photoflare +sudo dnf install photoflare +``` + +### Tdiff + +[Tdiff][13] is a command-line tool for comparing two file trees. In addition to showing that some files or directories exist in one tree only, tdiff shows differences in file sizes, types and contents, owner user and group ids, permissions, modification time and more. + +#### Installation instructions + +The [repo][14] currently provides tdiff for Fedora 29-31 and Rawhide, EPEL 6-8 and other distributions. To install tdiff, use these commands: + +``` +sudo dnf copr enable fif/tdiff +sudo dnf install tdiff +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-january-2020/ + +作者:[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/author/dturecek/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://docs.pagure.org/copr.copr/user_documentation.html# +[4]: https://gitlab.gnome.org/World/design/contrast +[5]: https://www.w3.org/WAI/standards-guidelines/wcag/ +[6]: https://fedoramagazine.org/wp-content/uploads/2020/01/contrast-screenshot.png +[7]: https://copr.fedorainfracloud.org/coprs/atim/contrast/ +[8]: https://github.com/cdemoulins/pamixer +[9]: https://copr.fedorainfracloud.org/coprs/opuk/pamixer/ +[10]: https://photoflare.io/ +[11]: https://fedoramagazine.org/wp-content/uploads/2020/01/photoflare-screenshot.png +[12]: https://copr.fedorainfracloud.org/coprs/adriend/photoflare/ +[13]: https://github.com/F-i-f/tdiff +[14]: https://copr.fedorainfracloud.org/coprs/fif/tdiff/ From 341610abc18f8596276da09f3491a4d52d9bacaf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 30 Jan 2020 00:57:30 +0800 Subject: [PATCH 0473/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200130=20Meet?= =?UTF-8?q?=20FuryBSD:=20A=20New=20Desktop=20BSD=20Distribution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md --- ...FuryBSD- A New Desktop BSD Distribution.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md diff --git a/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md b/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md new file mode 100644 index 0000000000..eee1d27f9c --- /dev/null +++ b/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Meet FuryBSD: A New Desktop BSD Distribution) +[#]: via: (https://itsfoss.com/furybsd/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Meet FuryBSD: A New Desktop BSD Distribution +====== + +In the last couple of months, a few new desktop BSD have been announced. There is [HyperbolaBSD which was Hyperbola GNU/Linux][1] previously. Another new entry in the [BSD][2] world is [FuryBSD][3]. + +### FuryBSD: A new BSD distribution + +![][4] + +At its heart, FuryBSD is a very simple beast. According to [the site][5], “FuryBSD is a back to basics lightweight desktop distribution based on stock FreeBSD.” It is basically FreeBSD with a desktop environment pre-configured and several apps preinstalled. The goal is to quickly get a FreeBSD-based system running on your computer. + +You might be thinking that this sounds a lot like a couple of other BSDs that are available, such as [NomadBSD][6] and [GhostBSD][7]. The major difference between those BSDs and FuryBSD is that FuryBSD is much closer to stock FreeBSD. For example, FuryBSD uses the FreeBSD installer, while others have created their own installers and utilities. + +As it states on the [site][8], “Although FuryBSD may resemble past graphical BSD projects like PC-BSD and TrueOS, FuryBSD is created by a different team and takes a different approach focusing on tight integration with FreeBSD. This keeps overhead low and maintains compatibility with upstream.” The lead dev also told me that “One key focus for FuryBSD is for it to be a small live media with a few assistive tools to test drivers for hardware.” + +Currently, you can go to the [FuryBSD homepage][3] and download either an XFCE or KDE LiveCD. A GNOME version is in the works. + +### Who’s is Behind FuryBSD? + +The lead dev behind FuryBSD is [Joe Maloney][9]. Joe has been a FreeBSD user for many years. He contributed to other BSD projects, such as PC-BSD. He also worked with Eric Turgeon, the creator of GhostBSD, to rewrite the GhostBSD LiveCD. Along the way, he picked up a better understanding of BSD and started to form an idea of how he would make a distribution on his own. + +Joe is joined by several other devs who have also spent many years in the BSD world, such as Jaron Parsons, Josh Smith, and Damian Szidiropulosz. + +### The Future for FuryBSD + +At the moment, FuryBSD is nothing more than a pre-configured FreeBSD setup. However, the devs have a [list of improvements][5] that they want to make going forward. These include: + + * A sane framework for loading, 3rd party proprietary drivers graphics, wireless + * Cleanup up the LiveCD experience a bit more to continue to make it more friendly + * Printing support out of box + * A few more default applications included to provide a complete desktop experience + * Integrated [ZFS][10] replication tools for backup and restore + * Live image persistence options + * A custom pkg repo with sane defaults + * Continuous integration for applications updates + * Quality assurance for FreeBSD on the desktop + * Tailored artwork, color scheming, and theming + * Directory services integration + * Security hardening + + + +The devs make it quite clear that any changes they make will have a lot of thought and research behind them. They don’t want to compliment a feature, only to have to remove it or change it when it breaks something. + +![FuryBSD desktop][11] + +### How You Can Help FuryBSD? + +At this moment the project is still very young. Since all projects need help to survive, I asked Joe what kind of help they were looking for. He said, “We could use help [answering questions on the forums][12], [GitHub][13] tickets, help with documentation are all needed.” He also said that if people wanted to add support for other desktop environments, pull requests are welcome. + +### Final Thoughts + +Although I have not tried it yet, I have a good feeling about FuryBSD. It sounds like the project is in capable hands. Joe Maloney has been thinking about how to make the best BSD desktop experience for over a decade. Unlike majority of Linux distros that are basically a rethemed Ubuntu, the devs behind FuryBSD know what they are doing and they are choosing quality over the fancy bells and whistles. + +What are your thoughts on this new entry into the every growing desktop BSD market? Have you tried out FuryBSD or will you give it a try? 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][14]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/furybsd/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/hyperbola-linux-bsd/ +[2]: https://itsfoss.com/bsd/ +[3]: https://www.furybsd.org/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/fury-bsd.jpg?ssl=1 +[5]: https://www.furybsd.org/manifesto/ +[6]: https://itsfoss.com/nomadbsd/ +[7]: https://ghostbsd.org/ +[8]: https://www.furybsd.org/furybsd-video-overview-at-knoxbug/ +[9]: https://github.com/pkgdemon +[10]: https://itsfoss.com/what-is-zfs/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/FuryBSDS-desktop.jpg?resize=800%2C450&ssl=1 +[12]: https://forums.furybsd.org/ +[13]: https://github.com/furybsd +[14]: https://reddit.com/r/linuxusersgroup From c9371d2cdcddb60c762d76b8c4025b86345528b1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 30 Jan 2020 00:58:17 +0800 Subject: [PATCH 0474/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=203=20?= =?UTF-8?q?lessons=20I've=20learned=20writing=20Ansible=20playbooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200129 3 lessons I-ve learned writing Ansible playbooks.md --- ... I-ve learned writing Ansible playbooks.md | 221 ++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 sources/tech/20200129 3 lessons I-ve learned writing Ansible playbooks.md diff --git a/sources/tech/20200129 3 lessons I-ve learned writing Ansible playbooks.md b/sources/tech/20200129 3 lessons I-ve learned writing Ansible playbooks.md new file mode 100644 index 0000000000..a2cfe25265 --- /dev/null +++ b/sources/tech/20200129 3 lessons I-ve learned writing Ansible playbooks.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 lessons I've learned writing Ansible playbooks) +[#]: via: (https://opensource.com/article/20/1/ansible-playbooks-lessons) +[#]: author: (Jeff Geerling https://opensource.com/users/geerlingguy) + +3 lessons I've learned writing Ansible playbooks +====== +Avoid common pitfalls and supercharge your Ansible playbook maintenance +by following these best practices. +![plastic game pieces on a board][1] + +I've used Ansible since 2013 and maintain some of my original playbooks to this day. They have evolved with Ansible from version 1.4 to the current version (as of this writing, 2.9). + +Along the way, as Ansible grew from having dozens to hundreds and now thousands of modules, I've learned a lot about how to make sure my playbooks are maintainable and scalable as my systems grow. Even for simple projects (like the [playbook I use to manage my own laptop][2]), it pays dividends to avoid common pitfalls and make decisions that will make the future you thankful instead of regretful. + +The three main takeaways from this experience are: + + 1. Stay organized + 2. Test early and often + 3. Simplify, optimize + + + +The importance of each lesson I've learned follows in that order, too; it's no use trying to optimize something (point 3) that's already poorly assembled (point 1). Each step builds on the one above, so I'll guide you through each step. + +### Stay organized + +![Organized bins of equipment][3] + +At a bare minimum, you should **store your Ansible playbooks in a Git repository**. This helps with so many things: + + 1. Once you have a known working state, you can commit the work (ideally, with tags marking major versions, like 1.0.0 for the first stable version and 2.0.0 for an upgrade or rewrite). + 2. You can always walk back changes if necessary to a previous known-working state (e.g., by using `git reset` or `git checkout `). + 3. Large-scale changes (e.g., feature additions or a major upgrade) can be worked on in a branch, so you can still maintain the existing playbook and have adequate time to work on major changes. + + + +Storing playbooks in Git also helps with the second important organization technique: **run your playbooks from a build server**. + +Whether you use [Ansible Tower][4], [Jenkins][5], or some other build system, using a central interface for playbook runs gives you consistency and stability—you don't risk having one admin run a playbook one way (e.g., with the wrong version of roles or an old checkout) and someone else running it another way, breaking your servers. + +It also helps because it forces you to ensure all your playbook's resources are encapsulated in the playbook's repository and build configuration. Ideally, the entire build (including the job configuration) would be captured in the repository (e.g., through the use of a `Jenkinsfile` or its equivalent). + +Another important aspect to organization is **documentation**; at a bare minimum, I have a README in every playbook repository with the following contents: + + * The playbook's purpose + * Links to relevant resources (CI build status, external documentation, issue tracking, primary contacts) + * Instructions for local testing and development + + + +Even if you have the playbook automated through a build server, it is important to have thorough and correct documentation for how to run the playbook otherwise (e.g., locally in a test environment). I like to make sure my projects are easily approachable—not only for others who might eventually need to work with them but also myself! I often forget a nuance or dependency when running a playbook, and the README is the perfect place to outline any peculiarities. + +Finally, the _structure_ of the Ansible tasks themselves are important, and I like to ensure I have a maintainable structure by having **small, readable task files** and by extracting related sets of tasks into **Ansible roles**. + +Generally, if an individual playbook reaches around 100 lines of YAML, I'll start breaking it up into separate task files and using `include_tasks` to include those files. If I find a set of tasks that operates independently and could be broken out into its own [Ansible role][6], I'll work on extracting those tasks and related handlers, variables, and templates. + +Using roles is the best way to supercharge Ansible playbook maintenance; I often have to do similar tasks in many (if not most) playbooks, like managing user accounts or installing and configuring a web server or database. Abstracting these tasks into Ansible roles means I can maintain one set of tasks to be used among many playbooks, with variables to give flexibility where needed. + +Ansible roles can also be contributed back to the community via [Ansible Galaxy][7] if you're able to make them generic and provide the code with an open source license. I have contributed over a hundred roles to Galaxy, and they are made better by the fact that thousands of other playbooks (besides my own) rely on them and break if there is a bug in the role. + +One final note on roles: If you choose to use external roles (either from Galaxy or a private Git repository), I recommend committing the role to your repository (instead of adding it to a `.gitignore` file and downloading the role every time you run your playbook) because I like to avoid relying on downloads from Ansible Galaxy for every playbook run. You should still use a `requirements.yml` file to define role dependencies and define specific versions for the roles so you can choose when to upgrade your dependencies. + +### Test early and often + +![A stack of computer boards][8] + +Ansible allows you to define infrastructure as code. And like any software, it is essential to be able to verify that the code you write does what you expect. + +Like any software, it's best to _test_ your Ansible playbooks. And when I consider testing for any individual Ansible project I build, I think of a spectrum of CI testing options I can use, going in order from the easiest to hardest to implement: + + 1. `yamllint` + 2. `ansible-playbook --syntax-check` + 3. `ansible-lint` + 4. [Molecule test][9] (integration tests) + 5. `ansible-playbook --check` (testing against production) + 6. Building parallel infrastructure + + + +The first three options (linting and running a syntax check on your playbook) are essentially free; they run very fast and can help you avoid the most common problems with your playbook's task structure and formatting. + +They provide some value, but unless the playbook is extremely simple, I like to go beyond basic linting and run tests using [Molecule][9]. I usually use Molecule's built-in Docker integration to run my playbook against a local Docker instance running the same base OS as my production server. For some of my roles, which I run on different Linux distributions (e.g., CentOS and Debian), I run the Molecule test playbook once for each distro—and sometimes with extra test scenarios for more complex roles. + +If you're interested in learning how to test roles with Molecule, I wrote a blog post on the topic a couple of years ago called [Testing your Ansible roles with Molecule][10]. The process for testing full playbooks is similar, and in both cases, the tests can be run inside most CI environments (for example, my [geerlingguy.apache][11] role runs a suite of [Molecule tests via Travis CI][12]). + +The final two test options, running the playbook in `--check` mode or building parallel production infrastructure, require more setup work and often go beyond what's necessary for efficient testing processes. But in cases where playbooks manage servers critical to business revenue, they can be necessary. + +There are a few other things that are important to watch for when running tests and periodically checking or updating your playbooks: + + * Make sure you track (and fix) any `DEPRECATION WARNING`s you see in Ansible's output. Usually, you'll have a year or two before the warning leads to a failure in the latest Ansible version, so the earlier you can update your playbook code, the better. + * Every Ansible version has a [porting guide][13]) that is extremely helpful when you're updating from one version to the next. + * If you see annoying `WARN` messages in playbook output when you're using a module like `command`, and you know you can safely ignore them, you can add a `warn: no` under the `args` in a task. It's better to squelch these warnings so that more actionable warnings (like deprecation warnings) will be noticed at a glance. + + + +Finally, I like to make sure my CI environments are always running the latest Ansible release (and not locked into a specific version that I know works with my playbooks), because I know if a playbook will break right after the new release comes out. My build server is locked into a specific Ansible version, which may be one or two versions behind the latest version, so this gives me the time to ensure I fix any new issues discovered in CI tests before I upgrade my build server to the latest version. + +### Simplify, optimize + +![Charging AirPods][14] + +> "YAML is not a programming language." +> — Jeff Geerling + +Simplicity in your playbooks makes maintenance and future changes a lot easier. Sometimes I'll look at a playbook and be puzzled as to what's happening because there are multiple `when` and `until` conditions with a bunch of Python mixed in with Jinja filters. + +If I start to see more than one or two chained filters or Python method calls (especially anything having to do with regular expressions), I see that as a prime candidate for rewriting the required functionality as an Ansible module. The module could be maintained in Python and tested independently and would be easier to maintain as strictly Python code rather than mixing in all the Python inline with your YAML task definitions. + +So my first point is: Stick to Ansible's modules and simple task definitions as much as possible. Try to use Jinja filters wherever possible, and avoid chaining more than one or two filters on a variable at a time. If you have a lot of complex inline Python or Jinja, it's time to consider refactoring it into a custom Ansible module. + +Another common thing I see people do, especially when building out roles the first time, is using complex dict variables where separate "flat" variables may be more flexible. + +For example, instead of having an **apache** role with many options in one giant dict, like this: + + +``` +apache: +  startservers: 2 +  maxclients: 2 +``` + +And consider using separate flat variables: + + +``` +apache_startservers: 2 +apache_maxclients: 2 +``` + +The reason for this is simple: Using flat variables allows playbooks to override one particular value easily, without having to redefine the entire dictionary. This is especially helpful when you have dozens (or in some rare cases, _hundreds_) of default variables in a role. + +Once the playbook and role code looks good, it's time to start thinking about **optimization**. + +A few of the first things I look at are: + + * Can I disable `gather_facts`? Not every playbook needs all the facts, and it adds a bit of overhead on every run, on every server. + * Can I increase the number of `forks` Ansible uses? The default is five, but if I have 50 servers, can I operate on 20 or 25 at a time to vastly reduce the amount of time Ansible takes to run a playbook on all the servers? + * In CI, can I parallelize test scenarios? Instead of running one test, then the next, if I can start all the tests at once, it will make my CI test cycle much faster. If CI is slow, you'll tend to ignore it or not wait until the test run is complete, so it's important to make sure your test cycle is short. + + + +When I'm looking through tasks in a role or playbook, I also look for a few blatant performance issues that are common with certain modules: + + * When using `package` (or `apt`, `yum`, `dnf`, etc.), if there is more than one package being managed, the list should be passed directly to the `name` parameter and not via `with_items` or a `loop`—this way Ansible can efficiently operate on the whole list in one go instead of doing it package by package. + * When using `copy`, how many files are being copied? If there is a single file or even a few dozen, it might be fine, but the `copy` module is very slow if you have hundreds or thousands of files to be copied (better to use a module like `synchronize` or a different strategy like copying a tarball and expanding it on the server). + * If using `lineinfile` in a loop, it might be more efficient (and sometimes easier to maintain) to use `template` instead and control the entire file in one pass. + + + +Once I've gotten most of the low-hanging fruit out of the way, I like to profile my playbook, and Ansible has some built-in tools for this. You can configure extra callback plugins to measure role and task performance by setting the `callback_whitelist` option under `defaults` in your `ansible.cfg`: + + +``` +[defaults] +callback_whitelist = profile_roles, profile_tasks, timer +``` + +Now, when you run your playbook, you get a summary of the slowest roles and tasks at the end: + + +``` +Monday 10 September       22:31:08 -0500 (0:00:00.851)       0:01:08.824 ****** +=============================================================================== +geerlingguy.docker ------------------------------------------------------ 9.65s +geerlingguy.security ---------------------------------------------------- 9.33s +geerlingguy.nginx ------------------------------------------------------- 6.65s +geerlingguy.firewall ---------------------------------------------------- 5.39s +geerlingguy.munin-node -------------------------------------------------- 4.51s +copy -------------------------------------------------------------------- 4.34s +geerlingguy.backup ------------------------------------------------------ 4.14s +geerlingguy.htpasswd ---------------------------------------------------- 4.13s +geerlingguy.ntp --------------------------------------------------------- 3.94s +geerlingguy.swap -------------------------------------------------------- 2.71s +template ---------------------------------------------------------------- 2.64s +... +``` + +If anything takes more than a few seconds, it might be good to figure out exactly why it's taking so long. + +### Summary + +I hope you learned a few ways you can make your Ansible Playbooks more maintainable; as I said in the beginning, each of the three takeaways (stay organized, test, then simplify and optimize) builds on the previous, so start by making sure you have clean, documented code, then make sure it's well-tested, and finally look at how you can make it even better and faster! + +* * * + +_This article is a follow up to Jeff's presentation, [Make your Ansible playbooks flexible, maintainable, and scalable][15], at AnsibleFest 2018, which you can [watch here][16]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/ansible-playbooks-lessons + +作者:[Jeff Geerling][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/geerlingguy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1 (plastic game pieces on a board) +[2]: https://github.com/geerlingguy/mac-dev-playbook +[3]: https://opensource.com/sites/default/files/uploads/organized.jpg (Organized bins of equipment) +[4]: https://www.ansible.com/products/tower +[5]: https://jenkins.io +[6]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html +[7]: https://galaxy.ansible.com +[8]: https://opensource.com/sites/default/files/uploads/test-early-often.jpg (A stack of computer boards) +[9]: https://molecule.readthedocs.io/en/stable/ +[10]: https://www.jeffgeerling.com/blog/2018/testing-your-ansible-roles-molecule +[11]: https://github.com/geerlingguy/ansible-role-apache +[12]: https://travis-ci.org/geerlingguy/ansible-role-apache +[13]: https://docs.ansible.com/ansible/latest/porting_guides/porting_guides.html +[14]: https://opensource.com/sites/default/files/uploads/simplify-optimize.jpg (Charging AirPods) +[15]: https://www.jeffgeerling.com/blog/2019/make-your-ansible-playbooks-flexible-maintainable-and-scalable-ansiblefest-austin-2018 +[16]: https://www.youtube.com/watch?v=kNDL13MJG6Y From d37116e9ad28c2742744a6f7189f9eacfd7b7b01 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 30 Jan 2020 00:58:54 +0800 Subject: [PATCH 0475/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=20Use?= =?UTF-8?q?=20Emacs=20to=20get=20social=20and=20track=20your=20todo=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200129 Use Emacs to get social and track your todo list.md --- ... to get social and track your todo list.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20200129 Use Emacs to get social and track your todo list.md diff --git a/sources/tech/20200129 Use Emacs to get social and track your todo list.md b/sources/tech/20200129 Use Emacs to get social and track your todo list.md new file mode 100644 index 0000000000..3893aac377 --- /dev/null +++ b/sources/tech/20200129 Use Emacs to get social and track your todo list.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Emacs to get social and track your todo list) +[#]: via: (https://opensource.com/article/20/1/emacs-social-track-todo-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use Emacs to get social and track your todo list +====== +Access Twitter, Reddit, chat, email, RSS, and your todo list in the +nineteenth in our series on 20 ways to be more productive with open +source in 2020. +![Team communication, chat][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Doing (almost) all the things with Emacs, part 2 + +[Yesterday][2], I talked about how to read email, access your addresses, and show calendars in Emacs. Emacs has tons and tons of functionality, and you can also use it for Twitter, chatting, to-do lists, and more! + +![All the things with Emacs][3] + +To do all of this, you need to install some Emacs packages. As you did yesterday, open the Emacs package manager with **Meta**+**x package-manager** (Meta is **Alt** on most keyboards or **Option** on MacOS). Now select the following packages with **i**, then install them by typing **x**: + + +``` +nnreddit +todotxt +twittering-mode +``` + +Once they are installed, open **~/.emacs.d/init.el** with **Ctrl**+**x Ctrl**+**x**, and add the following before the **(custom-set-variables** line: + + +``` +;; Todo.txt +(require 'todotxt) +(setq todotxt-file (expand-file-name "~/.todo/todo.txt")) + +;; Twitter +(require 'twittering-mode) +(setq twittering-use-master-password t) +(setq twittering-icon-mode t) + +;; Python3 for nnreddit +(setq elpy-rpc-python-command "python3") +``` + +Save the file with **Ctrl**+**x Ctrl**+**a**, exit Emacs with **Ctrl**+**x Ctrl**+**c**, then restart Emacs. + +#### Tweet from Emacs with twittering-mode + +![Twitter in Emacs][4] + +[Twittering-mode][5] is one of the best Emacs interfaces for Twitter. It supports almost all the features of Twitter and has some easy-to-use keyboard shortcuts. + +To get started, type **Meta**+**x twit** to launch twittering-mode. It will give a URL to open—and prompt you to launch a browser with it if you want—so you can log in and get an authorization token. Copy and paste the token into Emacs, and your Twitter timeline should load. You can scroll with the **Arrow** keys, use **Tab** to move from item to item, and press **Enter** to view the URL the cursor is on. If the cursor is on a username, pressing **Enter** will open that timeline in a web browser. If you are on a tweet's text, pressing **Enter** will reply to that tweet. You can create a new tweet with **u**, retweet something with **Ctrl**+**c**+**Enter**, and send a direct message with **d**—the dialog it opens has instructions on how to send, cancel, and shorten URLs. + +Pressing **V** will open a prompt to get to other timelines. To open your mentions, type **:mentions**. The home timeline is **:home**, and typing a username will take you to that user's timeline. Finally, pressing **q** will quit twittering-mode and close the window. + +There is a lot more functionality available in twittering-mode, and I encourage you to read the [full list][6] on its GitHub page. + +#### Track your to-do's in Emacs with Todotxt.el + +![todo.txt in emacs][7] + +[Todotxt.el][8] is a nice interface for the [todo.txt][9] to-do list manager. It has hotkeys for just about everything. + +To start it up, type **Meta**+**x todotxt**, and it will load the todo.txt file you specified in the **todotxt-file** variable (which you set in the first part of this article). Inside the buffer (window) for todo.txt, you can press **a** to add a new task and **c** to mark it complete. You can set priorities with **r**, and add projects and context to an item with **t**. When you are ready to move everything to **done.txt**, just press **A**. And you can filter the list with **/** or refresh back to the full list with **l**. And again, you can press **q** to exit. + +#### Chat in Emacs with ERC + +![Chatting with erc][10] + +One of Vim's shortcomings is that trying to use chat with it is difficult (at best). Emacs, on the other hand, has the [ERC][11] client built into the default distribution. Start ERC with **Meta**+**x erc**, and you will be prompted for a server name, username, and password. You can use the same information you used a few days ago when you set up [BitlBee][12]: server **localhost**, port **6667**, and the same username with no password. It should be the same as using almost any other IRC client. Each channel will be split into a new buffer (window), and you can switch between them with **Ctrl**+**x Ctrl**+**b**, which also switches between other buffers in Emacs. The **/quit** command will exit ERC. + +#### Read email, Reddit, and RSS feeds with Gnus + +![Mail, Reddit, and RSS feeds with Gnus][13] + +I'm sure many long-time Emacs users were asking, "but what about [Gnus][14]?" yesterday when I was talking about reading mail in Emacs. And it's a valid question. Gnus is a mail and newsreader built into Emacs, although it doesn't support [Notmuch][15] as a mail reader, just as a search engine. However, if you are configuring it for Reddit and RSS feeds (as you'll do in a moment), it's smart to add in mail functionality as well. + +Gnus was created for reading Usenet News and grew from there. So, a lot of its look and feel (and terminology) seem a lot like a Usenet newsreader. + +Gnus has its own configuration file in **~/.gnus** (the configuration can also be included in the main **~/.emacs.d/init.el**). Open **~/.gnus** with **Ctrl**+**x Ctrl**+**f** and add the following: + + +``` +;; Required packages +(require 'nnir) +(require 'nnrss) + +;; Primary Mailbox +(setq gnus-select-method +      '(nnmaildir "Local" +                  (directory "~/Maildir") +                  (nnir-search-engine notmuch) +      )) +(add-to-list 'gnus-secondary-select-methods +             '(nnreddit "")) +``` + +Save the file with **Ctrl**+**x Ctrl**+**s**. This tells Gnus to read mail from the local mailbox in **~/Maildir** as the primary source (**gnus-select-method**) and add a second source (**gnus-secondary-select-methods**) using the [nnreddit][16] plugin. You can also define multiple secondary sources, including Usenet News (nntp), IMAP (nnimap), mbox (nnmbox), and virtual collections (nnvirtual). You can learn more about all the options in the [Gnus manual][17]. + +Once you save the file, start Gnus with **Meta**+**x gnus**. The first run will install [Reddit Terminal Viewer][18] in a Python virtual environment, which is how it gets Reddit articles. It will then launch your browser to log into Reddit. After that, it will scan and load your subscribed Reddit groups. You will see a list of email folders with new mail and the list of subreddits with new content. Pressing **Enter** on any of them will load the list of messages for the group. You can navigate with the **Arrow** keys and press **Enter** to load and read a message. Pressing **q** will go back to the prior view when viewing message lists, and pressing **q** from the main window will exit Gnus. When reading a Reddit group, **a** creates a new message; in a mail group, **m** creates a new email; and **r** replies to messages in either view. + +You can also add RSS feeds to the Gnus interface and read them like mail and newsgroups. To add an RSS feed, type **G**+**R** and fill in the RSS feed's URL. You will be prompted for the title and description of the feed, which should be auto-filled from the feed. Now type **g** to check for new messages (this checks for new messages in all groups). Reading a feed is like reading Reddit groups and mail, so it uses the same keys. + +There is a _lot_ of functionality in Gnus, and there are a whole lot more key combinations. The [Gnus Reference Card][19] lists all of them for each view (on five pages in very small type). + +#### See your position with nyan-mode + +As a final note, you might notice [Nyan cat][20] at the bottom of some of my screenshots. This is [nyan-mode][21], which indicates where you are in a buffer, so it gets longer as you get closer to the bottom of a document or buffer. You can install it with the package manager and set it up with the following code in **~/.emacs.d/init.el**: + + +``` +;; Nyan Cat +(setq nyan-wavy-trail t) +(setq nyan-bar-length 20) +(nyan-mode) +``` + +### Scratching Emacs' surface + +This is just scratching the surface of all the things you can do with Emacs. It is _very_ powerful, and it is one of my go-to tools for being productive whether I'm tracking to-dos, reading and responding to mail, editing text, or chatting with my friends and co-workers. It takes a bit of getting used to, but once you do, it can become one of the most useful tools on your desktop. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/emacs-social-track-todo-list + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) +[2]: https://opensource.com/article/20/1/emacs-mail-calendar +[3]: https://opensource.com/sites/default/files/uploads/productivity_19-1.png (All the things with Emacs) +[4]: https://opensource.com/sites/default/files/uploads/productivity_19-2.png (Twitter in Emacs) +[5]: https://github.com/hayamiz/twittering-mode +[6]: https://github.com/hayamiz/twittering-mode#features +[7]: https://opensource.com/sites/default/files/uploads/productivity_19-3.png (todo.txt in emacs) +[8]: https://github.com/rpdillon/todotxt.el +[9]: http://todotxt.org/ +[10]: https://opensource.com/sites/default/files/uploads/productivity_19-4.png (Chatting with erc) +[11]: https://www.gnu.org/software/emacs/manual/html_mono/erc.html +[12]: https://opensource.com/article/20/1/open-source-chat-tool +[13]: https://opensource.com/sites/default/files/uploads/productivity_19-5.png (Mail, Reddit, and RSS feeds with Gnus) +[14]: https://www.gnus.org/ +[15]: https://opensource.com/article/20/1/organize-email-notmuch +[16]: https://github.com/dickmao/nnreddit +[17]: https://www.gnus.org/manual/gnus.html +[18]: https://pypi.org/project/rtv/ +[19]: https://www.gnu.org/software/emacs/refcards/pdf/gnus-refcard.pdf +[20]: http://www.nyan.cat/ +[21]: https://github.com/TeMPOraL/nyan-mode From a2672d1ae8dd70fcb0cb8186a296a66fe0b24290 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 30 Jan 2020 00:59:23 +0800 Subject: [PATCH 0476/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=207=20?= =?UTF-8?q?open=20source=20desktop=20tools:=20Download=20our=20new=20eBook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200129 7 open source desktop tools- Download our new eBook.md --- ...e desktop tools- Download our new eBook.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/tech/20200129 7 open source desktop tools- Download our new eBook.md diff --git a/sources/tech/20200129 7 open source desktop tools- Download our new eBook.md b/sources/tech/20200129 7 open source desktop tools- Download our new eBook.md new file mode 100644 index 0000000000..303f86919c --- /dev/null +++ b/sources/tech/20200129 7 open source desktop tools- Download our new eBook.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 open source desktop tools: Download our new eBook) +[#]: via: (https://opensource.com/article/20/1/open-source-desktop-tools-guide) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +7 open source desktop tools: Download our new eBook +====== +Choice is more than a feature of Linux; it's a way of life thanks to a +wealth of open source tools. +![Browser of things][1] + +Linux users say that choice is one of the platform's strengths. On the surface, this might sound self-aggrandizing (or self-deprecating, depending on your perspective). Other operating systems offer choice, too, but once you look at the options available for nearly anything you want to do on Linux, it doesn't take long to conclude that a new word ought to be invented for what we mean by "choice." + +User choice isn't a "feature" of Linux; it's a way of life. Whether you're looking for a whole new desktop or just a new system tray, Linux hackers provide you options. You might also be able to hack some simple commands together to create a batch processor for yourself—and you might publish it online for others, thereby contributing to the array of choice. + +With so many options available, it can be a real challenge to find the solutions you prefer. One of the most effective ways to discover cool new things in the Linux world is through personal recommendation. That's one of the many reasons Opensource.com covers what might seem like random applications—through sharing your experiences with software, others can discover new applications to love without the pain of rummaging through piles of choice. + +### Sharing and open source + +Obviously, you can share software _recommendations_ with friends, whether the software is open source or not. However, in the proprietary world, you can't share the software that you're recommending, and in the world of proprietary software as a service (SaaS), part of the act of sharing is the key component to a pyramid scheme for more user data. It's not quite the same as the no-strings-attached gift of open source. + +Sharing is an integral part of free and open source software. It's one of the [four freedoms][2] defined by the Free Software Foundation, and it's the central concern of [Creative Commons][3]. + +While it's easy to fall into the trap of viewing open source sharing as something that applies only to lines of sometimes cryptic-looking code, it goes well beyond that. Sharing is almost endemic to open culture, explicitly allowing and encouraging it on every level, from code, to tutorials and tips, to physical redistribution of a wealth of common goods and services. Part of that is the simple act of telling others about a cool technology that has improved the way we work and live. + +### Download the eBook + +Opensource.com contributor and productivity aficionado Kevin Sonney has shared many of his favorite desktop applications in our latest eBook, [7 open source desktop tools][4]. As is often the case in the open source world, he doesn't just share his knowledge about his favorite desktop tools, he explains how and why he chooses those tools to help you can evaluate them for yourself. Download it today! + +### [Download the 7 open source desktop tools eBook][4] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-desktop-tools-guide + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things) +[2]: https://www.gnu.org/philosophy/free-sw.en.html +[3]: https://creativecommons.org +[4]: https://opensource.com/downloads/desktop-tools From f6c1490ac95dd5eef58654e31002d511b1c0b16a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 30 Jan 2020 01:00:31 +0800 Subject: [PATCH 0477/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200130=20Inte?= =?UTF-8?q?l=20denies=20reports=20of=20Xeon=20shortage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200130 Intel denies reports of Xeon shortage.md --- ...0 Intel denies reports of Xeon shortage.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/talk/20200130 Intel denies reports of Xeon shortage.md diff --git a/sources/talk/20200130 Intel denies reports of Xeon shortage.md b/sources/talk/20200130 Intel denies reports of Xeon shortage.md new file mode 100644 index 0000000000..fce436ea0a --- /dev/null +++ b/sources/talk/20200130 Intel denies reports of Xeon shortage.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Intel denies reports of Xeon shortage) +[#]: via: (https://www.networkworld.com/article/3516392/intel-denies-reports-of-xeon-shortage.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Intel denies reports of Xeon shortage +====== +The PC side of Intel's Xeon processor supply remains constrained, but server customers should get their orders this year. +Intel + +Intel has denied reports that its Xeon supply chain is suffering the same constraints as its PC desktop/laptop business. CEO Bob Swan said during the company's recent earnings call that its inventory was depleted but customers are getting orders. + +The issue blew up last week when HPE – one of Intel's largest server OEM partners – reportedly [told UK-based publication The Register][1] that there were supply constraints with Cascade Lake processors, the most recent generation of Xeon Scalable processors, and urged HPE customers "to consider alternative processors." HPE did not clarify if it meant Xeon processors other than Cascade Lake or AMD Epyc processors. + +AMD must have loved that. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +At the time, Intel was in the quiet period prior to announcing fourth quarter 2019 results, so when I initially approached them for comment, company executives could not answer. But on last week’s earnings call, Swan set the record straight. While supply of desktop CPUs remains constrained, especially on the low-end, Xeon supply is in “pretty good shape,” as he put it, even after a 19% growth in demand for the quarter. + +“When you have that kind of spike in demand, we are not perfect across all products or all SKUs. But server CPUs, we really prioritize that and try to put ourselves in a position where we are not constrained, and we are in pretty good shape. Pretty great shape, macro. Micro, a few challenges here and there. But server CPU supply is pretty good,” he [said on an earnings call][3] with Wall Street analysts. + +Intel CFO George Davis added that supply is expected to improve in the second half of this year, across the board, thanks to an expansion of production capacity. "In the second half of the year we would expect to be able to bring both our server products and, most importantly, our PC products back to a more normalized inventory level," Davis said. + +Intel’s data center group had record revenue of $7.2 billion in Q4 2019, up 19% from Q4 2018. In particular, cloud revenue was up 48% year-over-year as cloud service providers continue building out crazy levels of capacity. + +**[ Check out our [12 most powerful hyperconverged infrasctructure vendors][4]. | Get regularly scheduled insights by [signing up for Network World newsletters][5]. ]** + +Hyperscalers like Amazon and Google are building data centers the size of football stadiums and filling them with tens of thousands of servers at a time. I’ve heard concerns about this trend of a half-dozen or so companies hoovering up all of the supply of CPUs, memory, flash and traditional disk, and so on, but so far any real shortages have not come to pass. + +Perhaps not surprisingly, Intel's enterprise and government revenue was down 7% as more and more companies reduce their data center footprint, while communication and service providers' revenue grew 14% as customers continue to adopt AI-based solutions to transform their networks and transition to 5G. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3516392/intel-denies-reports-of-xeon-shortage.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.theregister.co.uk/2020/01/20/intel_hpe_xeon_shortage/ +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://seekingalpha.com/article/4318803-intel-corporation-intc-ceo-bob-swan-on-q4-2019-results-earnings-call-transcript?part=single +[4]: https://www.networkworld.com/article/3112622/hardware/12-most-powerful-hyperconverged-infrastructure-vendors.htmll +[5]: https://www.networkworld.com/newsletters/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From ccd604a3bb7a5a7069f382cdac1e7fe8a0753353 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 30 Jan 2020 01:03:09 +0800 Subject: [PATCH 0478/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=20You?= =?UTF-8?q?=20can=20now=20have=20a=20Mac=20Pro=20in=20your=20data=20center?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200129 You can now have a Mac Pro in your data center.md --- ... now have a Mac Pro in your data center.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/talk/20200129 You can now have a Mac Pro in your data center.md diff --git a/sources/talk/20200129 You can now have a Mac Pro in your data center.md b/sources/talk/20200129 You can now have a Mac Pro in your data center.md new file mode 100644 index 0000000000..f779534e5f --- /dev/null +++ b/sources/talk/20200129 You can now have a Mac Pro in your data center.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (You can now have a Mac Pro in your data center) +[#]: via: (https://www.networkworld.com/article/3516490/you-can-now-have-a-mac-pro-in-your-data-center.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +You can now have a Mac Pro in your data center +====== +The company that once eschewed the enterprise now has a server version of the Mac Pro. Apple's rack-mountable Mac Pro starts at $6,499. +Apple + +Steve Jobs rather famously said he hated the enterprise because the people who use the product have no say in its purchase. Well, Apple's current management has adopted the enterprise, ever so slowly, and is now shipping its first server in years. Sort of. + +Apple introduced a new version of the Mac Pro in December 2019, after a six-year gap in releases, and said it would make the computer rack-mountable for data centers. But at the time, all the attention was on the computer’s aesthetics, because it looked like a cheese grater. The other bit of focus was on the price; a fully decked Mac Pro cost an astronomical $53,799. Granted, that did include specs like 1.5TB of DRAM and 8TB of SSD storage. Those are impressive specs for a server, although the price is still a little crazy. + +Earlier this month, Apple quietly delivered on the promise to make the Mac Pro rack-mountable. The Mac Pro rack configuration comes with a $500 premium over the cost of the standing tower, which means it starts at $6,499. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +That gives you an 8-core Intel Xeon W CPU, 32GB of memory, a Radeon Pro 580X GPU, and 256GB of SSD storage. Most importantly, it gives you the rack mounting rails (which ship in a separate box for some reason) needed to install it in a cabinet. Once installed, the Mac Pro is roughly the size of a 4U server. + +Mac Pros are primarily used in production facilities, where they are used with other audio and video production hardware. MacStadium, a Mac developer with its own data centers, has been installing and testing the servers and thus far has had high praise for both the [ease of install][2] and [performance][3]. + +The server-ready version features a slight difference in its case, according to people who have tested it. The twist handle on the Mac Pro case is replaced with two lock switches that allow the case to be removed to access the internal components. It comes with two Thunderbolt 3 ports and a power button. + +The Mac Pro may be expensive, but you get a lot of performance for your money. Popular YouTube Mac enthusiast Marques Brownlee [tested it out][4] on a 8k resolution video encoding job. Brownlee found a MacBook Pro took 20 minutes to render the five-minute-long video, a iMac Pro desktop took 12 minutes, and the Mac Pro processed the video in 4:20. So the Mac Pro encoded 8k resolution video faster than real time. + +**[ Learn [how server disaggregation can boost data center efficiency][5] and [how Windows Server 2019 embraces hyperconverged data centers][6] . | Get regularly scheduled insights by [signing up for Network World newsletters][7]. ]** + +Apple’s last server was the Xserve, killed off in 2010 after several years of neglect. Instead, it made a version of MacOS for the whole Mac line that would let the hardware be run as a server, which is exactly what the new rack-mountable version of the Mac Pro is. + +MacStadium is doing benchmarks like Node.js, a JavaScript runtime. It will be interesting to see if anyone outside of audio/video encoding uses a Mac Pro in their data centers. + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3516490/you-can-now-have-a-mac-pro-in-your-data-center.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://twitter.com/brianstucki/status/1219299028791226368 +[3]: https://blog.macstadium.com/blog/2019-mac-pros-at-macstadium +[4]: https://www.youtube.com/watch?v=DOPswcaSsu8&t= +[5]: https://www.networkworld.com/article/3266624/how-server-disaggregation-could-make-cloud-datacenters-more-efficient.html +[6]: https://www.networkworld.com/article/3263718/software/windows-server-2019-embraces-hybrid-cloud-hyperconverged-data-centers-linux.html +[7]: https://www.networkworld.com/newsletters/signup.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From 176f883711443e3ecb50417b5a080f73f14aa849 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 30 Jan 2020 01:05:20 +0800 Subject: [PATCH 0479/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200129=20Show?= =?UTF-8?q?ing=20memory=20usage=20in=20Linux=20by=20process=20and=20user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200129 Showing memory usage in Linux by process and user.md --- ...mory usage in Linux by process and user.md | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 sources/tech/20200129 Showing memory usage in Linux by process and user.md diff --git a/sources/tech/20200129 Showing memory usage in Linux by process and user.md b/sources/tech/20200129 Showing memory usage in Linux by process and user.md new file mode 100644 index 0000000000..8e21baf042 --- /dev/null +++ b/sources/tech/20200129 Showing memory usage in Linux by process and user.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Showing memory usage in Linux by process and user) +[#]: via: (https://www.networkworld.com/article/3516319/showing-memory-usage-in-linux-by-process-and-user.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Showing memory usage in Linux by process and user +====== +There are several commands for checking up on memory usage in a Linux system, and here are some of the better ones. +[Fancycrave][1] [(CC0)][2] + +There are a lot of tools for looking at memory usage on Linux systems. Some are commonly used commands like **free** and **ps** while others are tools like **top** that allow you to display system performance stats in various ways. In this post, we’ll look at some commands that can be most helpful in identifying the users and processes that are using the most memory. + +Here are some that address memory usage by process. + +### Using top + +One of the best commands for looking at memory usage is **top**. One extremely easy way to see what processes are using the most memory is to start **top** and then press **shift+m** to switch the order of the processes shown to rank them by the percentage of memory each is using. Once you’ve entered **shift+m**, your top output should reorder the task entries to look something like this: + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +$top +top - 09:39:34 up 5 days, 3 min, 3 users, load average: 4.77, 4.43, 3.72 +Tasks: 251 total, 3 running, 247 sleeping, 1 stopped, 0 zombie +%Cpu(s): 50.6 us, 35.9 sy, 0.0 ni, 13.4 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5944.4 total, 128.9 free, 2509.3 used, 3306.2 buff/cache +MiB Swap: 2048.0 total, 2045.7 free, 2.2 used. 3053.5 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 400 nemo 20 0 3309580 550188 168372 S 0.3 9.0 1:33.27 Web Content +32469 nemo 20 0 3492840 447372 163296 S 7.3 7.3 3:55.60 firefox +32542 nemo 20 0 2845732 433388 140984 S 6.0 7.1 4:11.16 Web Content + 342 nemo 20 0 2848520 352288 118972 S 10.3 5.8 4:04.89 Web Content + 2389 nemo 20 0 1774412 236700 90044 S 39.7 3.9 9:32.64 vlc +29527 nemo 20 0 2735792 225980 84744 S 9.6 3.7 3:02.35 gnome-shell +30497 nemo 30 10 1088476 159636 88884 S 0.0 2.6 0:11.99 update-manager +30058 nemo 20 0 1089464 140952 33128 S 0.0 2.3 0:04.58 gnome-software +32533 nemo 20 0 2389088 104712 79544 S 0.0 1.7 0:01.43 WebExtensions + 2256 nemo 20 0 1217884 103424 31304 T 0.0 1.7 0:00.28 vlc + 1713 nemo 20 0 2374396 79588 61452 S 0.0 1.3 0:00.49 Web Content +29306 nemo 20 0 389668 74376 54340 S 2.3 1.2 0:57.25 Xorg +32739 nemo 20 0 289528 58900 34480 S 1.0 1.0 1:04.08 RDD Process +29732 nemo 20 0 789196 57724 42428 S 0.0 0.9 0:00.38 evolution-alarm + 2373 root 20 0 150408 57000 9924 S 0.3 0.9 10:15.35 nessusd +``` + +Notice the **%MEM** ranking. The list will be limited by your window size, but the most significant processes with respect to memory usage will show up at the top of the process list. + +### Using ps + +The **ps** command includes a column that displays memory usage for each process. To get the most useful display for viewing the top memory users, however, you can pass the **ps** output from this command to the **sort** command. Here’s an example that provides a very useful display: + +``` +$ ps aux | sort -rnk 4 | head -5 +nemo 400 3.4 9.2 3309580 563336 ? Sl 08:59 1:36 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 9086 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 32469 8.2 7.7 3492840 469516 ? Sl 08:54 4:15 /usr/lib/firefox/firefox -new-window +nemo 32542 8.9 7.6 2875428 462720 ? Sl 08:55 4:36 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 1 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 342 9.9 5.9 2854664 363528 ? Sl 08:59 4:44 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 8763 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 2389 39.5 3.8 1774412 236116 pts/1 Sl+ 09:15 12:21 vlc videos/edge_computing.mp4 +``` + +In the example above (truncated for this post), sort is being used with the **-r** (reverse), the **-n** (numeric) and the **-k** (key) options which are telling the command to sort the output in reverse numeric order based on the fourth column (memory usage) in the output from **ps**. If we first display the heading for the **ps** output, this is a little easier to see. + +``` +$ ps aux | head -1; ps aux | sort -rnk 4 | head -5 +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +nemo 400 3.4 9.2 3309580 563336 ? Sl 08:59 1:36 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 9086 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 32469 8.2 7.7 3492840 469516 ? Sl 08:54 4:15 /usr/lib/firefox/firefox -new-window +nemo 32542 8.9 7.6 2875428 462720 ? Sl 08:55 4:36 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 1 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 342 9.9 5.9 2854664 363528 ? Sl 08:59 4:44 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 8763 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 2389 39.5 3.8 1774412 236116 pts/1 Sl+ 09:15 12:21 vlc videos/edge_computing.mp4 +``` + +If you like this command, you can set it up as an alias with a command like the one below. Don't forget to add it to your ~/.bashrc file if you want to make it permanent. + +``` +$ alias mem-by-proc="ps aux | head -1; ps aux | sort -rnk 4" +``` + +Here are some commands that reveal memory usage by user. + +### Using top + +Examining memory usage by user is somewhat more complicated because you have to find a way to group all of a user’s processes into a single memory-usage total. + +If you want to home in on a single user, **top** can be used much in the same way that it was used above. Just add a username with the -U option as shown below and press the **shift+m** keys to order by memory usage: + +``` +$ top -U nemo +top - 10:16:33 up 5 days, 40 min, 3 users, load average: 1.91, 1.82, 2.15 +Tasks: 253 total, 2 running, 250 sleeping, 1 stopped, 0 zombie +%Cpu(s): 28.5 us, 36.8 sy, 0.0 ni, 34.4 id, 0.3 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5944.4 total, 224.1 free, 2752.9 used, 2967.4 buff/cache +MiB Swap: 2048.0 total, 2042.7 free, 5.2 used. 2812.0 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 400 nemo 20 0 3315724 623748 165440 S 1.0 10.2 1:48.78 Web Content +32469 nemo 20 0 3629380 607492 161688 S 2.3 10.0 6:06.89 firefox +32542 nemo 20 0 2886700 404980 136648 S 5.6 6.7 6:50.01 Web Content + 342 nemo 20 0 2922248 375784 116096 S 19.5 6.2 8:16.07 Web Content + 2389 nemo 20 0 1762960 234644 87452 S 0.0 3.9 13:57.53 vlc +29527 nemo 20 0 2736924 227260 86092 S 0.0 3.7 4:09.11 gnome-shell +30497 nemo 30 10 1088476 156372 85620 S 0.0 2.6 0:11.99 update-manager +30058 nemo 20 0 1089464 138160 30336 S 0.0 2.3 0:04.62 gnome-software +32533 nemo 20 0 2389088 102532 76808 S 0.0 1.7 0:01.79 WebExtensions +``` + +### Using ps + +You can also use a **ps** command to rank an individual user's processes by memory usage. In this example, we do this by selecting a single user's processes with a **grep** command: + +``` +$ ps aux | head -1; ps aux | grep ^nemo| sort -rnk 4 | more +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +nemo 32469 7.1 11.5 3724364 701388 ? Sl 08:54 7:21 /usr/lib/firefox/firefox -new-window +nemo 400 2.0 8.9 3308556 543232 ? Sl 08:59 2:01 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 9086 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni/usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 32542 7.9 7.1 2903084 436196 ? Sl 08:55 8:07 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 1 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 342 10.8 7.0 2941056 426484 ? Rl 08:59 10:45 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 8763 -prefMapSize 210653 -parentBuildID 20200107212822 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 32469 true tab +nemo 2389 16.9 3.8 1762960 234644 pts/1 Sl+ 09:15 13:57 vlc videos/edge_computing.mp4 +nemo 29527 3.9 3.7 2736924 227448 ? Ssl 08:50 4:11 /usr/bin/gnome-shell +``` + +### Using ps along with other commands + +What gets complicated is when you want to compare users' memory usages with each other. In that case, creating a by-user total and ranking them is a good technique, but it requires a little more work and uses a number of commands. In the script below, we get a list of users with the **ps aux | grep -v COMMAND | awk '{print $1}' | sort -u** command. This includes system users like **syslog**. We then collect stats for each user and total the memory usage stat for each task with **awk**. As a last step, we display each user's memory usage sum in numerical (largest first) order. + +``` +#!/bin/bash + +stats=”” +echo "% user" +echo "============" + +# collect the data +for user in `ps aux | grep -v COMMAND | awk '{print $1}' | sort -u` +do + stats="$stats\n`ps aux | egrep ^$user | awk 'BEGIN{total=0}; \ + {total += $4};END{print total,$1}'`" +done + +# sort data numerically (largest first) +echo -e $stats | grep -v ^$ | sort -rn | head +``` + +Output from this script might look like this: + +``` +$ ./show_user_mem_usage +% user +============ +69.6 nemo +5.8 root +0.5 www-data +0.3 shs +0.2 whoopsie +0.2 systemd+ +0.2 colord +0.2 clamav +0 syslog +0 rtkit +``` + +There are a lot of ways to report on memory usage on Linux. Focusing on which processes and users are consuming the most memory can benefit from a few carefully crafted tools and commands. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3516319/showing-memory-usage-in-linux-by-process-and-user.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://unsplash.com/photos/37LPYOkEE2o +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 96dbdb6cea61a94b6ef2eb674d7e1b9c2c897354 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 30 Jan 2020 11:14:00 +0800 Subject: [PATCH 0480/3057] PUB @alim0x https://linux.cn/article-11831-1.html --- .../20191108 My Linux story- Learning Linux in the 90s.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20191108 My Linux story- Learning Linux in the 90s.md (100%) diff --git a/translated/talk/20191108 My Linux story- Learning Linux in the 90s.md b/published/20191108 My Linux story- Learning Linux in the 90s.md similarity index 100% rename from translated/talk/20191108 My Linux story- Learning Linux in the 90s.md rename to published/20191108 My Linux story- Learning Linux in the 90s.md From ab7d0cd7f509de585c35970424ca7b53397e6955 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 30 Jan 2020 11:56:53 +0800 Subject: [PATCH 0481/3057] PRF @laingke --- ...to inter-process communication in Linux.md | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md b/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md index b88af1f2ca..893e9f9ff3 100644 --- a/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md +++ b/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md @@ -1,24 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Introducing the guide to inter-process communication in Linux) [#]: via: (https://opensource.com/article/20/1/inter-process-communication-linux) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Linux 进程间通信介绍指南 +免费电子书《Linux 进程间通信指南》介绍 ====== -这本免费的电子书使经验丰富的程序员更深入了解 Linux 中进程间通信(IPC)的核心概念和机制。 -![Inter-process Communication in Linux][1] -让一个软件过程与另一个软件过程进行对话是一个微妙的平衡行为。但是,它对于应用程序而言可能是至关重要的功能,因此这是任何从事复杂项目的程序员都必须解决的问题。你的应用程序是否需要启动由其它软件处理的工作;监视外设或网络上正在执行的操作;或者检测来自其它来源的信号,当你的软件需要依赖其自身代码之外的东西来知道下一步做什么或什么时候做时,你就需要考虑进程间通信(IPC)。 +> 这本免费的电子书使经验丰富的程序员更深入了解 Linux 中进程间通信(IPC)的核心概念和机制。 -Unix 操作系统在很久以前就说明了这一点,这可能是因为人们早就期望软件会来自各种来源。按照相同的传统,Linux 为 IPC 和一些新接口提供了许多相同的接口。Linux 内核具有几个 IPC 方法,[util-linux 包][2]包含 `ipcmk`、`ipcrm`、`ipcs` 和 `lsipc` 命令,用于监视和管理 IPC 消息。 +![](https://img.linux.net.cn/data/attachment/album/202001/30/115631jthl0h61zhhmwpv1.jpeg) + +让一个软件过程与另一个软件过程进行对话是一个微妙的平衡行为。但是,它对于应用程序而言可能是至关重要的功能,因此这是任何从事复杂项目的程序员都必须解决的问题。你的应用程序是否需要启动由其它软件处理的工作;监视外设或网络上正在执行的操作;或者检测来自其它来源的信号,当你的软件需要依赖其自身代码之外的东西来知道下一步做什么或什么时候做时,你就需要考虑进程间通信inter-process communication(IPC)。 + +这在 Unix 操作系统上已经由来已久了,这可能是因为人们早期预期软件会来自各种来源。按照相同的传统,Linux 提供了一些同样的 IPC 接口和一些新接口。Linux 内核具有多种 IPC 方法,[util-linux 包][2]包含了 `ipcmk`、`ipcrm`、`ipcs` 和 `lsipc` 命令,用于监视和管理 IPC 消息。 ### 显示进程间通信信息 -在尝试 IPC 之前,你应该知道系统上已经有哪些 IPC 工具。`lsipc` 命令提供了该信息。 +在尝试 IPC 之前,你应该知道系统上已经有哪些 IPC 设施。`lsipc` 命令提供了该信息。 ``` RESOURCE DESCRIPTION LIMIT USED USE% @@ -41,23 +43,23 @@ SEMVMX Semaphore max value 32767 - - ``` $ ipcs -\------ Message Queues Creators/Owners --- +------ Message Queues Creators/Owners --- msqid perms cuid cgid [...] -\------ Shared Memory Segment Creators/Owners +------ Shared Memory Segment Creators/Owners shmid perms cuid cgid [...] 557056 700 seth users [...] 3571713 700 seth users [...] 2654210 600 seth users [...] 2457603 700 seth users [...] -\------ Semaphore Arrays Creators/Owners --- +------ Semaphore Arrays Creators/Owners --- semid perms cuid cgid [...] ``` -这表明当前没有消息或信号量数组,但是使用了一些共享内存段。 +这表明当前没有消息或信号量阵列,但是使用了一些共享内存段。 -你可以在系统上执行一个简单的示例,这样就可以看到其中一个系统正在工作。它涉及到一些 C 代码,所以你必须在系统上有构建工具。必须安装才能从源代码构建的软件包的名称取决于发行版,因此请参考文档以获取详细信息。例如,在基于 Debian 的发行版上,你可以在 wiki 的[构建教程][3]部分了解构建需求,而在基于 Fedora 的发行版上,你可以参考文档的[从源代码安装软件][4]部分。 +你可以在系统上执行一个简单的示例,这样就可以看到正在工作的系统之一。它涉及到一些 C 代码,所以你必须在系统上有构建工具。必须安装这些软件包才能从源代码构建软件,这些软件包的名称取决于发行版,因此请参考文档以获取详细信息。例如,在基于 Debian 的发行版上,你可以在 wiki 的[构建教程][3]部分了解构建需求,而在基于 Fedora 的发行版上,你可以参考该文档的[从源代码安装软件][4]部分。 ### 创建一个消息队列 @@ -87,11 +89,10 @@ int main() { printf("Message: %s\n",message.text); printf("Queue: %d\n",msqid); return 0; -} + } ``` -编译应用程序并运行: - +编译该应用程序并运行: ``` $ gcc msgsend.c -o msg.bin @@ -100,19 +101,18 @@ Message: opensource.com Queue: 32769 ``` -你刚刚向消息队列发送了一条消息。你可以使用 `ipcs` 命令验证这一点,使用 `\——queue` 选项将输出限制到消息队列: - +你刚刚向你的消息队列发送了一条消息。你可以使用 `ipcs` 命令验证这一点,可以使用 `——queue` 选项将输出限制到该消息队列: ``` $ ipcs -q -\------ Message Queues -------- +------ Message Queues -------- key msqid owner perms used-bytes messages 0x7b341ab9 0 seth 666 0 0 0x72bd8410 32764 seth 644 24 1 ``` -你也可以检索这些讯息: +你也可以检索这些消息: ``` #include @@ -125,7 +125,7 @@ struct msgbuffer { int main() { int msqid = 32764; - msgrcv(msqid, &message, sizeof(message),0,0); + msgrcv(msqid, &message, sizeof(message),0,0); printf("\nQueue: %d\n",msqid); printf("Got this message: %s\n", message.text); msgctl(msqid,IPC_RMID,NULL); @@ -142,11 +142,11 @@ Queue: 32764 Got this message: opensource.com ``` -### 下载[电子书][5] +### 下载这本电子书 -这只是 Marty Kalin 的 [Linux 内进程间通信指南][5]中课程的一个例子,这是可从 Opensource.com 下载的最新免费(和知识共享)电子书。在短短的几节课中,你将从消息队列、共享内存和信号量、套接字、信号等中了解 IPC 的 POSIX 方法。认真阅读 Marty 的书,您将成为一个消息灵通的程序员。而这不仅适用于经验丰富的编码人员,如果你编写的只是 shell 脚本,那么你将拥有有关管道(命名和未命名)和共享文件的大量实践知识,以及使用共享文件或外部消息队列时需要了解的重要概念。 +这只是 Marty Kalin 的《[Linux 进程间通信指南][5]》中课程的一个例子,可从 Opensource.com 下载的这本最新免费(且 CC 授权)的电子书。在短短的几节课中,你将从消息队列、共享内存和信号量、套接字、信号等中了解 IPC 的 POSIX 方法。认真阅读 Marty 的书,你将成为一个博识的程序员。而这不仅适用于经验丰富的编码人员,如果你编写的只是 shell 脚本,那么你将拥有有关管道(命名和未命名)和共享文件的大量实践知识,以及使用共享文件或外部消息队列时需要了解的重要概念。 -如果你对制作具有动态和系统意识的优秀软件感兴趣,那么你需要了解 IPC。让[这本书][5]做你的向导。 +如果你对制作具有动态和具有系统感知的优秀软件感兴趣,那么你需要了解 IPC。让[这本书][5]做你的向导。 -------------------------------------------------------------------------------- @@ -155,7 +155,7 @@ via: https://opensource.com/article/20/1/inter-process-communication-linux 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d7f127d21263b93ac6b5180900e8b956d6f19117 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 30 Jan 2020 11:57:33 +0800 Subject: [PATCH 0482/3057] PUB @laingke https://linux.cn/article-11832-1.html --- ...ucing the guide to inter-process communication in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200103 Introducing the guide to inter-process communication in Linux.md (98%) diff --git a/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md b/published/20200103 Introducing the guide to inter-process communication in Linux.md similarity index 98% rename from translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md rename to published/20200103 Introducing the guide to inter-process communication in Linux.md index 893e9f9ff3..91a1f7821b 100644 --- a/translated/tech/20200103 Introducing the guide to inter-process communication in Linux.md +++ b/published/20200103 Introducing the guide to inter-process communication in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11832-1.html) [#]: subject: (Introducing the guide to inter-process communication in Linux) [#]: via: (https://opensource.com/article/20/1/inter-process-communication-linux) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 96587bd45b043e49adec1728faec746222b41a14 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 30 Jan 2020 14:13:55 +0800 Subject: [PATCH 0483/3057] translated --- ...en source tools to manage your contacts.md | 145 ------------------ ...en source tools to manage your contacts.md | 143 +++++++++++++++++ 2 files changed, 143 insertions(+), 145 deletions(-) delete mode 100644 sources/tech/20200116 3 open source tools to manage your contacts.md create mode 100644 translated/tech/20200116 3 open source tools to manage your contacts.md diff --git a/sources/tech/20200116 3 open source tools to manage your contacts.md b/sources/tech/20200116 3 open source tools to manage your contacts.md deleted file mode 100644 index e763954bcc..0000000000 --- a/sources/tech/20200116 3 open source tools to manage your contacts.md +++ /dev/null @@ -1,145 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (3 open source tools to manage your contacts) -[#]: via: (https://opensource.com/article/20/1/sync-contacts-locally) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -3 open source tools to manage your contacts -====== -Access your contacts more quickly by syncing them locally. Learn how in -the sixth in our series on 20 ways to be more productive with open -source in 2020. -![Team communication, chat][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Open source tools for contact management - -In previous articles in this series, I explained how to synchronize your [mail][2] and [calendars][3] locally. Hopefully, that has sped up accessing your mail and calendar. Now I'll talk about contacts, which you can use to send mail and calendar invites. - -![abook][4] - -I have collected a lot of email addresses over the course of my, well, life so far. And managing all that data can be a bit of a pain. There are web-based services, but they aren't as fast as a local copy. - -A few days ago, I talked about [vdirsyncer][5] for managing calendars. Vdirsyncer also handles contacts using the CardDAV protocol. Vdirsyncer supports **google_contacts** and **carddav** to do contact synchronizations in addition to the **filesystem** store it uses for calendars, but the **fileext** setting will change, so you won't be trying to store contacts in calendar files. - -I added a configuration block to the config file and mirrored my contacts from Google. Extra steps are required to set it up. Once the Google setup is complete, the configuration is pretty simple: - - -``` -[pair address_sync] -a = "googlecard" -b = "localcard" -collections = ["from a", "from b"] -conflict_resolution = "a wins" - -[storage googlecard] -type = "google_contacts" -token_file = "~/.vdirsyncer/google_token" -client_id = "my_client_id" -client_secret = "my_client_secret" - -[storage localcard] -type = "filesystem" -path = "~/.calendars/Addresses/" -fileext = ".vcf" -``` - -Now when I run **vdirsyncer discover**, it finds my Google contacts, and **vdirsyncer sync** copies them to my local machine. But again, that's only half the story. Now I want to read and use the contacts. Enter [khard][6] and [abook][7]. - -![khard search][8] - -Why two applications? Each has its own use case, and in this case, more is better. Khard does for addresses what [khal][9] does for calendar entries. You'll probably want to install the latest release via pip if your distribution ships an older version. Once khard is installed, you need to create **~/.config/khard/khard.conf** because khard doesn't have a nifty configuration wizard the way khal does. Mine looks like this: - - -``` -[addressbooks] -[[addresses]] -path = ~/.calendars/Addresses/default/ - -[general] -debug = no -default_action = list -editor = vim, -i, NONE -merge_editor = vimdiff - -[contact table] -display = first_name -group_by_addressbook = no -reverse = no -show_nicknames = yes -show_uids = no -sort = last_name -localize_dates = yes - -[vcard] -preferred_version = 3.0 -search_in_source_files = yes -skip_unparsable = no -``` - -This defines the source address book (and gives it a friendly name), as well as what to display and what do use to edit contacts. Running **khard list** will list all the entries, and **khard list <[some@email.adr][10]>** will search for a specific entry. If you want to add or edit an entry, the **add** and **edit** commands launch the configured editor with the same basic template, the only difference being that the **add** template will be blank. - -![editing in khard][11] - -Abook requires you to import and export VCF files but offers some nice features for lookups. To convert your files to the abook format, first install abook and create the **~/.abook** default directory. Now tell abook to parse all the files and put them into the **~/.abook/addresses** file: - - -``` -apt install abook -ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses -``` - -Now run **abook**, and you'll have a very nice UI to browse, search, and edit the entries. Exporting them back to individual entries is a bit of a pain, so I do most of my edits with khard and have a cron job to import them into abook. - -Abook can also search on the command line and has a lot of documentation about integrating it with mail clients. For example, you can use abook for lookups in the [Notmuch][12] email client [alot][13] by adding some information to the **.config/alot/config** file: - - -``` -[accounts] -  [[Personal]] -     realname = Kevin Sonney -     address = [kevin@sonney.com][14] -     alias_regexp = kevin\[+.+@sonney.com][15] -     gpg_key = 7BB612C9 -     sendmail_command = msmtp --account=Personal -t -     # ~ expansion works -     sent_box = maildir://~/Maildir/Sent -     draft_box = maildir://~/Maildir/Drafts -    [[[abook]]] -        type = abook -``` - -And there you have it: fast lookup of your contacts to go with your mail and calendars! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/sync-contacts-locally - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) -[2]: https://opensource.com/article/20/1/sync-email-offlineimap -[3]: https://opensource.com/article/20/1/open-source-calendar -[4]: https://opensource.com/sites/default/files/uploads/productivity_6-1.png (abook) -[5]: https://github.com/pimutils/vdirsyncer -[6]: https://github.com/scheibler/khard -[7]: http://abook.sourceforge.net/ -[8]: https://opensource.com/sites/default/files/uploads/productivity_6-2.png (khard search) -[9]: https://khal.readthedocs.io/en/v0.9.2/index.html -[10]: mailto:some@email.adr -[11]: https://opensource.com/sites/default/files/uploads/productivity_6-3.png (editing in khard) -[12]: https://opensource.com/article/20/1/organize-email-notmuch -[13]: https://github.com/pazz/alot -[14]: mailto:kevin@sonney.com -[15]: mailto:+.+@sonney.com diff --git a/translated/tech/20200116 3 open source tools to manage your contacts.md b/translated/tech/20200116 3 open source tools to manage your contacts.md new file mode 100644 index 0000000000..173d743c6d --- /dev/null +++ b/translated/tech/20200116 3 open source tools to manage your contacts.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 open source tools to manage your contacts) +[#]: via: (https://opensource.com/article/20/1/sync-contacts-locally) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +用于联系人管理的开源工具 +====== +通过将联系人同步到本地从而更快访问它。在我们的 20 个使用开源提升生产力的系列的第六篇文章中了解该如何做。 +![Team communication, chat][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 用于联系人管理的开源工具 + +在本系列之前的文章中,我解释了如何在本地同步你的[邮件][2]和[日历][3]。希望这些加速了你访问邮件和日历。现在,我将讨论联系人同步,你可以使用这些发送邮件和日历邀请。 + +![abook][4] + +我目前收集了很多邮件地址。管理这些数据可能有点麻烦。有基于 Web 的服务,但它们不如本地副本快。 + +几天前,我谈到了用于管理日历的 [vdirsyncer][5]。vdirsyncer 还使用 CardDAV 协议处理联系人。vdirsyncer 除了可以使用**文件系统**存储日历外,还支持 **google_contacts** 和 **carddav** 进行联系人同步,但 **fileext** 设置将更改,因此你无法在日历文件中存储联系人。 + +我在配置文件添加了一块配置,并从 Google 镜像了我的联系人。设置它需要额外的步骤。从 Google 镜像完成后,配置非常简单: + + +``` +[pair address_sync] +a = "googlecard" +b = "localcard" +collections = ["from a", "from b"] +conflict_resolution = "a wins" + +[storage googlecard] +type = "google_contacts" +token_file = "~/.vdirsyncer/google_token" +client_id = "my_client_id" +client_secret = "my_client_secret" + +[storage localcard] +type = "filesystem" +path = "~/.calendars/Addresses/" +fileext = ".vcf" +``` + +现在,当我运行 **vdirsyncer discover** 时,它会找到我的 Google 联系人,并且 **vdirsyncer sync** 将它们复制到我的本地计算机。但同样,这只进行到一半。现在我想查看和使用联系人。输入 [khard][6] 和 [abook][7]。 + +![khard search][8] + +为什么选择两个应用?因为每个都有它自己的使用场景,在这里,越多越好。khard 用于管理地址,类似于 [khal][9] 用于管理日历条目。如果你的发行版附带了旧版本,你可能需要通过 pip 安装最新版本。安装 khard 后,你需要创建 **~/.config/khard/khard.conf**,因为 khard 没有与 khal 那样漂亮的配置向导。我的看起来像这样: + + +``` +[addressbooks] +[[addresses]] +path = ~/.calendars/Addresses/default/ + +[general] +debug = no +default_action = list +editor = vim, -i, NONE +merge_editor = vimdiff + +[contact table] +display = first_name +group_by_addressbook = no +reverse = no +show_nicknames = yes +show_uids = no +sort = last_name +localize_dates = yes + +[vcard] +preferred_version = 3.0 +search_in_source_files = yes +skip_unparsable = no +``` + +这会定义源通讯簿(并给它一个友好的名称)、显示内容和联系人编辑程序。运行 **khard list** 将列出所有条目,**khard list <[some@email.adr][10]>** 可以搜索特定条目。如果要添加或编辑条目,**add** 和 **edit** 命令将使用相同的基本模板打开配置的编辑器,唯一的区别是 **add** 命令的模板将为空。 + +![editing in khard][11] + +abook 需要你导入和导出 VCF 文件,但它为查找提供了一些不错的功能。要将文件转换为 abook 格式,请先安装 abook 并创建 **~/.abook** 默认目录。然后让 abook 解析所有文件,并将它们放入 **~/.abook/addresses** 文件中: + + +``` +apt install abook +ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses +``` + +现在运行 **abook**,你将有一个非常好的 UI 来浏览、搜索和编辑条目。将它们导出到单个文件有点痛苦,所以我用 khard 进行大部分编辑,并有一个 cron 任务将它们导入到 abook 中。 + +abook 还可在命令行中搜索,并有大量有关将其与邮件客户端集成的文档。例如,你可以在 **.config/alot/config** 文件中添加一些信息,从而在 [Nmuch][12] 的邮件客户端 [alot][13] 中使用 abook 查询联系人: + + +``` +[accounts] +  [[Personal]] +     realname = Kevin Sonney +     address = [kevin@sonney.com][14] +     alias_regexp = kevin\[+.+@sonney.com][15] +     gpg_key = 7BB612C9 +     sendmail_command = msmtp --account=Personal -t +     # ~ expansion works +     sent_box = maildir://~/Maildir/Sent +     draft_box = maildir://~/Maildir/Drafts +    [[[abook]]] +        type = abook +``` + +这样你就可以在邮件和日历中快速查找联系人了! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-contacts-locally + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) +[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[3]: https://opensource.com/article/20/1/open-source-calendar +[4]: https://opensource.com/sites/default/files/uploads/productivity_6-1.png (abook) +[5]: https://github.com/pimutils/vdirsyncer +[6]: https://github.com/scheibler/khard +[7]: http://abook.sourceforge.net/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_6-2.png (khard search) +[9]: https://khal.readthedocs.io/en/v0.9.2/index.html +[10]: mailto:some@email.adr +[11]: https://opensource.com/sites/default/files/uploads/productivity_6-3.png (editing in khard) +[12]: https://opensource.com/article/20/1/organize-email-notmuch +[13]: https://github.com/pazz/alot +[14]: mailto:kevin@sonney.com +[15]: mailto:+.+@sonney.com From 752f65fcc5bc0d503da9c9f5fe09eca8b8ee07ce Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 30 Jan 2020 14:19:20 +0800 Subject: [PATCH 0484/3057] translating --- ... this open source tool to get your local weather forecast.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200123 Use this open source tool to get your local weather forecast.md b/sources/tech/20200123 Use this open source tool to get your local weather forecast.md index 644bd80331..df44d3b659 100644 --- a/sources/tech/20200123 Use this open source tool to get your local weather forecast.md +++ b/sources/tech/20200123 Use this open source tool to get your local weather forecast.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e0168742bd38f2f803427b47dec1297be326e21a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 30 Jan 2020 19:48:17 +0800 Subject: [PATCH 0485/3057] PRF @geekpi --- ...en source tools to manage your contacts.md | 60 +++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/translated/tech/20200116 3 open source tools to manage your contacts.md b/translated/tech/20200116 3 open source tools to manage your contacts.md index 173d743c6d..01f4d57c98 100644 --- a/translated/tech/20200116 3 open source tools to manage your contacts.md +++ b/translated/tech/20200116 3 open source tools to manage your contacts.md @@ -1,32 +1,33 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (3 open source tools to manage your contacts) [#]: via: (https://opensource.com/article/20/1/sync-contacts-locally) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) -用于联系人管理的开源工具 +用于联系人管理的三个开源工具 ====== -通过将联系人同步到本地从而更快访问它。在我们的 20 个使用开源提升生产力的系列的第六篇文章中了解该如何做。 -![Team communication, chat][1] + +> 通过将联系人同步到本地从而更快访问它。在我们的 20 个使用开源提升生产力的系列的第六篇文章中了解该如何做。 + +![](https://img.linux.net.cn/data/attachment/album/202001/30/194811bbtt449zfr9zppb3.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 用于联系人管理的开源工具 -在本系列之前的文章中,我解释了如何在本地同步你的[邮件][2]和[日历][3]。希望这些加速了你访问邮件和日历。现在,我将讨论联系人同步,你可以使用这些发送邮件和日历邀请。 +在本系列之前的文章中,我解释了如何在本地同步你的[邮件][2]和[日历][3]。希望这些加速了你访问邮件和日历。现在,我将讨论联系人同步,你可以给他们发送邮件和日历邀请。 ![abook][4] 我目前收集了很多邮件地址。管理这些数据可能有点麻烦。有基于 Web 的服务,但它们不如本地副本快。 -几天前,我谈到了用于管理日历的 [vdirsyncer][5]。vdirsyncer 还使用 CardDAV 协议处理联系人。vdirsyncer 除了可以使用**文件系统**存储日历外,还支持 **google_contacts** 和 **carddav** 进行联系人同步,但 **fileext** 设置将更改,因此你无法在日历文件中存储联系人。 +几天前,我谈到了用于管理日历的 [vdirsyncer][5]。vdirsyncer 还使用 CardDAV 协议处理联系人。vdirsyncer 除了可以使用**文件系统**存储日历外,还支持通过 **google_contacts** 和 **carddav** 进行联系人同步,但 `fileext` 设置会被更改,因此你无法在日历文件中存储联系人。 我在配置文件添加了一块配置,并从 Google 镜像了我的联系人。设置它需要额外的步骤。从 Google 镜像完成后,配置非常简单: - ``` [pair address_sync] a = "googlecard" @@ -46,12 +47,11 @@ path = "~/.calendars/Addresses/" fileext = ".vcf" ``` -现在,当我运行 **vdirsyncer discover** 时,它会找到我的 Google 联系人,并且 **vdirsyncer sync** 将它们复制到我的本地计算机。但同样,这只进行到一半。现在我想查看和使用联系人。输入 [khard][6] 和 [abook][7]。 +现在,当我运行 `vdirsyncer discover` 时,它会找到我的 Google 联系人,并且 `vdirsyncer sync` 将它们复制到我的本地计算机。但同样,这只进行到一半。现在我想查看和使用联系人。需要 [khard][6] 和 [abook][7]。 ![khard search][8] -为什么选择两个应用?因为每个都有它自己的使用场景,在这里,越多越好。khard 用于管理地址,类似于 [khal][9] 用于管理日历条目。如果你的发行版附带了旧版本,你可能需要通过 pip 安装最新版本。安装 khard 后,你需要创建 **~/.config/khard/khard.conf**,因为 khard 没有与 khal 那样漂亮的配置向导。我的看起来像这样: - +为什么选择两个应用?因为每个都有它自己的使用场景,在这里,越多越好。khard 用于管理地址,类似于 [khal][9] 用于管理日历条目。如果你的发行版附带了旧版本,你可能需要通过 `pip` 安装最新版本。安装 khard 后,你需要创建 `~/.config/khard/khard.conf`,因为 khard 没有与 khal 那样漂亮的配置向导。我的看起来像这样: ``` [addressbooks] @@ -79,36 +79,34 @@ search_in_source_files = yes skip_unparsable = no ``` -这会定义源通讯簿(并给它一个友好的名称)、显示内容和联系人编辑程序。运行 **khard list** 将列出所有条目,**khard list <[some@email.adr][10]>** 可以搜索特定条目。如果要添加或编辑条目,**add** 和 **edit** 命令将使用相同的基本模板打开配置的编辑器,唯一的区别是 **add** 命令的模板将为空。 +这会定义源通讯簿(并给它一个友好的名称)、显示内容和联系人编辑程序。运行 `khard list` 将列出所有条目,`khard list ` 可以搜索特定条目。如果要添加或编辑条目,`add` 和 `edit` 命令将使用相同的基本模板打开配置的编辑器,唯一的区别是 `add` 命令的模板将为空。 ![editing in khard][11] -abook 需要你导入和导出 VCF 文件,但它为查找提供了一些不错的功能。要将文件转换为 abook 格式,请先安装 abook 并创建 **~/.abook** 默认目录。然后让 abook 解析所有文件,并将它们放入 **~/.abook/addresses** 文件中: - +abook 需要你导入和导出 VCF 文件,但它为查找提供了一些不错的功能。要将文件转换为 abook 格式,请先安装 abook 并创建 `~/.abook` 默认目录。然后让 abook 解析所有文件,并将它们放入 `~/.abook/addresses` 文件中: ``` apt install abook -ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses +ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses ``` -现在运行 **abook**,你将有一个非常好的 UI 来浏览、搜索和编辑条目。将它们导出到单个文件有点痛苦,所以我用 khard 进行大部分编辑,并有一个 cron 任务将它们导入到 abook 中。 - -abook 还可在命令行中搜索,并有大量有关将其与邮件客户端集成的文档。例如,你可以在 **.config/alot/config** 文件中添加一些信息,从而在 [Nmuch][12] 的邮件客户端 [alot][13] 中使用 abook 查询联系人: +现在运行 `abook`,你将有一个非常漂亮的 UI 来浏览、搜索和编辑条目。将它们导出到单个文件有点痛苦,所以我用 khard 进行大部分编辑,并有一个 cron 任务将它们导入到 abook 中。 +abook 还可在命令行中搜索,并有大量有关将其与邮件客户端集成的文档。例如,你可以在 `.config/alot/config` 文件中添加一些信息,从而在 [Nmuch][12] 的邮件客户端 [alot][13] 中使用 abook 查询联系人: ``` [accounts] -  [[Personal]] -     realname = Kevin Sonney -     address = [kevin@sonney.com][14] -     alias_regexp = kevin\[+.+@sonney.com][15] -     gpg_key = 7BB612C9 -     sendmail_command = msmtp --account=Personal -t -     # ~ expansion works -     sent_box = maildir://~/Maildir/Sent -     draft_box = maildir://~/Maildir/Drafts -    [[[abook]]] -        type = abook + [[Personal]] + realname = Kevin Sonney + address = kevin@sonney.com + alias_regexp = kevin\+.+@sonney.com + gpg_key = 7BB612C9 + sendmail_command = msmtp --account=Personal -t + # ~ expansion works + sent_box = maildir://~/Maildir/Sent + draft_box = maildir://~/Maildir/Drafts + [[[abook]]] + type = abook ``` 这样你就可以在邮件和日历中快速查找联系人了! @@ -120,15 +118,15 @@ via: https://opensource.com/article/20/1/sync-contacts-locally 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/ksonney [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) -[2]: https://opensource.com/article/20/1/sync-email-offlineimap -[3]: https://opensource.com/article/20/1/open-source-calendar +[2]: https://linux.cn/article-11804-1.html +[3]: https://linux.cn/article-11812-1.html [4]: https://opensource.com/sites/default/files/uploads/productivity_6-1.png (abook) [5]: https://github.com/pimutils/vdirsyncer [6]: https://github.com/scheibler/khard From cee17089ff42f63d41f7aa97469e976b45a28549 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 30 Jan 2020 19:51:30 +0800 Subject: [PATCH 0486/3057] PUB @geekpi https://linux.cn/article-11834-1.html --- .../20200116 3 open source tools to manage your contacts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200116 3 open source tools to manage your contacts.md (98%) diff --git a/translated/tech/20200116 3 open source tools to manage your contacts.md b/published/20200116 3 open source tools to manage your contacts.md similarity index 98% rename from translated/tech/20200116 3 open source tools to manage your contacts.md rename to published/20200116 3 open source tools to manage your contacts.md index 01f4d57c98..a1862377d8 100644 --- a/translated/tech/20200116 3 open source tools to manage your contacts.md +++ b/published/20200116 3 open source tools to manage your contacts.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11834-1.html) [#]: subject: (3 open source tools to manage your contacts) [#]: via: (https://opensource.com/article/20/1/sync-contacts-locally) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From f4550f2a813cd992128e1e307baf73a1be8e149c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 30 Jan 2020 21:57:47 +0800 Subject: [PATCH 0487/3057] APL --- sources/tech/20200109 My favorite Bash hacks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200109 My favorite Bash hacks.md b/sources/tech/20200109 My favorite Bash hacks.md index 857f10e160..647b83a21a 100644 --- a/sources/tech/20200109 My favorite Bash hacks.md +++ b/sources/tech/20200109 My favorite Bash hacks.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d8d6f0eed0b8f0aee178c4ad5aff7723a5d2925c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 30 Jan 2020 23:18:37 +0800 Subject: [PATCH 0488/3057] TSL --- .../tech/20200109 My favorite Bash hacks.md | 142 ------------------ .../tech/20200109 My favorite Bash hacks.md | 136 +++++++++++++++++ 2 files changed, 136 insertions(+), 142 deletions(-) delete mode 100644 sources/tech/20200109 My favorite Bash hacks.md create mode 100644 translated/tech/20200109 My favorite Bash hacks.md diff --git a/sources/tech/20200109 My favorite Bash hacks.md b/sources/tech/20200109 My favorite Bash hacks.md deleted file mode 100644 index 647b83a21a..0000000000 --- a/sources/tech/20200109 My favorite Bash hacks.md +++ /dev/null @@ -1,142 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (My favorite Bash hacks) -[#]: via: (https://opensource.com/article/20/1/bash-scripts-aliases) -[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) - -My favorite Bash hacks -====== -Improve your productivity with aliases and other shortcuts for the -things you forget too often. -![bash logo on green background][1] - -When you work with computers all day, it's fantastic to find repeatable commands and tag them for easy use later on. They all sit there, tucked away in **~/.bashrc** (or ~/.zshrc for [Zsh users][2]), waiting to help improve your day! - -In this article, I share some of my favorite of these helper commands for things I forget a lot, in hopes that they will save you, too, some heartache over time. - -### Say when it's over - -When I'm using longer-running commands, I often multitask and then have to go back and check if the action has completed. But not anymore, with this helpful invocation of **say** (this is on MacOS; change for your local equivalent): - - -``` -function looooooooong { -    START=$(date +%s.%N) -    $* -    EXIT_CODE=$? -    END=$(date +%s.%N) -    DIFF=$(echo "$END - $START" | bc) -    RES=$(python -c "diff = $DIFF; min = int(diff / 60); print('%s min' % min)") -    result="$1 completed in $RES, exit code $EXIT_CODE." -    echo -e "\n⏰  $result" -    ( say -r 250 $result 2>&1 > /dev/null & ) -} -``` - -This command marks the start and end time of a command, calculates the minutes it takes, and speaks the command invoked, the time taken, and the exit code. I find this super helpful when a simple console bell just won't do. - -### Install helpers - -I started using Ubuntu back in the Lucid days, and one of the first things I needed to learn was how to install packages. And one of the first aliases I ever added was a helper for this (named based on the memes of the day): - - -``` -`alias canhas="sudo apt-get install -y"` -``` - -### GNU Privacy Guard (GPG) signing - -On the off chance I have to sign a [GPG][3] email without having an extension or application to do it for me, I drop down into the command line and use these terribly dorky aliases: - - -``` -alias gibson="gpg --encrypt --sign --armor" -alias ungibson="gpg --decrypt" -``` - -### Docker - -There are many Docker commands, but there are even more **docker compose** commands. I used to forget the **\--rm** flags, but not anymore with these useful aliases: - - -``` -alias dc="docker-compose" -alias dcr="docker-compose run --rm" -alias dcb="docker-compose run --rm --build" -``` - -### gcurl helper for Google Cloud - -This one is relatively new to me, but it's [heavily documented][4]. gcurl is an alias to ensure you get all the correct flags when using local curl commands with authentication headers when working with Google Cloud APIs.  - -### Git and ~/.gitignore - -I work a lot in Git, so I have a special section dedicated to Git helpers. - -One of my most useful helpers is one I use to clone GitHub repos. Instead of having to run: - - -``` -`git clone git@github.com:org/repo /Users/glasnt/git/org/repo` -``` - -I set up a clone function: - - -``` -clone(){ -    echo Cloning $1 to ~/git/$1 -    cd ~/git -    git clone [git@github.com][5]:$1 $1 -    cd $1 -} -``` - -Even though I always forget and giggle any time I'm diving into my **~/.bashrc** file, I also have my "refresh upstream" command: - - -``` -`alias yoink="git checkout master && git fetch upstream master && git merge upstream/master"` -``` - -Another helper for Git-ville is a global ignore file. In your **git config --global --list** you should see a **core.excludesfile**. If not, [create one][6], and fill it full of things that you always put into your individual **.gitignore** files. As a Python developer on MacOS, for me this is: - - -``` -.DS_Store     # macOS clutter -venv/         # I never want to commit my virtualenv -*.egg-info/*  # ... nor any locally compiled packages -__pycache__   # ... or source -*.swp         # ... nor any files open in vim -``` - -You can find other suggestions over on [Gitignore.io][7] or on the [Gitignore repo][8] on GitHub. - -### Your turn - -What are your favorite helper commands? Please share them in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/bash-scripts-aliases - -作者:[Katie McLaughlin][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/glasnt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) -[2]: https://opensource.com/article/19/9/getting-started-zsh -[3]: https://gnupg.org/ -[4]: https://cloud.google.com/service-infrastructure/docs/service-control/getting-started -[5]: mailto:git@github.com -[6]: https://help.github.com/en/github/using-git/ignoring-files#create-a-global-gitignore -[7]: https://www.gitignore.io/ -[8]: https://github.com/github/gitignore diff --git a/translated/tech/20200109 My favorite Bash hacks.md b/translated/tech/20200109 My favorite Bash hacks.md new file mode 100644 index 0000000000..8106ebaf4c --- /dev/null +++ b/translated/tech/20200109 My favorite Bash hacks.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My favorite Bash hacks) +[#]: via: (https://opensource.com/article/20/1/bash-scripts-aliases) +[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) + +我珍藏的 Bash 秘籍 +====== + +> 通过别名和其他捷径来提高你经常忘记的那些事情的效率。 + +![bash logo on green background][1] + +要是你整天使用计算机,如果能找到可重复的命令并标记它们,以便以后轻松使用那就太棒了。它们全都在那里,藏在 `~/.bashrc` 中(或 [zsh 用户][2]的 `~/.zshrc` 中),等待着改善你的生活! + +在本文中,我分享了我最喜欢的这些辅助命令,它们可以帮助我避免一些遗忘的事情,也希望可以帮助到你,以及为你解决一些越来越头疼的问题。 + +### 完事说一声 + +当我执行一个需要长时间运行的命令时,我经常采用多任务的方式,然后必须回过去检查该操作是否已完成。 然而通过有用的 `say`,现在就不用再这样了(这是在 MacOS 上;更改为本地环境等效的方式): + +``` +function looooooooong { + START=$(date +%s.%N) + $* + EXIT_CODE=$? + END=$(date +%s.%N) + DIFF=$(echo "$END - $START" | bc) + RES=$(python -c "diff = $DIFF; min = int(diff / 60); print('%s min' % min)") + result="$1 completed in $RES, exit code $EXIT_CODE." + echo -e "\n⏰ $result" + ( say -r 250 $result 2>&1 > /dev/null & ) +} +``` + +这个命令会标记命令的开始和结束时间,计算所需的分钟数,并说出调用的命令、花费的时间和退出码。当简单的控制台铃声无法使用时,我发现这个超级有用。 + +### 安装小助手 + +我在小的时候就开始使用 Ubuntu,而我需要学习的第一件事是如何安装软件包。我曾经添加的第一个别名之一是它的助手(根据当天的流行梗命名的): + +``` +alias canhas="sudo apt-get install -y" +``` + +### GPG 签名 + +有时候,我必须在没有扩展程序或应用程序的情况下给电子邮件签署 [GPG][3] 签名,我会跳到命令行并使用以下令人讨厌的别名: + +``` +alias gibson="gpg --encrypt --sign --armor" +alias ungibson="gpg --decrypt" +``` + +### Docker + +Docker 命令很多,但是 Docker compose 命令更多。我曾经使用这些别名来忘记 `--rm` 标志,但是现在不再使用这些有用的别名了: + +``` +alias dc="docker-compose" +alias dcr="docker-compose run --rm" +alias dcb="docker-compose run --rm --build" +``` + +### Google Cloud 的 gcurl 辅助程序 + +对于我来说,Google Cloud 是一个相对较新的东西,而它有[极多的文档][4]。gcurl 是一个别名,可确保在用带有身份验证标头的本地 curl 命令连接 Google Cloud API 时,可以获得所有正确的标头。 + +### Git 和 ~/.gitignore + +我工作中用 Git 很多,因此我有一个专门的部分来介绍 Git 的辅助程序。 + +我最有用的辅助程序之一是我用来克隆 GitHub 存储库的助手。你不必运行: + +``` +git clone git@github.com:org/repo /Users/glasnt/git/org/repo +``` + +我设置了一个克隆函数: + +``` +clone(){ +    echo Cloning $1 to ~/git/$1 +    cd ~/git +    git clone git@github.com:$1 $1 +    cd $1 +} +``` + +即使每次进入 `~/.bashrc` 文件时,我总是会忘记和傻笑,我也有一个“刷新上游”命令: + +``` +alias yoink="git checkout master && git fetch upstream master && git merge upstream/master" +``` + +给 Git 人的另一个辅助程序是全局忽略文件。在你的 `git config --global --list` 中,你应该看到一个 `core.excludesfile`。如果没有,请[创建一个][6],然后将你总是放到各个 `.gitignore` 文件中的内容填满它。作为 MacOS 上的 Python 开发人员,对我来说,这写内容是: + + +``` +.DS_Store     # macOS clutter +venv/         # I never want to commit my virtualenv +*.egg-info/*  # ... nor any locally compiled packages +__pycache__   # ... or source +*.swp         # ... nor any files open in vim +``` + +你可以在 [Gitignore.io][7] 或 GitHub 上的 [Gitignore 存储库][8]上找到其他建议。 + +### 轮到你了 + +你最喜欢的辅助程序命令是什么?请在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/bash-scripts-aliases + +作者:[Katie McLaughlin][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/glasnt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/19/9/getting-started-zsh +[3]: https://gnupg.org/ +[4]: https://cloud.google.com/service-infrastructure/docs/service-control/getting-started +[5]: mailto:git@github.com +[6]: https://help.github.com/en/github/using-git/ignoring-files#create-a-global-gitignore +[7]: https://www.gitignore.io/ +[8]: https://github.com/github/gitignore From 6c6daca749f9bee15b55e23df30c0c08b5749d87 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 31 Jan 2020 00:58:08 +0800 Subject: [PATCH 0489/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200130=20Run?= =?UTF-8?q?=20your=20network=20with=20open=20source=20software?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200130 Run your network with open source software.md --- ... your network with open source software.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20200130 Run your network with open source software.md diff --git a/sources/tech/20200130 Run your network with open source software.md b/sources/tech/20200130 Run your network with open source software.md new file mode 100644 index 0000000000..13137ce392 --- /dev/null +++ b/sources/tech/20200130 Run your network with open source software.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run your network with open source software) +[#]: via: (https://opensource.com/article/20/1/open-source-networking) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Run your network with open source software +====== +VyOS is an easy-to-install open source router and firewall solution +![Multi-colored and directional network computer cables][1] + +Way back in 2005, a company called Vyatta was founded by Allan Leinwand. It offered the first commercially supported, open source router and firewall solution. Named after the ancient Sanskrit for "open," the company's goal of bringing open source networking products to the market was so successful that it was purchased by competitor Brocade. This effectively killed Vyatta, but because Vyatta's product was open source, it didn't stop it. As it turns out, Vyatta's software-defined networking capabilities have been continued and developed as [VyOS][2]. + +The VyOS distribution is based on Debian Linux, with source code available from a [Git repository][3] and a [rolling release ISO][4]. For mission-critical applications, there are [long-term support releases and support contracts][5]. + +### Building a network + +Networking has changed since 2005, and thanks to the VyOS project, so has the software that drives it. After learning that VyOS was continuing the work of Vyatta, I downloaded the ISO to try it out. The installation process was easier for me than the normal Debian install, which is a simple task. VyOS doesn't boot into a graphical interface, but to a text console. It's just you and a bunch of configuration files, just like you might expect from a serious router. + +The default install of VyOS provides no default configuration. It's entirely up to you to build the network you want to run. Depending on your point of view, that's either refreshing or frustrating, but it gives you an idea of the intended audience: VyOS is built for network engineers who've mapped out their desired topography and are capable of creating it with some subnet calculations and text definitions. + +### The VyOS configure command + +That said, VyOS isn't just a re-branded Debian release. One of its key features is its **configure** command, an interactive tool for defining network definitions that are applied only after you commit them. In addition to feeling familiar to users accustomed to IOS and similar toolchains, this allows you to configure your network even as the router continues its normal operations. Nothing is final until you type **commit**. + +Once you've tested a committed network change, you can use the **save** command to permanently store your configuration files for backup or migration to other VyOS machines. + +You enter configuration mode with the **configure** command. There are too many possible network configurations to go over **configure** or basic networking tasks here, but the syntax is generally intuitive and predictable. For instance, to enable SSH management over port 22212 of your router: + + +``` +`# set service ssh port '22212'` +``` + +To set the network interface card (NIC) **eth1** to an internal IP address and to create a description identifying it as the default gateway: + + +``` +# set interfaces ethernet eth1 address '10.1.0.1/24' +# set interfaces ethernet eth1 description 'INSIDE' +``` + +To set the public IP of NIC **eth0** and describe it as the world-facing interface: + + +``` +# set interfaces ethernet eth0 address dhcp +# set interfaces ethernet eth0 description 'OUTSIDE' +``` + +To activate network address translation (NAT), it's the same structure: + + +``` +set nat source rule 100 outbound-interface 'eth0' +set nat source rule 100 source address '10.1.0.0/24' +set nat source rule 100 translation address masquerade +``` + +Assuming those are the only tasks you have for now, commit and save: + + +``` +# commit +# save && exit +Saving configuration to '/config/config.boot'... +Done +$ +``` + +Although that's probably not everything you need to do in real life, it gives you an idea of the direct simplicity that VyOS provides. You don't have to deal with "reverse engineering" confusing graphical interfaces nor scrubbing through verbose configuration files for a poorly named key. You have a unified interface for every task, whether it's setting up a firewall, implementing DHCP, DNS, quality of service, VPN gateways, IPv6, or whatever else. + +### Professional networking appliance + +VyOS might not be a beginner-level router distribution, but it's a great tool to have on hand even if you're just starting out. There's no better way to learn the basics of networking than to have an open source router available for manipulation and testing. It's the 21st century, after all; you can set up a computer lab consisting of virtual clients networked to one another through a virtual VyOS instance entirely within [GNOME Boxes][6] for $0. You can learn advanced networking concepts and solutions armed with little more than a Linux computer and the excellent [VyOS documentation][7]. + +If you're already a networking professional, then take a look at VyOS. You'll find its philosophy on configuration simple and its configure tool efficient. + +Connecting your Linux computer to a network is pretty straightforward, except when it is not. In... + +Jay Turner gives tips for attracting and maintaining an open source community around networking. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-networking + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: http://vyos.io +[3]: https://github.com/vyos/ +[4]: https://www.vyos.io/rolling-release/ +[5]: https://vyos.io/subscriptions/ +[6]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[7]: https://vyos.readthedocs.io/en/latest/index.html From 0f8c44bca2773a4e063c8e5f97445804b9d8c107 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 31 Jan 2020 00:58:42 +0800 Subject: [PATCH 0490/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200130=204=20?= =?UTF-8?q?open=20source=20productivity=20tools=20on=20my=20wishlist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200130 4 open source productivity tools on my wishlist.md --- ...ource productivity tools on my wishlist.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20200130 4 open source productivity tools on my wishlist.md diff --git a/sources/tech/20200130 4 open source productivity tools on my wishlist.md b/sources/tech/20200130 4 open source productivity tools on my wishlist.md new file mode 100644 index 0000000000..d36f020aa3 --- /dev/null +++ b/sources/tech/20200130 4 open source productivity tools on my wishlist.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 open source productivity tools on my wishlist) +[#]: via: (https://opensource.com/article/20/1/open-source-productivity-tools) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +4 open source productivity tools on my wishlist +====== +Find out what the open source world needs to work on in the final +article in our series on 20 ways to be more productive with open source +in 2020. +![Two diverse hands holding a globe][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### But what about… + +When searching for productivity apps, I never find everything I want, and I almost always miss something great that my readers share with me. So, as I bring this series to a close, it's time [again][2] to talk about some of the topics I failed to cover in this year's series. + +![Desktop with Joplin, Emacs, and Firefox][3] + +#### Chatting in Vim + +I tried. I really, _really_ tried to get chat to work in Vim, but it was not to be. The one package I was able to find, [VimIRC.vim][4], never did work for me, and I tried for a few days to no avail. The other option I explored was [Irc it][5], which requires a lot more [effort to set up][6] than I could fit into my available space or time. I tried, I really did, and for the Vim users out there, I'm sorry I wasn't able to get something workable for you. + +#### Org mode + +![Org Mode in Emacs][7] + +I love [Org Mode][8], and I use it daily. I could spend several days _just_ talking about Org. It provides basic [task tracking][9]; Google [calendar][10] sync and [CalFW][11] integration; rich text documents, websites, and presentations; linking to all the things; and; and; and… + +I expect you will hear more from me about Org in 2020 because it really is pretty cool. + +#### GUI programs + +In 2019's productivity series, I shared a lot of programs with a graphical user interface (GUI), and this year almost all are command-line applications. There are some great graphical programs to help with some of the things I talked about this year—[mail][12] programs to talk to Maildir mailboxes, calendar programs to read local calendar files, [weather][13] apps, and so on. I even tried several new-to-me things to see if they would fit with the overall theme. With the exception of [twin][14], I didn't feel that there were any GUI programs that were new (to me) or notable (again, to me) to write about this year. And that brings me to… + +#### Mobile + +More and more people are using tablets (sometimes in conjunction with a laptop) as their primary device. I use my phone for most of my social media and instant messaging, and, more often than not, I use my tablet (OK, let's be honest, _tablets_) to read or browse the web. It isn't that open source mobile apps aren't out there, that's for sure, but they didn't fit with my themes this year. There is a lot going on with open source and mobile apps, and I'm watching carefully for things that can help me be more productive on my phone and tablet. + +### Your turn + +Thank you very much for reading the series this year. Please comment with what you think I missed or need to look at for 2021. And as I say on the [Productivity Alchemy][15] podcast: "Remember folks: Stay productive!" + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-productivity-tools + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe) +[2]: https://opensource.com/article/19/1/productivity-tool-wish-list +[3]: https://opensource.com/sites/default/files/uploads/productivity_20-1.png (Desktop with Joplin, Emacs, and Firefox) +[4]: https://github.com/vim-scripts/VimIRC.vim +[5]: https://tools.suckless.org/ii/ +[6]: https://www.reddit.com/r/vim/comments/48t7ws/vim_ii_irc_client_xpost_runixporn/d0macnl/ +[7]: https://opensource.com/sites/default/files/uploads/productivity_20-2.png (Org Mode in Emacs) +[8]: https://orgmode.org/ +[9]: https://opensource.com/article/20/1/open-source-to-do-list +[10]: https://opensource.com/article/20/1/open-source-calendar +[11]: https://github.com/kiwanami/emacs-calfw +[12]: https://opensource.com/article/20/1/organize-email-notmuch +[13]: https://opensource.com/article/20/1/open-source-weather-forecast +[14]: https://github.com/cosmos72/twin +[15]: https://productivityalchemy.com From 795c86f607c757ee21796833f0ac77d8d20fd1f7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 31 Jan 2020 00:59:23 +0800 Subject: [PATCH 0491/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200130=20NSA?= =?UTF-8?q?=20cloud=20advice,=20Facebook=20open=20source=20year=20in=20rev?= =?UTF-8?q?iew,=20and=20more=20industry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md --- ...ear in review, and more industry trends.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/tech/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md diff --git a/sources/tech/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md b/sources/tech/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md new file mode 100644 index 0000000000..7a3a40d845 --- /dev/null +++ b/sources/tech/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NSA cloud advice, Facebook open source year in review, and more industry trends) +[#]: via: (https://opensource.com/article/20/1/nsa-facebook-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +NSA cloud advice, Facebook open source year in review, and more industry trends +====== +A weekly look at open source community and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [Facebook open source year in review][2] + +> Last year was a busy one for our [open source][3] engineers. In 2019 we released 170 new open source projects, bringing our portfolio to a total of 579 [active repositories][3]. While it’s important for our internal engineers to contribute to these projects (and they certainly do — with more than 82,000 commits this year), we are also incredibly grateful for the massive support from external contributors. Approximately 2,500 external contributors committed more than 32,000 changes. In addition to these contributions, nearly 93,000 new people starred our projects this year, growing the most important component of any open source project — the community! Facebook Open Source would not be here without your contributions, so we want to thank you for your participation in 2019. + +**The impact**: Facebook got ~33% more changes than they would have had they decided to develop these as closed projects. Organizations addressing similar challenges got an 82,000-commit boost in exchange. What a clear illustration of the business impact of open source development. + +## [Cloud advice from the NSA][4] + +> This document divides cloud vulnerabilities into four classes (misconfiguration, poor access control, shared tenancy vulnerabilities, and supply chain vulnerabilities) that encompass the vast majority of known vulnerabilities. Cloud customers have a critical role in mitigating misconfiguration and poor access control, but can also take actions to protect cloud resources from the exploitation of shared tenancy and supply chain vulnerabilities. Descriptions of each vulnerability class along with the most effective mitigations are provided to help organizations lock down their cloud resources. By taking a risk-based approach to cloud adoption, organizations can securely benefit from the cloud’s extensive capabilities. + +**The impact**: The Fear, Uncertainty, and Doubt (FUD) that has been associated with cloud adoption is being debunked more all the time. None other then the US Department of Defense has done a lot of the thinking so you don't have to, and there is a good chance that their concerns are at least as dire as yours are. + +## [With Kubernetes, China Minsheng Bank transformed its legacy applications][5] + +> But all of CMBC’s legacy applications—for example, the core banking system, payment systems, and channel systems—were written in C and Java, using traditional architecture. “We wanted to do distributed applications because in the past we used VMs in our own data center, and that was quite expensive and with low resource utilization rate,” says Zhang. “Our biggest challenge is how to make our traditional legacy applications adaptable to the cloud native environment.” So far, around 20 applications are running in production on the Kubernetes platform, and 30 new applications are in active development to adopt the Kubernetes platform. + +**The impact**: This illustrates nicely the challenges and opportunities facing businesses in a competitive environment, and suggests a common adoption pattern. Do new stuff the new way, and move the old stuff as it makes sense. + +## [The '5 Rs' of the move to cloud native: Re-platform, re-host, re-factor, replace, retire][6] + +> The bottom line is that telcos and service providers will go cloud native when it is cheaper for them to migrate to the cloud and pay cloud costs than it is to remain in the data centre. That time is now and by adhering to the "5 Rs" of the move to cloud native, Re-platform, Re-host, Re-factor, Replace and/or Retire, the path is open, clearly marked and the goal eminently achievable. + +**The impact**: Cloud-native is basically used as a synonym for open source in this interview; there is no other type of technology that will deliver the same lift. + +## [Fedora CoreOS out of preview][7] + +> Fedora CoreOS is a new Fedora Edition built specifically for running containerized workloads securely and at scale. It’s the successor to both [Fedora Atomic Host][8] and [CoreOS Container Linux][9] and is part of our effort to explore new ways of assembling and updating an OS. Fedora CoreOS combines the provisioning tools and automatic update model of Container Linux with the packaging technology, OCI support, and SELinux security of Atomic Host.  For more on the Fedora CoreOS philosophy, goals, and design, see the [announcement of the preview release][10]. + +**The impact**: Collapsing these two branches of the Linux family tree into one another moves the state of the art forward for everyone (once you get through the migration). + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/nsa-facebook-more-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://opensource.com/article/20/1/hybrid-developer-future-industry-trends +[3]: https://opensource.facebook.com/ +[4]: https://media.defense.gov/2020/Jan/22/2002237484/-1/-1/0/CSI-MITIGATING-CLOUD-VULNERABILITIES_20200121.PDF +[5]: https://www.cncf.io/blog/2020/01/23/with-kubernetes-china-minsheng-bank-transformed-its-legacy-applications-and-moved-into-ai-blockchain-and-big-data/ +[6]: https://www.telecomtv.com/content/cloud-native/the-5-rs-of-the-move-to-cloud-native-re-platform-re-host-re-factor-replace-retire-37473/ +[7]: https://fedoramagazine.org/fedora-coreos-out-of-preview/ +[8]: https://www.projectatomic.io/ +[9]: https://coreos.com/os/docs/latest/ +[10]: https://fedoramagazine.org/introducing-fedora-coreos/ From c2ac0c1d9a30ad4f11bee889bb4a91a2e9c61afd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 31 Jan 2020 09:40:28 +0800 Subject: [PATCH 0492/3057] Rename sources/tech/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md to sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md --- ...cebook open source year in review, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md (100%) diff --git a/sources/tech/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md b/sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md similarity index 100% rename from sources/tech/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md rename to sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md From 104ab55186df5c7f53d73bb13ea3eabf7b7c356d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 31 Jan 2020 10:33:38 +0800 Subject: [PATCH 0493/3057] translated --- ... open source chat tool to rule them all.md | 44 ++++--- ... open source chat tool to rule them all.md | 107 ++++++++++++++++++ 2 files changed, 128 insertions(+), 23 deletions(-) create mode 100644 translated/tech/20200119 One open source chat tool to rule them all.md diff --git a/sources/tech/20200119 One open source chat tool to rule them all.md b/sources/tech/20200119 One open source chat tool to rule them all.md index 25f6728c84..2a4a6d52b4 100644 --- a/sources/tech/20200119 One open source chat tool to rule them all.md +++ b/sources/tech/20200119 One open source chat tool to rule them all.md @@ -7,63 +7,61 @@ [#]: via: (https://opensource.com/article/20/1/open-source-chat-tool) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) -One open source chat tool to rule them all +一个管理所有聊天的开源聊天工具 ====== -BitlBee brings multiple chat applications into a single interface. Find -out how to set up and use BitlBee in the ninth in our series on 20 ways -to be more productive with open source in 2020. +BitlBee 将多个聊天应用集合到一个界面中。在我们的 20 个使用开源提升生产力的系列的第九篇文章中了解如何设置和使用 BitlBee。 ![Person using a laptop][1] -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 -### Bring all your chats into one interface with BitlBee +### 将所有聊天都放到 BitlBee 中 -Instant messaging and chat have become a staple of the online world. And if you are like me, you probably have about five or six different apps running to talk to your friends, co-workers, and others. It really is a pain to keep up with it all. Thankfully, you can use one app (OK, two apps) to consolidate a lot of those chats into a single point. +即时消息和聊天已经成为网络世界的主要内容。如果你像我一样,你可能打开五六个不同的应用与你的朋友、同事和其他人交谈。跟上所有聊天真的很痛苦。谢天谢地,你可以使用一个应用(好吧,是两个)将这些聊天整个到一个地方。 ![BitlBee on XChat][2] -[BitlBee][3] is an application that you run as a service that can bridge a standard IRC client with a whole bunch of messaging services. And since it is essentially an IRC server, you have a wealth of clients to choose from. +[BitlBee][3] 是作为服务运行的应用,它可以将标准的 IRC 客户端与大量的消息服务进行桥接。而且,由于它本质上是 IRC 服务器,因此你可以选择很多客户端。 -BitlBee is included with almost all Linux distributions. Installing on Ubuntu (my Linux desktop of choice) goes something like this: +BitlBee 几乎包含在所有 Linux 发行版中。在 Ubuntu 上安装(我选择的 Linux 桌面),类似这样: ``` `sudo apt install bitlbee-libpurple` ``` -On  other distributions, the name of the package may be slightly different, but a search for _bitlbee_ should reveal your options. +在其他发行版上,包名可能略有不同,但搜索 _bitlbee_ 应该就能看到。 -You'll notice I use the libpurple version of BitlBee. This version allows me to use all the protocols available in the [libpurple][4] instant messaging library, which was originally developed for [Pidgin][5]. +你会注意到我用的 libpurple 版的 BitlBee。这个版本能让我使用 [libpurple][4] 即时消息库中提供的所有协议,该库最初是为 [Pidgin][5] 开发的。 -Once the package is installed, the service should start automatically. Now, using an IRC client ([XChat][6] in these pictures), I can connect to the service on port 6667 (the standard IRC port). +安装完成后,服务应会自动启动。现在,使用一个 IRC 客户端(图片中为 [XChat][6]),我可以连接到端口 6667(标准 IRC 端口)上的服务。 ![Initial BitlBee connection][7] -You will be automatically connected to the control channel **&bitlbee**. This channel is unique to you—every person gets their own on multi-user systems. This is where you can configure the services. +你将自动连接到控制频道和 **bitlbee**。此频道对于你是独一无二的,每个人在多用户系统上都有自己的频道。在这里你可以配置服务。 -The full documentation is available at any time by typing **help** in the control channel. Explore here, then register an account on the server with the **register** command. +在控制频道中输入 **help**,你可以随时获得完整的文档。浏览它,然后使用 **register** 命令在服务器上注册帐户。 ``` `register ` ``` -Now, any configuration changes you make on the server—IM accounts, settings, etc.—will be saved when you type **save**. Whenever you connect, use **identify <mypassword>** to connect to your account and load all those settings. +现在,你在服务器上所做的任何配置更改(IM 帐户、设置等)都将在输入 **save** 时保存。每当你连接时,使用 **identify <mypassword>** 连接到你的帐户并加载这些设置。 ![purple settings][8] -The command **help purple** will show you all the available protocols that libpurple provides. For example, I've installed the [**telegram-purple**][9] package, which adds the ability to connect to Telegram. I can add an account by using my phone number with the **account add** command. +命令 **help purple** 将显示 libpurple 提供的所有可用协议。例如,我安装了 [**telegram-purple**][9] 包,它增加了连接到 Telegram 的能力。我可以使用 **account add** 命令将我的电话号码作为帐户添加。 ``` `account add telegram +15555555` ``` -BitlBee will show that it has added the account. You can list your accounts with **account list**. Since I only have one account, I can log into it with **account 0 on**, and it will go through the Telegram login process, list all my friends and chats, and I am good to go. +BitlBee 将显示它已添加帐户。你可以使用 **account list** 列出你的帐户。因为我只有一个帐户,我可以通过 **account 0 on** 登录,它会进行 Telegram 登录,列出我所有的朋友和聊天,接下来就能正常聊天了。 -But what about Slack, one of the most common chat systems out there? Well, you can install the [**slack-libpurple**][10] plugin, and do the same for Slack. If you aren't comfortable compiling and installing things, this may not be for you. +但是,对于 Slack 这个最常见的聊天系统之一呢?你可以安装 [**slack-libpurple**][10] 插件,并且对 Slack 执行同样的操作。如果你不愿意编译和安装这些,这可能不适合你。 -Follow the instructions on the plugin page, and after you have installed it, restart the BitlBee service. Now when you run **help purple**, Slack should be listed. Adding a Slack account happens the same as with all the other protocols. +按照插件页面上的说明操作,安装后重新启动 BitlBee 服务。现在,当你运行 **help purple** 时,应该会列出 Slack。像其他协议一样添加一个 Slack 帐户。 ``` @@ -72,16 +70,16 @@ account 1 set password my_legcay_API_token account 1 on ``` -And what do you know? You're connected to Slack, and you can add the Slack channels you're interested in with the **chat add** command. For example: +你知道么,你已经连接到 Slack 中,你可以通过 **chat add** 命令添加你感兴趣的 Slack 频道。比如: ``` `chat add 1 happyparty` ``` -adds the Slack channel happyparty as the local channel #happyparty. You can use the standard IRC **/join** command to access the channel now. Pretty cool. +将 Slack 频道 happyparty 添加为本地频道 #happyparty。现在可以使用标准 IRC **/join** 命令访问该频道。这很酷。 -BitlBee and an IRC client help me keep (most of) my chats and instant messages in a single place and reduces my distractions because I no longer have to find and switch to whichever app just pinged me. +BitlBee 和 IRC 客户端帮助我的(大部分)聊天和即时消息保存在一个地方,并减少了我的分心,因为我不再需要查找并切换到任何一个刚刚找我的应用上。 -------------------------------------------------------------------------------- @@ -89,7 +87,7 @@ via: https://opensource.com/article/20/1/open-source-chat-tool 作者:[Kevin Sonney][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20200119 One open source chat tool to rule them all.md b/translated/tech/20200119 One open source chat tool to rule them all.md new file mode 100644 index 0000000000..2a4a6d52b4 --- /dev/null +++ b/translated/tech/20200119 One open source chat tool to rule them all.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (One open source chat tool to rule them all) +[#]: via: (https://opensource.com/article/20/1/open-source-chat-tool) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +一个管理所有聊天的开源聊天工具 +====== +BitlBee 将多个聊天应用集合到一个界面中。在我们的 20 个使用开源提升生产力的系列的第九篇文章中了解如何设置和使用 BitlBee。 +![Person using a laptop][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 将所有聊天都放到 BitlBee 中 + +即时消息和聊天已经成为网络世界的主要内容。如果你像我一样,你可能打开五六个不同的应用与你的朋友、同事和其他人交谈。跟上所有聊天真的很痛苦。谢天谢地,你可以使用一个应用(好吧,是两个)将这些聊天整个到一个地方。 + +![BitlBee on XChat][2] + +[BitlBee][3] 是作为服务运行的应用,它可以将标准的 IRC 客户端与大量的消息服务进行桥接。而且,由于它本质上是 IRC 服务器,因此你可以选择很多客户端。 + +BitlBee 几乎包含在所有 Linux 发行版中。在 Ubuntu 上安装(我选择的 Linux 桌面),类似这样: + + +``` +`sudo apt install bitlbee-libpurple` +``` + +在其他发行版上,包名可能略有不同,但搜索 _bitlbee_ 应该就能看到。 + +你会注意到我用的 libpurple 版的 BitlBee。这个版本能让我使用 [libpurple][4] 即时消息库中提供的所有协议,该库最初是为 [Pidgin][5] 开发的。 + +安装完成后,服务应会自动启动。现在,使用一个 IRC 客户端(图片中为 [XChat][6]),我可以连接到端口 6667(标准 IRC 端口)上的服务。 + +![Initial BitlBee connection][7] + +你将自动连接到控制频道和 **bitlbee**。此频道对于你是独一无二的,每个人在多用户系统上都有自己的频道。在这里你可以配置服务。 + +在控制频道中输入 **help**,你可以随时获得完整的文档。浏览它,然后使用 **register** 命令在服务器上注册帐户。 + + +``` +`register ` +``` + +现在,你在服务器上所做的任何配置更改(IM 帐户、设置等)都将在输入 **save** 时保存。每当你连接时,使用 **identify <mypassword>** 连接到你的帐户并加载这些设置。 + +![purple settings][8] + +命令 **help purple** 将显示 libpurple 提供的所有可用协议。例如,我安装了 [**telegram-purple**][9] 包,它增加了连接到 Telegram 的能力。我可以使用 **account add** 命令将我的电话号码作为帐户添加。 + + +``` +`account add telegram +15555555` +``` + +BitlBee 将显示它已添加帐户。你可以使用 **account list** 列出你的帐户。因为我只有一个帐户,我可以通过 **account 0 on** 登录,它会进行 Telegram 登录,列出我所有的朋友和聊天,接下来就能正常聊天了。 + +但是,对于 Slack 这个最常见的聊天系统之一呢?你可以安装 [**slack-libpurple**][10] 插件,并且对 Slack 执行同样的操作。如果你不愿意编译和安装这些,这可能不适合你。 + +按照插件页面上的说明操作,安装后重新启动 BitlBee 服务。现在,当你运行 **help purple** 时,应该会列出 Slack。像其他协议一样添加一个 Slack 帐户。 + + +``` +account add slack [ksonney@myslack.slack.com][11] +account 1 set password my_legcay_API_token +account 1 on +``` + +你知道么,你已经连接到 Slack 中,你可以通过 **chat add** 命令添加你感兴趣的 Slack 频道。比如: + + +``` +`chat add 1 happyparty` +``` + +将 Slack 频道 happyparty 添加为本地频道 #happyparty。现在可以使用标准 IRC **/join** 命令访问该频道。这很酷。 + +BitlBee 和 IRC 客户端帮助我的(大部分)聊天和即时消息保存在一个地方,并减少了我的分心,因为我不再需要查找并切换到任何一个刚刚找我的应用上。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-chat-tool + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/sites/default/files/uploads/productivity_9-1.png (BitlBee on XChat) +[3]: https://www.bitlbee.org/ +[4]: https://developer.pidgin.im/wiki/WhatIsLibpurple +[5]: http://pidgin.im/ +[6]: http://xchat.org/ +[7]: https://opensource.com/sites/default/files/uploads/productivity_9-2.png (Initial BitlBee connection) +[8]: https://opensource.com/sites/default/files/uploads/productivity_9-3.png (purple settings) +[9]: https://github.com/majn/telegram-purple +[10]: https://github.com/dylex/slack-libpurple +[11]: mailto:ksonney@myslack.slack.com From 449f124d6303d3f1ffb357f22626406b39429791 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 31 Jan 2020 10:35:18 +0800 Subject: [PATCH 0494/3057] translated --- ... open source chat tool to rule them all.md | 107 ------------------ 1 file changed, 107 deletions(-) delete mode 100644 sources/tech/20200119 One open source chat tool to rule them all.md diff --git a/sources/tech/20200119 One open source chat tool to rule them all.md b/sources/tech/20200119 One open source chat tool to rule them all.md deleted file mode 100644 index 2a4a6d52b4..0000000000 --- a/sources/tech/20200119 One open source chat tool to rule them all.md +++ /dev/null @@ -1,107 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (One open source chat tool to rule them all) -[#]: via: (https://opensource.com/article/20/1/open-source-chat-tool) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -一个管理所有聊天的开源聊天工具 -====== -BitlBee 将多个聊天应用集合到一个界面中。在我们的 20 个使用开源提升生产力的系列的第九篇文章中了解如何设置和使用 BitlBee。 -![Person using a laptop][1] - -去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 - -### 将所有聊天都放到 BitlBee 中 - -即时消息和聊天已经成为网络世界的主要内容。如果你像我一样,你可能打开五六个不同的应用与你的朋友、同事和其他人交谈。跟上所有聊天真的很痛苦。谢天谢地,你可以使用一个应用(好吧,是两个)将这些聊天整个到一个地方。 - -![BitlBee on XChat][2] - -[BitlBee][3] 是作为服务运行的应用,它可以将标准的 IRC 客户端与大量的消息服务进行桥接。而且,由于它本质上是 IRC 服务器,因此你可以选择很多客户端。 - -BitlBee 几乎包含在所有 Linux 发行版中。在 Ubuntu 上安装(我选择的 Linux 桌面),类似这样: - - -``` -`sudo apt install bitlbee-libpurple` -``` - -在其他发行版上,包名可能略有不同,但搜索 _bitlbee_ 应该就能看到。 - -你会注意到我用的 libpurple 版的 BitlBee。这个版本能让我使用 [libpurple][4] 即时消息库中提供的所有协议,该库最初是为 [Pidgin][5] 开发的。 - -安装完成后,服务应会自动启动。现在,使用一个 IRC 客户端(图片中为 [XChat][6]),我可以连接到端口 6667(标准 IRC 端口)上的服务。 - -![Initial BitlBee connection][7] - -你将自动连接到控制频道和 **bitlbee**。此频道对于你是独一无二的,每个人在多用户系统上都有自己的频道。在这里你可以配置服务。 - -在控制频道中输入 **help**,你可以随时获得完整的文档。浏览它,然后使用 **register** 命令在服务器上注册帐户。 - - -``` -`register ` -``` - -现在,你在服务器上所做的任何配置更改(IM 帐户、设置等)都将在输入 **save** 时保存。每当你连接时,使用 **identify <mypassword>** 连接到你的帐户并加载这些设置。 - -![purple settings][8] - -命令 **help purple** 将显示 libpurple 提供的所有可用协议。例如,我安装了 [**telegram-purple**][9] 包,它增加了连接到 Telegram 的能力。我可以使用 **account add** 命令将我的电话号码作为帐户添加。 - - -``` -`account add telegram +15555555` -``` - -BitlBee 将显示它已添加帐户。你可以使用 **account list** 列出你的帐户。因为我只有一个帐户,我可以通过 **account 0 on** 登录,它会进行 Telegram 登录,列出我所有的朋友和聊天,接下来就能正常聊天了。 - -但是,对于 Slack 这个最常见的聊天系统之一呢?你可以安装 [**slack-libpurple**][10] 插件,并且对 Slack 执行同样的操作。如果你不愿意编译和安装这些,这可能不适合你。 - -按照插件页面上的说明操作,安装后重新启动 BitlBee 服务。现在,当你运行 **help purple** 时,应该会列出 Slack。像其他协议一样添加一个 Slack 帐户。 - - -``` -account add slack [ksonney@myslack.slack.com][11] -account 1 set password my_legcay_API_token -account 1 on -``` - -你知道么,你已经连接到 Slack 中,你可以通过 **chat add** 命令添加你感兴趣的 Slack 频道。比如: - - -``` -`chat add 1 happyparty` -``` - -将 Slack 频道 happyparty 添加为本地频道 #happyparty。现在可以使用标准 IRC **/join** 命令访问该频道。这很酷。 - -BitlBee 和 IRC 客户端帮助我的(大部分)聊天和即时消息保存在一个地方,并减少了我的分心,因为我不再需要查找并切换到任何一个刚刚找我的应用上。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/open-source-chat-tool - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) -[2]: https://opensource.com/sites/default/files/uploads/productivity_9-1.png (BitlBee on XChat) -[3]: https://www.bitlbee.org/ -[4]: https://developer.pidgin.im/wiki/WhatIsLibpurple -[5]: http://pidgin.im/ -[6]: http://xchat.org/ -[7]: https://opensource.com/sites/default/files/uploads/productivity_9-2.png (Initial BitlBee connection) -[8]: https://opensource.com/sites/default/files/uploads/productivity_9-3.png (purple settings) -[9]: https://github.com/majn/telegram-purple -[10]: https://github.com/dylex/slack-libpurple -[11]: mailto:ksonney@myslack.slack.com From 7aef949b362364b53a8b52000b033c6ff62afad9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 31 Jan 2020 10:38:25 +0800 Subject: [PATCH 0495/3057] translating --- sources/tech/20200121 Read Reddit from the Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200121 Read Reddit from the Linux terminal.md b/sources/tech/20200121 Read Reddit from the Linux terminal.md index 81c7e9d35e..689314a73e 100644 --- a/sources/tech/20200121 Read Reddit from the Linux terminal.md +++ b/sources/tech/20200121 Read Reddit from the Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 19ac94836cf959595042e4f6bb166703269d4300 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 31 Jan 2020 11:11:18 +0800 Subject: [PATCH 0496/3057] PRF @geekpi --- ...ith this open source to-do list manager.md | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/translated/tech/20200117 Get started with this open source to-do list manager.md b/translated/tech/20200117 Get started with this open source to-do list manager.md index 5845325fde..f77f516328 100644 --- a/translated/tech/20200117 Get started with this open source to-do list manager.md +++ b/translated/tech/20200117 Get started with this open source to-do list manager.md @@ -7,28 +7,29 @@ [#]: via: (https://opensource.com/article/20/1/open-source-to-do-list) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) -开始使用开源待办清单管理器 +开始使用开源待办事项清单管理器 ====== -Todo 是跟踪任务列表的强大方法。在我们的 20 个使用开源提升生产力的系列的第七篇文章中了解如何使用它。 -![Team checklist][1] + +> 待办事项清单是跟踪任务列表的强大方法。在我们的 20 个使用开源提升生产力的系列的第七篇文章中了解如何使用它。 + +![](https://img.linux.net.cn/data/attachment/album/202001/31/111103kmv55ploshuso4ot.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 todo 跟踪任务 -任务和待办事项列表离我很近。我是生产力的狂热粉丝(以至于我为此做了一个[播客][2]),我尝试了各种不同的应用。我甚至为此[做了演讲][3]并[写了些文章][4]。因此,当我谈到提高工作效率时,肯定会出现任务和待办事项清单工具。 +任务管理和待办事项清单是我非常喜欢0的东西。我是一位生产效率的狂热粉丝(以至于我为此做了一个[播客][2]),我尝试了各种不同的应用。我甚至为此[做了演讲][3]并[写了些文章][4]。因此,当我谈到提高工作效率时,肯定会出现任务管理和待办事项清单工具。 ![Getting fancy with Todo.txt][5] -说实话,由于简单、跨平台且易于同步,你用 [todo.txt][6] 不会错。它是两个我经常使用的待办列表以及任务管理应用之一(另一个是 [Org mode][7])。让我继续使用它的原因它简单、便携、易于理解,并且有许多很好的附加组件,并且当一台机器有附加组件,而另一台没有,也不会破坏程序。由于它是一个 Bash shell 脚本,我还没发现一个无法支持它的系统。 +说实话,由于简单、跨平台且易于同步,用 [todo.txt][6] 肯定不会错。它是我不断反复提到的两个待办事项清单以及任务管理应用之一(另一个是 [Org 模式][7])。让我反复使用它的原因是它简单、可移植、易于理解,并且有许多很好的附加组件,并且当一台机器有附加组件,而另一台没有,也不会破坏它。由于它是一个 Bash shell 脚本,我还没发现一个无法支持它的系统。 #### 设置 todo.txt -首先,你需要安装基本 shell 脚本并将默认配置文件复制到 **~/.todo** 目录: - +首先,你需要安装基本 shell 脚本并将默认配置文件复制到 `~/.todo` 目录: ``` -git clone +git clone https://github.com/todotxt/todo.txt-cli.git cd todo.txt-cli make sudo make install @@ -36,49 +37,47 @@ mkdir ~/.todo cp todo.cfg ~/.todo/config ``` -接下来,设置配置文件。此时,我想取消注释颜色设置,但必须马上设置的是 **TODO_DIR** 变量: - +接下来,设置配置文件。一般,我想取消对颜色设置的注释,但必须马上设置的是 `TODO_DIR` 变量: ``` -`export TODO_DIR="$HOME/.todo"` +export TODO_DIR="$HOME/.todo" ``` #### 添加待办事件 -要添加第一个待办事件,只需输入 **todo.sh add <NewTodo>** 就能添加。这还将在 **$HOME/.todo/** 中创建三个文件:todo.txt、todo.txt 和 reports.txt。 +要添加第一个待办事件,只需输入 `todo.sh add ` 就能添加。这还将在 `$HOME/.todo/` 中创建三个文件:`todo.txt`、`done.txt` 和 `reports.txt`。 -添加几个项目后,运行 **todo.sh ls** 查看你的待办事项。 +添加几个项目后,运行 `todo.sh ls` 查看你的待办事项。 ![Basic todo.txt list][8] #### 管理任务 -你可以通过给项目设置优先级来稍微改善它。要向项目添加优先级,运行 **todo.sh pri # A**。数字是列表中任务的数量,而字母 ”A“ 是优先级。你可以将优先级设置为从 A 到 Z,因为这是它的排序方式。 +你可以通过给项目设置优先级来稍微改善它。要向项目添加优先级,运行 `todo.sh pri # A`。数字是列表中任务的数量,而字母 `A` 是优先级。你可以将优先级设置为从 A 到 Z,因为这是它的排序方式。 -要完成任务,运行**todo.sh do #** 来标记项目已完成,并将项目移动到 done.txt。运行 **todo.sh report** 会向 report.txt 写入已完成和未完成项的数量。 - -所有三个文件的格式都有详细记录,因此你可以选择自己的文本编辑器修改。todo.txt 的基本格式是: +要完成任务,运行 `todo.sh do #` 来标记项目已完成并将它移动到 `done.txt`。运行 `todo.sh report` 会向 `report.txt` 写入已完成和未完成项的数量。 +所有这三个文件的格式都有详细的说明,因此你可以使用你的文本编辑器修改。`todo.txt` 的基本格式是: ``` -`(Priority) YYYY-MM-DD Task` +(Priority) YYYY-MM-DD Task ``` -如果设置了任务,那么日期表示任务的到期日期。手动编辑文件时,只需在任务前面加一个 ”x“ 来标记为已完成。运行 **todo.sh archive** 会将这些项目移动到 done.txt,你可以在该文本文件编辑,并在有时间时将已完成的项目归档。 +该日期表示任务的到期日期(如果已设置)。手动编辑文件时,只需在任务前面加一个 `x` 来标记为已完成。运行 `todo.sh archive` 会将这些项目移动到 `done.txt`,你可以编辑该文本文件,并在有时间时将已完成的项目归档。 #### 设置重复任务 -我有很多重复任务,我需要以每天/周/月来计划。 +我有很多重复的任务,我需要以每天/周/月来计划。 ![Recurring tasks with the ice_recur add-on][9] -这就是 todo.txt 的灵活性所在。通过在 **~/.todo.actions.d/** 中使用[附加组件][10],你可以添加命令并扩展基本 todo.sh 的功能。附加组件基本上是实现特定命令的脚本。对于重复执行的任务,插件 [ice_recur][11] 可以满足。按照页面上的说明操作,你可以以非常灵活的方式设置要重复处理的任务。 +这就是 `todo.txt` 的灵活性所在。通过在 `~/.todo.actions.d/` 中使用[附加组件][10],你可以添加命令并扩展基本 `todo.sh` 的功能。附加组件基本上是实现特定命令的脚本。对于重复执行的任务,插件 [ice_recur][11] 应该符合要求。按照其页面上的说明操作,你可以设置任务以非常灵活的方式重复执行。 ![Todour on MacOS][12] -目录中有很多附加组件,包括同步到某些云服务。也有链接到桌面或移动端应用的组件,这样你可以随时看到待办列表。 +在该[附加组件目录][10]中有很多附加组件,包括同步到某些云服务,也有链接到桌面或移动端应用的组件,这样你可以随时看到待办列表。 -我只介绍了这个 todo 功能的表面,所以请花点时间深入了解这个工具的强大!它真的帮助我跟上每天的任务。 +我只是简单介绍了这个代办事项清单功能,请花点时间深入了解这个工具的强大!它确实可以帮助我每天完成任务。 -------------------------------------------------------------------------------- @@ -87,7 +86,7 @@ via: https://opensource.com/article/20/1/open-source-to-do-list 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -104,4 +103,4 @@ via: https://opensource.com/article/20/1/open-source-to-do-list [9]: https://opensource.com/sites/default/files/uploads/productivity_7-3.png (Recurring tasks with the ice_recur add-on) [10]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory [11]: https://github.com/rlpowell/todo-text-stuff -[12]: https://opensource.com/sites/default/files/uploads/productivity_7-4.png (Todour on MacOS) \ No newline at end of file +[12]: https://opensource.com/sites/default/files/uploads/productivity_7-4.png (Todour on MacOS) From 212d2e79d017d2d0f382df68e056c9423f5aa846 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 31 Jan 2020 11:20:47 +0800 Subject: [PATCH 0497/3057] PUB @geekpi https://linux.cn/article-11835-1.html --- ... Get started with this open source to-do list manager.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200117 Get started with this open source to-do list manager.md (98%) diff --git a/translated/tech/20200117 Get started with this open source to-do list manager.md b/published/20200117 Get started with this open source to-do list manager.md similarity index 98% rename from translated/tech/20200117 Get started with this open source to-do list manager.md rename to published/20200117 Get started with this open source to-do list manager.md index f77f516328..deaa6da72a 100644 --- a/translated/tech/20200117 Get started with this open source to-do list manager.md +++ b/published/20200117 Get started with this open source to-do list manager.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11835-1.html) [#]: subject: (Get started with this open source to-do list manager) [#]: via: (https://opensource.com/article/20/1/open-source-to-do-list) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From b1a522110436c65bc30c68f4ba9216714caa2dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 31 Jan 2020 11:43:54 +0800 Subject: [PATCH 0498/3057] Translated --- ...buntu- Important Things You Should Know.md | 175 ----------------- ...buntu- Important Things You Should Know.md | 176 ++++++++++++++++++ 2 files changed, 176 insertions(+), 175 deletions(-) delete mode 100644 sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md create mode 100644 translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md diff --git a/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md b/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md deleted file mode 100644 index f58ada5c58..0000000000 --- a/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md +++ /dev/null @@ -1,175 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Root User in Ubuntu: Important Things You Should Know) -[#]: via: (https://itsfoss.com/root-user-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Root User in Ubuntu: Important Things You Should Know -====== - -When you have just started using Linux, you’ll find many things that are different from Windows. One of those ‘different things’ is the concept of the root user. - -In this beginner series, I’ll explain a few important things about the root user in Ubuntu. - -**Please keep in mind that while I am writing this from Ubuntu user’s perspective, it should be valid for most Linux distributions.** - -You’ll learn the following in this article: - - * [Why root user is disabled in Ubuntu][1] - * [Using commands as root][2] - * [Switch to root user][3] - * [Unlock the root user][4] - - - -### What is root user? Why is it locked in Ubuntu? - -![][5] - -In Linux, there is always a super user called [root][6]. This is the super admin account that can do anything and everything with the system. It can access any file and run any command on your Linux system. - -With great power comes great responsibility. Root user gives you complete power over the system and hence it should be used with great cautious. Root user can access system files and run commands to make changes to the system configuration. And hence, an incorrect command may destroy the system. - -This is why [Ubuntu][7] and other Ubuntu-based distributions lock the root user by default to save you from accidental disasters. - -You don’t need to have root privilege for your daily tasks like moving file in your home directory, downloading files from internet, creating documents etc. - -_**Take this analogy for understanding it better. If you have to cut a fruit, you use a kitchen knife. If you have to cut down a tree, you have to use a saw. Now, you may use the saw to cut fruits but that’s not wise, is it?**_ - -Does this mean that you cannot be root in Ubuntu or use the system with root privileges? No, you can still have root access with the help of ‘sudo’ (explained in the next section). - -**Bottom line: -**Root user is too powerful to be used for regular tasks. This is why it is not recommended to use root all the time. You can still run specific commands with root. - -### How to run commands as root user in Ubuntu? - -![Image Credit: xkcd][8] - -You’ll need root privileges for some system specific tasks. For example, if you want to [update Ubuntu via command line][9], you cannot run the command as a regular user. It will give you permission denied error. - -``` -apt update -Reading package lists... Done -E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) -E: Unable to lock directory /var/lib/apt/lists/ -W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) -W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) -``` - -So, how do you run commands as root? The simple answer is to add sudo before the commands that require to be run as root. - -``` -sudo apt update -``` - -Ubuntu and many other Linux distributions use a special mechanism called sudo. Sudo is a program that controls access to running commands as root (or other users). - -Sudo is actually quite a versatile tool. It can be configured to allow a user to run all commands as root or only some commands as root. You can also configure if password is required for some commands or not to run it with sudo. It’s an extensive topic and maybe I’ll discuss it in details in another article. - -For the moment, you should know that [when you install Ubuntu][10], you are forced to create a user account. This user account works as the admin on your system and as per the default sudo policy in Ubuntu, it can run any command on your system with root privileges. - -The thing with sudo is that running **sudo doesn’t require root password but the user’s own password**. - -And this is why when you run a command with sudo, it asks for the password of the user who is running the sudo command: - -``` -[email protected]:~$ sudo apt update -[sudo] password for abhishek: -``` - -As you can see in the example above, user _abhishek_ was trying to run the ‘apt update’ command with _sudo_ and the system asked the password for _abhishek_. - -If you are absolutely new to Linux, you might be surprised that when you start typing your password in the terminal, nothing happens on the screen. This is perfectly normal because as the default security feature, nothing is displayed on the screen. Not even the asterisks (*). You type your password and press enter. - -**Bottom line: -**To run commands as root in Ubuntu, add sudo before the command. -When asked for password, enter your account’s password. -When you type the password on the screen, nothing is visible. Just keep on typing the password and press enter. - -### How to become root user in Ubuntu? - -You can use sudo to run the commands as root. However in situations, where you have to run several commands as root and you keep forogetting to add sudo before the commands, you may switch to root user temporarily. - -The sudo command allows you to simulate a root login shell with this command: - -``` -sudo -i -``` - -``` -[email protected]:~$ sudo -i -[sudo] password for abhishek: -[email protected]:~# whoami -root -[email protected]:~# -``` - -You’ll notice that when you switch to root, the shell command prompt changes from $ (dollar key sign) to # (pound key sign). This makes me crack a (lame) joke that pound is stronger than dollar. - -_**Though I have showed you how to become the root user, I must warn you that you should avoid using the system as root. It’s discouraged for a reason after all.**_ - -Another way to temporarily switch to root user is by using the su command: - -``` -sudo su -``` - -If you try to use the su command without sudo, you’ll encounter ‘su authentication failure’ error. - -You can go back to being the normal user by using the exit command. - -``` -exit -``` - -### How to enable root user in Ubuntu? - -By now you know that the root user is locked by default in Ubuntu based distributions. - -Linux gives you the freedom to do whatever you want with your system. Unlocking the root user is one of those freedoms. - -If, for some reasons, you decided to enable the root user, you can do so by setting up a password for it: - -``` -sudo passwd root -``` - -Again, this is not recommended and I won’t encourage you to do that on your desktop. If you forgot it, you won’t be able to [change the root password in Ubuntu][11] again. - -You can lock the root user again by removing the password: - -``` -sudo passwd -dl root -``` - -**In the end…** - -I hope you have a slightly better understanding of the root concept now. If you still have some confusion and questions about it, please let me know in the comments. I’ll try to answer your questions and might update the article as well. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/root-user-ubuntu/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: tmp.IrHYJBAqVn#what-is-root -[2]: tmp.IrHYJBAqVn#run-command-as-root -[3]: tmp.IrHYJBAqVn#become-root -[4]: tmp.IrHYJBAqVn#enable-root -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/root_user_ubuntu.png?ssl=1 -[6]: http://www.linfo.org/root.html -[7]: https://ubuntu.com/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/sudo_sandwich.png?ssl=1 -[9]: https://itsfoss.com/update-ubuntu/ -[10]: https://itsfoss.com/install-ubuntu/ -[11]: https://itsfoss.com/how-to-hack-ubuntu-password/ diff --git a/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md b/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md new file mode 100644 index 0000000000..6113f5aa4a --- /dev/null +++ b/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Root User in Ubuntu: Important Things You Should Know) +[#]: via: (https://itsfoss.com/root-user-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Ubuntu 的 root 用户:你应该知道的重要事情 +====== + +当你已经开始使用 Linux 时,你将发现与 Windows 的很多不同。其中一个‘不同的东西’是 root 用户的概念。 + +在这个初学者系列中,我将解释几个关于 Ubuntu 的 root 用户的重要的东西。 + +**请记住,尽管我正在从 Ubuntu 用户的角度编写这篇文章,它应该对大多数的 Linux 发行版也是有效的。** + +你将在这篇文章中学到下面的内容: + + * [为什么在 Ubuntu 中禁用 root 用户][1] + * [像 root 用户一样使用命令][2] + * [切换为 root 用户][3] + * [解锁 root 用户][4] + + + +### 什么是 root 用户?为什么它在 Ubuntu 中被锁定? + +![][5] + +在 Linux 中,这里总是有一个称为 [root][6] 的超级用户。这是超级管理员账号,它可以做任何事以及使用系统的一切东西。它可以在你的 Linux 系统上访问任何文件和运行任何命令。 + +能力越大,责任越大。root 用户给予你完全控制系统,因此,它应该被谨慎地使用。root 用户可以访问系统文件,运行更改系统配置的命令。因此,一个错误的命令可能会破坏系统。 + +这就是为什么 [Ubuntu][7] 和其它基于 Ubuntu 的发行版默认锁定 root 用户以从意外的灾难中挽救你的原因。 + +对于你的日常任务,像移动你 home 目录中的文件,从因特网下载文件,创建文档等等,你不需要拥有 root 权限。 + +_**打个比方来更好地理解它。假设你不得不切一个水果,你使用一把厨房用刀。假设你不得不砍一颗树,你不得不使用一把锯子。现在,你可以使用锯子来切水果,但是那不明智,不是吗?**_ + +这意味着,你不能是 Ubuntu 中 root 用户,或者不能使用 root +权限来使用系统?不,你仍然可以在 ‘sudo’ 的帮助下来拥有 root 权限来访问(在下一节中解释)。 + +**底线: +**使用于常规任务,root 用户权限太过强大。这就是为什么不建议一直使用 root 用户。你仍然可以使用 root 用户来运行特殊的命令。 + +### 如何在 Ubuntu 中像 root 用户一样运行命令? + +![Image Credit: xkcd][8] + +对于一些系统的特殊任务来说,你将需要 root 权限。例如。如果你想[通过命令行更新 Ubuntu ][9],你不能作为一个常规用户运行该命令。它将给予你权限被拒绝的错误。 + +``` +apt update +Reading package lists... Done +E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) +E: Unable to lock directory /var/lib/apt/lists/ +W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) +W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) +``` + +那么,你如何像 root 用户一样运行命令?简单的答案是,在命令前添加 sudo ,来像 root 用户一样运行。 + +``` +sudo apt update +``` + +Ubuntu 和很多其它的 Linux 发行版使用一个被称为 sudo 的特殊程序机制。Sudo 是一个像 root 用户(或其它用户)一样来控制运行命令访问的程序。 + +实际上,Sudo 是一个非常多用途的工具。它可以配置为允许一个用户像 root 用户一样来运行所有的命令,或者仅仅一些命令。你也可以配置是否一些命令需要密码,或者不使用 sudo 去运行命令。它是一个广泛的主题,也许我将在另一篇文章中详细讨论它。 + +就目前而言,你应该知道 [当你安装 Ubuntu 时][10] ,你必需创建一个用户账号。这个用户账号在你系统上作为管理员工作,在 Ubuntu 中作为一个默认的 sudo 策略,它可以在你的系统上使用 root 用户权限来运行任何命令。 + +sudo 的问题是,运行 **sudo 不需要 root 用户密码,而是需要用户自己的密码**。 + +并且这就是为什么当你使用 sudo 运行一个命令,会要求正在运行 sudo 命令的用户的密码的原因: + +``` +[email protected]:~$ sudo apt update +[sudo] password for abhishek: +``` + +正如你在上面示例中所见 _abhishek_ 在尝试使用 _sudo_ 来运行 ‘apt update’ 命令,系统要求 _abhishek_ 的密码。 + +如果你对 Linux 完全不熟悉,当你在终端中开始输入密码时,你可能会惊讶,在屏幕上什么都没有发生。这是十分正常的,因为作为默认的安全功能,在屏幕上什么都不会显示。甚至星号(*)都没有。你输入你的密码并按 Enter 键。 + +**底限: +**为在 Ubuntu 中像 root 用户一样运行命令,在命令前添加 sudo 。 +当被要求输入密码时,输入你的账户的密码。 +当你在屏幕上输入密码时,什么都看不到。请保持输入密码,并按 Enter 键。 + +### 如何在 Ubuntu 中成为 root 用户? + +你可以使用 sudo 来像 root 用户一样运行命令。但是,在某些情况下,你必需像 root 用户一样来运行一些命令,而你总是忘了在命令前添加 sudo ,那么你可以临时切换为 root 用户。 + +sudo 命令允许你来模拟一个 root 用户登录的 shell ,使用这个命令: + +``` +sudo -i +``` + +``` +[email protected]:~$ sudo -i +[sudo] password for abhishek: +[email protected]:~# whoami +root +[email protected]:~# +``` + +你将注意到,当你切换为 root 用户时,shell 命令提示符从 $ (美元按键符号)更改为 # (英镑按键符号)。这使我开了一个(拙劣的)玩笑,英镑比美元强大。 + +_**虽然我已经向你显示如何成为 root 用户,但是我必需警告你,你应该避免作为 root 用户使用系统。毕竟它有阻拦你使用 root 用户的原因。**_ + +另外一种临时切换为 root 用户的方法是使用 su 命令: + +``` +sudo su +``` + +如果你尝试使用不带有的 sudo 的 su 命令,你将遇到 ‘su authentication failure’ 错误。 + +你可以使用 exit 命令来恢复为正常用户。 + +``` +exit +``` + +### 如何在 Ubuntu 中启用 root 用户? + +现在你知道,root 用户在基于 Ubuntu 发行版中是默认锁定的。 + +Linux 给予你在系统上想做什么就做什么的自由。解锁 root 用户就是这些自由之一。 + +如果,出于某些原因,你决定启用 root 用户,你可以通过为其设置一个密码来做到: + +``` +sudo passwd root +``` + +再强调一次,不建议使用 root 用户,并且我不支持你在你的桌面上也这样做。如果你忘记密码,你将不能再次 [在 Ubuntu 中更改 root 用户密码][11] 。 + +你可以通过移除密码来再次锁定 root 用户: + +``` +sudo passwd -dl root +``` + +**最后…** + +我希望你现在对 root 概念有稍微更好一点的理解。如果你仍然有些关于它的困惑和问题,请在评论中让我知道。我将尝试回答你的问题,并且也可能更新这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/root-user-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: tmp.IrHYJBAqVn#what-is-root +[2]: tmp.IrHYJBAqVn#run-command-as-root +[3]: tmp.IrHYJBAqVn#become-root +[4]: tmp.IrHYJBAqVn#enable-root +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/root_user_ubuntu.png?ssl=1 +[6]: http://www.linfo.org/root.html +[7]: https://ubuntu.com/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/sudo_sandwich.png?ssl=1 +[9]: https://itsfoss.com/update-ubuntu/ +[10]: https://itsfoss.com/install-ubuntu/ +[11]: https://itsfoss.com/how-to-hack-ubuntu-password/ From 66f29cbba59b69377f98fd36a0305a5df11b988f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 31 Jan 2020 11:54:49 +0800 Subject: [PATCH 0499/3057] Translating --- .../20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md b/sources/tech/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md index 229ea0eb6e..5aff6be9eb 100644 --- a/sources/tech/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md +++ b/sources/tech/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md @@ -1,3 +1,4 @@ +Translating by robsean MidnightBSD Could Be Your Gateway to FreeBSD ====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/midnight_4_0.jpg?itok=T2gpLVui) From 1454d7851f2e7221ceedc44d223e5ebb33e9c110 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 31 Jan 2020 13:05:35 +0800 Subject: [PATCH 0500/3057] PRF @robsean --- ...buntu- Important Things You Should Know.md | 83 +++++++++---------- 1 file changed, 38 insertions(+), 45 deletions(-) diff --git a/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md b/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md index 6113f5aa4a..c09cc5b595 100644 --- a/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md +++ b/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md @@ -1,16 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Root User in Ubuntu: Important Things You Should Know) [#]: via: (https://itsfoss.com/root-user-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Ubuntu 的 root 用户:你应该知道的重要事情 +Ubuntu 中的 root 用户:你应该知道的重要事情 ====== -当你已经开始使用 Linux 时,你将发现与 Windows 的很多不同。其中一个‘不同的东西’是 root 用户的概念。 +![][5] + +当你刚开始使用 Linux 时,你将发现与 Windows 的很多不同。其中一个“不同的东西”是 root 用户的概念。 在这个初学者系列中,我将解释几个关于 Ubuntu 的 root 用户的重要的东西。 @@ -18,38 +20,32 @@ Ubuntu 的 root 用户:你应该知道的重要事情 你将在这篇文章中学到下面的内容: - * [为什么在 Ubuntu 中禁用 root 用户][1] - * [像 root 用户一样使用命令][2] - * [切换为 root 用户][3] - * [解锁 root 用户][4] - - +* 为什么在 Ubuntu 中禁用 root 用户 +* 像 root 用户一样使用命 +* 切换为 root 用户 +* 解锁 root 用户 ### 什么是 root 用户?为什么它在 Ubuntu 中被锁定? -![][5] +在 Linux 中,有一个称为 [root][6] 的超级用户。这是超级管理员账号,它可以做任何事以及使用系统的一切东西。它可以在你的 Linux 系统上访问任何文件和运行任何命令。 -在 Linux 中,这里总是有一个称为 [root][6] 的超级用户。这是超级管理员账号,它可以做任何事以及使用系统的一切东西。它可以在你的 Linux 系统上访问任何文件和运行任何命令。 +能力越大,责任越大。root 用户给予你完全控制系统的能力,因此,它应该被谨慎地使用。root 用户可以访问系统文件,运行更改系统配置的命令。因此,一个错误的命令可能会破坏系统。 -能力越大,责任越大。root 用户给予你完全控制系统,因此,它应该被谨慎地使用。root 用户可以访问系统文件,运行更改系统配置的命令。因此,一个错误的命令可能会破坏系统。 +这就是为什么 [Ubuntu][7] 和其它基于 Ubuntu 的发行版默认锁定 root 用户,以从意外的灾难中挽救你的原因。 -这就是为什么 [Ubuntu][7] 和其它基于 Ubuntu 的发行版默认锁定 root 用户以从意外的灾难中挽救你的原因。 +对于你的日常任务,像移动你家目录中的文件,从互联网下载文件,创建文档等等,你不需要拥有 root 权限。 -对于你的日常任务,像移动你 home 目录中的文件,从因特网下载文件,创建文档等等,你不需要拥有 root 权限。 +**打个比方来更好地理解它。假设你想要切一个水果,你可以使用一把厨房用刀。假设你想要砍一颗树,你就得使用一把锯子。现在,你可以使用锯子来切水果,但是那不明智,不是吗?**_ -_**打个比方来更好地理解它。假设你不得不切一个水果,你使用一把厨房用刀。假设你不得不砍一颗树,你不得不使用一把锯子。现在,你可以使用锯子来切水果,但是那不明智,不是吗?**_ +这意味着,你不能是 Ubuntu 中 root 用户或者不能使用 root 权限来使用系统吗?不,你仍然可以在 `sudo` 的帮助下来拥有 root 权限来访问(在下一节中解释)。 -这意味着,你不能是 Ubuntu 中 root 用户,或者不能使用 root -权限来使用系统?不,你仍然可以在 ‘sudo’ 的帮助下来拥有 root 权限来访问(在下一节中解释)。 - -**底线: -**使用于常规任务,root 用户权限太过强大。这就是为什么不建议一直使用 root 用户。你仍然可以使用 root 用户来运行特殊的命令。 +> **要点:** 使用于常规任务,root 用户权限太过强大。这就是为什么不建议一直使用 root 用户。你仍然可以使用 root 用户来运行特殊的命令。 ### 如何在 Ubuntu 中像 root 用户一样运行命令? ![Image Credit: xkcd][8] -对于一些系统的特殊任务来说,你将需要 root 权限。例如。如果你想[通过命令行更新 Ubuntu ][9],你不能作为一个常规用户运行该命令。它将给予你权限被拒绝的错误。 +对于一些系统的特殊任务来说,你将需要 root 权限。例如。如果你想[通过命令行更新 Ubuntu][9],你不能作为一个常规用户运行该命令。它将给出权限被拒绝的错误。 ``` apt update @@ -60,41 +56,38 @@ W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Pe W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) ``` -那么,你如何像 root 用户一样运行命令?简单的答案是,在命令前添加 sudo ,来像 root 用户一样运行。 +那么,你如何像 root 用户一样运行命令?简单的答案是,在命令前添加 `sudo`,来像 root 用户一样运行。 ``` sudo apt update ``` -Ubuntu 和很多其它的 Linux 发行版使用一个被称为 sudo 的特殊程序机制。Sudo 是一个像 root 用户(或其它用户)一样来控制运行命令访问的程序。 +Ubuntu 和很多其它的 Linux 发行版使用一个被称为 `sudo` 的特殊程序机制。`sudo` 是一个以 root 用户(或其它用户)来控制运行命令访问的程序。 -实际上,Sudo 是一个非常多用途的工具。它可以配置为允许一个用户像 root 用户一样来运行所有的命令,或者仅仅一些命令。你也可以配置是否一些命令需要密码,或者不使用 sudo 去运行命令。它是一个广泛的主题,也许我将在另一篇文章中详细讨论它。 +实际上,`sudo` 是一个非常多用途的工具。它可以配置为允许一个用户像 root 用户一样来运行所有的命令,或者仅仅一些命令。你也可以配置为无需密码即可使用 sudo 运行命令。这个主题内容比较丰富,也许我将在另一篇文章中详细讨论它。 -就目前而言,你应该知道 [当你安装 Ubuntu 时][10] ,你必需创建一个用户账号。这个用户账号在你系统上作为管理员工作,在 Ubuntu 中作为一个默认的 sudo 策略,它可以在你的系统上使用 root 用户权限来运行任何命令。 +就目前而言,你应该知道[当你安装 Ubuntu 时][10],你必须创建一个用户账号。这个用户账号在你系统上以管理员身份来工作,并且按照 Ubuntu 中的默认 sudo 策略,它可以在你的系统上使用 root 用户权限来运行任何命令。 -sudo 的问题是,运行 **sudo 不需要 root 用户密码,而是需要用户自己的密码**。 +`sudo` 的问题是,运行 **sudo 不需要 root 用户密码,而是需要用户自己的密码**。 -并且这就是为什么当你使用 sudo 运行一个命令,会要求正在运行 sudo 命令的用户的密码的原因: +并且这就是为什么当你使用 `sudo` 运行一个命令,会要求输入正在运行 `sudo` 命令的用户的密码的原因: ``` [email protected]:~$ sudo apt update [sudo] password for abhishek: ``` -正如你在上面示例中所见 _abhishek_ 在尝试使用 _sudo_ 来运行 ‘apt update’ 命令,系统要求 _abhishek_ 的密码。 +正如你在上面示例中所见 `abhishek` 在尝试使用 `sudo` 来运行 `apt update` 命令,系统要求输入 `abhishek` 的密码。 -如果你对 Linux 完全不熟悉,当你在终端中开始输入密码时,你可能会惊讶,在屏幕上什么都没有发生。这是十分正常的,因为作为默认的安全功能,在屏幕上什么都不会显示。甚至星号(*)都没有。你输入你的密码并按 Enter 键。 +**如果你对 Linux 完全不熟悉,当你在终端中开始输入密码时,你可能会惊讶,在屏幕上什么都没有发生。这是十分正常的,因为作为默认的安全功能,在屏幕上什么都不会显示。甚至星号(`*`)都没有。输入你的密码并按回车键。** -**底限: -**为在 Ubuntu 中像 root 用户一样运行命令,在命令前添加 sudo 。 -当被要求输入密码时,输入你的账户的密码。 -当你在屏幕上输入密码时,什么都看不到。请保持输入密码,并按 Enter 键。 +> **要点:**为在 Ubuntu 中像 root 用户一样运行命令,在命令前添加 `sudo`。 当被要求输入密码时,输入你的账户的密码。当你在屏幕上输入密码时,什么都看不到。请继续输入密码,并按回车键。 ### 如何在 Ubuntu 中成为 root 用户? -你可以使用 sudo 来像 root 用户一样运行命令。但是,在某些情况下,你必需像 root 用户一样来运行一些命令,而你总是忘了在命令前添加 sudo ,那么你可以临时切换为 root 用户。 +你可以使用 `sudo` 来像 root 用户一样运行命令。但是,在某些情况下,你必须以 root 用户身份来运行一些命令,而你总是忘了在命令前添加 `sudo`,那么你可以临时切换为 root 用户。 -sudo 命令允许你来模拟一个 root 用户登录的 shell ,使用这个命令: +`sudo` 命令允许你来模拟一个 root 用户登录的 shell ,使用这个命令: ``` sudo -i @@ -108,19 +101,19 @@ root [email protected]:~# ``` -你将注意到,当你切换为 root 用户时,shell 命令提示符从 $ (美元按键符号)更改为 # (英镑按键符号)。这使我开了一个(拙劣的)玩笑,英镑比美元强大。 +你将注意到,当你切换为 root 用户时,shell 命令提示符从 `$`(美元符号)更改为 `#`(英镑符号)。我开个(拙劣的)玩笑,英镑比美元强大。 -_**虽然我已经向你显示如何成为 root 用户,但是我必需警告你,你应该避免作为 root 用户使用系统。毕竟它有阻拦你使用 root 用户的原因。**_ +**虽然我已经向你显示如何成为 root 用户,但是我必须警告你,你应该避免作为 root 用户使用系统。毕竟它有阻拦你使用 root 用户的原因。** -另外一种临时切换为 root 用户的方法是使用 su 命令: +另外一种临时切换为 root 用户的方法是使用 `su` 命令: ``` sudo su ``` -如果你尝试使用不带有的 sudo 的 su 命令,你将遇到 ‘su authentication failure’ 错误。 +如果你尝试使用不带有的 `sudo` 的 `su` 命令,你将遇到 “su authentication failure” 错误。 -你可以使用 exit 命令来恢复为正常用户。 +你可以使用 `exit` 命令来恢复为正常用户。 ``` exit @@ -132,13 +125,13 @@ exit Linux 给予你在系统上想做什么就做什么的自由。解锁 root 用户就是这些自由之一。 -如果,出于某些原因,你决定启用 root 用户,你可以通过为其设置一个密码来做到: +如果出于某些原因,你决定启用 root 用户,你可以通过为其设置一个密码来做到: ``` sudo passwd root ``` -再强调一次,不建议使用 root 用户,并且我不支持你在你的桌面上也这样做。如果你忘记密码,你将不能再次 [在 Ubuntu 中更改 root 用户密码][11] 。 +再强调一次,不建议使用 root 用户,并且我也不鼓励你在桌面上这样做。如果你忘记了密码,你将不能再次[在 Ubuntu 中更改 root 用户密码][11]。(LCTT 译注:可以通过单用户模式修改。) 你可以通过移除密码来再次锁定 root 用户: @@ -146,9 +139,9 @@ sudo passwd root sudo passwd -dl root ``` -**最后…** +### 最后… -我希望你现在对 root 概念有稍微更好一点的理解。如果你仍然有些关于它的困惑和问题,请在评论中让我知道。我将尝试回答你的问题,并且也可能更新这篇文章。 +我希望你现在对 root 概念理解得更好一点。如果你仍然有些关于它的困惑和问题,请在评论中让我知道。我将尝试回答你的问题,并且也可能更新这篇文章。 -------------------------------------------------------------------------------- @@ -157,7 +150,7 @@ via: https://itsfoss.com/root-user-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a19775aa4ab437de30b3433f471144d12fd518a0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 31 Jan 2020 13:06:09 +0800 Subject: [PATCH 0501/3057] PUB @robsean https://linux.cn/article-11837-1.html --- ...5 Root User in Ubuntu- Important Things You Should Know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200115 Root User in Ubuntu- Important Things You Should Know.md (99%) diff --git a/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md b/published/20200115 Root User in Ubuntu- Important Things You Should Know.md similarity index 99% rename from translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md rename to published/20200115 Root User in Ubuntu- Important Things You Should Know.md index c09cc5b595..0abc566f4b 100644 --- a/translated/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md +++ b/published/20200115 Root User in Ubuntu- Important Things You Should Know.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11837-1.html) [#]: subject: (Root User in Ubuntu: Important Things You Should Know) [#]: via: (https://itsfoss.com/root-user-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 6a5097dc4e770a30f3cdaf41757487aeaa83a6d5 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 31 Jan 2020 14:01:22 +0800 Subject: [PATCH 0502/3057] Translating. --- .../tech/20200126 What-s your favorite Linux distribution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200126 What-s your favorite Linux distribution.md b/sources/tech/20200126 What-s your favorite Linux distribution.md index 029a4272e8..c1f4ab4688 100644 --- a/sources/tech/20200126 What-s your favorite Linux distribution.md +++ b/sources/tech/20200126 What-s your favorite Linux distribution.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (LazyWolfLin) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -43,7 +43,7 @@ via: https://opensource.com/article/20/1/favorite-linux-distribution 作者:[Opensource.com][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 4add6a1fd8bfe3d3ee4cf12753dd6de155b8ce92 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 31 Jan 2020 14:31:00 +0800 Subject: [PATCH 0503/3057] Translating What's your favorite Linux distribution.md --- ...What‘s your favorite Linux distribution.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 translated/tech/20200126 What‘s your favorite Linux distribution.md diff --git a/translated/tech/20200126 What‘s your favorite Linux distribution.md b/translated/tech/20200126 What‘s your favorite Linux distribution.md new file mode 100644 index 0000000000..196eca3a47 --- /dev/null +++ b/translated/tech/20200126 What‘s your favorite Linux distribution.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's your favorite Linux distribution?) +[#]: via: (https://opensource.com/article/20/1/favorite-linux-distribution) +[#]: author: (Opensource.com https://opensource.com/users/admin) + +你最喜欢哪一个 Linux 发行版? +====== +参与我们的第七届年度调查,让我们了解你对 Linux 发行版的偏好。 + +![Hand putting a Linux file folder into a drawer][1] + +What's your favorite Linux distribution? Take our 7th annual poll. Some have come and gone, but there are hundreds of [Linux distributions][2] alive and well today. The combination of distribution, package manager, and desktop creates an endless amount of customized environments for Linux users. + +We asked the community of writers what their favorite is and why. While there were some commonalities (Fedora and Ubuntu were popular choices for a variety of reasons), we heard a few surprises as well. Here are a few of their responses: + +"I use the Fedora distro! I love the community of people who work together to make an awesome operating system that showcases the greatest innovations in the free and open source software world." — Matthew Miller + +"I use Arch at home. As a gamer, I want easy access to the latest Wine versions and GFX drivers, as well as large amounts of control over my OS. Give me a rolling-release distro with every package at bleeding-edge." —Aimi Hobson + +"NixOS, with nothing coming close in the hobbyist niche." —Alexander Sosedkin + +"I have used every Fedora version as my primary work OS. Meaning, I started with the first one. Early on, I asked myself if there would ever come a time when I couldn't remember which number I was on. That time has arrived. What year is it, anyway?" —Hugh Brock + +"I usually have Ubuntu, CentOS, and Fedora boxes running around the house and the office. We depend on all of these distributions for various things. Fedora for speed and getting the latest versions of applications and libraries. Ubuntu for those that need easy of use with a large community of support. CentOS when we need a rock-solid server platform that just runs." —Steve Morris + +"My favorite? For the community, and how packages are built for the distribution (from source, not binaries), I choose Fedora. For pure breadth of packages available and elegance in how packages are defined and developed, I choose Debian. For documentation, I choose Arch. For newbies that ask, I used to recommend Ubuntu but now recommend Fedora." —Al Stone + +* * * + +We've been asking the community this question since 2014. With the exception of PCLinuxOS taking the lead in 2015, Ubuntu tends to be the fan-favorite from year to year. Other popular contenders have been Fedora, Debian, Mint, and Arch. Which distribution stands out to you in the new decade? If we didn't include your favorite in the list of choices, tell us about it in the comments.  + +Here's a look at your favorite Linux distributions throughout the last seven years. You can find this in our latest yearbook, [Best of a decade on Opensource.com][3]. To download the whole eBook, [click here][3]! + +![Poll results for favorite Linux distribution through the years][4] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/favorite-linux-distribution + +作者:[Opensource.com][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/admin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://distrowatch.com/ +[3]: https://opensource.com/downloads/2019-yearbook-special-edition +[4]: https://opensource.com/sites/default/files/pictures/linux-distributions-through-the-years.jpg (favorite Linux distribution through the years) From 5a22ee9fc0a21430eeb1fd7c89137829323d4922 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Fri, 31 Jan 2020 14:37:35 +0800 Subject: [PATCH 0504/3057] Update 20180503 How the four components of a distributed tracing system work together.md --- ... components of a distributed tracing system work together.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180503 How the four components of a distributed tracing system work together.md b/sources/tech/20180503 How the four components of a distributed tracing system work together.md index 68ba97e989..76e093f072 100644 --- a/sources/tech/20180503 How the four components of a distributed tracing system work together.md +++ b/sources/tech/20180503 How the four components of a distributed tracing system work together.md @@ -1,4 +1,4 @@ -chenmu-kk is translating. +chenmu-kk is translating . How the four components of a distributed tracing system work together ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/touch-tracing.jpg?itok=rOmsY-nU) From d822d1f0e947d59c7248ded6c1b47b8892a39ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E6=96=B0=E9=98=BF=E5=B2=A9?= <31788564+mengxinayan@users.noreply.github.com> Date: Fri, 31 Jan 2020 06:31:15 -0800 Subject: [PATCH 0505/3057] Update & Translating File name: 20200129 Showing memory usage in Linux by process and user.md Translator: mengxinayan --- ...00129 Showing memory usage in Linux by process and user.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200129 Showing memory usage in Linux by process and user.md b/sources/tech/20200129 Showing memory usage in Linux by process and user.md index 8e21baf042..85c6fcb4ea 100644 --- a/sources/tech/20200129 Showing memory usage in Linux by process and user.md +++ b/sources/tech/20200129 Showing memory usage in Linux by process and user.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (mengxinayan) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -180,7 +180,7 @@ via: https://www.networkworld.com/article/3516319/showing-memory-usage-in-linux- 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[mengxinayan](https://github.com/mengxinayan) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4c90885ba1d4629c74a65cca4014d94e062d283d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 1 Feb 2020 00:58:43 +0800 Subject: [PATCH 0506/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200131=205=20?= =?UTF-8?q?ways=20to=20use=20Emacs=20as=20your=20RPG=20dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200131 5 ways to use Emacs as your RPG dashboard.md --- ...ways to use Emacs as your RPG dashboard.md | 182 ++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 sources/tech/20200131 5 ways to use Emacs as your RPG dashboard.md diff --git a/sources/tech/20200131 5 ways to use Emacs as your RPG dashboard.md b/sources/tech/20200131 5 ways to use Emacs as your RPG dashboard.md new file mode 100644 index 0000000000..b1d7c6923d --- /dev/null +++ b/sources/tech/20200131 5 ways to use Emacs as your RPG dashboard.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to use Emacs as your RPG dashboard) +[#]: via: (https://opensource.com/article/20/1/emacs-rpgs) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 ways to use Emacs as your RPG dashboard +====== +Emacs is a flexible way to organize and manage your tabletop +role-playing games. +![Chess pieces on a chess board][1] + +There are two ways to play a tabletop role-playing game (RPG): You can play an adventure written by the game's publisher or an independent author, or you can play an adventure that is made up as you go. Regardless of which you choose, there's probably prep work to do. One player (generically called the _game master_) must gather monster or enemy stats, loot tables, and references for rules, and the other players must build characters and apportion (pretend) equipment. Nothing's going to eliminate prep work from a complex RPG, but if you're an [Emacs][2] user, you might find that Emacs makes a great dashboard to keep everything all straight. + +### Organize the rules + +Unfortunately, the digital editions of many RPGs are distributed as PDFs because that's what the RPG publisher sent to the printer for the physical edition. PDFs are good at preserving layout, but they're far from an ideal eBook format. If you play RPGs published under an open license, you can often obtain the rules in alternate formats (such as HTML), which gives you more control and flexibility. Even the world's first and most famous RPG, Dungeons & Dragons, provides its rules as a free download in digital format (which has been translated into HTML and Markdown by many a website). + +I open the rules as Markdown in Emacs so that I have a searchable reference at the ready. While opening the rules as a PDF in a PDF reader lets you search for embedded text, using a text file instead provides several benefits. First of all, a text file is much smaller than a PDF, so it's faster to load and to search. Second, text files are easily editable, so if you find a rule that sends you seeking clarification, you can add what you learn (or whatever you make up) directly into your master document. You can also add house rules and additional resources. My aim is to have a single file that contains all of the rules and resources I use in games I run, with everything a quick **Ctrl+s** (**C-s** in Emacs notation) away. + +### Manage initiatives + +Most RPG systems feature a method to determine the order of play during combat. This is commonly called _initiative_, and it comes up a lot since the source of conflict in games often involves combat or some kind of opposed competitive action. It's not that hard to keep track of combat with pencil and paper, but in games where I'm using digital assets anyway, I find it easier to stay digital for everything. Luckily, the venerable [Org mode][3] provides an excellent solution. + +When players roll for initiative, I type their names into Emacs' scratch buffer. Then I type each monster or enemy, along with the hit or health points (HP) of each, followed by two columns of 0: + + +``` +brad +emily +zombie 22 0 0 +zombie 22 0 0 +flesh-golem 93 0 0 +``` + +Then I select the block of player characters (PCs) and monsters and use the **org-table-create-or-convert-from-region** function to create an Org mode table around it. Using **Alt+Down arrow** (**M-down** in Emacs notation), I move each PC or monster into the correct initiative order. + + +``` +| emily       |    |   |   | +| flesh-golem | 93 | 0 | 0 | +| zombie      | 22 | 0 | 0 | +| brad        |    |   |   | +| zombie      | 22 | 0 | 0 | +``` + +During combat, I only need to record damage for monsters, because the players manage their own HP. For the enemies I control in combat, the second column is its HP (its starting number is taken from the RPG system's rules), and the third is the damage dealt during the current round. + +Table formulas in Org mode are defined on a special **TBLFM** line at the end of the table. If you've used any computerized spreadsheet for anything, [Org table][4] will be fairly intuitive. For combat tracking, I want the third column to be subtracted from the second. Columns are indexed from left to right (**$1** for the first, **$2** for the second, and **$3** for the third), so to replace the contents of column $2 with the sum of columns $2 and $3, I add this line to the bottom of the table: + + +``` +`#+TBLFM: $2=vsum($2 - $3)` +``` + +I don't actually type that into Emacs every time the game enters combat mode. Instead, I've defined an auto-completion trigger with Emacs' [abbrev mode][5], a system that allows you to type in a special string of your choosing, which Emacs expands into something more complex. I define my abbreviations in a file called **~/.emacs.d/abbrev_defs**, using **rpgi** followed by a **Space** as the trigger for Emacs to change the line to my initiative table formula: + + +``` +(define-abbrev-table 'global-abbrev-table +  '( +    ("rpgi" "#+TBLFM: $2=vsum($2 - $3)" nil 0) +   )) +``` + +Each time a player deals damage to a monster, I enter the amount of damage in the damage column. To trigger a table recalculation, I press **Ctrl+u Ctrl+c** (i.e., **C-u C-c** in Emacs) or **Ctrl+c Ctrl+c** (i.e., **C-c C-c**) if I happen to be on the formula line:  + + +``` +| brad        |    |    | +| emily       |    |    | +| zombie      | 12 | 10 | +| zombie      | 15 |  7 | +| flesh-golem | 91 |  2 | +#+TBLFM: $2=vsum($2 - $3) +``` + +This system isn't perfect. Character names can't contain any spaces because Org table splits cells by white space. It's relatively easy to forget that you processed one line and accidentally reprocess it at the end of a round. To add HP back to a creature's total, you have to use a negative number. (I think of it as negative damage, which suggests health.) Then again, many computerized initiative trackers suffer the same problems, so it's not a particularly bad solution. For me, it's one of the faster methods I've found (I'm happy to admit that [MapTool][6] is the best, but I use my Emacs workflow when I'm not using a digital shared map). + +### View PDFs in DocView + +Sometimes a PDF is unavoidable. Whether it's a d100 list of tavern names or a dungeon map, some resources exist only as a PDF with no extractable text data. In these cases, Emacs' [DocView][7] package can help. DocView is a mode that loads PDF data and generates a PNG file for you to view (Emacs can also view JPEG files). I've found that large PDFs are problematic and slow, but if it's a low-resolution PDF with just one or two pages, DocView is an easy way to reference a document without leaving Emacs. + +I use this mode exclusively for maps, tables, and lists. It's not useful for anything that might involve searching, because text data isn't accessible, but it's an amazingly useful feature for documents you only need to glance at. + +![Emacs for RPG][8] + +The [Ghostscript][9] suite that ships with most Linux distributions (or certainly is available in your repository) allows you to process PDFs, drastically simplifying them by lowering the resolution of images from print quality to screen quality. The command contains mostly PostScript commands and attributes, but you don't need to become a PostScript expert to perform a quick down-res: + + +``` +$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \ +-dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH \ +-sOutputFile=adventure.pdf \ +-dDownsampleColorImages=true \ +-dColorImageResolution=72 big-adventure-module.pdf +``` + +Opening PDFs in Emacs isn't as exciting as it may sound. It's not by any means a first-class PDF viewer, but for select resources, it can be a convenient way to keep all your information on one screen. + +### Create adventure rap sheets + +Published adventures are often heavy on prose. The theory is that you've paid a lot of money for a prepared adventure, so you obviously want value for your purchase. I do value the lore and world-building that authors put into their adventures, but during a game, I like to have a quick reference to the information I need for the game mechanics to work as intended. In other words, I don't need to have the story of why a trap was placed in a dungeon when a rogue triggers it; I only need to know that the trap exists and what the rogue needs to roll in order to survive. + +I haven't found any modern adventure format that provides me with just that information, so I end up creating my own "rap sheets": a minimal outline for the adventure, with just the game mechanics information I need for each location. Once again, Org mode is the best way for me to keep this information handy. + +In Org mode, you create lists using asterisks for bullet points. For a sub-item, add an asterisk. Even better, press **C-c t** (that's **Ctrl+c** and then the **t** key) to mark the item as a **TODO** item. When your players clear an area in the game, press **C-c t** again to mark the location **DONE**. + + +``` +* DONE 1 Entrance +** Zombie +AC 9 | HP 22 +* TODO 2 Necromancer's chambers +** Flesh golem +AC 16 | HP 93 +** Treasure +\- Gold ring (200 gp) +\- Rusty nail (1 cp) +  Cursed (roll on curse table) +** Secret door (DC 20) +\- to area 11 +``` + +Each asterisk is collapsible, so you can get a summary of a global area by collapsing your list down to just the top-level: + + +``` +* DONE 1 Entrance +* TODO 2 Necromancer's chambers +* TODO 3 Wyrmling nursery +* TODO 4 Caretaker's chambers +* TODO 5 Caretaker's laboratory +``` + +An added bonus: I find that making my own rap sheets helps me internalize both the mechanics and the lore of the adventure I'm preparing, so the benefits to this method are numerous. Since I manage any adventure I run in Emacs with Git, once I do the prep work for an adventure, I have fresh copies of all my assets in case I run the adventure with another group or with a set of fresh characters. + +### Make your own adventure journal + +Generally, I let my players keep their own notes about the adventure because I want to encourage players to interpret the events happening in the adventure for themselves. However, a game master needs private notes to keep all of the improvised data in order. For example, if a published adventure doesn't feature a blacksmith shop, but players decide to visit a blacksmith, then a blacksmith needs to be invented in the moment. If the players revisit the blacksmith six weeks later, then they expect it to be the same blacksmith, and it's up to the game master to keep track of such additions to the published setting. I manage my personal notes about adventures in two different ways, depending on what's available to me. + +If I have the text of the adventure in an editable format (such as HTML or Markdown), I enter my additions into the adventure as if the publisher had included them from the start. This means there's always one source of truth for the setting and for significant events. + +If I haven't been able to get an editable copy of the adventure because it's a hard copy or a PDF that's not easily modified, then I write my additions into my rap sheets in Org mode. This functionally means that there's still one source of truth because my rap sheets are the first place I look for information, falling back on the published text only for details I've forgotten. Sometimes I like my additions enough to merge them back into my Git master for the adventure, but usually, I trust in improvisation and let additions happen dynamically for each group that plays the adventure. + +### Why Emacs is my favorite RPG dashboard + +I've fallen into using Emacs for RPGs because it serves as the heads-up display of my dreams. The "right" answer is probably a good [tiling window manager][10], but until I implement that, I'm happy with Emacs. Everything's bound to keyboard shortcuts designed for specificity and speed, and there's just enough easy customization that I can hack together good-enough solutions—sometimes even while players are arguing with one another about what to do next. + +I've tried juggling multiple desktops, several PDF reader windows, and a spreadsheet for initiatives; while it's a fine experience, nothing has equaled the fluidity of Emacs as my RPG dashboard. + +* * * + +Hey! do you love Emacs? [Write an article][11] about how you use an Emacs (GNU or otherwise) for inclusion in our forthcoming Emacs series! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/emacs-rpgs + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-chess-games.png?itok=U1lWMZ0y (Chess pieces on a chess board) +[2]: https://opensource.com/life/16/2/intro-to-emacs +[3]: https://orgmode.org/ +[4]: https://orgmode.org/manual/Tables.html +[5]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Abbrevs.html#Abbrevs +[6]: https://opensource.com/article/19/6/how-use-maptools +[7]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Document-View.html +[8]: https://opensource.com/sites/default/files/uploads/emacs-rpg.jpg (Emacs for RPG) +[9]: https://www.ghostscript.com/ +[10]: https://opensource.com/article/19/12/ratpoison-linux-desktop +[11]: https://opensource.com/how-submit-article From 4e4f09fa7f2bd9c3e8d2ed648b9547271ea632fe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 1 Feb 2020 01:39:09 +0800 Subject: [PATCH 0507/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200131=20Intr?= =?UTF-8?q?o=20to=20the=20Linux=20command=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200131 Intro to the Linux command line.md --- ...0200131 Intro to the Linux command line.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20200131 Intro to the Linux command line.md diff --git a/sources/tech/20200131 Intro to the Linux command line.md b/sources/tech/20200131 Intro to the Linux command line.md new file mode 100644 index 0000000000..572be7eee2 --- /dev/null +++ b/sources/tech/20200131 Intro to the Linux command line.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Intro to the Linux command line) +[#]: via: (https://www.networkworld.com/article/3518440/intro-to-the-linux-command-line.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Intro to the Linux command line +====== +Here are some warm-up exercises for anyone just starting to use the Linux command line. Warning: It can be addictive. +[Sandra Henry-Stocker / Linux][1] [(CC0)][2] + +If you’re new to Linux or have simply never bothered to explore the command line, you may not understand why so many Linux enthusiasts get excited typing commands when they’re sitting at a comfortable desktop with plenty of tools and apps available to them. In this post, we’ll take a quick dive to explore the wonders of the command line and see if maybe we can get you hooked. + +First, to use the command line, you have to open up a command tool (also referred to as a “command prompt”). How to do this will depend on which version of Linux you’re running. On RedHat, for example, you might see an Activities tab at the top of your screen which will open a list of options and a small window for entering a command (like “cmd” which will open the window for you). On Ubuntu and some others, you might see a small terminal icon along the left-hand side of your screen. On many systems, you can open a command window by pressing the **Ctrl+Alt+t** keys at the same time. + +You will also find yourself on the command line if you log into a Linux system using a tool like PuTTY. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Once you get your command line window, you’ll find yourself sitting at a prompt. It could be just a **$** or something as elaborate as “**user@system:~$**” but it means that the system is ready to run commands for you. + +Once you get this far, it will be time to start entering commands. Below are some of the commands to try first, and [here is a PDF][4] of some particularly useful commands and a two-sided command cheatsheet suitable for printing out and laminating. + +``` +Command What it does +pwd show me where I am in the file system (initially, this will be your + home directory) +ls list my files +ls -a list even more of my files (including those that start with a period) +ls -al list my files with lots of details (including dates, file sizes and + permissions) +who show me who is logged in (don’t be disappointed if it’s only you) +date remind me what day today is (shows the time too) +ps list my running processes (might just be your shell and the “ps” + command) +``` + +Once you’ve gotten used to your Linux home from the command line point of view, you can begin to explore. Maybe you’ll feel ready to wander around the file system with commands like these: + +``` +Command What it does +cd /tmp move to another directory (in this case, /tmp) +ls list files in that location +cd go back home (with no arguments, cd always takes you back to your home + directory) +cat .bashrc display the contents of a file (in this case, .bashrc) +history show your recent commands +echo hello say “hello” to yourself +cal show a calendar for the current month +``` + +To get a feeling for why more advanced Linux users like the command line so much, you will want to try some other features – like redirection and pipes. Redirection is when you take the output of a command and drop it into a file instead of displaying it on your screen. Pipes are when you take the output of one command and send it to another command that will manipulate it in some way. Here are commands to try: + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][5] + +``` +Command What it does +echo “echo hello” > tryme create a new file and put the words “echo hello” into + it +chmod 700 tryme make the new file executable +tryme run the new file (it should run the command it + contains and display “hello”) +ps aux show all running processes +ps aux | grep $USER show all running processes, but limit the output to + lines containing your username +echo $USER display your username using an environment variable +whoami display your username with a command +who | wc -l count how many users are currently logged in +``` + +### Wrap-Up + +Once you get used to the basic commands, you can explore other commands and try your hand at writing scripts. You might find that Linux is a lot more powerful and nice to use than you ever imagined. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3518440/intro-to-the-linux-command-line.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://commons.wikimedia.org/wiki/File:Tux.svg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.networkworld.com/article/3391029/must-know-linux-commands.html +[5]: https://www.networkworld.com/newsletters/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 7d22c8245dfedeeb3ac7224ff29184be8dd3f11a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 1 Feb 2020 01:40:08 +0800 Subject: [PATCH 0508/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200131=20How?= =?UTF-8?q?=20bacteria=20could=20run=20the=20Internet=20of=20Things?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200131 How bacteria could run the Internet of Things.md --- ...cteria could run the Internet of Things.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/talk/20200131 How bacteria could run the Internet of Things.md diff --git a/sources/talk/20200131 How bacteria could run the Internet of Things.md b/sources/talk/20200131 How bacteria could run the Internet of Things.md new file mode 100644 index 0000000000..48f86de474 --- /dev/null +++ b/sources/talk/20200131 How bacteria could run the Internet of Things.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How bacteria could run the Internet of Things) +[#]: via: (https://www.networkworld.com/article/3518413/how-bacteria-could-run-the-internet-of-things.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How bacteria could run the Internet of Things +====== +The Internet of Bio-Nano Things (IoBNT) would use certain kinds of bacteria, which scientists think has the attributes needed to make effective sensor networks. +Thinkstock + +Biologically created computing devices could one day be as commonplace as today’s microprocessors and microchips, some scientists believe. Consider DNA, the carrier of genetic information and the principal component of chromosomes; it's showing promise [as a data storage medium][1]. + +A recent study ([PDF][2]) suggests taking matters further and using microbes to network and communicate at nanoscale. The potential is highly attractive for the Internet of Things (IoT), where concealability and unobtrusiveness may be needed for the technology to become completely ubiquitous. + +Advantages to an organic version of IoT include not only the tiny size but also the autonomous nature of bacteria, which includes inherent propulsion. There’s “an embedded, natural propeller motor,” the scientists from Queen Mary University in London explain of the swimming functions microbes perform. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +At this point, research into the Internet of Bio-Nano Things (IoBNT) is at an early stage, and the Queen Mary University researchers are predominantly explaining how similarities between bacteria and computing could be exploited. But the study is intriguing. + +"The microbes share similarities with components of typical computer IoT devices," wrote Raphael Kim and Stefan Posland in their [paper][2] published on the subject. “This presents a strong argument for bacteria to be considered as a living form of Internet of Things (IoT) device.” + +Environmental IoT is one area they say could benefit. In smart cities, for example, bacteria could be programmed to sense for pollutants. Microbes have good chemical-sensing functions and could turn out to work better than electronic sensors. In fact, the authors say that microbes share some of the same sensing, actuating, communicating and processing abilities that the computerized IoT has. + +In the case of sensing and actuating, bacteria can detect chemicals, electromagnetic fields, light, mechanical stress and temperature — just what’s required in a traditional printed circuit board-based sensor. Plus, the microbes respond. They can produce colored proteins, for example. And not only that, they respond in a more nuanced way compared to the chip-based sensors. They can be more sensitive, as one example. + +[The time of 5G is almost here][4] + +The aforementioned DNA, built into bacteria, functions as a control unit, both for processing and storing data. Genomic DNA would contain the instructions for some functioning, and plasmids — which is another form of DNA related to how genes get into organisms — customize process functions through gene addition and subtraction. + +Networking is also addressed. Transceivers are also in bacterial IoT, the team says. The importing and exporting of molecules act as a form of signaling pathway, and a DNA exchange between two cells can take place. That’s called “molecular communication” and is described as a bacterial nanonetwork. Digital-to-DNA and back to DNA again is a DNA-related area currently showing promise. + +Bacteria should become a “substrate to build a biological version of the Internet of Things,” the scientists say. Interestingly, similar to how traditional IoT has been propelled forward by tech hobbyists mucking around with Arduino microcontrollers and Raspberry Pi educational mini-computers, Kim and Posland reckon it will be do-it-yourself biology that will kick-start IoBNT. They point out that easily obtainable educational products like [the Amino Labs kit][5] already allow the generation of specific colors from bacteria, for example. + +“Currently, tools and techniques to run small-scale experiments with micro-organisms are widely available to the general public, through various channels, including maker spaces.” + +The team also suggest that hypothetically the “gamification of bacteria” could become a part of the experimentation. Biotic games exist. The researchers propose “to utilize the DIY biology movement and gamification techniques to leverage user engagement and introduction to bacteria.” + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3518413/how-bacteria-could-run-the-internet-of-things.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3268646/dna-data-storage-closer-to-becoming-reality.html +[2]: https://arxiv.org/ftp/arxiv/papers/1910/1910.01974.pdf +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.networkworld.com/article/3354477/mobile-world-congress-the-time-of-5g-is-almost-here.html +[5]: https://amino.bio/ +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 60b4b26f1606225edd395f943946dbd230f0ce75 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 1 Feb 2020 10:31:17 +0800 Subject: [PATCH 0509/3057] translating --- ...tool to get your local weather forecast.md | 104 ------------------ ...tool to get your local weather forecast.md | 101 +++++++++++++++++ 2 files changed, 101 insertions(+), 104 deletions(-) delete mode 100644 sources/tech/20200123 Use this open source tool to get your local weather forecast.md create mode 100644 translated/tech/20200123 Use this open source tool to get your local weather forecast.md diff --git a/sources/tech/20200123 Use this open source tool to get your local weather forecast.md b/sources/tech/20200123 Use this open source tool to get your local weather forecast.md deleted file mode 100644 index df44d3b659..0000000000 --- a/sources/tech/20200123 Use this open source tool to get your local weather forecast.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use this open source tool to get your local weather forecast) -[#]: via: (https://opensource.com/article/20/1/open-source-weather-forecast) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use this open source tool to get your local weather forecast -====== -Know whether you need a coat, an umbrella, or sunscreen before you go -out with wego in the thirteenth in our series on 20 ways to be more -productive with open source in 2020. -![Sky with clouds and grass][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Check the weather with wego - -One of the things I love about the past decade of my employment is that it mostly has been remote. I can work anywhere I happen to be in the world, although the reality is that I spend a lot of time in my home office. The downside is that when I leave the house, I base a lot of decisions on what the conditions look like outside my window. And where I live, "sunny and clear" can mean anything from "scorchingly hot" to "below freezing" to "it will rain in an hour." Being able to check the actual conditions and forecast quickly is pretty useful. - -![Wego][2] - -[Wego][3] is a program written in Go that will fetch and display your local weather. It even renders it in shiny ASCII art if you wish. - -To install wego, you need to make sure [Go][4] is installed on your system. After that, you can fetch the latest version with the **go get** command. You'll probably want to add the **~/go/bin** directory to your path as well: - - -``` -go get -u github.com/schachmat/wego -export PATH=~/go/bin:$PATH -wego -``` - -On its first run, wego will complain about missing API keys. Now you need to decide on a backend. The default backend is for [Forecast.io][5], which is part of [Dark Sky][6]. Wego also supports [OpenWeatherMap][7] and [WorldWeatherOnline][8]. I prefer OpenWeatherMap, so that's what I'll show you how to set up here. - -You'll need to [register for an API key][9] with OpenWeatherMap. Registration is free, although the free API key has a limit on how many queries you can make in a day; this should be fine for an average user. Once you have your API key, put it into the **~/.wegorc** file. Now is also a good time to fill in your location, language, and whether you use metric, imperial (US/UK), metric-ms, or International System of Units (SI). OpenWeatherMap supports locations by name, postal code, coordinates, and ID, which is one of the reasons I like it. - - -``` -# wego configuration for OEM -aat-coords=false -aat-monochrome=false -backend=openweathermap -days=3 -forecast-lang=en -frontend=ascii-art-table -jsn-no-indent=false -location=Pittsboro -owm-api-key=XXXXXXXXXXXXXXXXXXXXX -owm-debug=false -owm-lang=en -units=imperial -``` - -Now, running **wego** at the command line will show the local weather for the next three days. - -Wego can also show data as JSON output for consumption by programs and with emoji. You can choose a frontend with the **-f** command-line parameter or in the **.wegorc** file. - -![Wego at login][10] - -If you want to see the weather every time you open a new shell or log into a host, simply add wego to your **~/.bashrc** (or **~/.zshrc** in my case). - -The [wttr.in][11] project is a web-based wrapper around wego. It provides some additional display options and is available on the website of the same name. One cool thing about wttr.in is that you can fetch one-line information about the weather with **curl**. I have a little shell function called **get_wttr** that fetches the current forecast in a shortened form. - - -``` -get_wttr() { -  curl -s "wttr.in/Pittsboro?format=3"     -} -``` - -![weather tool for productivity][12] - -Now, before I leave the house, I have a quick and easy way to find out if I need a coat, an umbrella, or sunscreen—directly from the command line where I spend most of my time. - -I began paragliding a few years ago. It’s maybe the most weather-dependent sport in the world. We... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/open-source-weather-forecast - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass) -[2]: https://opensource.com/sites/default/files/uploads/productivity_13-1.png (Wego) -[3]: https://github.com/schachmat/wego -[4]: https://golang.org/doc/install -[5]: https://forecast.io -[6]: https://darksky.net -[7]: https://openweathermap.org/ -[8]: https://www.worldweatheronline.com/ -[9]: https://openweathermap.org/api -[10]: https://opensource.com/sites/default/files/uploads/productivity_13-2.png (Wego at login) -[11]: https://github.com/chubin/wttr.in -[12]: https://opensource.com/sites/default/files/uploads/day13-image3.png (weather tool for productivity) diff --git a/translated/tech/20200123 Use this open source tool to get your local weather forecast.md b/translated/tech/20200123 Use this open source tool to get your local weather forecast.md new file mode 100644 index 0000000000..e151e40d65 --- /dev/null +++ b/translated/tech/20200123 Use this open source tool to get your local weather forecast.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this open source tool to get your local weather forecast) +[#]: via: (https://opensource.com/article/20/1/open-source-weather-forecast) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用这个开源工具获取本地天气预报 +====== +在我们的 20 个使用开源提升生产力的系列的第十三篇文章中使用 wego 来了解出门前你是否要需要外套、雨伞或者防晒霜。 +![Sky with clouds and grass][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 wego 了解天气 + +过去十年我对我的职业最满意的地方之一是大多数时候是远程工作。尽管现实情况是我很多时候是在家里办公,但我可以在世界上任何地方工作。缺点是,离家时我会根据天气做出一些决定。在我居住的地方,”晴朗“可以表示从”酷热“、”低于零度“到”一小时内会小雨“。能够了解实际情况和快速预测非常有用。 + +![Wego][2] + +[Wego][3] 是用 Go 编写的程序,可以获取并显示你的当地天气。如果你愿意,它甚至可以用闪亮的 ASCII 艺术效果进行渲染。 + +要安装 wego,你需要确保在系统上安装了[Go][4]。之后,你可以使用 **go get** 命令获取最新版本。你可能还想将 **~/go/bin** 目录添加到路径中: + + +``` +go get -u github.com/schachmat/wego +export PATH=~/go/bin:$PATH +wego +``` + +首次运行时,wego 会报告缺失 API 密钥。现在你需要决定一个后端。默认后端是 [Forecast.io][5],它是 [Dark Sky][6]的一部分。Wego还支持 [OpenWeatherMap][7] 和 [WorldWeatherOnline][8]。我更喜欢 OpenWeatherMap,因此我将在此向你展示如何设置。 + +你需要在 OpenWeatherMap 中[注册 API 密钥][9]。注册是免费的,尽管免费的 API 密钥限制了一天可以查询的数量,但这对于普通用户来说应该没问题。得到 API 密钥后,将它放到 **~/.wegorc** 文件中。现在可以填写你的位置、语言以及使用公制、英制(英国/美国)还是国际单位制(SI)。OpenWeatherMap 可通过名称、邮政编码、坐标和 ID 确定位置,这是我喜欢它的原因之一。 + + + +``` +# wego configuration for OEM +aat-coords=false +aat-monochrome=false +backend=openweathermap +days=3 +forecast-lang=en +frontend=ascii-art-table +jsn-no-indent=false +location=Pittsboro +owm-api-key=XXXXXXXXXXXXXXXXXXXXX +owm-debug=false +owm-lang=en +units=imperial +``` + +现在,在命令行运行 **wego** 将显示接下来三天的当地天气。 + +Wego 还可以输出 JSON 以便程序使用,还可显示 emoji。你可以使用 **-f** 参数或在 **.wegorc** 文件中指定前端。 + +![Wego at login][10] + +如果你想在每次打开 shell 或登录主机时查看天气,只需将 wego 添加到 **~/.bashrc**(我这里是 **~/.zshrc**)即可。 + +[wttr.in][11] 项目是 wego 上的基于 Web 的封装。它提供了一些其他显示选项,并且可以在同名网站上看到。关于 wttr.in 的一件很酷的事情是,你可以使用 **curl** 获取一行天气信息。我有一个名为 **get_wttr** 的 shell 函数,用于获取当前简化的预报信息。 + + +``` +get_wttr() { +  curl -s "wttr.in/Pittsboro?format=3"     +} +``` + +![weather tool for productivity][12] + +现在,在我离开家之前,我就可以通过命令行快速简单地获取我是否需要外套、雨伞或者防晒霜了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-weather-forecast + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass) +[2]: https://opensource.com/sites/default/files/uploads/productivity_13-1.png (Wego) +[3]: https://github.com/schachmat/wego +[4]: https://golang.org/doc/install +[5]: https://forecast.io +[6]: https://darksky.net +[7]: https://openweathermap.org/ +[8]: https://www.worldweatheronline.com/ +[9]: https://openweathermap.org/api +[10]: https://opensource.com/sites/default/files/uploads/productivity_13-2.png (Wego at login) +[11]: https://github.com/chubin/wttr.in +[12]: https://opensource.com/sites/default/files/uploads/day13-image3.png (weather tool for productivity) From 2938813972673d0936258e1d64ce06af7932c2f7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 1 Feb 2020 10:35:42 +0800 Subject: [PATCH 0510/3057] translating --- ...eeds and podcasts in one place with this open source tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md b/sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md index 994523d830..d257520efa 100644 --- a/sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md +++ b/sources/tech/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From be6b1cf405831fa52f2914ed889d220acd10d734 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 1 Feb 2020 11:16:42 +0800 Subject: [PATCH 0511/3057] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20202001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... to create an e-book chapter template in LibreOffice Writer.md | 0 published/{ => 202001}/20190405 File sharing with Git.md | 0 published/{ => 202001}/20190406 Run a server with Git.md | 0 .../20190619 Getting started with OpenSSL- Cryptography basics.md | 0 .../20190724 How to make an old computer useful again.md | 0 ... An advanced look at Python interfaces using zope.interface.md | 0 ...n save your tasks - and your sanity - if SSH is interrupted.md | 0 published/{ => 202001}/20191015 How GNOME uses Git.md | 0 .../20191016 Open source interior design with Sweet Home 3D.md | 0 .../{ => 202001}/20191017 Intro to the Linux useradd command.md | 0 .../20191108 My Linux story- Learning Linux in the 90s.md | 0 .../20191113 How to cohost GitHub and GitLab with Ansible.md | 0 .../{ => 202001}/20191121 Simulate gravity in your Python game.md | 0 .../20191129 How to write a Python web API with Django.md | 0 .../{ => 202001}/20191130 7 maker gifts for kids and teens.md | 0 .../20191205 Add jumping to your Python platformer game.md | 0 .../20191208 What-s your favorite terminal emulator.md | 0 .../20191210 Lessons learned from programming in Go.md | 0 ... Enable your Python game player to run forward and backward.md | 0 .../20191214 Make VLC More Awesome With These Simple Tips.md | 0 .../20191215 How to Add Border Around Text in GIMP.md | 0 ...7 App Highlight- Open Source Disk Partitioning Tool GParted.md | 0 .../{ => 202001}/20191219 Kubernetes namespaces for beginners.md | 0 .../20191220 4 ways to volunteer this holiday season.md | 0 ...220 Why Vim fans love the Herbstluftwm Linux window manager.md | 0 .../20191221 Pop-_OS vs Ubuntu- Which One is Better.md | 0 ...191224 Chill out with the Linux Equinox Desktop Environment.md | 0 ...91226 Darktable 3 Released With GUI Rework and New Features.md | 0 .../20191227 10 resources to boost your Git skills.md | 0 ...hy Your Distribution Still Using an ‘Outdated- Linux Kernel.md | 0 .../20191229 The best resources for agile software development.md | 0 .../20191230 10 articles to enhance your security aptitude.md | 0 ...230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md | 0 ...1 10 Ansible resources to accelerate your automation skills.md | 0 .../20191231 12 programming resources for coders of all levels.md | 0 .../{ => 202001}/20200101 5 predictions for Kubernetes in 2020.md | 0 ...00101 9 cheat sheets and guides to enhance your tech skills.md | 0 .../20200101 Signal- A Secure, Open Source Messaging App.md | 0 .../20200102 Put some loot in your Python platformer game.md | 0 ...3 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md | 0 ...troducing the guide to inter-process communication in Linux.md | 0 ...20200103 My Raspberry Pi retrospective- 6 projects and more.md | 0 .../20200105 PaperWM- tiled window management for GNOME.md | 0 ...0106 How to write a Python web API with Pyramid and Cornice.md | 0 ...107 Generating numeric sequences with the Linux seq command.md | 0 ...0107 How piwheels will save Raspberry Pi users time in 2020.md | 0 .../20200108 How to setup multiple monitors in sway.md | 0 ...0109 Huawei-s Linux Distribution openEuler is Available Now.md | 0 ...end eMail With a List of User Accounts Expiring in -X- Days.md | 0 .../20200111 Sync files across multiple devices with Syncthing.md | 0 ... Use Stow for configuration management of multiple machines.md | 0 .../20200113 Keep your email in sync with OfflineIMAP.md | 0 ...tV- A Bash function to maintain Python virtual environments.md | 0 .../{ => 202001}/20200114 Organize your email with Notmuch.md | 0 published/{ => 202001}/20200115 6 handy Bash scripts for Git.md | 0 ...15 Organize and sync your calendar with khal and vdirsyncer.md | 0 ...00115 Root User in Ubuntu- Important Things You Should Know.md | 0 .../20200115 Why everyone is talking about WebAssembly.md | 0 .../20200116 3 open source tools to manage your contacts.md | 0 ...Rust- Which to choose for programming hardware abstractions.md | 0 ...200117 Get started with this open source to-do list manager.md | 0 .../20200117 Locking and unlocking accounts on Linux systems.md | 0 .../20200119 What-s your favorite Linux terminal trick.md | 0 ...ting up passwordless Linux logins using public-private keys.md | 0 .../20200123 Wine 5.0 is Released- Here-s How to Install it.md | 0 65 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 202001}/20171018 How to create an e-book chapter template in LibreOffice Writer.md (100%) rename published/{ => 202001}/20190405 File sharing with Git.md (100%) rename published/{ => 202001}/20190406 Run a server with Git.md (100%) rename published/{ => 202001}/20190619 Getting started with OpenSSL- Cryptography basics.md (100%) rename published/{ => 202001}/20190724 How to make an old computer useful again.md (100%) rename published/{ => 202001}/20190924 An advanced look at Python interfaces using zope.interface.md (100%) rename published/{ => 202001}/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md (100%) rename published/{ => 202001}/20191015 How GNOME uses Git.md (100%) rename published/{ => 202001}/20191016 Open source interior design with Sweet Home 3D.md (100%) rename published/{ => 202001}/20191017 Intro to the Linux useradd command.md (100%) rename published/{ => 202001}/20191108 My Linux story- Learning Linux in the 90s.md (100%) rename published/{ => 202001}/20191113 How to cohost GitHub and GitLab with Ansible.md (100%) rename published/{ => 202001}/20191121 Simulate gravity in your Python game.md (100%) rename published/{ => 202001}/20191129 How to write a Python web API with Django.md (100%) rename published/{ => 202001}/20191130 7 maker gifts for kids and teens.md (100%) rename published/{ => 202001}/20191205 Add jumping to your Python platformer game.md (100%) rename published/{ => 202001}/20191208 What-s your favorite terminal emulator.md (100%) rename published/{ => 202001}/20191210 Lessons learned from programming in Go.md (100%) rename published/{ => 202001}/20191211 Enable your Python game player to run forward and backward.md (100%) rename published/{ => 202001}/20191214 Make VLC More Awesome With These Simple Tips.md (100%) rename published/{ => 202001}/20191215 How to Add Border Around Text in GIMP.md (100%) rename published/{ => 202001}/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md (100%) rename published/{ => 202001}/20191219 Kubernetes namespaces for beginners.md (100%) rename published/{ => 202001}/20191220 4 ways to volunteer this holiday season.md (100%) rename published/{ => 202001}/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md (100%) rename published/{ => 202001}/20191221 Pop-_OS vs Ubuntu- Which One is Better.md (100%) rename published/{ => 202001}/20191224 Chill out with the Linux Equinox Desktop Environment.md (100%) rename published/{ => 202001}/20191226 Darktable 3 Released With GUI Rework and New Features.md (100%) rename published/{ => 202001}/20191227 10 resources to boost your Git skills.md (100%) rename published/{ => 202001}/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md (100%) rename published/{ => 202001}/20191229 The best resources for agile software development.md (100%) rename published/{ => 202001}/20191230 10 articles to enhance your security aptitude.md (100%) rename published/{ => 202001}/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md (100%) rename published/{ => 202001}/20191231 10 Ansible resources to accelerate your automation skills.md (100%) rename published/{ => 202001}/20191231 12 programming resources for coders of all levels.md (100%) rename published/{ => 202001}/20200101 5 predictions for Kubernetes in 2020.md (100%) rename published/{ => 202001}/20200101 9 cheat sheets and guides to enhance your tech skills.md (100%) rename published/{ => 202001}/20200101 Signal- A Secure, Open Source Messaging App.md (100%) rename published/{ => 202001}/20200102 Put some loot in your Python platformer game.md (100%) rename published/{ => 202001}/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md (100%) rename published/{ => 202001}/20200103 Introducing the guide to inter-process communication in Linux.md (100%) rename published/{ => 202001}/20200103 My Raspberry Pi retrospective- 6 projects and more.md (100%) rename published/{ => 202001}/20200105 PaperWM- tiled window management for GNOME.md (100%) rename published/{ => 202001}/20200106 How to write a Python web API with Pyramid and Cornice.md (100%) rename published/{ => 202001}/20200107 Generating numeric sequences with the Linux seq command.md (100%) rename published/{ => 202001}/20200107 How piwheels will save Raspberry Pi users time in 2020.md (100%) rename published/{ => 202001}/20200108 How to setup multiple monitors in sway.md (100%) rename published/{ => 202001}/20200109 Huawei-s Linux Distribution openEuler is Available Now.md (100%) rename published/{ => 202001}/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md (100%) rename published/{ => 202001}/20200111 Sync files across multiple devices with Syncthing.md (100%) rename published/{ => 202001}/20200112 Use Stow for configuration management of multiple machines.md (100%) rename published/{ => 202001}/20200113 Keep your email in sync with OfflineIMAP.md (100%) rename published/{ => 202001}/20200113 setV- A Bash function to maintain Python virtual environments.md (100%) rename published/{ => 202001}/20200114 Organize your email with Notmuch.md (100%) rename published/{ => 202001}/20200115 6 handy Bash scripts for Git.md (100%) rename published/{ => 202001}/20200115 Organize and sync your calendar with khal and vdirsyncer.md (100%) rename published/{ => 202001}/20200115 Root User in Ubuntu- Important Things You Should Know.md (100%) rename published/{ => 202001}/20200115 Why everyone is talking about WebAssembly.md (100%) rename published/{ => 202001}/20200116 3 open source tools to manage your contacts.md (100%) rename published/{ => 202001}/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md (100%) rename published/{ => 202001}/20200117 Get started with this open source to-do list manager.md (100%) rename published/{ => 202001}/20200117 Locking and unlocking accounts on Linux systems.md (100%) rename published/{ => 202001}/20200119 What-s your favorite Linux terminal trick.md (100%) rename published/{ => 202001}/20200122 Setting up passwordless Linux logins using public-private keys.md (100%) rename published/{ => 202001}/20200123 Wine 5.0 is Released- Here-s How to Install it.md (100%) diff --git a/published/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/published/202001/20171018 How to create an e-book chapter template in LibreOffice Writer.md similarity index 100% rename from published/20171018 How to create an e-book chapter template in LibreOffice Writer.md rename to published/202001/20171018 How to create an e-book chapter template in LibreOffice Writer.md diff --git a/published/20190405 File sharing with Git.md b/published/202001/20190405 File sharing with Git.md similarity index 100% rename from published/20190405 File sharing with Git.md rename to published/202001/20190405 File sharing with Git.md diff --git a/published/20190406 Run a server with Git.md b/published/202001/20190406 Run a server with Git.md similarity index 100% rename from published/20190406 Run a server with Git.md rename to published/202001/20190406 Run a server with Git.md diff --git a/published/20190619 Getting started with OpenSSL- Cryptography basics.md b/published/202001/20190619 Getting started with OpenSSL- Cryptography basics.md similarity index 100% rename from published/20190619 Getting started with OpenSSL- Cryptography basics.md rename to published/202001/20190619 Getting started with OpenSSL- Cryptography basics.md diff --git a/published/20190724 How to make an old computer useful again.md b/published/202001/20190724 How to make an old computer useful again.md similarity index 100% rename from published/20190724 How to make an old computer useful again.md rename to published/202001/20190724 How to make an old computer useful again.md diff --git a/published/20190924 An advanced look at Python interfaces using zope.interface.md b/published/202001/20190924 An advanced look at Python interfaces using zope.interface.md similarity index 100% rename from published/20190924 An advanced look at Python interfaces using zope.interface.md rename to published/202001/20190924 An advanced look at Python interfaces using zope.interface.md diff --git a/published/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md b/published/202001/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md similarity index 100% rename from published/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md rename to published/202001/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md diff --git a/published/20191015 How GNOME uses Git.md b/published/202001/20191015 How GNOME uses Git.md similarity index 100% rename from published/20191015 How GNOME uses Git.md rename to published/202001/20191015 How GNOME uses Git.md diff --git a/published/20191016 Open source interior design with Sweet Home 3D.md b/published/202001/20191016 Open source interior design with Sweet Home 3D.md similarity index 100% rename from published/20191016 Open source interior design with Sweet Home 3D.md rename to published/202001/20191016 Open source interior design with Sweet Home 3D.md diff --git a/published/20191017 Intro to the Linux useradd command.md b/published/202001/20191017 Intro to the Linux useradd command.md similarity index 100% rename from published/20191017 Intro to the Linux useradd command.md rename to published/202001/20191017 Intro to the Linux useradd command.md diff --git a/published/20191108 My Linux story- Learning Linux in the 90s.md b/published/202001/20191108 My Linux story- Learning Linux in the 90s.md similarity index 100% rename from published/20191108 My Linux story- Learning Linux in the 90s.md rename to published/202001/20191108 My Linux story- Learning Linux in the 90s.md diff --git a/published/20191113 How to cohost GitHub and GitLab with Ansible.md b/published/202001/20191113 How to cohost GitHub and GitLab with Ansible.md similarity index 100% rename from published/20191113 How to cohost GitHub and GitLab with Ansible.md rename to published/202001/20191113 How to cohost GitHub and GitLab with Ansible.md diff --git a/published/20191121 Simulate gravity in your Python game.md b/published/202001/20191121 Simulate gravity in your Python game.md similarity index 100% rename from published/20191121 Simulate gravity in your Python game.md rename to published/202001/20191121 Simulate gravity in your Python game.md diff --git a/published/20191129 How to write a Python web API with Django.md b/published/202001/20191129 How to write a Python web API with Django.md similarity index 100% rename from published/20191129 How to write a Python web API with Django.md rename to published/202001/20191129 How to write a Python web API with Django.md diff --git a/published/20191130 7 maker gifts for kids and teens.md b/published/202001/20191130 7 maker gifts for kids and teens.md similarity index 100% rename from published/20191130 7 maker gifts for kids and teens.md rename to published/202001/20191130 7 maker gifts for kids and teens.md diff --git a/published/20191205 Add jumping to your Python platformer game.md b/published/202001/20191205 Add jumping to your Python platformer game.md similarity index 100% rename from published/20191205 Add jumping to your Python platformer game.md rename to published/202001/20191205 Add jumping to your Python platformer game.md diff --git a/published/20191208 What-s your favorite terminal emulator.md b/published/202001/20191208 What-s your favorite terminal emulator.md similarity index 100% rename from published/20191208 What-s your favorite terminal emulator.md rename to published/202001/20191208 What-s your favorite terminal emulator.md diff --git a/published/20191210 Lessons learned from programming in Go.md b/published/202001/20191210 Lessons learned from programming in Go.md similarity index 100% rename from published/20191210 Lessons learned from programming in Go.md rename to published/202001/20191210 Lessons learned from programming in Go.md diff --git a/published/20191211 Enable your Python game player to run forward and backward.md b/published/202001/20191211 Enable your Python game player to run forward and backward.md similarity index 100% rename from published/20191211 Enable your Python game player to run forward and backward.md rename to published/202001/20191211 Enable your Python game player to run forward and backward.md diff --git a/published/20191214 Make VLC More Awesome With These Simple Tips.md b/published/202001/20191214 Make VLC More Awesome With These Simple Tips.md similarity index 100% rename from published/20191214 Make VLC More Awesome With These Simple Tips.md rename to published/202001/20191214 Make VLC More Awesome With These Simple Tips.md diff --git a/published/20191215 How to Add Border Around Text in GIMP.md b/published/202001/20191215 How to Add Border Around Text in GIMP.md similarity index 100% rename from published/20191215 How to Add Border Around Text in GIMP.md rename to published/202001/20191215 How to Add Border Around Text in GIMP.md diff --git a/published/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/published/202001/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md similarity index 100% rename from published/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md rename to published/202001/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md diff --git a/published/20191219 Kubernetes namespaces for beginners.md b/published/202001/20191219 Kubernetes namespaces for beginners.md similarity index 100% rename from published/20191219 Kubernetes namespaces for beginners.md rename to published/202001/20191219 Kubernetes namespaces for beginners.md diff --git a/published/20191220 4 ways to volunteer this holiday season.md b/published/202001/20191220 4 ways to volunteer this holiday season.md similarity index 100% rename from published/20191220 4 ways to volunteer this holiday season.md rename to published/202001/20191220 4 ways to volunteer this holiday season.md diff --git a/published/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/published/202001/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md similarity index 100% rename from published/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md rename to published/202001/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md diff --git a/published/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/published/202001/20191221 Pop-_OS vs Ubuntu- Which One is Better.md similarity index 100% rename from published/20191221 Pop-_OS vs Ubuntu- Which One is Better.md rename to published/202001/20191221 Pop-_OS vs Ubuntu- Which One is Better.md diff --git a/published/20191224 Chill out with the Linux Equinox Desktop Environment.md b/published/202001/20191224 Chill out with the Linux Equinox Desktop Environment.md similarity index 100% rename from published/20191224 Chill out with the Linux Equinox Desktop Environment.md rename to published/202001/20191224 Chill out with the Linux Equinox Desktop Environment.md diff --git a/published/20191226 Darktable 3 Released With GUI Rework and New Features.md b/published/202001/20191226 Darktable 3 Released With GUI Rework and New Features.md similarity index 100% rename from published/20191226 Darktable 3 Released With GUI Rework and New Features.md rename to published/202001/20191226 Darktable 3 Released With GUI Rework and New Features.md diff --git a/published/20191227 10 resources to boost your Git skills.md b/published/202001/20191227 10 resources to boost your Git skills.md similarity index 100% rename from published/20191227 10 resources to boost your Git skills.md rename to published/202001/20191227 10 resources to boost your Git skills.md diff --git a/published/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md b/published/202001/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md similarity index 100% rename from published/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md rename to published/202001/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md diff --git a/published/20191229 The best resources for agile software development.md b/published/202001/20191229 The best resources for agile software development.md similarity index 100% rename from published/20191229 The best resources for agile software development.md rename to published/202001/20191229 The best resources for agile software development.md diff --git a/published/20191230 10 articles to enhance your security aptitude.md b/published/202001/20191230 10 articles to enhance your security aptitude.md similarity index 100% rename from published/20191230 10 articles to enhance your security aptitude.md rename to published/202001/20191230 10 articles to enhance your security aptitude.md diff --git a/published/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/published/202001/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md similarity index 100% rename from published/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md rename to published/202001/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md diff --git a/published/20191231 10 Ansible resources to accelerate your automation skills.md b/published/202001/20191231 10 Ansible resources to accelerate your automation skills.md similarity index 100% rename from published/20191231 10 Ansible resources to accelerate your automation skills.md rename to published/202001/20191231 10 Ansible resources to accelerate your automation skills.md diff --git a/published/20191231 12 programming resources for coders of all levels.md b/published/202001/20191231 12 programming resources for coders of all levels.md similarity index 100% rename from published/20191231 12 programming resources for coders of all levels.md rename to published/202001/20191231 12 programming resources for coders of all levels.md diff --git a/published/20200101 5 predictions for Kubernetes in 2020.md b/published/202001/20200101 5 predictions for Kubernetes in 2020.md similarity index 100% rename from published/20200101 5 predictions for Kubernetes in 2020.md rename to published/202001/20200101 5 predictions for Kubernetes in 2020.md diff --git a/published/20200101 9 cheat sheets and guides to enhance your tech skills.md b/published/202001/20200101 9 cheat sheets and guides to enhance your tech skills.md similarity index 100% rename from published/20200101 9 cheat sheets and guides to enhance your tech skills.md rename to published/202001/20200101 9 cheat sheets and guides to enhance your tech skills.md diff --git a/published/20200101 Signal- A Secure, Open Source Messaging App.md b/published/202001/20200101 Signal- A Secure, Open Source Messaging App.md similarity index 100% rename from published/20200101 Signal- A Secure, Open Source Messaging App.md rename to published/202001/20200101 Signal- A Secure, Open Source Messaging App.md diff --git a/published/20200102 Put some loot in your Python platformer game.md b/published/202001/20200102 Put some loot in your Python platformer game.md similarity index 100% rename from published/20200102 Put some loot in your Python platformer game.md rename to published/202001/20200102 Put some loot in your Python platformer game.md diff --git a/published/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md b/published/202001/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md similarity index 100% rename from published/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md rename to published/202001/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md diff --git a/published/20200103 Introducing the guide to inter-process communication in Linux.md b/published/202001/20200103 Introducing the guide to inter-process communication in Linux.md similarity index 100% rename from published/20200103 Introducing the guide to inter-process communication in Linux.md rename to published/202001/20200103 Introducing the guide to inter-process communication in Linux.md diff --git a/published/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/published/202001/20200103 My Raspberry Pi retrospective- 6 projects and more.md similarity index 100% rename from published/20200103 My Raspberry Pi retrospective- 6 projects and more.md rename to published/202001/20200103 My Raspberry Pi retrospective- 6 projects and more.md diff --git a/published/20200105 PaperWM- tiled window management for GNOME.md b/published/202001/20200105 PaperWM- tiled window management for GNOME.md similarity index 100% rename from published/20200105 PaperWM- tiled window management for GNOME.md rename to published/202001/20200105 PaperWM- tiled window management for GNOME.md diff --git a/published/20200106 How to write a Python web API with Pyramid and Cornice.md b/published/202001/20200106 How to write a Python web API with Pyramid and Cornice.md similarity index 100% rename from published/20200106 How to write a Python web API with Pyramid and Cornice.md rename to published/202001/20200106 How to write a Python web API with Pyramid and Cornice.md diff --git a/published/20200107 Generating numeric sequences with the Linux seq command.md b/published/202001/20200107 Generating numeric sequences with the Linux seq command.md similarity index 100% rename from published/20200107 Generating numeric sequences with the Linux seq command.md rename to published/202001/20200107 Generating numeric sequences with the Linux seq command.md diff --git a/published/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/published/202001/20200107 How piwheels will save Raspberry Pi users time in 2020.md similarity index 100% rename from published/20200107 How piwheels will save Raspberry Pi users time in 2020.md rename to published/202001/20200107 How piwheels will save Raspberry Pi users time in 2020.md diff --git a/published/20200108 How to setup multiple monitors in sway.md b/published/202001/20200108 How to setup multiple monitors in sway.md similarity index 100% rename from published/20200108 How to setup multiple monitors in sway.md rename to published/202001/20200108 How to setup multiple monitors in sway.md diff --git a/published/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/published/202001/20200109 Huawei-s Linux Distribution openEuler is Available Now.md similarity index 100% rename from published/20200109 Huawei-s Linux Distribution openEuler is Available Now.md rename to published/202001/20200109 Huawei-s Linux Distribution openEuler is Available Now.md diff --git a/published/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/published/202001/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md similarity index 100% rename from published/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md rename to published/202001/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md diff --git a/published/20200111 Sync files across multiple devices with Syncthing.md b/published/202001/20200111 Sync files across multiple devices with Syncthing.md similarity index 100% rename from published/20200111 Sync files across multiple devices with Syncthing.md rename to published/202001/20200111 Sync files across multiple devices with Syncthing.md diff --git a/published/20200112 Use Stow for configuration management of multiple machines.md b/published/202001/20200112 Use Stow for configuration management of multiple machines.md similarity index 100% rename from published/20200112 Use Stow for configuration management of multiple machines.md rename to published/202001/20200112 Use Stow for configuration management of multiple machines.md diff --git a/published/20200113 Keep your email in sync with OfflineIMAP.md b/published/202001/20200113 Keep your email in sync with OfflineIMAP.md similarity index 100% rename from published/20200113 Keep your email in sync with OfflineIMAP.md rename to published/202001/20200113 Keep your email in sync with OfflineIMAP.md diff --git a/published/20200113 setV- A Bash function to maintain Python virtual environments.md b/published/202001/20200113 setV- A Bash function to maintain Python virtual environments.md similarity index 100% rename from published/20200113 setV- A Bash function to maintain Python virtual environments.md rename to published/202001/20200113 setV- A Bash function to maintain Python virtual environments.md diff --git a/published/20200114 Organize your email with Notmuch.md b/published/202001/20200114 Organize your email with Notmuch.md similarity index 100% rename from published/20200114 Organize your email with Notmuch.md rename to published/202001/20200114 Organize your email with Notmuch.md diff --git a/published/20200115 6 handy Bash scripts for Git.md b/published/202001/20200115 6 handy Bash scripts for Git.md similarity index 100% rename from published/20200115 6 handy Bash scripts for Git.md rename to published/202001/20200115 6 handy Bash scripts for Git.md diff --git a/published/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/published/202001/20200115 Organize and sync your calendar with khal and vdirsyncer.md similarity index 100% rename from published/20200115 Organize and sync your calendar with khal and vdirsyncer.md rename to published/202001/20200115 Organize and sync your calendar with khal and vdirsyncer.md diff --git a/published/20200115 Root User in Ubuntu- Important Things You Should Know.md b/published/202001/20200115 Root User in Ubuntu- Important Things You Should Know.md similarity index 100% rename from published/20200115 Root User in Ubuntu- Important Things You Should Know.md rename to published/202001/20200115 Root User in Ubuntu- Important Things You Should Know.md diff --git a/published/20200115 Why everyone is talking about WebAssembly.md b/published/202001/20200115 Why everyone is talking about WebAssembly.md similarity index 100% rename from published/20200115 Why everyone is talking about WebAssembly.md rename to published/202001/20200115 Why everyone is talking about WebAssembly.md diff --git a/published/20200116 3 open source tools to manage your contacts.md b/published/202001/20200116 3 open source tools to manage your contacts.md similarity index 100% rename from published/20200116 3 open source tools to manage your contacts.md rename to published/202001/20200116 3 open source tools to manage your contacts.md diff --git a/published/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/published/202001/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md similarity index 100% rename from published/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md rename to published/202001/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md diff --git a/published/20200117 Get started with this open source to-do list manager.md b/published/202001/20200117 Get started with this open source to-do list manager.md similarity index 100% rename from published/20200117 Get started with this open source to-do list manager.md rename to published/202001/20200117 Get started with this open source to-do list manager.md diff --git a/published/20200117 Locking and unlocking accounts on Linux systems.md b/published/202001/20200117 Locking and unlocking accounts on Linux systems.md similarity index 100% rename from published/20200117 Locking and unlocking accounts on Linux systems.md rename to published/202001/20200117 Locking and unlocking accounts on Linux systems.md diff --git a/published/20200119 What-s your favorite Linux terminal trick.md b/published/202001/20200119 What-s your favorite Linux terminal trick.md similarity index 100% rename from published/20200119 What-s your favorite Linux terminal trick.md rename to published/202001/20200119 What-s your favorite Linux terminal trick.md diff --git a/published/20200122 Setting up passwordless Linux logins using public-private keys.md b/published/202001/20200122 Setting up passwordless Linux logins using public-private keys.md similarity index 100% rename from published/20200122 Setting up passwordless Linux logins using public-private keys.md rename to published/202001/20200122 Setting up passwordless Linux logins using public-private keys.md diff --git a/published/20200123 Wine 5.0 is Released- Here-s How to Install it.md b/published/202001/20200123 Wine 5.0 is Released- Here-s How to Install it.md similarity index 100% rename from published/20200123 Wine 5.0 is Released- Here-s How to Install it.md rename to published/202001/20200123 Wine 5.0 is Released- Here-s How to Install it.md From 523ed70853c845ed4944ebb553dff4d0c3990b8e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 1 Feb 2020 12:15:05 +0800 Subject: [PATCH 0512/3057] =?UTF-8?q?=E6=B8=85=E9=99=A4=E5=A4=AA=E4=B9=85?= =?UTF-8?q?=E8=BF=9C=E7=9A=84=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20200117 Fedora CoreOS out of preview.md | 108 --- ...ft release open source machine learning.md | 80 -- ...the developer, and more industry trends.md | 61 -- ...ript Fatigue- Realities of our industry.md | 221 ----- .../20171030 Why I love technical debt.md | 69 -- ... How to Monetize an Open Source Project.md | 86 -- ...air writing helps improve documentation.md | 87 -- ... and How to Set an Open Source Strategy.md | 120 --- ...71116 Why is collaboration so difficult.md | 94 -- ...lved our transparency and silo problems.md | 95 -- ...and GitHub to improve its documentation.md | 116 --- ... sourcing movements can share knowledge.md | 121 --- ... the cost of structured data is reduced.md | 181 ---- ...ering- A new paradigm for cybersecurity.md | 87 -- ...eat resume that actually gets you hired.md | 395 --------- ...lopment process that puts quality first.md | 99 --- ...nframes Aren-t Going Away Any Time Soon.md | 73 -- ...ywhere Is Dead, Long Live Anarchy Linux.md | 127 --- ... even if you don-t identify as a writer.md | 149 ---- ...ser community makes for better software.md | 47 - ...an anonymity and accountability coexist.md | 79 -- ...0216 Q4OS Makes Linux Easy for Everyone.md | 140 --- ...en naming software development projects.md | 91 -- ...80221 3 warning flags of DevOps metrics.md | 42 - ...0180222 3 reasons to say -no- in DevOps.md | 105 --- ... Give Life to a Mobile Linux Experience.md | 123 --- ...ortant issue in a DevOps transformation.md | 91 -- ...301 How to hire the right DevOps talent.md | 48 - ... as team on today-s open source project.md | 53 -- ...303 4 meetup ideas- Make your data open.md | 75 -- ...How to apply systems thinking in DevOps.md | 89 -- ...ommunity will help your project succeed.md | 111 --- ...Growing an Open Source Project Too Fast.md | 40 - ...comers- A guide for advanced developers.md | 119 --- ...en Source Projects With These Platforms.md | 96 -- ...for better agile retrospective meetings.md | 66 -- ...180323 7 steps to DevOps hiring success.md | 56 -- ... Android Auto emulator for Raspberry Pi.md | 81 -- ...one should avoid with hybrid multicloud.md | 87 -- ...0180404 Is the term DevSecOps necessary.md | 51 -- ...ing -ownership- across the organization.md | 125 --- .../talk/20180410 Microservices Explained.md | 61 -- ...ent, from coordination to collaboration.md | 71 -- ...back up your people, not just your data.md | 79 -- ... develop the FOSS leaders of the future.md | 93 -- ...mpatible with part-time community teams.md | 73 -- ...pen source project-s workflow on GitHub.md | 109 --- ...Could Be Costing to More Than You Think.md | 39 - ...s a Server in Every Serverless Platform.md | 87 -- ...80511 Looking at the Lispy side of Perl.md | 357 -------- ...7 Whatever Happened to the Semantic Web.md | 106 --- ...nciples of resilience for women in tech.md | 93 -- ... AI Is Coming to Edge Computing Devices.md | 66 -- ... list for open organization enthusiasts.md | 133 --- ...d avoid with hybrid multi-cloud, part 2.md | 68 -- ...g your project and community on Twitter.md | 157 ---- ...rate to the world of Linux from Windows.md | 154 ---- ...ones can teach us about open innovation.md | 49 - ...Ren-Py for creating interactive fiction.md | 70 -- ...ce Certification Matters More Than Ever.md | 49 - ... Linux and Windows Without Dual Booting.md | 141 --- ...eveloper 9 experiences you ll encounter.md | 141 --- ... a multi-microphone hearing aid project.md | 69 -- ...Confessions of a recovering Perl hacker.md | 46 - ... Success with Open Source Certification.md | 63 -- .../talk/20180719 Finding Jobs in Software.md | 90 -- ...e Certification- Preparing for the Exam.md | 64 -- ...ur workloads to the cloud is a bad idea.md | 71 -- ...jargon- The good, the bad, and the ugly.md | 108 --- ...180802 Design thinking as a way of life.md | 95 -- ...rammer in an underrepresented community.md | 94 -- ...lding more trustful teams in four steps.md | 70 -- ...ur team to a microservices architecture.md | 180 ---- .../20180809 How do tools affect culture.md | 56 -- ...eimplement Inheritance and Polymorphism.md | 235 ----- ...t the Evolution of the Desktop Computer.md | 130 --- ...Ru makes a college education affordable.md | 60 -- ...atient data safe with open source tools.md | 51 -- ...source projects for the new school year.md | 59 -- ...80906 DevOps- The consequences of blame.md | 67 -- ...he Rise and Demise of RSS (Old Version).md | 278 ------ ...80917 How gaming turned me into a coder.md | 103 --- ...Building a Secure Ecosystem for Node.js.md | 51 -- ...ubleshooting Node.js Issues with llnode.md | 75 -- ...1003 13 tools to measure DevOps success.md | 84 -- ...sier to Get a Payrise by Switching Jobs.md | 99 --- ...es for giving open source code feedback.md | 47 - ...sational interface design and usability.md | 105 --- ... your organization-s security expertise.md | 147 --- ...reasons not to write in-house ops tools.md | 64 -- ...pen source classifiers in AI algorithms.md | 111 --- ... BeOS or not to BeOS, that is the Haiku.md | 151 ---- ...out leveling up a heroic developer team.md | 213 ----- ...tips for facilitators of agile meetings.md | 60 -- ...open source hardware increases security.md | 84 -- ...ntinuous testing wrong - Opensource.com.md | 184 ---- ...rce in education creates new developers.md | 65 -- ...derstanding a -nix Shell by Writing One.md | 412 --------- ...seen these personalities in open source.md | 93 -- .../20181114 Analyzing the DNA of DevOps.md | 158 ---- ...open source- 9 tips for getting started.md | 76 -- ... Closer Look at Voice-Assisted Speakers.md | 125 --- ...t the open source community means to me.md | 94 -- ...9 top tech-recruiting mistakes to avoid.md | 108 --- ...back is important to the DevOps culture.md | 68 -- ... emerging tipping points in open source.md | 93 -- ... reasons to give Linux for the holidays.md | 78 -- ...in Linux Kernel Code Replaced with -Hug.md | 81 -- ...nately, Garbage Collection isn-t Enough.md | 44 - ...ware delivery with value stream mapping.md | 94 -- ...on the Desktop- Are We Nearly There Yet.md | 344 ------- .../talk/20181209 Open source DIY ethics.md | 62 -- ... tips to help non-techies move to Linux.md | 111 --- ...-t Succeeded on Desktop- Linus Torvalds.md | 65 -- ...ipten, LDC and bindbc-sdl (translation).md | 276 ------ ...ch skill in 2019- What you need to know.md | 145 --- ...ons for artificial intelligence in 2019.md | 91 -- ... Don-t Use ZFS on Linux- Linus Torvalds.md | 82 -- ...g- gene signatures and connectivity map.md | 133 --- ...hannels are bad and you should feel bad.md | 443 ---------- sources/tech/20170115 Magic GOPATH.md | 119 --- ...eboard problems in pure Lambda Calculus.md | 836 ------------------ ...20171006 7 deadly sins of documentation.md | 85 -- ...nes and Android Architecture Components.md | 201 ----- ...ute Once with Xen Linux TPM 2.0 and TXT.md | 94 -- ...o Mint and Quicken for personal finance.md | 96 -- ...1114 Finding Files with mlocate- Part 2.md | 174 ---- ...ux Programs for Drawing and Image Editing.md | 130 --- ...1121 Finding Files with mlocate- Part 3.md | 142 --- ...eractive Workflows for Cpp with Jupyter.md | 301 ------- ...usiness Software Alternatives For Linux.md | 117 --- ...power of community with organized chaos.md | 110 --- ...erve Scientific and Medical Communities.md | 170 ---- ... millions of Linux users with Snapcraft.md | 321 ------- ...xtensions You Should Be Using Right Now.md | 307 ------- ...ings Flexibility and Choice to openSUSE.md | 114 --- ...n must include people with disabilities.md | 67 -- sources/tech/20171224 My first Rust macro.md | 145 --- .../20180108 Debbugs Versioning- Merging.md | 80 -- ...erTux- A Linux Take on Super Mario Game.md | 77 -- ...et a compelling reason to turn to Linux.md | 70 -- ...ures resolving symbol addresses is hard.md | 163 ---- ...180114 Playing Quake 4 on Linux in 2018.md | 80 -- ...To Create A Bootable Zorin OS USB Drive.md | 315 ------- ...Top 6 open source desktop email clients.md | 115 --- ... Perl module a minimalist web framework.md | 106 --- ...urity features installing apps and more.md | 245 ----- ... for using CUPS for printing with Linux.md | 101 --- ...here MQ programming in Python with Zato.md | 262 ------ ... and manage MacOS LaunchAgents using Go.md | 314 ------- ...security risks in open source libraries.md | 249 ------ .../tech/20180130 Trying Other Go Versions.md | 112 --- ...chem group subversion repository to Git.md | 223 ----- ...y a React App on a DigitalOcean Droplet.md | 199 ----- .../tech/20180202 CompositeAcceleration.md | 211 ----- ...h the openbox windows manager in Fedora.md | 216 ----- ...0205 Writing eBPF tracing tools in Rust.md | 258 ------ ...art writing macros in LibreOffice Basic.md | 332 ------- ...e to create interactive adventure games.md | 299 ------- ...20180211 Latching Mutations with GitOps.md | 60 -- ...t Is sosreport- How To Create sosreport.md | 195 ---- ...A Comparison of Three Linux -App Stores.md | 128 --- ...n source card and board games for Linux.md | 103 --- ...hite male asshole, by a former offender.md | 153 ---- ...o create an open source stack using EFK.md | 388 -------- .../tech/20180327 Anna A KVS for any scale.md | 139 --- ...n to the Flask Python web app framework.md | 451 ---------- ... Importer Tool Rewritten in C plus plus.md | 70 -- ...ipt to your Java enterprise with Vert.x.md | 362 -------- ...80411 5 Best Feed Reader Apps for Linux.md | 192 ---- ...custom Linux settings with DistroTweaks.md | 108 --- ... Getting started with Jenkins Pipelines.md | 352 -------- ...0180413 Redcore Linux Makes Gentoo Easy.md | 89 -- ...iting Advanced Web Applications with Go.md | 695 --------------- ...y way to add free books to your eReader.md | 179 ---- ...x filesystem forensics - Opensource.com.md | 342 ------- ...aging virtual environments with Vagrant.md | 488 ---------- ... An easy way to generate RPG characters.md | 136 --- ...istributed tracing system work together.md | 156 ---- ... Modularity in Fedora 28 Server Edition.md | 76 -- ...507 Multinomial Logistic Classification.md | 215 ----- ...ux Revives Your Older Computer [Review].md | 114 --- ...ghtBSD Could Be Your Gateway to FreeBSD.md | 180 ---- ...to the Pyramid web framework for Python.md | 617 ------------- ...ust, flexible virtual tabletop for RPGs.md | 216 ----- ...t The Historical Uptime Of Linux System.md | 330 ------- ...id into a Linux development environment.md | 81 -- ...w to Enable Click to Minimize On Ubuntu.md | 102 --- ... BSD Distribution for the Desktop Users.md | 147 --- ...ustralian TV Channels to a Raspberry Pi.md | 209 ----- ... Go runtime implements maps efficiently.md | 355 -------- ... Build an Amazon Echo with Raspberry Pi.md | 374 -------- ...1 3 open source music players for Linux.md | 128 --- ...Get Started with Snap Packages in Linux.md | 159 ---- ...How to Install and Use Flatpak on Linux.md | 167 ---- ...ping tools to extract data from the web.md | 207 ----- ...ing an older relative online with Linux.md | 76 -- ...n books for Linux and open source types.md | 113 --- ...e tools to make literature reviews easy.md | 73 -- ...Ledger for YNAB-like envelope budgeting.md | 143 --- ...h tips for everyday at the command line.md | 593 ------------- ...t apps with Pronghorn, a Java framework.md | 120 --- ...180621 Troubleshooting a Buildah script.md | 179 ---- ...corn Archimedes Games on a Raspberry Pi.md | 539 ----------- ...629 Discover hidden gems in LibreOffice.md | 97 -- ...ging Linux applications becoming a snap.md | 148 ---- ...Browse Stack Overflow From The Terminal.md | 188 ---- ...gs to do After Installing Linux Mint 19.md | 223 ----- ...702 5 open source alternatives to Skype.md | 101 --- ...v4 launch an optimism born of necessity.md | 91 -- ...Scheme for the Software Defined Vehicle.md | 88 -- ...6 Using Ansible to set up a workstation.md | 168 ---- ... simple and elegant free podcast player.md | 119 --- ...The aftermath of the Gentoo GitHub hack.md | 72 -- ...ource racing and flying games for Linux.md | 102 --- ... Snapshot And Restore Utility For Linux.md | 237 ----- ...mand Line With OpenSubtitlesDownload.py.md | 221 ----- ...ner image- Meeting the legal challenges.md | 64 -- ...tandard Notes for encrypted note-taking.md | 299 ------- ...lusively Created for Microsoft Exchange.md | 114 --- ...0180801 Migrating Perl 5 code to Perl 6.md | 77 -- ...2 Walkthrough On How To Use GNOME Boxes.md | 117 --- ...ora Server to create a router - gateway.md | 285 ------ ...NU Make to load 1.4GB of data every day.md | 126 --- ...ecryption Effect Seen On Sneakers Movie.md | 110 --- ...806 Use Gstreamer and Python to rip CDs.md | 312 ------- ...fix, an open source mail transfer agent.md | 334 ------- ...Quality sound, open source music player.md | 105 --- ...E- 6 reasons to love this Linux desktop.md | 71 -- ...garden with Edraw Max - FOSS adventures.md | 74 -- .../20180816 Garbage collection in Perl 6.md | 121 --- ...ryaLinux- A Distribution and a Platform.md | 224 ----- ... a new open source web development tool.md | 282 ------ ...r behaviour on my competitor-s websites.md | 117 --- ...owchart and diagramming tools for Linux.md | 186 ---- ... books to your eReader- Formatting tips.md | 183 ---- ...sktop Client With VODs And Chat Support.md | 126 --- ...20180829 4 open source monitoring tools.md | 143 --- sources/tech/20180829 Containers in Perl 6.md | 174 ---- ...0830 A quick guide to DNF for yum users.md | 131 --- ... your website across all mobile devices.md | 85 -- ...ow subroutine signatures work in Perl 6.md | 335 ------- ...reat Desktop for the Open Source Purist.md | 114 --- ...diobook Player For DRM-Free Audio Files.md | 72 -- ...st your own cloud with Raspberry Pi NAS.md | 128 --- ...r Own Streaming Media Server In Minutes.md | 171 ---- ...ibuted tracing in a microservices world.md | 113 --- ...untu Linux With Kazam -Beginner-s Guide.md | 185 ---- ...oint is a Delight for Stealth Game Fans.md | 104 --- ...s To Find Out Process ID (PID) In Linux.md | 208 ----- ... the Audiophile Linux distro for a spin.md | 161 ---- ...29 Use Cozy to Play Audiobooks in Linux.md | 138 --- .../tech/20181003 Manage NTP with Chrony.md | 291 ------ ... 4 Must-Have Tools for Monitoring Linux.md | 102 --- ... to access educational material offline.md | 107 --- ...erna, a web-based information organizer.md | 128 --- ...tion to Ansible Operators in Kubernetes.md | 81 -- ...ckage installation for the Raspberry Pi.md | 87 -- ...ting upstream releases with release-bot.md | 327 ------- ...source alternatives to Microsoft Access.md | 94 -- ...tive, JavaScript timeline building tool.md | 82 -- ...irmware Version from Linux Command Line.md | 131 --- ... data streams on the Linux command line.md | 302 ------- ... started with OKD on your Linux desktop.md | 407 --------- ...How to manage storage on Linux with LVM.md | 237 ----- ...es Installed From Particular Repository.md | 342 ------- ...s on running new software in production.md | 151 ---- ...Behind the scenes with Linux containers.md | 205 ----- ...o After Installing elementary OS 5 Juno.md | 260 ------ ...how C-- destructors are useful in Envoy.md | 130 --- ...20181122 Getting started with Jenkins X.md | 148 ---- ... scientific research Linux distribution.md | 79 -- ...tom documentation workflows with Sphinx.md | 126 --- ...How to test your network with PerfSONAR.md | 148 ---- ...nd Tutorial With Examples For Beginners.md | 192 ---- ...earch - Quick Search GUI Tool for Linux.md | 108 --- ... How to view XML files in a web browser.md | 109 --- ... Screen Recorders for the Linux Desktop.md | 177 ---- ...ent and delivery of a hybrid mobile app.md | 102 --- ...you document a tech project with comics.md | 100 --- ... Commands And Programs From Commandline.md | 265 ------ ...g Flood Element for performance testing.md | 180 ---- ...h Reliability Infrastructure Migrations.md | 78 -- ...using KeePassX to secure your passwords.md | 78 -- ...less Way of Using Google Drive on Linux.md | 137 --- ...Large files with Git- LFS and git-annex.md | 145 --- ...o Heaven With These 23 GNOME Extensions.md | 288 ------ ...226 -Review- Polo File Manager in Linux.md | 139 --- ... model of concurrent garbage collection.md | 62 -- ...1229 Some nonparametric statistics math.md | 178 ---- 290 files changed, 44787 deletions(-) delete mode 100644 sources/news/20200117 Fedora CoreOS out of preview.md delete mode 100644 sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md delete mode 100644 sources/news/20200125 What 2020 brings for the developer, and more industry trends.md delete mode 100644 sources/talk/20170717 The Ultimate Guide to JavaScript Fatigue- Realities of our industry.md delete mode 100644 sources/talk/20171030 Why I love technical debt.md delete mode 100644 sources/talk/20171107 How to Monetize an Open Source Project.md delete mode 100644 sources/talk/20171114 Why pair writing helps improve documentation.md delete mode 100644 sources/talk/20171115 Why and How to Set an Open Source Strategy.md delete mode 100644 sources/talk/20171116 Why is collaboration so difficult.md delete mode 100644 sources/talk/20171221 Changing how we use Slack solved our transparency and silo problems.md delete mode 100644 sources/talk/20180109 How Mycroft used WordPress and GitHub to improve its documentation.md delete mode 100644 sources/talk/20180111 The open organization and inner sourcing movements can share knowledge.md delete mode 100644 sources/talk/20180112 in which the cost of structured data is reduced.md delete mode 100644 sources/talk/20180124 Security Chaos Engineering- A new paradigm for cybersecurity.md delete mode 100644 sources/talk/20180131 How to write a really great resume that actually gets you hired.md delete mode 100644 sources/talk/20180206 UQDS- A software-development process that puts quality first.md delete mode 100644 sources/talk/20180207 Why Mainframes Aren-t Going Away Any Time Soon.md delete mode 100644 sources/talk/20180209 Arch Anywhere Is Dead, Long Live Anarchy Linux.md delete mode 100644 sources/talk/20180209 How writing can change your career for the better, even if you don-t identify as a writer.md delete mode 100644 sources/talk/20180209 Why an involved user community makes for better software.md delete mode 100644 sources/talk/20180214 Can anonymity and accountability coexist.md delete mode 100644 sources/talk/20180216 Q4OS Makes Linux Easy for Everyone.md delete mode 100644 sources/talk/20180220 4 considerations when naming software development projects.md delete mode 100644 sources/talk/20180221 3 warning flags of DevOps metrics.md delete mode 100644 sources/talk/20180222 3 reasons to say -no- in DevOps.md delete mode 100644 sources/talk/20180223 Plasma Mobile Could Give Life to a Mobile Linux Experience.md delete mode 100644 sources/talk/20180223 Why culture is the most important issue in a DevOps transformation.md delete mode 100644 sources/talk/20180301 How to hire the right DevOps talent.md delete mode 100644 sources/talk/20180302 Beyond metrics- How to operate as team on today-s open source project.md delete mode 100644 sources/talk/20180303 4 meetup ideas- Make your data open.md delete mode 100644 sources/talk/20180314 How to apply systems thinking in DevOps.md delete mode 100644 sources/talk/20180315 6 ways a thriving community will help your project succeed.md delete mode 100644 sources/talk/20180315 Lessons Learned from Growing an Open Source Project Too Fast.md delete mode 100644 sources/talk/20180316 How to avoid humiliating newcomers- A guide for advanced developers.md delete mode 100644 sources/talk/20180320 Easily Fund Open Source Projects With These Platforms.md delete mode 100644 sources/talk/20180321 8 tips for better agile retrospective meetings.md delete mode 100644 sources/talk/20180323 7 steps to DevOps hiring success.md delete mode 100644 sources/talk/20180330 Meet OpenAuto, an Android Auto emulator for Raspberry Pi.md delete mode 100644 sources/talk/20180403 3 pitfalls everyone should avoid with hybrid multicloud.md delete mode 100644 sources/talk/20180404 Is the term DevSecOps necessary.md delete mode 100644 sources/talk/20180405 Rethinking -ownership- across the organization.md delete mode 100644 sources/talk/20180410 Microservices Explained.md delete mode 100644 sources/talk/20180412 Management, from coordination to collaboration.md delete mode 100644 sources/talk/20180416 For project safety back up your people, not just your data.md delete mode 100644 sources/talk/20180417 How to develop the FOSS leaders of the future.md delete mode 100644 sources/talk/20180418 Is DevOps compatible with part-time community teams.md delete mode 100644 sources/talk/20180419 3 tips for organizing your open source project-s workflow on GitHub.md delete mode 100644 sources/talk/20180420 What You Don-t Know About Linux Open Source Could Be Costing to More Than You Think.md delete mode 100644 sources/talk/20180424 There-s a Server in Every Serverless Platform.md delete mode 100644 sources/talk/20180511 Looking at the Lispy side of Perl.md delete mode 100644 sources/talk/20180527 Whatever Happened to the Semantic Web.md delete mode 100644 sources/talk/20180604 10 principles of resilience for women in tech.md delete mode 100644 sources/talk/20180613 AI Is Coming to Edge Computing Devices.md delete mode 100644 sources/talk/20180619 A summer reading list for open organization enthusiasts.md delete mode 100644 sources/talk/20180620 3 pitfalls everyone should avoid with hybrid multi-cloud, part 2.md delete mode 100644 sources/talk/20180622 7 tips for promoting your project and community on Twitter.md delete mode 100644 sources/talk/20180701 How to migrate to the world of Linux from Windows.md delete mode 100644 sources/talk/20180703 What Game of Thrones can teach us about open innovation.md delete mode 100644 sources/talk/20180704 Comparing Twine and Ren-Py for creating interactive fiction.md delete mode 100644 sources/talk/20180705 5 Reasons Open Source Certification Matters More Than Ever.md delete mode 100644 sources/talk/20180706 Robolinux Lets You Easily Run Linux and Windows Without Dual Booting.md delete mode 100644 sources/talk/20180711 Becoming a senior developer 9 experiences you ll encounter.md delete mode 100644 sources/talk/20180711 Open hardware meets open science in a multi-microphone hearing aid project.md delete mode 100644 sources/talk/20180716 Confessions of a recovering Perl hacker.md delete mode 100644 sources/talk/20180717 Tips for Success with Open Source Certification.md delete mode 100644 sources/talk/20180719 Finding Jobs in Software.md delete mode 100644 sources/talk/20180724 Open Source Certification- Preparing for the Exam.md delete mode 100644 sources/talk/20180724 Why moving all your workloads to the cloud is a bad idea.md delete mode 100644 sources/talk/20180726 Tech jargon- The good, the bad, and the ugly.md delete mode 100644 sources/talk/20180802 Design thinking as a way of life.md delete mode 100644 sources/talk/20180807 Becoming a successful programmer in an underrepresented community.md delete mode 100644 sources/talk/20180807 Building more trustful teams in four steps.md delete mode 100644 sources/talk/20180808 3 tips for moving your team to a microservices architecture.md delete mode 100644 sources/talk/20180809 How do tools affect culture.md delete mode 100644 sources/talk/20180813 Using D Features to Reimplement Inheritance and Polymorphism.md delete mode 100644 sources/talk/20180817 5 Things Influenza Taught Me About the Evolution of the Desktop Computer.md delete mode 100644 sources/talk/20180817 OERu makes a college education affordable.md delete mode 100644 sources/talk/20180820 Keeping patient data safe with open source tools.md delete mode 100644 sources/talk/20180831 3 innovative open source projects for the new school year.md delete mode 100644 sources/talk/20180906 DevOps- The consequences of blame.md delete mode 100644 sources/talk/20180916 The Rise and Demise of RSS (Old Version).md delete mode 100644 sources/talk/20180917 How gaming turned me into a coder.md delete mode 100644 sources/talk/20180920 Building a Secure Ecosystem for Node.js.md delete mode 100644 sources/talk/20180925 Troubleshooting Node.js Issues with llnode.md delete mode 100644 sources/talk/20181003 13 tools to measure DevOps success.md delete mode 100644 sources/talk/20181007 Why it-s Easier to Get a Payrise by Switching Jobs.md delete mode 100644 sources/talk/20181009 4 best practices for giving open source code feedback.md delete mode 100644 sources/talk/20181010 Talk over text- Conversational interface design and usability.md delete mode 100644 sources/talk/20181011 How to level up your organization-s security expertise.md delete mode 100644 sources/talk/20181017 We already have nice things, and other reasons not to write in-house ops tools.md delete mode 100644 sources/talk/20181018 The case for open source classifiers in AI algorithms.md delete mode 100644 sources/talk/20181019 To BeOS or not to BeOS, that is the Haiku.md delete mode 100644 sources/talk/20181023 What MMORPGs can teach us about leveling up a heroic developer team.md delete mode 100644 sources/talk/20181024 5 tips for facilitators of agile meetings.md delete mode 100644 sources/talk/20181031 How open source hardware increases security.md delete mode 100644 sources/talk/20181107 5 signs you are doing continuous testing wrong - Opensource.com.md delete mode 100644 sources/talk/20181107 How open source in education creates new developers.md delete mode 100644 sources/talk/20181107 Understanding a -nix Shell by Writing One.md delete mode 100644 sources/talk/20181113 Have you seen these personalities in open source.md delete mode 100644 sources/talk/20181114 Analyzing the DNA of DevOps.md delete mode 100644 sources/talk/20181114 Is your startup built on open source- 9 tips for getting started.md delete mode 100644 sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md delete mode 100644 sources/talk/20181127 What the open source community means to me.md delete mode 100644 sources/talk/20181129 9 top tech-recruiting mistakes to avoid.md delete mode 100644 sources/talk/20181129 Why giving back is important to the DevOps culture.md delete mode 100644 sources/talk/20181130 3 emerging tipping points in open source.md delete mode 100644 sources/talk/20181205 5 reasons to give Linux for the holidays.md delete mode 100644 sources/talk/20181205 F-Words in Linux Kernel Code Replaced with -Hug.md delete mode 100644 sources/talk/20181205 Unfortunately, Garbage Collection isn-t Enough.md delete mode 100644 sources/talk/20181206 6 steps to optimize software delivery with value stream mapping.md delete mode 100644 sources/talk/20181209 Linux on the Desktop- Are We Nearly There Yet.md delete mode 100644 sources/talk/20181209 Open source DIY ethics.md delete mode 100644 sources/talk/20181217 8 tips to help non-techies move to Linux.md delete mode 100644 sources/talk/20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md delete mode 100644 sources/talk/20181220 D in the Browser with Emscripten, LDC and bindbc-sdl (translation).md delete mode 100644 sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md delete mode 100644 sources/talk/20190205 7 predictions for artificial intelligence in 2019.md delete mode 100644 sources/talk/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md delete mode 100644 sources/tech/20151127 Research log- gene signatures and connectivity map.md delete mode 100644 sources/tech/20160302 Go channels are bad and you should feel bad.md delete mode 100644 sources/tech/20170115 Magic GOPATH.md delete mode 100644 sources/tech/20170320 Whiteboard problems in pure Lambda Calculus.md delete mode 100644 sources/tech/20171006 7 deadly sins of documentation.md delete mode 100644 sources/tech/20171006 Create a Clean-Code App with Kotlin Coroutines and Android Architecture Components.md delete mode 100644 sources/tech/20171010 In Device We Trust Measure Twice Compute Once with Xen Linux TPM 2.0 and TXT.md delete mode 100644 sources/tech/20171030 5 open source alternatives to Mint and Quicken for personal finance.md delete mode 100644 sources/tech/20171114 Finding Files with mlocate- Part 2.md delete mode 100644 sources/tech/20171116 Unleash Your Creativity – Linux Programs for Drawing and Image Editing.md delete mode 100644 sources/tech/20171121 Finding Files with mlocate- Part 3.md delete mode 100644 sources/tech/20171129 Interactive Workflows for Cpp with Jupyter.md delete mode 100644 sources/tech/20171130 Excellent Business Software Alternatives For Linux.md delete mode 100644 sources/tech/20171130 Tap the power of community with organized chaos.md delete mode 100644 sources/tech/20171201 Linux Distros That Serve Scientific and Medical Communities.md delete mode 100644 sources/tech/20171202 Easily control delivery of your Python applications to millions of Linux users with Snapcraft.md delete mode 100644 sources/tech/20171203 Top 20 GNOME Extensions You Should Be Using Right Now.md delete mode 100644 sources/tech/20171208 GeckoLinux Brings Flexibility and Choice to openSUSE.md delete mode 100644 sources/tech/20171222 Why the diversity and inclusion conversation must include people with disabilities.md delete mode 100644 sources/tech/20171224 My first Rust macro.md delete mode 100644 sources/tech/20180108 Debbugs Versioning- Merging.md delete mode 100644 sources/tech/20180108 SuperTux- A Linux Take on Super Mario Game.md delete mode 100644 sources/tech/20180108 You GNOME it- Windows and Apple devs get a compelling reason to turn to Linux.md delete mode 100644 sources/tech/20180109 Profiler adventures resolving symbol addresses is hard.md delete mode 100644 sources/tech/20180114 Playing Quake 4 on Linux in 2018.md delete mode 100644 sources/tech/20180116 How To Create A Bootable Zorin OS USB Drive.md delete mode 100644 sources/tech/20180119 Top 6 open source desktop email clients.md delete mode 100644 sources/tech/20180126 An introduction to the Web Simple Perl module a minimalist web framework.md delete mode 100644 sources/tech/20180129 CopperheadOS Security features installing apps and more.md delete mode 100644 sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md delete mode 100644 sources/tech/20180129 WebSphere MQ programming in Python with Zato.md delete mode 100644 sources/tech/20180130 Create and manage MacOS LaunchAgents using Go.md delete mode 100644 sources/tech/20180130 Mitigating known security risks in open source libraries.md delete mode 100644 sources/tech/20180130 Trying Other Go Versions.md delete mode 100644 sources/tech/20180131 Migrating the debichem group subversion repository to Git.md delete mode 100644 sources/tech/20180201 I Built This - Now What How to deploy a React App on a DigitalOcean Droplet.md delete mode 100644 sources/tech/20180202 CompositeAcceleration.md delete mode 100644 sources/tech/20180205 Getting Started with the openbox windows manager in Fedora.md delete mode 100644 sources/tech/20180205 Writing eBPF tracing tools in Rust.md delete mode 100644 sources/tech/20180208 How to start writing macros in LibreOffice Basic.md delete mode 100644 sources/tech/20180209 How to use Twine and SugarCube to create interactive adventure games.md delete mode 100644 sources/tech/20180211 Latching Mutations with GitOps.md delete mode 100644 sources/tech/20180307 What Is sosreport- How To Create sosreport.md delete mode 100644 sources/tech/20180309 A Comparison of Three Linux -App Stores.md delete mode 100644 sources/tech/20180314 5 open source card and board games for Linux.md delete mode 100644 sources/tech/20180319 How to not be a white male asshole, by a former offender.md delete mode 100644 sources/tech/20180326 How to create an open source stack using EFK.md delete mode 100644 sources/tech/20180327 Anna A KVS for any scale.md delete mode 100644 sources/tech/20180402 An introduction to the Flask Python web app framework.md delete mode 100644 sources/tech/20180403 Open Source Accounting Program GnuCash 3.0 Released With a New CSV Importer Tool Rewritten in C plus plus.md delete mode 100644 sources/tech/20180404 Bring some JavaScript to your Java enterprise with Vert.x.md delete mode 100644 sources/tech/20180411 5 Best Feed Reader Apps for Linux.md delete mode 100644 sources/tech/20180411 Replicate your custom Linux settings with DistroTweaks.md delete mode 100644 sources/tech/20180412 Getting started with Jenkins Pipelines.md delete mode 100644 sources/tech/20180413 Redcore Linux Makes Gentoo Easy.md delete mode 100644 sources/tech/20180419 Writing Advanced Web Applications with Go.md delete mode 100644 sources/tech/20180420 A handy way to add free books to your eReader.md delete mode 100644 sources/tech/20180423 Breach detection with Linux filesystem forensics - Opensource.com.md delete mode 100644 sources/tech/20180423 Managing virtual environments with Vagrant.md delete mode 100644 sources/tech/20180430 PCGen- An easy way to generate RPG characters.md delete mode 100644 sources/tech/20180503 How the four components of a distributed tracing system work together.md delete mode 100644 sources/tech/20180507 Modularity in Fedora 28 Server Edition.md delete mode 100644 sources/tech/20180507 Multinomial Logistic Classification.md delete mode 100644 sources/tech/20180509 4MLinux Revives Your Older Computer [Review].md delete mode 100644 sources/tech/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md delete mode 100644 sources/tech/20180514 An introduction to the Pyramid web framework for Python.md delete mode 100644 sources/tech/20180514 MapTool- A robust, flexible virtual tabletop for RPGs.md delete mode 100644 sources/tech/20180514 Tuptime - A Tool To Report The Historical Uptime Of Linux System.md delete mode 100644 sources/tech/20180515 Termux turns Android into a Linux development environment.md delete mode 100644 sources/tech/20180522 How to Enable Click to Minimize On Ubuntu.md delete mode 100644 sources/tech/20180524 TrueOS- A Simple BSD Distribution for the Desktop Users.md delete mode 100644 sources/tech/20180527 Streaming Australian TV Channels to a Raspberry Pi.md delete mode 100644 sources/tech/20180529 How the Go runtime implements maps efficiently.md delete mode 100644 sources/tech/20180531 How to Build an Amazon Echo with Raspberry Pi.md delete mode 100644 sources/tech/20180601 3 open source music players for Linux.md delete mode 100644 sources/tech/20180601 Get Started with Snap Packages in Linux.md delete mode 100644 sources/tech/20180608 How to Install and Use Flatpak on Linux.md delete mode 100644 sources/tech/20180608 How to use screen scraping tools to extract data from the web.md delete mode 100644 sources/tech/20180609 4 tips for getting an older relative online with Linux.md delete mode 100644 sources/tech/20180611 12 fiction books for Linux and open source types.md delete mode 100644 sources/tech/20180612 7 open source tools to make literature reviews easy.md delete mode 100644 sources/tech/20180612 Using Ledger for YNAB-like envelope budgeting.md delete mode 100644 sources/tech/20180614 Bash tips for everyday at the command line.md delete mode 100644 sources/tech/20180618 Write fast apps with Pronghorn, a Java framework.md delete mode 100644 sources/tech/20180621 Troubleshooting a Buildah script.md delete mode 100644 sources/tech/20180626 Playing Badass Acorn Archimedes Games on a Raspberry Pi.md delete mode 100644 sources/tech/20180629 Discover hidden gems in LibreOffice.md delete mode 100644 sources/tech/20180629 Is implementing and managing Linux applications becoming a snap.md delete mode 100644 sources/tech/20180629 SoCLI - Easy Way To Search And Browse Stack Overflow From The Terminal.md delete mode 100644 sources/tech/20180701 12 Things to do After Installing Linux Mint 19.md delete mode 100644 sources/tech/20180702 5 open source alternatives to Skype.md delete mode 100644 sources/tech/20180702 Diggs v4 launch an optimism born of necessity.md delete mode 100644 sources/tech/20180703 AGL Outlines Virtualization Scheme for the Software Defined Vehicle.md delete mode 100644 sources/tech/20180706 Using Ansible to set up a workstation.md delete mode 100644 sources/tech/20180708 simple and elegant free podcast player.md delete mode 100644 sources/tech/20180710 The aftermath of the Gentoo GitHub hack.md delete mode 100644 sources/tech/20180711 5 open source racing and flying games for Linux.md delete mode 100644 sources/tech/20180723 System Snapshot And Restore Utility For Linux.md delete mode 100644 sources/tech/20180727 Download Subtitles Via Right Click From File Manager Or Command Line With OpenSubtitlesDownload.py.md delete mode 100644 sources/tech/20180731 What-s in a container image- Meeting the legal challenges.md delete mode 100644 sources/tech/20180801 Getting started with Standard Notes for encrypted note-taking.md delete mode 100644 sources/tech/20180801 Hiri is a Linux Email Client Exclusively Created for Microsoft Exchange.md delete mode 100644 sources/tech/20180801 Migrating Perl 5 code to Perl 6.md delete mode 100644 sources/tech/20180802 Walkthrough On How To Use GNOME Boxes.md delete mode 100644 sources/tech/20180803 How to use Fedora Server to create a router - gateway.md delete mode 100644 sources/tech/20180806 How ProPublica Illinois uses GNU Make to load 1.4GB of data every day.md delete mode 100644 sources/tech/20180806 Recreate Famous Data Decryption Effect Seen On Sneakers Movie.md delete mode 100644 sources/tech/20180806 Use Gstreamer and Python to rip CDs.md delete mode 100644 sources/tech/20180809 Getting started with Postfix, an open source mail transfer agent.md delete mode 100644 sources/tech/20180810 Strawberry- Quality sound, open source music player.md delete mode 100644 sources/tech/20180815 Happy birthday, GNOME- 6 reasons to love this Linux desktop.md delete mode 100644 sources/tech/20180816 Designing your garden with Edraw Max - FOSS adventures.md delete mode 100644 sources/tech/20180816 Garbage collection in Perl 6.md delete mode 100644 sources/tech/20180817 AryaLinux- A Distribution and a Platform.md delete mode 100644 sources/tech/20180817 Cloudgizer- An introduction to a new open source web development tool.md delete mode 100644 sources/tech/20180821 How I recorded user behaviour on my competitor-s websites.md delete mode 100644 sources/tech/20180822 9 flowchart and diagramming tools for Linux.md delete mode 100644 sources/tech/20180824 Add free books to your eReader- Formatting tips.md delete mode 100644 sources/tech/20180828 Orion Is A QML - C-- Twitch Desktop Client With VODs And Chat Support.md delete mode 100644 sources/tech/20180829 4 open source monitoring tools.md delete mode 100644 sources/tech/20180829 Containers in Perl 6.md delete mode 100644 sources/tech/20180830 A quick guide to DNF for yum users.md delete mode 100644 sources/tech/20180830 How to scale your website across all mobile devices.md delete mode 100644 sources/tech/20180912 How subroutine signatures work in Perl 6.md delete mode 100644 sources/tech/20180914 Freespire Linux- A Great Desktop for the Open Source Purist.md delete mode 100644 sources/tech/20180918 Cozy Is A Nice Linux Audiobook Player For DRM-Free Audio Files.md delete mode 100644 sources/tech/20180919 Host your own cloud with Raspberry Pi NAS.md delete mode 100644 sources/tech/20180919 Streama - Setup Your Own Streaming Media Server In Minutes.md delete mode 100644 sources/tech/20180920 Distributed tracing in a microservices world.md delete mode 100644 sources/tech/20180920 Record Screen in Ubuntu Linux With Kazam -Beginner-s Guide.md delete mode 100644 sources/tech/20180923 Gunpoint is a Delight for Stealth Game Fans.md delete mode 100644 sources/tech/20180925 9 Easiest Ways To Find Out Process ID (PID) In Linux.md delete mode 100644 sources/tech/20180925 Taking the Audiophile Linux distro for a spin.md delete mode 100644 sources/tech/20180929 Use Cozy to Play Audiobooks in Linux.md delete mode 100644 sources/tech/20181003 Manage NTP with Chrony.md delete mode 100644 sources/tech/20181004 4 Must-Have Tools for Monitoring Linux.md delete mode 100644 sources/tech/20181005 How to use Kolibri to access educational material offline.md delete mode 100644 sources/tech/20181008 Taking notes with Laverna, a web-based information organizer.md delete mode 100644 sources/tech/20181015 An introduction to Ansible Operators in Kubernetes.md delete mode 100644 sources/tech/20181016 piwheels- Speedy Python package installation for the Raspberry Pi.md delete mode 100644 sources/tech/20181017 Automating upstream releases with release-bot.md delete mode 100644 sources/tech/20181018 4 open source alternatives to Microsoft Access.md delete mode 100644 sources/tech/20181018 TimelineJS- An interactive, JavaScript timeline building tool.md delete mode 100644 sources/tech/20181023 How to Check HP iLO Firmware Version from Linux Command Line.md delete mode 100644 sources/tech/20181031 Working with data streams on the Linux command line.md delete mode 100644 sources/tech/20181101 Getting started with OKD on your Linux desktop.md delete mode 100644 sources/tech/20181105 How to manage storage on Linux with LVM.md delete mode 100644 sources/tech/20181106 How To Check The List Of Packages Installed From Particular Repository.md delete mode 100644 sources/tech/20181111 Some notes on running new software in production.md delete mode 100644 sources/tech/20181112 Behind the scenes with Linux containers.md delete mode 100644 sources/tech/20181115 11 Things To Do After Installing elementary OS 5 Juno.md delete mode 100644 sources/tech/20181118 An example of how C-- destructors are useful in Envoy.md delete mode 100644 sources/tech/20181122 Getting started with Jenkins X.md delete mode 100644 sources/tech/20181127 Bio-Linux- A stable, portable scientific research Linux distribution.md delete mode 100644 sources/tech/20181128 Building custom documentation workflows with Sphinx.md delete mode 100644 sources/tech/20181128 How to test your network with PerfSONAR.md delete mode 100644 sources/tech/20181129 The Top Command Tutorial With Examples For Beginners.md delete mode 100644 sources/tech/20181203 ANGRYsearch - Quick Search GUI Tool for Linux.md delete mode 100644 sources/tech/20181206 How to view XML files in a web browser.md delete mode 100644 sources/tech/20181207 5 Screen Recorders for the Linux Desktop.md delete mode 100644 sources/tech/20181207 Automatic continuous development and delivery of a hybrid mobile app.md delete mode 100644 sources/tech/20181209 How do you document a tech project with comics.md delete mode 100644 sources/tech/20181211 How To Benchmark Linux Commands And Programs From Commandline.md delete mode 100644 sources/tech/20181214 Tips for using Flood Element for performance testing.md delete mode 100644 sources/tech/20181215 New talk- High Reliability Infrastructure Migrations.md delete mode 100644 sources/tech/20181217 6 tips and tricks for using KeePassX to secure your passwords.md delete mode 100644 sources/tech/20181218 Insync- The Hassleless Way of Using Google Drive on Linux.md delete mode 100644 sources/tech/20181221 Large files with Git- LFS and git-annex.md delete mode 100644 sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md delete mode 100644 sources/tech/20181226 -Review- Polo File Manager in Linux.md delete mode 100644 sources/tech/20181228 The office coffee model of concurrent garbage collection.md delete mode 100644 sources/tech/20181229 Some nonparametric statistics math.md diff --git a/sources/news/20200117 Fedora CoreOS out of preview.md b/sources/news/20200117 Fedora CoreOS out of preview.md deleted file mode 100644 index d7a1393cde..0000000000 --- a/sources/news/20200117 Fedora CoreOS out of preview.md +++ /dev/null @@ -1,108 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fedora CoreOS out of preview) -[#]: via: (https://fedoramagazine.org/fedora-coreos-out-of-preview/) -[#]: author: (bgilbert https://fedoramagazine.org/author/bgilbert/) - -Fedora CoreOS out of preview -====== - -![The Fedora CoreOS logo on a gray background.][1] - -The Fedora CoreOS team is pleased to announce that Fedora CoreOS is now [available for general use][2]. - -Fedora CoreOS is a new Fedora Edition built specifically for running containerized workloads securely and at scale. It’s the successor to both [Fedora Atomic Host][3] and [CoreOS Container Linux][4] and is part of our effort to explore new ways of assembling and updating an OS. Fedora CoreOS combines the provisioning tools and automatic update model of Container Linux with the packaging technology, OCI support, and SELinux security of Atomic Host.  For more on the Fedora CoreOS philosophy, goals, and design, see the [announcement of the preview release][5]. - -Some highlights of the current Fedora CoreOS release: - - * [Automatic updates][6], with staged deployments and phased rollouts - * Built from Fedora 31, featuring: - * Linux 5.4 - * systemd 243 - * Ignition 2.1 - * OCI and Docker Container support via Podman 1.7 and Moby 18.09 - * cgroups v1 enabled by default for broader compatibility; cgroups v2 available via configuration - - - -Fedora CoreOS is available on a variety of platforms: - - * Bare metal, QEMU, OpenStack, and VMware - * Images available in all public AWS regions - * Downloadable cloud images for Alibaba, AWS, Azure, and GCP - * Can run live from RAM via ISO and PXE (netboot) images - - - -Fedora CoreOS is under active development.  Planned future enhancements include: - - * Addition of the _next_ release stream for extended testing of upcoming Fedora releases. - * Support for additional cloud and virtualization platforms, and processor architectures other than _x86_64_. - * Closer integration with Kubernetes distributions, including [OKD][7]. - * [Aggregate statistics collection][8]. - * Additional [documentation][9]. - - - -### Where do I get it? - -To try out the new release, head over to the [download page][10] to get OS images or cloud image IDs.  Then use the [quick start guide][11] to get a machine running quickly. - -### How do I get involved? - -It’s easy!  You can report bugs and missing features to the [issue tracker][12]. You can also discuss Fedora CoreOS in [Fedora Discourse][13], the [development mailing list][14], in _#fedora-coreos_ on Freenode, or at our [weekly IRC meetings][15]. - -### Are there stability guarantees? - -In general, the Fedora Project does not make any guarantees around stability.  While Fedora CoreOS strives for a high level of stability, this can be challenging to achieve in the rapidly evolving Linux and container ecosystems.  We’ve found that the incremental, exploratory, forward-looking development required for Fedora CoreOS — which is also a cornerstone of the Fedora Project as a whole — is difficult to reconcile with the iron-clad stability guarantee that ideally exists when automatically updating systems. - -We’ll continue to do our best not to break existing systems over time, and to give users the tools to manage the impact of any regressions.  Nevertheless, automatic updates may produce regressions or breaking changes for some use cases. You should make your own decisions about where and how to run Fedora CoreOS based on your risk tolerance, operational needs, and experience with the OS.  We will continue to announce any major planned or unplanned breakage to the [coreos-status mailing list][16], along with recommended mitigations. - -### How do I migrate from CoreOS Container Linux? - -Container Linux machines cannot be migrated in place to Fedora CoreOS.  We recommend [writing a new Fedora CoreOS Config][11] to provision Fedora CoreOS machines.  Fedora CoreOS Configs are similar to Container Linux Configs, and must be passed through the Fedora CoreOS Config Transpiler to produce an Ignition config for provisioning a Fedora CoreOS machine. - -Whether you’re currently provisioning your Container Linux machines using a Container Linux Config, handwritten Ignition config, or cloud-config, you’ll need to adjust your configs for differences between Container Linux and Fedora CoreOS.  For example, on Fedora CoreOS network configuration is performed with [NetworkManager key files][17] instead of _systemd-networkd_, and time synchronization is performed by _chrony_ rather than _systemd-timesyncd_.  Initial migration documentation will be [available soon][9] and a skeleton list of differences between the two OSes is available in [this issue][18]. - -CoreOS Container Linux will be maintained for a few more months, and then will be declared end-of-life.  We’ll announce the exact end-of-life date later this month. - -### How do I migrate from Fedora Atomic Host? - -Fedora Atomic Host has already reached end-of-life, and you should migrate to Fedora CoreOS as soon as possible.  We do not recommend in-place migration of Atomic Host machines to Fedora CoreOS. Instead, we recommend [writing a Fedora CoreOS Config][11] and using it to provision new Fedora CoreOS machines.  As with CoreOS Container Linux, you’ll need to adjust your existing cloud-configs for differences between Fedora Atomic Host and Fedora CoreOS. - -Welcome to Fedora CoreOS.  Deploy it, launch your apps, and let us know what you think! - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/fedora-coreos-out-of-preview/ - -作者:[bgilbert][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/bgilbert/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/introducing-fedora-coreos-816x345.png -[2]: https://getfedora.org/coreos/ -[3]: https://www.projectatomic.io/ -[4]: https://coreos.com/os/docs/latest/ -[5]: https://fedoramagazine.org/introducing-fedora-coreos/ -[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/auto-updates/ -[7]: https://www.okd.io/ -[8]: https://github.com/coreos/fedora-coreos-pinger/ -[9]: https://docs.fedoraproject.org/en-US/fedora-coreos/ -[10]: https://getfedora.org/coreos/download/ -[11]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ -[12]: https://github.com/coreos/fedora-coreos-tracker/issues -[13]: https://discussion.fedoraproject.org/c/server/coreos -[14]: https://lists.fedoraproject.org/archives/list/coreos@lists.fedoraproject.org/ -[15]: https://github.com/coreos/fedora-coreos-tracker#meetings -[16]: https://lists.fedoraproject.org/archives/list/coreos-status@lists.fedoraproject.org/ -[17]: https://developer.gnome.org/NetworkManager/stable/nm-settings-keyfile.html -[18]: https://github.com/coreos/fedora-coreos-tracker/issues/159 diff --git a/sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md b/sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md deleted file mode 100644 index 90b5c18537..0000000000 --- a/sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning) -[#]: via: (https://opensource.com/article/20/1/news-january-19) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we take a look machine learning tools from Uber and Lyft, open source software to fight cancer, saving students money with open textbooks, and more! - -### Uber and Lyft release machine learning tools - -It's hard to a growing company these days that doesn't take advantage of machine learning to streamline its business and make sense of the data it amasses. Ridesharing companies, which gather massive amounts of data, have enthusiastically embraced the promise of machine learning. Two of the biggest players in the ridesharing sector have made some of their machine learning code open source. - -Uber recently [released the source code][2] for its Manifold tool for debugging machine learning models. According to Uber software engineer Lezhi Li, Manifold will "benefit the machine learning (ML) community by providing interpretability and debuggability for ML workflows." If you're interested, you can browse Manifold's source code [on GitHub][3]. - -Lyft has also upped its open source stakes by releasing Flyte. Flyte, whose source code is [available on GitHub][4], manages machine learning pipelines and "is an essential backbone to (Lyft's) operations." Lyft has been using it to train AI models and process data "across pricing, logistics, mapping, and autonomous projects." - -### Software to detect cancer cells - -In a study recently published in _Nature Biotechnology_, a team of medical researchers from around the world announced [new open source software][5] that "could make it easier to create personalised cancer treatment plans." - -The software assesses "the proportion of cancerous cells in a tumour sample" and can help clinicians "judge the accuracy of computer predictions and establish benchmarks" across tumor samples. Maxime Tarabichi, one of the lead authors of [the study][6], said that the software "provides a foundation which will hopefully become a much-needed, unbiased, gold-standard benchmarking tool for assessing models that aim to characterise a tumour’s genetic diversity." - -### University of Regina saves students over $1 million with open textbooks - -If rising tuition costs weren't enough to send university student spiralling into debt, the high prices of textbooks can deepen the crater in their bank accounts. To help ease that financial pain, many universities turn to open textbooks. One of those schools is the University of Regina. By offering open text books, the university [expects to save a huge amount for students][7] over the next five years. - -The expected savings are in the region of $1.5 million (CAD), or around $1.1 million USD (at the time of writing). The textbooks, according to a report by radio station CKOM, are "provided free for (students) and they can be printed off or used as e-books." Students aren't getting inferior-quality textbooks, though. Nilgun Onder of the University of Regina said that the "textbooks and other open education resources the university published are all peer-reviewed resources. In other words, they are reliable and credible." - -### Tesla adopts Coreboot - -Much of the software driving (no pun intended) the electric vehicles made by Tesla Motors is open source. So it's not surprising to learn that the company has [adopted Coreboot][8] "as part of their electric vehicle computer systems." - -Coreboot was developed as a replacement for proprietary BIOS and is used to boot hardware and the Linux kernel. The code, which is in [Tesla's GitHub repository][9], "is from Tesla Motors and Samsung," according to Phoronix. Samsung, in case you're wondering, makes the chip on which Tesla's self-driving software runs. - -#### In other news - - * [Arduino launches new modular platform for IoT development][10] - * [SUSE and Karunya Institute of Technology and Sciences collaborate to enhance cloud and open source learning][11] - * [How open-source code could help us survive natural disasters][12] - * [The hottest thing in robotics is an open source project you've never heard of][13] - - - -_Thanks, as always, to Opensource.com staff members and moderators for their help this week. Make sure to check out [our event calendar][14], to see what's happening next week in open source._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/news-january-19 - -作者:[Scott Nesbitt][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/scottnesbitt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://venturebeat.com/2020/01/07/uber-open-sources-manifold-a-visual-tool-for-debugging-ai-models/ -[3]: https://github.com/uber/manifold -[4]: https://github.com/lyft/flyte -[5]: https://www.cbronline.com/industry/healthcare/open-source-cancer-cells/ -[6]: https://www.nature.com/articles/s41587-019-0364-z -[7]: https://www.ckom.com/2020/01/07/open-source-program-to-save-u-of-r-students-1-5m/ -[8]: https://www.phoronix.com/scan.php?page=news_item&px=Tesla-Uses-Coreboot -[9]: https://github.com/teslamotors/coreboot -[10]: https://techcrunch.com/2020/01/07/arduino-launches-a-new-modular-platform-for-iot-development/ -[11]: https://www.crn.in/news/suse-and-karunya-institute-of-technology-and-sciences-collaborate-to-enhance-cloud-and-open-source-learning/ -[12]: https://qz.com/1784867/open-source-data-could-help-save-lives-during-natural-disasters/ -[13]: https://www.techrepublic.com/article/the-hottest-thing-in-robotics-is-an-open-source-project-youve-never-heard-of/ -[14]: https://opensource.com/resources/conferences-and-events-monthly diff --git a/sources/news/20200125 What 2020 brings for the developer, and more industry trends.md b/sources/news/20200125 What 2020 brings for the developer, and more industry trends.md deleted file mode 100644 index e22735d21c..0000000000 --- a/sources/news/20200125 What 2020 brings for the developer, and more industry trends.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What 2020 brings for the developer, and more industry trends) -[#]: via: (https://opensource.com/article/20/1/hybrid-developer-future-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -What 2020 brings for the developer, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [How developers will work in 2020][2] - -> Developers have been spending an enormous amount of time on everything *except* making software that solves problems. ‘DevOps’ has transmogrified from ‘developers releasing software’ into ‘developers building ever more complex infrastructure atop Kubernetes’ and ‘developers reinventing their software as distributed stateless functions.’ In 2020, ‘serverless’ will mature. Handle state. Handle data storage without requiring devs to learn yet-another-proprietary-database-service. Learning new stuff is fun-but shipping is even better, and we’ll finally see systems and services that support that. - -**The impact:** A lot of forces are converging to give developers superpowers. There are ever more open source building blocks in place; thousands of geniuses are collaborating to make developer workflows more fun and efficient, and artificial intelligences are being brought to bear solving the types of problems a developer might face. On the one hand, there is clear leverage to giving developer superpowers: if they can make magic with software they'll be able to make even bigger magic with all this help. On the other hand, imagine if teachers had the same level of investment and support. Makes ya wonder don't it? - -## [2020 forecast: Cloud-y with a chance of hybrid][3] - -> Behind this growth is an array of new themes and strategies that are pushing cloud further up business agendas the world over. With ‘emerging’ technologies, such as AI and machine learning, containers and functions, and even more flexibility available with hybrid cloud solutions being provided by the major providers, it’s no wonder cloud is set to take centre stage. - -**The impact:** Hybrid cloud finally has the same level of flesh that public cloud and on-premises have. Over the course of 2019 especially the competing visions offered for what it meant to be hybrid formed a composite that drove home why someone would want it. At the same time more and more of the technology pieces that make hybrid viable are in place and maturing. 2019 was the year that people truly "got" hybrid. 2020 will be the year that people start to take advantage of it. - -## [The no-code delusion][4] - -> Increasingly popular in the last couple of years, I think 2020 is going to be the year of “no code”: the movement that says you can write business logic and even entire applications without having the training of a software developer. I empathise with people doing this, and I think some of the “no code” tools are great. But I also thing it’s wrong at heart. - -**The impact:** I've heard many devs say it over many years: "software development is hard." It would be a mistake to interpret that as "all software development is equally hard." What I've always found hard about learning to code is trying to think in a way that a computer will understand. With or without code, making computers do complex things will always require a different kind of thinking. - -## [All things Java][5] - -> The open, multi-vendor model has been a major strength—it’s very hard for any single vendor to pioneer a market for a sustained period of time—and taking different perspectives from diverse industries has been a key strength of the [evolution of Java][6]. Choosing to open source Java in 2006 was also a decision that only worked to strengthen the Java ecosystem, as it allowed Sun Microsystems and later Oracle to share the responsibility of maintaining and evolving Java with many other organizations and individuals. - -**The impact:** The things that move quickly in technology are the things that can be thrown away. When you know you're going to keep something for a long time, you're likely to make different choices about what to prioritize when building it. Disposable and long-lived both have their places, and the Java community made enough good decisions over the years that the language itself can have a foot in both camps. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/hybrid-developer-future-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://thenextweb.com/readme/2020/01/15/how-developers-will-work-in-2020/ -[3]: https://www.itproportal.com/features/2020-forecast-cloud-y-with-a-chance-of-hybrid/ -[4]: https://www.alexhudson.com/2020/01/13/the-no-code-delusion/ -[5]: https://appdevelopermagazine.com/all-things-java/ -[6]: https://appdevelopermagazine.com/top-10-developer-technologies-in-2019/ diff --git a/sources/talk/20170717 The Ultimate Guide to JavaScript Fatigue- Realities of our industry.md b/sources/talk/20170717 The Ultimate Guide to JavaScript Fatigue- Realities of our industry.md deleted file mode 100644 index 923d4618a9..0000000000 --- a/sources/talk/20170717 The Ultimate Guide to JavaScript Fatigue- Realities of our industry.md +++ /dev/null @@ -1,221 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Ultimate Guide to JavaScript Fatigue: Realities of our industry) -[#]: via: (https://lucasfcosta.com/2017/07/17/The-Ultimate-Guide-to-JavaScript-Fatigue.html) -[#]: author: (Lucas Fernandes Da Costa https://lucasfcosta.com) - -The Ultimate Guide to JavaScript Fatigue: Realities of our industry -====== - -**Complaining about JS Fatigue is just like complaining about the fact that humanity has created too many tools to solve the problems we have** , from email to airplanes and spaceships. - -Last week I’ve done a talk about this very same subject at the NebraskaJS 2017 Conference and I got so many positive feedbacks that I just thought this talk should also become a blog post in order to reach more people and help them deal with JS Fatigue and understand the realities of our industry. **My goal with this post is to change the way you think about software engineering in general and help you in any areas you might work on**. - -One of the things that has inspired me to write this blog post and that totally changed my life is [this great post by Patrick McKenzie, called “Don’t Call Yourself a Programmer and other Career Advice”][1]. **I highly recommend you read that**. Most of this blog post is advice based on what Patrick has written in that post applied to the JavaScript ecosystem and with a few more thoughts I’ve developed during these last years working in the tech industry. - -This first section is gonna be a bit philosophical, but I swear it will be worth reading. - -### Realities of Our Industry 101 - -Just like Patrick has done in [his post][1], let’s start with the most basic and essential truth about our industry: - -Software solves business problems - -This is it. **Software does not exist to please us as programmers** and let us write beautiful code. Neither it exists to create jobs for people in the tech industry. **Actually, it exists to kill as many jobs as possible, including ours** , and this is why basic income will become much more important in the next few years, but that’s a whole other subject. - -I’m sorry to say that, but the reason things are that way is that there are only two things that matter in the software engineering (and any other industries): - -**Cost versus Revenue** - -**The more you decrease cost and increase revenue, the more valuable you are** , and one of the most common ways of decreasing cost and increasing revenue is replacing human beings by machines, which are more effective and usually cost less in the long run. - -You are not paid to write code - -**Technology is not a goal.** Nobody cares about which programming language you are using, nobody cares about which frameworks your team has chosen, nobody cares about how elegant your data structures are and nobody cares about how good is your code. **The only thing that somebody cares about is how much does your software cost and how much revenue it generates**. - -Writing beautiful code does not matter to your clients. We write beautiful code because it makes us more productive in the long run and this decreases cost and increases revenue. - -The whole reason why we try not to write bugs is not that we value correctness, but that **our clients** value correctness. If you have ever seen a bug becoming a feature you know what I’m talking about. That bug exists but it should not be fixed. That happens because our goal is not to fix bugs, our goal is to generate revenue. If our bugs make clients happy then they increase revenue and therefore we are accomplishing our goals. - -Reusable space rockets, self-driving cars, robots, artificial intelligence: these things do not exist just because someone thought it would be cool to create them. They exist because there are business interests behind them. And I’m not saying the people behind them just want money, I’m sure they think that stuff is also cool, but the truth is that if they were not economically viable or had any potential to become so, they would not exist. - -Probably I should not even call this section “Realities of Our Industry 101”, maybe I should just call it “Realities of Capitalism 101”. - -And given that our only goal is to increase revenue and decrease cost, I think we as programmers should be paying more attention to requirements and design and start thinking with our minds and participating more actively in business decisions, which is why it is extremely important to know the problem domain we are working on. How many times before have you found yourself trying to think about what should happen in certain edge cases that have not been thought before by your managers or business people? - -In 1975, Boehm has done a research in which he found out that about 64% of all errors in the software he was studying were caused by design, while only 36% of all errors were coding errors. Another study called [“Higher Order Software—A Methodology for Defining Software”][2] also states that **in the NASA Apollo project, about 73% of all errors were design errors**. - -The whole reason why Design and Requirements exist is that they define what problems we’re going to solve and solving problems is what generates revenue. - -> Without requirements or design, programming is the art of adding bugs to an empty text file. -> -> * Louis Srygley -> - - -This same principle also applies to the tools we’ve got available in the JavaScript ecosystem. Babel, webpack, react, Redux, Mocha, Chai, Typescript, all of them exist to solve a problem and we gotta understand which problem they are trying to solve, we need to think carefully about when most of them are needed, otherwise, we will end up having JS Fatigue because: - -JS Fatigue happens when people use tools they don't need to solve problems they don't have. - -As Donald Knuth once said: “Premature optimization is the root of all evil”. Remember that software only exists to solve business problems and most software out there is just boring, it does not have any high scalability or high-performance constraints. Focus on solving business problems, focus on decreasing cost and generating revenue because this is all that matters. Optimize when you need, otherwise you will probably be adding unnecessary complexity to your software, which increases cost, and not generating enough revenue to justify that. - -This is why I think we should apply [Test Driven Development][3] principles to everything we do in our job. And by saying this I’m not just talking about testing. **I’m talking about waiting for problems to appear before solving them. This is what TDD is all about**. As Kent Beck himself says: “TDD reduces fear” because it guides your steps and allows you take small steps towards solving your problems. One problem at a time. By doing the same thing when it comes to deciding when to adopt new technologies then we will also reduce fear. - -Solving one problem at a time also decreases [Analysis Paralysis][4], which is basically what happens when you open Netflix and spend three hours concerned about making the optimal choice instead of actually watching something. By solving one problem at a time we reduce the scope of our decisions and by reducing the scope of our decisions we have fewer choices to make and by having fewer choices to make we decrease Analysis Paralysis. - -Have you ever thought about how easier it was to decide what you were going to watch when there were only a few TV channels available? Or how easier it was to decide which game you were going to play when you had only a few cartridges at home? - -### But what about JavaScript? - -By the time I’m writing this post NPM has 489,989 packages and tomorrow approximately 515 new ones are going to be published. - -And the packages we use and complain about have a history behind them we must comprehend in order to understand why we need them. **They are all trying to solve problems.** - -Babel, Dart, CoffeeScript and other transpilers come from our necessity of writing code other than JavaScript but making it runnable in our browsers. Babel even lets us write new generation JavaScript and make sure it will work even on older browsers, which has always been a great problem given the inconsistencies and different amount of compliance to the ECMA Specification between browsers. Even though the ECMA spec is becoming more and more solid these days, we still need Babel. And if you want to read more about Babel’s history I highly recommend that you read [this excellent post by Henry Zhu][5]. - -Module bundlers such as Webpack and Browserify also have their reason to exist. If you remember well, not so long ago we used to suffer a lot with lots of `script` tags and making them work together. They used to pollute the global namespace and it was reasonably hard to make them work together when one depended on the other. In order to solve this [`Require.js`][6] was created, but it still had its problems, it was not that straightforward and its syntax also made it prone to other problems, as you can see [in this blog post][7]. Then Node.js came with `CommonJS` imports, which were synchronous, simple and clean, but we still needed a way to make that work on our browsers and this is why we needed Webpack and Browserify. - -And Webpack itself actually solves more problems than that by allowing us to deal with CSS, images and many other resources as if they were JavaScript dependencies. - -Front-end frameworks are a bit more complicated, but the reason why they exist is to reduce the cognitive load when we write code so that we don’t need to worry about manipulating the DOM ourselves or even dealing with messy browser APIs (another problem JQuery came to solve), which is not only error prone but also not productive. - -This is what we have been doing this whole time in computer science. We use low-level abstractions and build even more abstractions on top of it. The more we worry about describing how our software should work instead of making it work, the more productive we are. - -But all those tools have something in common: **they exist because the web platform moves too fast**. Nowadays we’re using web technology everywhere: in web browsers, in desktop applications, in phone applications or even in watch applications. - -This evolution also creates problems we need to solve. PWAs, for example, do not exist only because they’re cool and we programmers have fun writing them. Remember the first section of this post: **PWAs exist because they create business value**. - -And usually standards are not fast enough to be created and therefore we need to create our own solutions to these things, which is why it is great to have such a vibrant and creative community with us. We’re solving problems all the time and **we are allowing natural selection to do its job**. - -The tools that suit us better thrive, get more contributors and develop themselves more quickly and sometimes other tools end up incorporating the good ideas from the ones that thrive and becoming even more popular than them. This is how we evolve. - -By having more tools we also have more choices. If you remember the UNIX philosophy well, it states that we should aim at creating programs that do one thing and do it well. - -We can clearly see this happening in the JS testing environment, for example, where we have Mocha for running tests and Chai for doing assertions, while in Java JUnit tries to do all these things. This means that if we have a problem with one of them or if we find another one that suits us better, we can simply replace that small part and still have the advantages of the other ones. - -The UNIX philosophy also states that we should write programs that work together. And this is exactly what we are doing! Take a look at Babel, Webpack and React, for example. They work very well together but we still do not need one to use the other. In the testing environment, for example, if we’re using Mocha and Chai all of a sudden we can just install Karma and run those same tests in multiple environments. - -### How to Deal With It - -My first advice for anyone suffering from JS Fatigue would definitely be to stay aware that **you don’t need to know everything**. Trying to learn it all at once, even when we don’t have to do so, only increases the feeling of fatigue. Go deep in areas that you love and for which you feel an inner motivation to study and adopt a lazy approach when it comes to the other ones. I’m not saying that you should be lazy, I’m just saying that you can learn those only when needed. Whenever you face a problem that requires you to use a certain technology to solve it, go learn. - -Another important thing to say is that **you should start from the beginning**. Make sure you have learned enough about JavaScript itself before using any JavaScript frameworks. This is the only way you will be able to understand them and bend them to your will, otherwise, whenever you face an error you have never seen before you won’t know which steps to take in order to solve it. Learning core web technologies such as CSS, HTML5, JavaScript and also computer science fundamentals or even how the HTTP protocol works will help you master any other technologies a lot more quickly. - -But please, don’t get too attached to that. Sometimes you gotta risk yourself and start doing things on your own. As Sacha Greif has written in [this blog post][8], spending too much time learning the fundamentals is just like trying to learn how to swim by studying fluid dynamics. Sometimes you just gotta jump into the pool and try to swim by yourself. - -And please, don’t get too attached to a single technology. All of the things we have available nowadays have already been invented in the past. Of course, they have different features and a brand new name, but, in their essence, they are all the same. - -If you look at NPM, it is nothing new, we already had Maven Central and Ruby Gems quite a long time ago. - -In order to transpile your code, Babel applies the very same principles and theory as some of the oldest and most well-known compilers, such as the GCC. - -Even JSX is not a new idea. It E4X (ECMAScript for XML) already existed more than 10 years ago. - -Now you might ask: “what about Gulp, Grunt and NPM Scripts?” Well, I’m sorry but we can solve all those problems with GNU Make in 1976. And actually, there are a reasonable number of JavaScript projects that still use it, such as Chai.js, for example. But we do not do that because we are hipsters that like vintage stuff. We use `make` because it solves our problems, and this is what you should aim at doing, as we’ve talked before. - -If you really want to understand a certain technology and be able to solve any problems you might face, please, dig deep. One of the most decisive factors to success is curiosity, so **dig deep into the technologies you like**. Try to understand them from bottom-up and whenever you think something is just “magic”, debunk that myth by exploring the codebase by yourself. - -In my opinion, there is no better quote than this one by Richard Feinman, when it comes to really learning something: - -> What I cannot create, I do not understand - -And just below this phrase, [in the same blackboard, Richard also wrote][9]: - -> Know how to solve every problem that has been solved - -Isn’t this just amazing? - -When Richard said that, he was talking about being able to take any theoretical result and re-derive it, but I think the exact same principle can be applied to software engineering. The tools that solve our problems have already been invented, they already exist, so we should be able to get to them all by ourselves. - -This is the very reason I love [some of the videos available in Egghead.io][10] in which Dan Abramov explains how to implement certain features that exist in Redux from scratch or [blog posts that teach you how to build your own JSX renderer][11]. - -So why not trying to implement these things by yourself or going to GitHub and reading their codebase in order to understand how they work? I’m sure you will find a lot of useful knowledge out there. Comments and tutorials might lie and be incorrect sometimes, the code cannot. - -Another thing that we have been talking a lot in this post is that **you should not get ahead of yourself**. Follow a TDD approach and solve one problem at a time. You are paid to increase revenue and decrease cost and you do this by solving problems, this is the reason why software exists. - -And since we love comparing our role to the ones related to civil engineering, let’s do a quick comparison between software development and civil engineering, just as [Sam Newman does in his brilliant book called “Building Microservices”][12]. - -We love calling ourselves “engineers” or “architects”, but is that term really correct? We have been developing software for what we know as computers less than a hundred years ago, while the Colosseum, for example, exists for about two thousand years. - -When was the last time you’ve seen a bridge falling and when was the last time your telephone or your browser crashed? - -In order to explain this, I’ll use an example I love. - -This is the beautiful and awesome city of Barcelona: - -![The City of Barcelona][13] - -When we look at it this way and from this distance, it just looks like any other city in the world, but when we look at it from above, this is how Barcelona looks: - -![Barcelona from above][14] - -As you can see, every block has the same size and all of them are very organized. If you’ve ever been to Barcelona you will also know how good it is to move through the city and how well it works. - -But the people that planned Barcelona could not predict what it was going to look like in the next two or three hundred years. In cities, people come in and people move through it all the time so what they had to do was make it grow organically and adapt as the time goes by. They had to be prepared for changes. - -This very same thing happens to our software. It evolves quickly, refactors are often needed and requirements change more frequently than we would like them to. - -So, instead of acting like a Software Engineer, act as a Town Planner. Let your software grow organically and adapt as needed. Solve problems as they come by but make sure everything still has its place. - -Doing this when it comes to software is even easier than doing this in cities due to the fact that **software is flexible, civil engineering is not**. **In the software world, our build time is compile time**. In Barcelona we cannot simply destroy buildings to give space to new ones, in Software we can do that a lot easier. We can break things all the time, we can make experiments because we can build as many times as we want and it usually takes seconds and we spend a lot more time thinking than building. Our job is purely intellectual. - -So **act like a town planner, let your software grow and adapt as needed**. - -By doing this you will also have better abstractions and know when it’s the right time to adopt them. - -As Sam Koblenski says: - -> Abstractions only work well in the right context, and the right context develops as the system develops. - -Nowadays something I see very often is people looking for boilerplates when they’re trying to learn a new technology, but, in my opinion, **you should avoid boilerplates when you’re starting out**. Of course boilerplates and generators are useful if you are already experienced, but they take a lot of control out of your hands and therefore you won’t learn how to set up a project and you won’t understand exactly where each piece of the software you are using fits. - -When you feel like you are struggling more than necessary to get something simple done, it might be the right time for you to look for an easier way to do this. In our role **you should strive to be lazy** , you should work to not work. By doing that you have more free time to do other things and this decreases cost and increases revenue, so that’s another way of accomplishing your goal. You should not only work harder, you should work smarter. - -Probably someone has already had the same problem as you’re having right now, but if nobody did it might be your time to shine and build your own solution and help other people. - -But sometimes you will not be able to realize you could be more effective in your tasks until you see someone doing them better. This is why it is so important to **talk to people**. - -By talking to people you share experiences that help each other’s careers and we discover new tools to improve our workflow and, even more important than that, learn how they solve their problems. This is why I like reading blog posts in which companies explain how they solve their problems. - -Especially in our area we like to think that Google and StackOverflow can answer all our questions, but we still need to know which questions to ask. I’m sure you have already had a problem you could not find a solution for because you didn’t know exactly what was happening and therefore didn’t know what was the right question to ask. - -But if I needed to sum this whole post in a single advice, it would be: - -Solve problems. - -Software is not a magic box, software is not poetry (unfortunately). It exists to solve problems and improves peoples’ lives. Software exists to push the world forward. - -**Now it’s your time to go out there and solve problems**. - - --------------------------------------------------------------------------------- - -via: https://lucasfcosta.com/2017/07/17/The-Ultimate-Guide-to-JavaScript-Fatigue.html - -作者:[Lucas Fernandes Da Costa][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://lucasfcosta.com -[b]: https://github.com/lujun9972 -[1]: http://www.kalzumeus.com/2011/10/28/dont-call-yourself-a-programmer/ -[2]: http://ieeexplore.ieee.org/document/1702333/ -[3]: https://en.wikipedia.org/wiki/Test_Driven_Development -[4]: https://en.wikipedia.org/wiki/Analysis_paralysis -[5]: https://babeljs.io/blog/2016/12/07/the-state-of-babel -[6]: http://requirejs.org -[7]: https://benmccormick.org/2015/05/28/moving-past-requirejs/ -[8]: https://medium.freecodecamp.org/a-study-plan-to-cure-javascript-fatigue-8ad3a54f2eb1 -[9]: https://www.quora.com/What-did-Richard-Feynman-mean-when-he-said-What-I-cannot-create-I-do-not-understand -[10]: https://egghead.io/lessons/javascript-redux-implementing-store-from-scratch -[11]: https://jasonformat.com/wtf-is-jsx/ -[12]: https://www.barnesandnoble.com/p/building-microservices-sam-newman/1119741399/2677517060476?st=PLA&sid=BNB_DRS_Marketplace+Shopping+Books_00000000&2sid=Google_&sourceId=PLGoP4760&k_clickid=3x4760 -[13]: /assets/barcelona-city.jpeg -[14]: /assets/barcelona-above.jpeg -[15]: https://twitter.com/thewizardlucas diff --git a/sources/talk/20171030 Why I love technical debt.md b/sources/talk/20171030 Why I love technical debt.md deleted file mode 100644 index da071d370a..0000000000 --- a/sources/talk/20171030 Why I love technical debt.md +++ /dev/null @@ -1,69 +0,0 @@ -Why I love technical debt -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_lovemoneyglory1.png?itok=nbSRovsj) -This is not necessarily the title you'd expect for an article, I guess,* but I'm a fan of [technical debt][1]. There are two reasons for this: a Bad Reason and a Good Reason. I'll be upfront about the Bad Reason first, then explain why even that isn't really a reason to love it. I'll then tackle the Good Reason, and you'll nod along in agreement. - -### The Bad Reason I love technical debt - -We'll get this out of the way, then, shall we? The Bad Reason is that, well, there's just lots of it, it's interesting, it keeps me in a job, and it always provides a reason, as a security architect, for me to get involved in** projects that might give me something new to look at. I suppose those aren't all bad things. It can also be a bit depressing, because there's always so much of it, it's not always interesting, and sometimes I need to get involved even when I might have better things to do. - -And what's worse is that it almost always seems to be security-related, and it's always there. That's the bad part. - -Security, we all know, is the piece that so often gets left out, or tacked on at the end, or done in half the time it deserves, or done by people who have half an idea, but don't quite fully grasp it. I should be clear at this point: I'm not saying that this last reason is those people's fault. That people know they need security is fantastic. If we (the security folks) or we (the organization) haven't done a good enough job in making sufficient security resources--whether people, training, or visibility--available to those people who need it, the fact that they're trying is great and something we can work on. Let's call that a positive. Or at least a reason for hope.*** - -### The Good Reason I love technical debt - -Let's get on to the other reason: the legitimate reason. I love technical debt when it's named. - -What does that mean? - -We all get that technical debt is a bad thing. It's what happens when you make decisions for pragmatic reasons that are likely to come back and bite you later in a project's lifecycle. Here are a few classic examples that relate to security: - - * Not getting around to applying authentication or authorization controls on APIs that might, at some point, be public. - * Lumping capabilities together so it's difficult to separate out appropriate roles later on. - * Hard-coding roles in ways that don't allow for customisation by people who may use your application in different ways from those you initially considered. - * Hard-coding cipher suites for cryptographic protocols, rather than putting them in a config file where they can be changed or selected later. - - - -There are lots more, of course, but those are just a few that jump out at me and that I've seen over the years. Technical debt means making decisions that will mean more work later on to fix them. And that can't be good, can it? - -There are two words in the preceding paragraphs that should make us happy: they are "decisions" and "pragmatic." Because, in order for something to be named technical debt, I'd argue, it has to have been subject to conscious decision-making, and trade-offs must have been made--hopefully for rational reasons. Those reasons may be many and various--lack of qualified resources; project deadlines; lack of sufficient requirement definition--but if they've been made consciously, then the technical debt can be named, and if technical debt can be named, it can be documented. - -And if it's documented, we're halfway there. As a security guy, I know that I can't force everything that goes out of the door to meet all the requirements I'd like--but the same goes for the high availability gal, the UX team, the performance folks, etc. - -What we need--what we all need--is for documentation to exist about why decisions were made, because when we return to the problem we'll know it was thought about. And, what's more, the recording of that information might even make it into product documentation. "This API is designed to be used in a protected environment and should not be exposed on the public Internet" is a great piece of documentation. It may not be what a customer is looking for, but at least they know how to deploy the product, and, crucially, it's an opportunity for them to come back to the product manager and say, "We'd really like to deploy that particular API in this way. Could you please add this as a feature request?" Product managers like that. Very much.**** - -The best thing, though, is not just that named technical debt is visible technical debt, but that if you encourage your developers to document the decisions in code,***** then there's a decent chance that they'll record some ideas about how this should be done in the future. If you're really lucky, they might even add some hooks in the code to make it easier (an "auth" parameter on the API, which is unused in the current version, but will make API compatibility so much simpler in new releases; or cipher entry in the config file that currently only accepts one option, but is at least checked by the code). - -I've been a bit disingenuous, I know, by defining technical debt as named technical debt. But honestly, if it's not named, then you can't know what it is, and until you know what it is, you can't fix it.******* My advice is this: when you're doing a release close-down (or in your weekly standup--EVERY weekly standup), have an agenda item to record technical debt. Name it, document it, be proud, sleep at night. - -* Well, apart from the obvious clickbait reason--for which I'm (a little) sorry. - -** I nearly wrote "poke my nose into." - -*** Work with me here. - -**** If you're software engineer/coder/hacker, here's a piece of advice: Learn to talk to product managers like real people, and treat them nicely. They (the better ones, at least) are invaluable allies when you need to prioritize features or have tricky trade-offs to make. - -***** Do this. Just do it. Documentation that isn't at least mirrored in code isn't real documentation.****** - -****** Don't believe me? Talk to developers. "Who reads product documentation?" "Oh, the spec? I skimmed it. A few releases back. I think." "I looked in the header file; couldn't see it there." - -******* Or decide not to fix it, which may also be an entirely appropriate decision. - -This article originally appeared on [Alice, Eve, and Bob - a security blog][2] and is republished with permission. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/10/why-i-love-technical-debt - -作者:[Mike Bursell][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/mikecamel -[1]:https://en.wikipedia.org/wiki/Technical_debt -[2]:https://aliceevebob.wordpress.com/2017/08/29/why-i-love-technical-debt/ diff --git a/sources/talk/20171107 How to Monetize an Open Source Project.md b/sources/talk/20171107 How to Monetize an Open Source Project.md deleted file mode 100644 index ab51006101..0000000000 --- a/sources/talk/20171107 How to Monetize an Open Source Project.md +++ /dev/null @@ -1,86 +0,0 @@ -How to Monetize an Open Source Project -====== - -![](http://www.itprotoday.com/sites/itprotoday.com/files/styles/article_featured_standard/public/ThinkstockPhotos-629994230_0.jpg?itok=5dZ68OTn) -The problem for any small group of developers putting the finishing touches on a commercial open source application is figuring out how to monetize the software in order to keep the bills paid and food on the table. Often these small pre-startups will start by deciding which of the recognized open source business models they're going to adapt, whether that be following Red Hat's lead and offering professional services, going the SaaS route, releasing as open core or something else. - -Steven Grandchamp, general manager for MariaDB's North America operations and CEO for Denver-based startup [Drud Tech][1], thinks that might be putting the cart before the horse. With an open source project, the best first move is to get people downloading and using your product for free. - -**Related:** [Demand for Open Source Skills Continues to Grow][2] - -"The number one tangent to monetization in any open source product is adoption, because the key to monetizing an open source product is you flip what I would call the sales funnel upside down," he told ITPro at the recent All Things Open conference in Raleigh, North Carolina. - -In many ways, he said, selling open source solutions is the opposite of marketing traditional proprietary products, where adoption doesn't happen until after a contract is signed. - -**Related:** [Is Raleigh the East Coast's Silicon Valley?][3] - -"In a proprietary software company, you advertise, you market, you make claims about what the product can do, and then you have sales people talk to customers. Maybe you have a free trial or whatever. Maybe you have a small version. Maybe it's time bombed or something like that, but you don't really get to realize the benefit of the product until there's a contract and money changes hands." - -Selling open source solutions is different because of the challenge of selling software that's freely available as a GitHub download. - -"The whole idea is to put the product out there, let people use it, experiment with it, and jump on the chat channels," he said, pointing out that his company Drud has a public chat channel that's open to anybody using their product. "A subset of that group is going to raise their hand and go, 'Hey, we need more help. We'd like a tighter relationship with the company. We'd like to know where your road map's going. We'd like to know about customization. We'd like to know if maybe this thing might be on your road map.'" - -Grandchamp knows more than a little about making software pay, from both the proprietary and open source sides of the fence. In the 1980s he served as VP of research and development at Formation Technologies, and became SVP of R&D at John H. Harland after it acquired Formation in the mid-90s. He joined MariaDB in 2016, after serving eight years as CEO at OpenLogic, which was providing commercial support for more than 600 open-source projects at the time it was acquired by Rogue Wave Software. Along the way, there was a two year stint at Microsoft's Redmond campus. - -OpenLogic was where he discovered open source, and his experiences there are key to his approach for monetizing open source projects. - -"When I got to OpenLogic, I was told that we had 300 customers that were each paying $99 a year for access to our tool," he explained. "But the problem was that nobody was renewing the tool. So I called every single customer that I could find and said 'did you like the tool?'" - -It turned out that nearly everyone he talked to was extremely happy with the company's software, which ironically was the reason they weren't renewing. The company's tool solved their problem so well there was no need to renew. - -"What could we have offered that would have made you renew the tool?" he asked. "They said, 'If you had supported all of the open source products that your tool assembled for me, then I would have that ongoing relationship with you.'" - -Grandchamp immediately grasped the situation, and when the CTO said such support would be impossible, Grandchamp didn't mince words: "Then we don't have a company." - -"We figured out a way to support it," he said. "We created something called the Open Logic Expert Community. We developed relationships with committers and contributors to a couple of hundred open source packages, and we acted as sort of the hub of the SLA for our customers. We had some people on staff, too, who knew the big projects." - -After that successful launch, Grandchamp and his team began hearing from customers that they were confused over exactly what open source code they were using in their projects. That lead to the development of what he says was the first software-as-a-service compliance portal of open source, which could scan an application's code and produce a list of all of the open source code included in the project. When customers then expressed confusion over compliance issues, the SaaS service was expanded to flag potential licensing conflicts. - -Although the product lines were completely different, the same approach was used to monetize MariaDB, then called SkySQL, after MySQL co-founders Michael "Monty" Widenius, David Axmark, and Allan Larsson created the project by forking MySQL, which Oracle had acquired from Sun Microsystems in 2010. - -Again, users were approached and asked what things they would be willing to purchase. - -"They wanted different functionality in the database, and you didn't really understand this if you didn't talk to your customers," Grandchamp explained. "Monty and his team, while they were being acquired at Sun and Oracle, were working on all kinds of new functionality, around cloud deployments, around different ways to do clustering, they were working on lots of different things. That work, Oracle and MySQL didn't really pick up." - -Rolling in the new features customers wanted needed to be handled gingerly, because it was important to the folks at MariaDB to not break compatibility with MySQL. This necessitated a strategy around when the code bases would come together and when they would separate. "That road map, knowledge, influence and technical information was worth paying for." - -As with OpenLogic, MariaDB customers expressed a willingness to spend money on a variety of fronts. For example, a big driver in the early days was a project called Remote DBA, which helped customers make up for a shortage of qualified database administrators. The project could help with design issues, as well as monitor existing systems to take the workload off of a customer's DBA team. The service also offered access to MariaDB's own DBAs, many of whom had a history with the database going back to the early days of MySQL. - -"That was a subscription offering that people were definitely willing to pay for," he said. - -The company also learned, again by asking and listening to customers, that there were various types of support subscriptions that customers were willing to purchase, including subscriptions around capability and functionality, and a managed service component of Remote DBA. - -These days Grandchamp is putting much of his focus on his latest project, Drud, a startup that offers a suite of integrated, automated, open source development tools for developing and managing multiple websites, which can be running on any combination of content management systems and deployment platforms. It is monetized partially through modules that add features like a centralized dashboard and an "intelligence engine." - -As you might imagine, he got it off the ground by talking to customers and giving them what they indicated they'd be willing to purchase. - -"Our number one customer target is the agency market," he said. "The enterprise market is a big target, but I believe it's our second target, not our first. And the reason it's number two is they don't make decisions very fast. There are technology refresh cycles that have to come up, there are lots of politics involved and lots of different vendors. It's lucrative once you're in, but in a startup you've got to figure out how to pay your bills. I want to pay my bills today. I don't want to pay them in three years." - -Drud's focus on the agency market illustrates another consideration: the importance of understanding something about your customers' business. When talking with agencies, many said they were tired of being offered generic software that really didn't match their needs from proprietary vendors that didn't understand their business. In Drud's case, that understanding is built into the company DNA. The software was developed by an agency to fill its own needs. - -"We are a platform designed by an agency for an agency," Grandchamp said. "Right there is a relationship that they're willing to pay for. We know their business." - -Grandchamp noted that startups also need to be able to distinguish users from customers. Most of the people downloading and using commercial open source software aren't the people who have authorization to make purchasing decisions. These users, however, can point to the people who control the purse strings. - -"It's our job to build a way to communicate with those users, provide them value so that they'll give us value," he explained. "It has to be an equal exchange. I give you value of a tool that works, some advice, really good documentation, access to experts who can sort of guide you along. Along the way I'm asking you for pieces of information. Who do you work for? How are the technology decisions happening in your company? Are there other people in your company that we should refer the product to? We have to create the dialog." - -In the end, Grandchamp said, in the open source world the people who go out to find business probably shouldn't see themselves as salespeople, but rather, as problem solvers. - -"I believe that you're not really going to need salespeople in this model. I think you're going to need customer success people. I think you're going to need people who can enable your customers to be successful in a business relationship that's more highly transactional." - -"People don't like to be sold," he added, "especially in open source. The last person they want to see is the sales person, but they like to ply and try and consume and give you input and give you feedback. They love that." - --------------------------------------------------------------------------------- - -via: http://www.itprotoday.com/software-development/how-monetize-open-source-project - -作者:[Christine Hall][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.itprotoday.com/author/christine-hall -[1]:https://www.drud.com/ -[2]:http://www.itprotoday.com/open-source/demand-open-source-skills-continues-grow -[3]:http://www.itprotoday.com/software-development/raleigh-east-coasts-silicon-valley diff --git a/sources/talk/20171114 Why pair writing helps improve documentation.md b/sources/talk/20171114 Why pair writing helps improve documentation.md deleted file mode 100644 index ff3bbb5888..0000000000 --- a/sources/talk/20171114 Why pair writing helps improve documentation.md +++ /dev/null @@ -1,87 +0,0 @@ -Why pair writing helps improve documentation -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead-2.png?itok=lPO6tqPd) - -Professional writers, at least in the Red Hat documentation team, nearly always work on docs alone. But have you tried writing as part of a pair? In this article, I'll explain a few benefits of pair writing. -### What is pair writing? - -Pair writing is when two writers work in real time, on the same piece of text, in the same room. This approach improves document quality, speeds up writing, and allows writers to learn from each other. The idea of pair writing is borrowed from [pair programming][1]. - -When pair writing, you and your colleague work on the text together, making suggestions and asking questions as needed. Meanwhile, you're observing each other's work. For example, while one is writing, the other writer observes details such as structure or context. Often discussion around the document turns into sharing experiences and opinions, and brainstorming about writing in general. - -At all times, the writing is done by only one person. Thus, you need only one computer, unless you want one writer to do online research while the other person does the writing. The text workflow is the same as if you are working alone: a text editor, the documentation source files, git, and so on. - -### Pair writing in practice - -My colleague Aneta Steflova and I have done more than 50 hours of pair writing working on the Red Hat Enterprise Linux System Administration docs and on the Red Hat Identity Management docs. I've found that, compared to writing alone, pair writing: - - * is as productive or more productive; - * improves document quality; - * helps writers share technical expertise; and - * is more fun. - - - -### Speed - -Two writers writing one text? Sounds half as productive, right? Wrong. (Usually.) - -Pair writing can help you work faster because two people have solutions to a bigger set of problems, which means getting blocked less often during the process. For example, one time we wrote urgent API docs for identity management. I know at least the basics of web APIs, the REST protocol, and so on, which helped us speed through those parts of the documentation. Working alone, Aneta would have needed to interrupt the writing process frequently to study these topics. - -### Quality - -Poor wording or sentence structure, inconsistencies in material, and so on have a harder time surviving under the scrutiny of four eyes. For example, one of our pair writing documents was reviewed by an extremely critical developer, who was known for catching technical inaccuracies and bad structure. After this particular review, he said, "Perfect. Thanks a lot." - -### Sharing expertise - -Each of us lives in our own writing bubble, and we normally don't know how others approach writing. Pair writing can help you improve your own writing process. For example, Aneta showed me how to better handle assignments in which the developer has provided starting text (as opposed to the writer writing from scratch using their own knowledge of the subject), which I didn't have experience with. Also, she structures the docs thoroughly, which I began doing as well. - -As another example, I'm good enough at Vim that XML editing (e.g., tags manipulation) is enjoyable instead of torturous. Aneta saw how I was using Vim, asked about it, suffered through the learning curve, and now takes advantage of the Vim features that help me. - -Pair writing is especially good for helping and mentoring new writers, and it's a great way to get to know professionally (and have fun with) colleagues. - -### When pair writing shines - -In addition to benefits I've already listed, pair writing is especially good for: - - * **Working with[Bugzilla][2]** : Bugzillas can be cumbersome and cause problems, especially for administration-clumsy people (like me). - * **Reviewing existing documents** : When documentation needs to be expanded or fixed, it is necessary to first examine the existing document. - * **Learning new technology** : A fellow writer can be a better teacher than an engineer. - * **Writing emails/requests for information to developers with well-chosen questions** : The difficulty of this task rises in proportion to the difficulty of technology you are documenting. - - - -Also, with pair writing, feedback is in real time, as-needed, and two-way. - -On the downside, pair writing can be a faster pace, giving a writer less time to mull over a topic or wording. On the other hand, generally peer review is not necessary after pair writing. - -### Words of caution - -To get the most out of pair writing: - - * Go into the project well prepared, otherwise you can waste your colleague's time. - * Talkative types need to stay focused on the task, otherwise they end up talking rather than writing. - * Be prepared for direct feedback. Pair writing is not for feedback-allergic writers. - * Beware of session hijackers. Dominant personalities can turn pair writing into writing solo with a spectator. (However, it _can _ be good if one person takes over at times, as long as the less-experienced partner learns from the hijacker, or the more-experienced writer is providing feedback to the hijacker.) - - - -### Conclusion - -Pair writing is a meeting, but one in which you actually get work done. It's an activity that lets writers focus on the one indispensable thing in our vocation--writing. - -_This post was written with the help of pair writing with Aneta Steflova._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/11/try-pair-writing - -作者:[Maxim Svistunov][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/maxim-svistunov -[1]:https://developer.atlassian.com/blog/2015/05/try-pair-programming/ -[2]:https://www.bugzilla.org/ diff --git a/sources/talk/20171115 Why and How to Set an Open Source Strategy.md b/sources/talk/20171115 Why and How to Set an Open Source Strategy.md deleted file mode 100644 index 79ec071b4d..0000000000 --- a/sources/talk/20171115 Why and How to Set an Open Source Strategy.md +++ /dev/null @@ -1,120 +0,0 @@ -Why and How to Set an Open Source Strategy -============================================================ - -![](https://www.linuxfoundation.org/wp-content/uploads/2017/11/open-source-strategy-1024x576.jpg) - -This article explains how to walk through, measure, and define strategies collaboratively in an open source community. - - _“If you don’t know where you are going, you’ll end up someplace else.” _ _—_  Yogi Berra - -Open source projects are generally started as a way to scratch one’s itch — and frankly that’s one of its greatest attributes. Getting code down provides a tangible method to express an idea, showcase a need, and solve a problem. It avoids over thinking and getting a project stuck in analysis-paralysis, letting the project pragmatically solve the problem at hand. - -Next, a project starts to scale up and gets many varied users and contributions, with plenty of opinions along the way. That leads to the next big challenge — how does a project start to build a strategic vision? In this article, I’ll describe how to walk through, measure, and define strategies collaboratively, in a community. - -Strategy may seem like a buzzword of the corporate world rather something that an open source community would embrace, so I suggest stripping away the negative actions that are sometimes associated with this word (e.g., staff reductions, discontinuations, office closures). Strategy done right isn’t a tool to justify unfortunate actions but to help show focus and where each community member can contribute. - -A good application of strategy achieves the following: - -* Why the project exists? - -* What the project looks to achieve? - -* What is the ideal end state for a project is. - -The key to success is answering these questions as simply as possible, with consensus from your community. Let’s look at some ways to do this. - -### Setting a mission and vision - - _“_ _Efforts and courage are not enough without purpose and direction.”_  — John F. Kennedy - -All strategic planning starts off with setting a course for where the project wants to go. The two tools used here are  _Mission_  and  _Vision_ . They are complementary terms, describing both the reason a project exists (mission) and the ideal end state for a project (vision). - -A great way to start this exercise with the intent of driving consensus is by asking each key community member the following questions: - -* What drove you to join and/or contribute the project? - -* How do you define success for your participation? - -In a company, you’d ask your customers these questions usually. But in open source projects, the customers are the project participants — and their time investment is what makes the project a success. - -Driving consensus means capturing the answers to these questions and looking for themes across them. At R Consortium, for example, I created a shared doc for the board to review each member’s answers to the above questions, and followed up with a meeting to review for specific themes that came from those insights. - -Building a mission flows really well from this exercise. The key thing is to keep the wording of your mission short and concise. Open Mainframe Project has done this really well. Here’s their mission: - - _Build community and adoption of Open Source on the mainframe by:_ - -* _Eliminating barriers to Open Source adoption on the mainframe_ - -* _Demonstrating value of the mainframe on technical and business levels_ - -* _Strengthening collaboration points and resources for the community to thrive_ - -At 40 words, it passes the key eye tests of a good mission statement; it’s clear, concise, and demonstrates the useful value the project aims for. - -The next stage is to reflect on the mission statement and ask yourself this question: What is the ideal outcome if the project accomplishes its mission? That can be a tough one to tackle. Open Mainframe Project put together its vision really well: - - _Linux on the Mainframe as the standard for enterprise class systems and applications._ - -You could read that as a [BHAG][1], but it’s really more of a vision, because it describes a future state that is what would be created by the mission being fully accomplished. It also hits the key pieces to an effective vision — it’s only 13 words, inspirational, clear, memorable, and concise. - -Mission and vision add clarity on the who, what, why, and how for your project. But, how do you set a course for getting there? - -### Goals, Objectives, Actions, and Results - - _“I don’t focus on what I’m up against. I focus on my goals and I try to ignore the rest.”_  — Venus Williams - -Looking at a mission and vision can get overwhelming, so breaking them down into smaller chunks can help the project determine how to get started. This also helps prioritize actions, either by importance or by opportunity. Most importantly, this step gives you guidance on what things to focus on for a period of time, and which to put off. - -There are lots of methods of time bound planning, but the method I think works the best for projects is what I’ve dubbed the GOAR method. It’s an acronym that stands for: - -* Goals define what the project is striving for and likely would align and support the mission. Examples might be “Grow a diverse contributor base” or “Become the leading project for X.” Goals are aspirational and set direction. - -* Objectives show how you measure a goal’s completion, and should be clear and measurable. You might also have multiple objectives to measure the completion of a goal. For example, the goal “Grow a diverse contributor base” might have objectives such as “Have X total contributors monthly” and “Have contributors representing Y different organizations.” - -* Actions are what the project plans to do to complete an objective. This is where you get tactical on exactly what needs done. For example, the objective “Have contributors representing Y different organizations” would like have actions of reaching out to interested organizations using the project, having existing contributors mentor new mentors, and providing incentives for first time contributors. - -* Results come along the way, showing progress both positive and negative from the actions. - -You can put these into a table like this: - -| Goals | Objectives | Actions | Results | -|:--|:--|:--|:--| -| Grow a diverse contributor base     | Have X total contributors monthly | Existing contributors mentor new mentors Providing incentives for first time contributors | | -| | Have contributors representing Y different organizations | Reach out to interested organizations using the project | | - - -In large organizations, monthly or quarterly goals and objectives often make sense; however, on open source projects, these time frames are unrealistic. Six- even 12-month tracking allows the project leadership to focus on driving efforts at a high level by nurturing the community along. - -The end result is a rubric that provides clear vision on where the project is going. It also lets community members more easily find ways to contribute. For example, your project may include someone who knows a few organizations using the project — this person could help introduce those developers to the codebase and guide them through their first commit. - -### What happens if the project doesn’t hit the goals? - - _“I have not failed. I’ve just found 10,000 ways that won’t work.”_  — Thomas A. Edison - -Figuring out what is within the capability of an organization — whether Fortune 500 or a small open source project — is hard. And, sometimes the expectations or market conditions change along the way. Does that make the strategy planning process a failure? Absolutely not! - -Instead, you can use this experience as a way to better understand your project’s velocity, its impact, and its community, and perhaps as a way to prioritize what is important and what’s not. - --------------------------------------------------------------------------------- - -via: https://www.linuxfoundation.org/blog/set-open-source-strategy/ - -作者:[ John Mertic][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linuxfoundation.org/author/jmertic/ -[1]:https://en.wikipedia.org/wiki/Big_Hairy_Audacious_Goal -[2]:https://www.linuxfoundation.org/author/jmertic/ -[3]:https://www.linuxfoundation.org/category/blog/ -[4]:https://www.linuxfoundation.org/category/audience/c-level/ -[5]:https://www.linuxfoundation.org/category/audience/developer-influencers/ -[6]:https://www.linuxfoundation.org/category/audience/entrepreneurs/ -[7]:https://www.linuxfoundation.org/category/campaigns/membership/how-to/ -[8]:https://www.linuxfoundation.org/category/campaigns/events-campaigns/linux-foundation/ -[9]:https://www.linuxfoundation.org/category/audience/open-source-developers/ -[10]:https://www.linuxfoundation.org/category/audience/open-source-professionals/ -[11]:https://www.linuxfoundation.org/category/audience/open-source-users/ -[12]:https://www.linuxfoundation.org/category/blog/thought-leadership/ diff --git a/sources/talk/20171116 Why is collaboration so difficult.md b/sources/talk/20171116 Why is collaboration so difficult.md deleted file mode 100644 index 6567b75dca..0000000000 --- a/sources/talk/20171116 Why is collaboration so difficult.md +++ /dev/null @@ -1,94 +0,0 @@ -Why is collaboration so difficult? -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_block_collaboration.png?itok=pKbXpr1e) - -Many contemporary definitions of "collaboration" define it simply as "working together"--and, in part, it is working together. But too often, we tend to use the term "collaboration" interchangeably with cognate terms like "cooperation" and "coordination." These terms also refer to some manner of "working together," yet there are subtle but important differences between them all. - -How does collaboration differ from coordination or cooperation? What is so important about collaboration specifically? Does it have or do something that coordination and cooperation don't? The short answer is a resounding "yes!" - -[This unit explores collaboration][1], a problematic term because it has become a simple buzzword for "working together." By the time you've studied the cases and practiced the exercises contained in this section, you will understand that it's so much more than that. - -### Not like the others - -"Coordination" can be defined as the ordering of a variety of people acting in an effective, unified manner toward an end goal or state - -In traditional organizations and businesses, people contributed according to their role definitions, such as in manufacturing, where each employee was responsible for adding specific components to the widget on an assembly line until the widget was complete. In contexts like these, employees weren't expected to contribute beyond their pre-defined roles (they were probably discouraged from doing so), and they didn't necessarily have a voice in the work or in what was being created. Often, a manager oversaw the unification of effort (hence the role "project coordinator"). Coordination is meant to connote a sense of harmony and unity, as if elements are meant to go together, resulting in efficiency among the ordering of the elements. - -One common assumption is that coordinated efforts are aimed at the same, single goal. So some end result is "successful" when people and parts work together seamlessly; when one of the parts breaks down and fails, then the whole goal fails. Many traditional businesses (for instance, those with command-and-control hierarchies) manage work through coordination. - -Cooperation is another term whose surface meaning is "working together." Rather than the sense of compliance that is part of "coordination," it carries a sense of agreement and helpfulness on the path toward completing a shared activity or goal. - -"Collaboration" also means "working together"--but that simple definition obscures the complex and often difficult process of collaborating. - -People tend to use the term "cooperation" when joining two semi-related entities where one or more entity could decide not to cooperate. The people and pieces that are part of a cooperative effort make the shared activity easier to perform or the shared goal easier to reach. "Cooperation" implies a shared goal or activity we agree to pursue jointly. One example is how police and witnesses cooperate to solve crimes. - -"Collaboration" also means "working together"--but that simple definition obscures the complex and often difficult process of collaborating. - -Sometimes collaboration involves two or more groups that do not normally work together; they are disparate groups or not usually connected. For instance, a traitor collaborates with the enemy, or rival businesses collaborate with each other. The subtlety of collaboration is that the two groups may have oppositional initial goals but work together to create a shared goal. Collaboration can be more contentious than coordination or cooperation, but like cooperation, any one of the entities could choose not to collaborate. Despite the contention and conflict, however, there is discourse--whether in the form of multi-way discussion or one-way feedback--because without discourse, there is no way for people to express a point of dissent that is ripe for negotiation. - -The success of any collaboration rests on how well the collaborators negotiate their needs to create the shared objective, and then how well they cooperate and coordinate their resources to execute a plan to reach their goals. - -### For example - -One way to think about these things is through a real-life example--like the writing of [this book][1]. - -The editor, [Bryan][2], coordinates the authors' work through the call for proposals, setting dates and deadlines, collecting the writing, and meeting editing dates and deadlines for feedback about our work. He coordinates the authors, the writing, the communications. In this example, I'm not coordinating anything except myself (still a challenge most days!). - -The success of any collaboration rests on how well the collaborators negotiate their needs to create the shared objective, and then how well they cooperate and coordinate their resources to execute a plan to reach their goals. - -I cooperate with Bryan's dates and deadlines, and with the ways he has decided to coordinate the work. I propose the introduction on GitHub; I wait for approval. I comply with instructions, write some stuff, and send it to him by the deadlines. He cooperates by accepting a variety of document formats. I get his edits,incorporate them, send it back him, and so forth. If I don't cooperate (or something comes up and I can't cooperate), then maybe someone else writes this introduction instead. - -Bryan and I collaborate when either one of us challenges something, including pieces of the work or process that aren't clear, things that we thought we agreed to, or things on which we have differing opinions. These intersections are ripe for negotiation and therefore indicative of collaboration. They are the opening for us to negotiate some creative work. - -Once the collaboration is negotiated and settled, writing and editing the book returns to cooperation/coordination; that is why collaboration relies on the other two terms of joint work. - -One of the most interesting parts of this example (and of work and shared activity in general) is the moment-by-moment pivot from any of these terms to the other. The writing of this book is not completely collaborative, coordinated, or cooperative. It's a messy mix of all three. - -### Why is collaboration important? - -Collaboration is an important facet of contemporary organizations--specifically those oriented toward knowledge work--because it allows for productive disagreement between actors. That kind of disagreement then helps increase the level of engagement and provide meaning to the group's work. - -In his book, The Age of Discontinuity: Guidelines to our Changing Society, [Peter Drucker discusses][3] the "knowledge worker" and the pivot from work based on experience (e.g. apprenticeships) to work based on knowledge and the application of knowledge. This change in work and workers, he writes: - -> ...will make the management of knowledge workers increasingly crucial to the performance and achievement of the knowledge society. We will have to learn to manage the knowledge worker both for productivity and for satisfaction, both for achievement and for status. We will have to learn to give the knowledge worker a job big enough to challenge him, and to permit performance as a "professional." - -In other words, knowledge workers aren't satisfied with being subordinate--told what to do by managers as, if there is one right way to do a task. And, unlike past workers, they expect more from their work lives, including some level of emotional fulfillment or meaning-making from their work. The knowledge worker, according to Drucker, is educated toward continual learning, "paid for applying his knowledge, exercising his judgment, and taking responsible leadership." So it then follows that knowledge workers expect from work the chance to apply and share their knowledge, develop themselves professionally, and continuously augment their knowledge. - -Interesting to note is the fact that Peter Drucker wrote about those concepts in 1969, nearly 50 years ago--virtually predicting the societal and organizational changes that would reveal themselves, in part, through the development of knowledge sharing tools such as forums, bulletin boards, online communities, and cloud knowledge sharing like DropBox and GoogleDrive as well as the creation of social media tools such as MySpace, Facebook, Twitter, YouTube and countless others. All of these have some basis in the idea that knowledge is something to liberate and share. - -In this light, one might view the open organization as one successful manifestation of a system of management for knowledge workers. In other words, open organizations are a way to manage knowledge workers by meeting the needs of the organization and knowledge workers (whether employees, customers, or the public) simultaneously. The foundational values this book explores are the scaffolding for the management of knowledge, and they apply to ways we can: - - * make sure there's a lot of varied knowledge around (inclusivity) - * help people come together and participate (community) - * circulate information, knowledge, and decision making (transparency) - * innovate and not become entrenched in old ways of thinking and being (adaptability) - * develop a shared goal and work together to use knowledge (collaboration) - - - -Collaboration is an important process because of the participatory effect it has on knowledge work and how it aids negotiations between people and groups. As we've discovered, collaboration is more than working together with some degree of compliance; in fact, it describes a type of working together that overcomes compliance because people can disagree, question, and express their needs in a negotiation and in collaboration. And, collaboration is more than "working toward a shared goal"; collaboration is a process which defines the shared goals via negotiation and, when successful, leads to cooperation and coordination to focus activity on the negotiated outcome. - -Collaboration is an important process because of the participatory effect it has on knowledge work and how it aids negotiations between people and groups. - -Collaboration works best when the other four open organization values are present. For instance, when people are transparent, there is no guessing about what is needed, why, by whom, or when. Also, because collaboration involves negotiation, it also needs diversity (a product of inclusivity); after all, if we aren't negotiating among differing views, needs, or goals, then what are we negotiating? During a negotiation, the parties are often asked to give something up so that all may gain, so we have to be adaptable and flexible to the different outcomes that negotiation can provide. Lastly, collaboration is often an ongoing process rather than one which is quickly done and over, so it's best to enter collaboration as if you are part of the same community, desiring everyone to benefit from the negotiation. In this way, acts of authentic and purposeful collaboration directly necessitate the emergence of the other four values--transparency, inclusivity, adaptability, and community--as they assemble part of the organization's collective purpose spontaneously. - -### Collaboration in open organizations - -Traditional organizations advance an agreed-upon set of goals that people are welcome to support or not. In these organizations, there is some amount of discourse and negotiation, but often a higher-ranking or more powerful member of the organization intervenes to make a decision, which the membership must accept (and sometimes ignores). In open organizations, however, the focus is for members to perform their activity and to work out their differences; only if necessary would someone get involved (and even then would try to do it in the most minimal way that support the shared values of community, transparency, adaptability, collaboration and inclusivity.) This make the collaborative processes in open organizations "messier" (or "chaotic" to use Jim Whitehurst's term) but more participatory and, hopefully, innovative. - -This article is part of the [Open Organization Workbook project][1]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/open-organization/17/11/what-is-collaboration - -作者:[Heidi Hess Von Ludewig][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/heidi-hess-von-ludewig -[1]:https://opensource.com/open-organization/17/8/workbook-project-announcement -[2]:http://opensource.com/users/bbehrens -[3]:https://www.elsevier.com/books/the-age-of-discontinuity/drucker/978-0-434-90395-5 diff --git a/sources/talk/20171221 Changing how we use Slack solved our transparency and silo problems.md b/sources/talk/20171221 Changing how we use Slack solved our transparency and silo problems.md deleted file mode 100644 index d68bab55bf..0000000000 --- a/sources/talk/20171221 Changing how we use Slack solved our transparency and silo problems.md +++ /dev/null @@ -1,95 +0,0 @@ -Changing how we use Slack solved our transparency and silo problems -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_abstract_pieces.jpg?itok=tGR1d2MU) - -Collaboration and information silos are a reality in most organizations today. People tend to regard them as huge barriers to innovation and organizational efficiency. They're also a favorite target for solutions from software tool vendors of all types. - -Tools by themselves, however, are seldom (if ever), the answer to a problem like organizational silos. The reason for this is simple: Silos are made of people, and human dynamics are key drivers for the existence of silos in the first place. - -So what is the answer? - -Successful communities are the key to breaking down silos. Tools play an important role in the process, but if you don't build successful communities around those tools, then you'll face an uphill battle with limited chances for success. Tools enable communities; they do not build them. This takes a thoughtful approach--one that looks at culture first, process second, and tools last. - -Successful communities are the key to breaking down silos. - -However, this is a challenge because, in most cases, this is not the way the process works in most businesses. Too many companies begin their journey to fix silos by thinking about tools first and considering metrics that don't evaluate the right factors for success. Too often, people choose tools for purely cost-based, compliance-based, or effort-based reasons--instead of factoring in the needs and desires of the user base. But subjective measures like "customer/user delight" are a real factor for these internal tools, and can make or break the success of both the tool adoption and the goal of increased collaboration. - -It's critical to understand the best technical tool (or what the business may consider the most cost-effective) is not always the solution that drives community, transparency, and collaboration forward. There is a reason that "Shadow IT"--users choosing their own tool solution, building community and critical mass around them--exists and is so effective: People who choose their own tools are more likely to stay engaged and bring others with them, breaking down silos organically. - -This is a story of how Autodesk ended up adopting Slack at enterprise scale to help solve our transparency and silo problems. Interestingly, Slack wasn't (and isn't) an IT-supported application at Autodesk. It's an enterprise solution that was adopted, built, and is still run by a group of passionate volunteers who are committed to a "default to open" paradigm. - -Utilizing Slack makes transparency happen for us. - -### Chat-tastrophe - -First, some perspective: My job at Autodesk is running our [Open@ADSK][1] initiative. I was originally hired to drive our open source strategy, but we quickly expanded my role to include driving open source best practices for internal development (inner source), and transforming how we collaborate internally as an organization. This last piece is where we pick up our story of Slack adoption in the company. - -But before we even begin to talk about our journey with Slack, let's address why lack of transparency and openness was a challenge for us. What is it that makes transparency such a desirable quality in organizations, and what was I facing when I started at Autodesk? - -Every company says they want "better collaboration." In our case, we are a 35-year-old software company that has been immensely successful at selling desktop "shrink-wrapped" software to several industries, including architecture, engineering, construction, manufacturing, and entertainment. But no successful company rests on its laurels, and Autodesk leadership recognized that a move to Cloud-based solutions for our products was key to the future growth of the company, including opening up new markets through product combinations that required Cloud computing and deep product integrations. - -The challenge in making this move was far more than just technical or architectural--it was rooted in the DNA of the company, in everything from how we were organized to how we integrated our products. The basic format of integration in our desktop products was file import/export. While this is undoubtedly important, it led to a culture of highly-specialized teams working in an environment that's more siloed than we'd like and not sharing information (or code). Prior to the move to a cloud-based approach, this wasn't as a much of a problem--but, in an environment that requires organizations to behave more like open source projects do, transparency, openness, and collaboration go from "nice-to-have" to "business critical." - -Like many companies our size, Autodesk has had many different collaboration solutions through the years, some of them commercial, and many of them home-grown. However, none of them effectively solved the many-to-many real-time collaboration challenge. Some reasons for this were technical, but many of them were cultural. - -I relied on a philosophy I'd formed through challenging experiences in my career: "Culture first, tools last." - -When someone first tasked me with trying to find a solution for this, I relied on a philosophy I'd formed through challenging experiences in my career: "Culture first, tools last." This is still a challenge for engineering folks like myself. We want to jump immediately to tools as the solution to any problem. However, it's critical to evaluate a company's ethos (culture), as well as existing processes to determine what kinds of tools might be a good fit. Unfortunately, I've seen too many cases where leaders have dictated a tool choice from above, based on the factors discussed earlier. I needed a different approach that relied more on fitting a tool into the culture we wanted to become, not the other way around. - -What I found at Autodesk were several small camps of people using tools like HipChat, IRC, Microsoft Lync, and others, to try to meet their needs. However, the most interesting thing I found was 85 separate instances of Slack in the company! - -Eureka! I'd stumbled onto a viral success (one enabled by Slack's ability to easily spin up "free" instances). I'd also landed squarely in what I like to call "silo-land." - -All of those instances were not talking to each other--so, effectively, we'd created isolated islands of information that, while useful to those in them, couldn't transform the way we operated as an enterprise. Essentially, our existing organizational culture was recreated in digital format in these separate Slack systems. Our organization housed a mix of these small, free instances, as well as multiple paid instances, which also meant we were not taking advantage of a common billing arrangement. - -My first (open source) thought was: "Hey, why aren't we using IRC, or some other open source tool, for this?" I quickly realized that didn't matter, as our open source engineers weren't the only people using Slack. People from all areas of the company--even senior leadership--were adopting Slack in droves, and, in some cases, convincing their management to pay for it! - -My second (engineering) thought was: "Oh, this is simple. We just collapse all 85 of those instances into a single cohesive Slack instance." What soon became obvious was that was the easy part of the solution. Much harder was the work of cajoling, convincing, and moving people to a single, transparent instance. Building in the "guard rails" to enable a closed source tool to provide this transparency was key. These guard rails came in the form of processes, guidelines, and community norms that were the hardest part of this transformation. - -### The real work begins - -As I began to slowly help users migrate to the common instance (paying for it was also a challenge, but a topic for another day), I discovered a dedicated group of power users who were helping each other in the #adsk-slack-help channel on our new common instance of Slack. These power users were, in effect, building the roots of our transparency and community through their efforts. - -The open source community manager in me quickly realized these users were the path to successfully scaling Slack at Autodesk. I enlisted five of them to help me, and, together we set about fabricating the community structure for the tool's rollout. - -We did, however, learn an important lesson about transparency and company culture along the way. - -Here I should note the distinction between a community structure/governance model and traditional IT policies: With the exception of security and data privacy/legal policies, volunteer admins and user community members completely define and govern our Slack instance. One of the keys to our success with Slack (currently approximately 9,100 users and roughly 4,300 public channels) was how we engaged and involved our users in building these governance structures. Things like channel naming conventions and our growing list of frequently asked questions were organic and have continued in that same vein. Our community members feel like their voices are heard (even if some disagree), and that they have been a part of the success of our deployment of Slack. - -We did, however, learn an important lesson about transparency and company culture along the way. - -### It's not the tool - -When we first launched our main Slack instance, we left the ability for anyone to make a channel private turned on. After about three months of usage, we saw a clear trend: More people were creating private channels (and messages) than they were public channels (the ratio was about two to one, private versus public). Since our effort to merge 85 Slack instances was intended to increase participation and transparency, we quickly adjusted our policy and turned off this feature for regular users. We instead implemented a policy of review by the admin team, with clear criteria (finance, legal, personnel discussions among the reasons) defined for private channels. - -This was probably the only time in this entire process that I regretted something. - -We took an amazing amount of flak for this decision because we were dealing with a corporate culture that was used to working in independent units that had minimal interaction with each other. Our defining moment of clarity (and the tipping point where things started to get better) occurred in an all-hands meeting when one of our senior executives asked me to address a question about Slack. I stood up to answer the question, and said (paraphrased from memory): "It's not about the tool. I could give you all the best, gold-plated collaboration platform in existence, but we aren't going to be successful if we don't change our approach to collaboration and learn to default to open." - -I didn't think anything more about that statement--until that senior executive starting using the phrase "default to open" in his slide decks, in his staff meetings, and with everyone he met. That one moment has defined what we have been trying to do with Slack: The tool isn't the sole reason we've been successful; it's the approach that we've taken around building a self-sustaining community that not only wants to use this tool, but craves the ability it gives them to work easily across the enterprise. - -### What we learned - -The tool isn't the sole reason we've been successful; it's the approach that we've taken around building a self-sustaining community that not only wants to use this tool, but craves the ability it gives them to work easily across the enterprise. - -I say all the time that this could have happened with other, similar tools (Hipchat, IRC, etc), but it works in this case specifically because we chose an approach of supporting a solution that the user community adopted for their needs, not strictly what the company may have chosen if the decision was coming from the top of the organizational chart. We put a lot of work into making it an acceptable solution (from the perspectives of security, legal, finance, etc.) for the company, but, ultimately, our success has come from the fact that we built this rollout (and continue to run the tool) as a community, not as a traditional corporate IT system. - -The most important lesson I learned through all of this is that transparency and community are evolutionary, not revolutionary. You have to understand where your culture is, where you want it to go, and utilize the lever points that the community is adopting itself to make sustained and significant progress. There is a fine balance point between an anarchy, and a thriving community, and we've tried to model our approach on the successful practices of today's thriving open source communities. - -Communities are personal. Tools come and go, but keeping your community at the forefront of your push to transparency is the key to success. - -This article is part of the [Open Organization Workbook project][2]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/open-organization/17/12/chat-platform-default-to-open - -作者:[Guy Martin][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/guyma -[1]:mailto:Open@ADSK -[2]:https://opensource.com/open-organization/17/8/workbook-project-announcement diff --git a/sources/talk/20180109 How Mycroft used WordPress and GitHub to improve its documentation.md b/sources/talk/20180109 How Mycroft used WordPress and GitHub to improve its documentation.md deleted file mode 100644 index 9e35e0ede7..0000000000 --- a/sources/talk/20180109 How Mycroft used WordPress and GitHub to improve its documentation.md +++ /dev/null @@ -1,116 +0,0 @@ -How Mycroft used WordPress and GitHub to improve its documentation -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead-2.png?itok=lPO6tqPd) - -Image credits : Photo by Unsplash; modified by Rikki Endsley. CC BY-SA 4.0 - -Imagine you've just joined a new technology company, and one of the first tasks you're assigned is to improve and centralize the organization's developer-facing documentation. There's just one catch: That documentation exists in many different places, across several platforms, and differs markedly in accuracy, currency, and style. - -So how did we tackle this challenge? - -### Understanding the scope - -As with any project, we first needed to understand the scope and bounds of the problem we were trying to solve. What documentation was good? What was working? What wasn't? How much documentation was there? What format was it in? We needed to do a **documentation audit**. Luckily, [Aneta Šteflova][1] had recently [published an article on OpenSource.com][2] about this, and it provided excellent guidance. - -![mycroft doc audit][4] - -Mycroft documentation audit, showing source, topic, medium, currency, quality and audience - -Next, every piece of publicly facing documentation was assessed for the topic it covered, the medium it used, currency, and quality. A pattern quickly emerged that different platforms had major deficiencies, allowing us to make a data-driven approach to decommission our existing Jekyll-based sites. The audit also highlighted just how fragmented our documentation sources were--we had developer-facing documentation across no fewer than seven sites. Although search engines were finding this content just fine, the fragmentation made it difficult for developers and users of Mycroft--our primary audiences--to navigate the information they needed. Again, this data helped us make the decision to centralize our documentation on to one platform. - -### Choosing a central platform - -As an organization, we wanted to constrain the number of standalone platforms in use. Over time, maintenance and upkeep of multiple platforms and integration touchpoints becomes cumbersome for any organization, but this is exacerbated for a small startup. - -One of the other business drivers in platform choice was that we had two primary but very different audiences. On one hand, we had highly technical developers who we were expecting would push documentation to its limits--and who would want to contribute to technical documentation using their tools of choice--[Git][5], [GitHub][6], and [Markdown][7]. Our second audience--end users--would primarily consume technical documentation and would want to do so in an inviting, welcoming platform that was visually appealing and provided additional features such as the ability to identify reading time and to provide feedback. The ability to capture feedback was also a key requirement from our side as without feedback on the quality of the documentation, we would not have a solid basis to undertake continuous quality improvement. - -Would we be able to identify one platform that met all of these competing needs? - -We realised that two platforms covered all of our needs: - - * [WordPress][8]: Our existing website is built on WordPress, and we have some reasonably robust WordPress skills in-house. The flexibility of WordPress also fulfilled our requirements for functionality like reading time and the ability to capture user feedback. - * [GitHub][9]: Almost [all of Mycroft.AI's source code is available on GitHub][10], and our development team uses this platform daily. - - - -But how could we marry the two? - - -![](https://opensource.com/sites/default/files/images/life-uploads/wordpress-github-sync.png) - -### Integrating WordPress and GitHub with WordPress GitHub Sync - -Luckily, our COO, [Nate Tomasi][11], spotted a WordPress plugin that promised to integrate the two. - -This was put through its paces on our test website, and it passed with flying colors. It was easy to install, had a straightforward configuration, which just required an OAuth token and webhook with GitHub, and provided two-way integration between WordPress and GitHub. - -It did, however, have a dependency--on Markdown--which proved a little harder to implement. We trialed several Markdown plugins, but each had several quirks that interfered with the rendering of non-Markdown-based content. After several days of frustration, and even an attempt to custom-write a plugin for our needs, we stumbled across [Parsedown Party][12]. There was much partying! With WordPress GitHub Sync and Parsedown Party, we had integrated our two key platforms. - -Now it was time to make our content visually appealing and usable for our user audience. - -### Reading time and feedback - -To implement the reading time and feedback functionality, we built a new [page template for WordPress][13], and leveraged plugins within the page template. - -Knowing the estimated reading time of an article in advance has been [proven to increase engagement with content][14] and provides developers and users with the ability to decide whether to read the content now or bookmark it for later. We tested several WordPress plugins for reading time, but settled on [Reading Time WP][15] because it was highly configurable and could be easily embedded into WordPress page templates. Our decision to place Reading Time at the top of the content was designed to give the user the choice of whether to read now or save for later. With Reading Time in place, we then turned our attention to gathering user feedback and ratings for our documentation. - -![](https://opensource.com/sites/default/files/images/life-uploads/screenshot-from-2017-12-08-00-55-31.png) - -There are several rating and feedback plugins available for WordPress. We needed one that could be easily customized for several use cases, and that could aggregate or summarize ratings. After some experimentation, we settled on [Multi Rating Pro][16] because of its wide feature set, especially the ability to create a Review Ratings page in WordPress--i.e., a central page where staff can review ratings without having to be logged in to the WordPress backend. The only gap we ran into here was the ability to set the display order of rating options--but it will likely be added in a future release. - -The WordPress GitHub Integration plugin also gave us the ability to link back to the GitHub repository where the original Markdown content was held, inviting technical developers to contribute to improving our documentation. - -### Updating the existing documentation - -Now that the "container" for our new documentation had been developed, it was time to update the existing content. Because much of our documentation had grown organically over time, there were no style guidelines to shape how keywords and code were styled. This was tackled first, so that it could be applied to all content. [You can see our content style guidelines on GitHub.][17] - -As part of the update, we also ran several checks to ensure that the content was technically accurate, augmenting the existing documentation with several images for better readability. - -There were also a couple of additional tools that made creating internal links for documentation pieces easier. First, we installed the [WP Anchor Header][18] plugin. This plugin provided a small but important function: adding `id` content in GitHub using the `[markdown-toc][19]` library, then simply copied in to the WordPress content, where they would automatically link to the `id` attributes to each `

`, `

` (and so on) element. This meant that internal anchors could be automatically generated on the command line from the Markdown content in GitHub using the `[markdown-toc][19]` library, then simply copied in to the WordPress content, where they would automatically link to the `id` attributes generated by WP Anchor Header. - -Next, we imported the updated documentation into WordPress from GitHub, and made sure we had meaningful and easy-to-search on slugs, descriptions, and keywords--because what good is excellent documentation if no one can find it?! A final activity was implementing redirects so that people hitting the old documentation would be taken to the new version. - -### What next? - -[Please do take a moment and have a read through our new documentation][20]. We know it isn't perfect--far from it--but we're confident that the mechanisms we've baked into our new documentation infrastructure will make it easier to identify gaps--and resolve them quickly. If you'd like to know more, or have suggestions for our documentation, please reach out to Kathy Reid on [Chat][21] (@kathy-mycroft) or via [email][22]. - -_Reprinted with permission from[Mycroft.ai][23]._ - -### About the author -Kathy Reid - Director of Developer Relations @MycroftAI, President of @linuxaustralia. Kathy Reid has expertise in open source technology management, web development, video conferencing, digital signage, technical communities and documentation. She has worked in a number of technical and leadership roles over the last 20 years, and holds Arts and Science undergraduate degrees... more about Kathy Reid - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/rocking-docs-mycroft - -作者:[Kathy Reid][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/kathyreid -[1]:https://opensource.com/users/aneta -[2]:https://opensource.com/article/17/10/doc-audits -[3]:/file/382466 -[4]:https://opensource.com/sites/default/files/images/life-uploads/mycroft-documentation-audit.png (mycroft documentation audit) -[5]:https://git-scm.com/ -[6]:https://github.com/MycroftAI -[7]:https://en.wikipedia.org/wiki/Markdown -[8]:https://www.wordpress.org/ -[9]:https://github.com/ -[10]:https://github.com/mycroftai -[11]:http://mycroft.ai/team/ -[12]:https://wordpress.org/plugins/parsedown-party/ -[13]:https://developer.wordpress.org/themes/template-files-section/page-template-files/ -[14]:https://marketingland.com/estimated-reading-times-increase-engagement-79830 -[15]:https://jasonyingling.me/reading-time-wp/ -[16]:https://multiratingpro.com/ -[17]:https://github.com/MycroftAI/docs-rewrite/blob/master/README.md -[18]:https://wordpress.org/plugins/wp-anchor-header/ -[19]:https://github.com/jonschlinkert/markdown-toc -[20]:https://mycroft.ai/documentation -[21]:https://chat.mycroft.ai/ -[22]:mailto:kathy.reid@mycroft.ai -[23]:https://mycroft.ai/blog/improving-mycrofts-documentation/ diff --git a/sources/talk/20180111 The open organization and inner sourcing movements can share knowledge.md b/sources/talk/20180111 The open organization and inner sourcing movements can share knowledge.md deleted file mode 100644 index 272c1b03ae..0000000000 --- a/sources/talk/20180111 The open organization and inner sourcing movements can share knowledge.md +++ /dev/null @@ -1,121 +0,0 @@ -The open organization and inner sourcing movements can share knowledge -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/gov_collaborative_risk.png?itok=we8DKHuL) -Image by : opensource.com - -Red Hat is a company with roughly 11,000 employees. The IT department consists of roughly 500 members. Though it makes up just a fraction of the entire organization, the IT department is still sufficiently staffed to have many application service, infrastructure, and operational teams within it. Our purpose is "to enable Red Hatters in all functions to be effective, productive, innovative, and collaborative, so that they feel they can make a difference,"--and, more specifically, to do that by providing technologies and related services in a fashion that is as open as possible. - -Being open like this takes time, attention, and effort. While we always strive to be as open as possible, it can be difficult. For a variety of reasons, we don't always succeed. - -In this story, I'll explain a time when, in the rush to innovate, the Red Hat IT organization lost sight of its open ideals. But I'll also explore how returning to those ideals--and using the collaborative tactics of "inner source"--helped us to recover and greatly improve the way we deliver services. - -### About inner source - -Before I explain how inner source helped our team, let me offer some background on the concept. - -Inner source is the adoption of open source development practices between teams within an organization to promote better and faster delivery without requiring project resources be exposed to the world or openly licensed. It allows an organization to receive many of the benefits of open source development methods within its own walls. - -In this way, inner source aligns well with open organization strategies and principles; it provides a path for open, collaborative development. While the open organization defines its principles of openness broadly as transparency, inclusivity, adaptability, collaboration, and community--and covers how to use these open principles for communication, decision making, and many other topics--inner source is about the adoption of specific and tactical practices, processes, and patterns from open source communities to improve delivery. - -For instance, [the Open Organization Maturity Model][1] suggests that in order to be transparent, teams should, at minimum, share all project resources with the project team (though it suggests that it's generally better to share these resources with the entire organization). The common pattern in both inner source and open source development is to host all resources in a publicly available version control system, for source control management, which achieves the open organization goal of high transparency. - -Inner source aligns well with open organization strategies and principles. - -Another example of value alignment appears in the way open source communities accept contributions. In open source communities, source code is transparently available. Community contributions in the form of patches or merge requests are commonly accepted practices (even expected ones). This provides one example of how to meet the open organization's goal of promoting inclusivity and collaboration. - -### The challenge - -Early in 2014, Red Hat IT began its first steps toward making Amazon Web Services (AWS) a standard hosting offering for business critical systems. While teams within Red Hat IT had built several systems and services in AWS by this time, these were bespoke creations, and we desired to make deploying services to IT standards in AWS both simple and standardized. - -In order to make AWS cloud hosting meet our operational standards (while being scalable), the Cloud Enablement team within Red Hat IT decided that all infrastructure in AWS would be configured through code, rather than manually, and that everyone would use a standard set of tools. The Cloud Enablement team designed and built these standard tools; a separate group, the Platform Operations team, was responsible for provisioning and hosting systems and services in AWS using the tools. - -The Cloud Enablement team built a toolset, obtusely named "Template Util," based on AWS Cloud Formations configurations wrapped in a management layer to enforce certain configuration requirements and make stamping out multiple copies of services across environments easier. While the Template Util toolset technically met all our initial requirements, and we eventually provisioned the infrastructure for more than a dozen services with it, engineers in every team working with the tool found using it to be painful. Michael Johnson, one engineer using the tool, said "It made doing something relatively straightforward really complicated." - -Among the issues Template Util exhibited were: - - * Underlying cloud formations technologies implied constraints on application stack management at odds with how we managed our application systems. - * The tooling was needlessly complex and brittle in places, using multiple layered templating technologies and languages making syntax issues hard to debug. - * The code for the tool--and some of the data users needed to manipulate the tool--were kept in a repository that was difficult for most users to access. - * There was no standard process to contributing or accepting changes. - * The documentation was poor. - - - -As more engineers attempted to use the Template Util toolset, they found even more issues and limitations with the tools. Unhappiness continued to grow. To make matters worse, the Cloud Enablement team then shifted priorities to other deliverables without relinquishing ownership of the tool, so bug fixes and improvements to the tools were further delayed. - -The real, core issues here were our inability to build an inclusive community to collaboratively build shared tooling that met everyone's needs. Fear of losing "ownership," fear of changing requirements, and fear of seeing hard work abandoned all contributed to chronic conflict, which in turn led to poorer outcomes. - -### Crisis point - -By September 2015, more than a year after launching our first major service in AWS with the Template Util tool, we hit a crisis point. - -Many engineers refused to use the tools. That forced all of the related service provisioning work on a small set of engineers, further fracturing the community and disrupting service delivery roadmaps as these engineers struggled to deal with unexpected work. We called an emergency meeting and invited all the teams involved to find a solution. - -During the emergency meeting, we found that people generally thought we needed immediate change and should start the tooling effort over, but even the decision to start over wasn't unanimous. Many solutions emerged--sometimes multiple solutions from within a single team--all of which would require significant work to implement. While we couldn't reach a consensus on which solution to use during this meeting, we did reach an agreement to give proponents of different technologies two weeks to work together, across teams, to build their case with a prototype, which the community could then review. - -While we didn't reach a final and definitive decision, this agreement was the first point where we started to return to the open source ideals that guide our mission. By inviting all involved parties, we were able to be transparent and inclusive, and we could begin rebuilding our internal community. By making clear that we wanted to improve things and were open to new options, we showed our commitment to adaptability and meritocracy. Most importantly, the plan for building prototypes gave people a clear, return path to collaboration. - -When the community reviewed the prototypes, it determined that the clear leader was an Ansible-based toolset that would eventually become known, internally, as Ansicloud. (At the time, no one involved with this work had any idea that Red Hat would acquire Ansible the following month. It should also be noted that other teams within Red Hat have found tools based on Cloud Formation extremely useful, even when our specific Template Util tool did not find success.) - -This prototyping and testing phase didn't fix things overnight, though. While we had consensus on the general direction we needed to head, we still needed to improve the new prototype to the point at which engineers could use it reliably for production services. - -So over the next several months, a handful of engineers worked to further build and extend the Ansicloud toolset. We built three new production services. While we were sharing code, that sharing activity occurred at a low level of maturity. Some engineers had trouble getting access due to older processes. Other engineers headed in slightly different directions, with each engineer having to rediscover some of the core design issues themselves. - -### Returning to openness - -This led to a turning point: Building on top of the previous agreement, we focused on developing a unified vision and providing easier access. To do this, we: - - 1. created a list of specific goals for the project (both "must-haves" and "nice-to-haves"), - 2. created an open issue log for the project to avoid solving the same problem repeatedly, - 3. opened our code base so anyone in Red Hat could read or clone it, and - 4. made it easy for engineers to get trusted committer access - - - -Our agreement to collaborate, our finally unified vision, and our improved tool development methods spurred the growth of our community. Ansicloud adoption spread throughout the involved organizations, but this led to a new problem: The tool started changing more quickly than users could adapt to it, and improvements that different groups submitted were beginning to affect other groups in unanticipated ways. - -These issues resulted in our recent turn to inner source practices. While every open source project operates differently, we focused on adopting some best practices that seemed common to many of them. In particular: - - * We identified the business owner of the project and the core-contributor group of developers who would govern the development of the tools and decide what contributions to accept. While we want to keep things open, we can't have people working against each other or breaking each other's functionality. - * We developed a project README clarifying the purpose of the tool and specifying how to use it. We also created a CONTRIBUTING document explaining how to contribute, what sort of contributions would be useful, and what sort of tests a contribution would need to pass to be accepted. - * We began building continuous integration and testing services for the Ansicloud tool itself. This helped us ensure we could quickly and efficiently validate contributions technically, before the project accepted and merged them. - - - -With these basic agreements, documents, and tools available, we were back onto the path of open collaboration and successful inner sourcing. - -### Why it matters - -Why does inner source matter? - -From a developer community point of view, shifting from a traditional siloed development model to the inner source model has produced significant, quantifiable improvements: - - * Contributions to our tooling have grown 72% per week (by number of commits). - * The percentage of contributions from non-core committers has grown from 27% to 78%; the users of the toolset are driving its development. - * The contributor list has grown by 15%, primarily from new users of the tool set, rather than core committers, increasing our internal community. - - - -And the tools we've delivered through this project have allowed us to see dramatic improvements in our business outcomes. Using the Ansicloud tools, 54 new multi-environment application service deployments were created in 385 days (compared to 20 services in 1,013 days with the Template Util tools). We've gone from one new service deployment in a 50-day period to one every week--a seven-fold increase in the velocity of our delivery. - -What really matters here is that the improvements we saw were not aberrations. Inner source provides common, easily understood patterns that organizations can adopt to effectively promote collaboration (not to mention other open organization principles). By mirroring open source production practices, inner source can also mirror the benefits of open source code, which have been seen time and time again: higher quality code, faster development, and more engaged communities. - -This article is part of the [Open Organization Workbook project][2]. - -### about the author -Tom Benninger - Tom Benninger is a Solutions Architect, Systems Engineer, and continual tinkerer at Red Hat, Inc. Having worked with startups, small businesses, and larger enterprises, he has experience within a broad set of IT disciplines. His current area of focus is improving Application Lifecycle Management in the enterprise. He has a particular interest in how open source, inner source, and collaboration can help support modern application development practices and the adoption of DevOps, CI/CD, Agile,... - --------------------------------------------------------------------------------- - -via: https://opensource.com/open-organization/18/1/open-orgs-and-inner-source-it - -作者:[Tom Benninger][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/tomben -[1]:https://opensource.com/open-organization/resources/open-org-maturity-model -[2]:https://opensource.com/open-organization/17/8/workbook-project-announcement diff --git a/sources/talk/20180112 in which the cost of structured data is reduced.md b/sources/talk/20180112 in which the cost of structured data is reduced.md deleted file mode 100644 index 992ad57a39..0000000000 --- a/sources/talk/20180112 in which the cost of structured data is reduced.md +++ /dev/null @@ -1,181 +0,0 @@ -in which the cost of structured data is reduced -====== -Last year I got the wonderful opportunity to attend [RacketCon][1] as it was hosted only 30 minutes away from my home. The two-day conference had a number of great talks on the first day, but what really impressed me was the fact that the entire second day was spent focusing on contribution. The day started out with a few 15- to 20-minute talks about how to contribute to a specific codebase (including that of Racket itself), and after that people just split off into groups focused around specific codebases. Each table had maintainers helping guide other folks towards how to work with the codebase and construct effective patch submissions. - -![lensmen chronicles][2] - -I came away from the conference with a great sense of appreciation for how friendly and welcoming the Racket community is, and how great Racket is as a swiss-army-knife type tool for quick tasks. (Not that it's unsuitable for large projects, but I don't have the opportunity to start any new large projects very frequently.) - -The other day I wanted to generate colored maps of the world by categorizing countries interactively, and Racket seemed like it would fit the bill nicely. The job is simple: show an image of the world with one country selected; when a key is pressed, categorize that country, then show the map again with all categorized countries colored, and continue with the next country selected. - -### GUIs and XML - -I have yet to see a language/framework more accessible and straightforward out of the box for drawing1. Here's the entry point which sets up state and then constructs a canvas that handles key input and display: -``` -(define (main path) - (let ([frame (new frame% [label "World color"])] - [categorizations (box '())] - [doc (call-with-input-file path read-xml/document)]) - (new (class canvas% - (define/override (on-char event) - (handle-key this categorizations (send event get-key-code))) - (super-new)) - [parent frame] - [paint-callback (draw doc categorizations)]) - (send frame show #t))) - -``` - -While the class system is not one of my favorite things about Racket (most newer code seems to avoid it in favor of [generic interfaces][3] in the rare case that polymorphism is truly called for), the fact that classes can be constructed in a light-weight, anonymous way makes it much less onerous than it could be. This code sets up all mutable state in a [`box`][4] which you use in the way you'd use a `ref` in ML or Clojure: a mutable wrapper around an immutable data structure. - -The world map I'm using is [an SVG of the Robinson projection][5] from Wikipedia. If you look closely there's a call to bind `doc` that calls [`call-with-input-file`][6] with [`read-xml/document`][7] which loads up the whole map file's SVG; just about as easily as you could ask for. - -The data you get back from `read-xml/document` is in fact a [document][8] struct, which contains an `element` struct containing `attribute` structs and lists of more `element` structs. All very sensible, but maybe not what you would expect in other dynamic languages like Clojure or Lua where free-form maps reign supreme. Racket really wants structure to be known up-front when possible, which is one of the things that help it produce helpful error messages when things go wrong. - -Here's how we handle keyboard input; we're displaying a map with one country highlighted, and `key` here tells us what the user pressed to categorize the highlighted country. If that key is in the `categories` hash then we put it into `categorizations`. -``` -(define categories #hash((select . "eeeeff") - (#\1 . "993322") - (#\2 . "229911") - (#\3 . "ABCD31") - (#\4 . "91FF55") - (#\5 . "2439DF"))) - -(define (handle-key canvas categorizations key) - (cond [(equal? #\backspace key) (swap! categorizations cdr)] - [(member key (dict-keys categories)) (swap! categorizations (curry cons key))] - [(equal? #\space key) (display (unbox categorizations))]) - (send canvas refresh)) - -``` - -### Nested updates: the bad parts - -Finally once we have a list of categorizations, we need to apply it to the map document and display. We apply a [`fold`][9] reduction over the XML document struct and the list of country categorizations (plus `'select` for the country that's selected to be categorized next) to get back a "modified" document struct where the proper elements have the style attributes applied for the given categorization, then we turn it into an image and hand it to [`draw-pict`][10]: -``` - -(define (update original-doc categorizations) - (for/fold ([doc original-doc]) - ([category (cons 'select (unbox categorizations))] - [n (in-range (length (unbox categorizations)) 0 -1)]) - (set-style doc n (style-for category)))) - -(define ((draw doc categorizations) _ context) - (let* ([newdoc (update doc categorizations)] - [xml (call-with-output-string (curry write-xml newdoc))]) - (draw-pict (call-with-input-string xml svg-port->pict) context 0 0))) - -``` - -The problem is in that pesky `set-style` function. All it has to do is reach deep down into the `document` struct to find the `n`th `path` element (the one associated with a given country), and change its `'style` attribute. It ought to be a simple task. Unfortunately this function ends up being anything but simple: -``` - -(define (set-style doc n new-style) - (let* ([root (document-element doc)] - [g (list-ref (element-content root) 8)] - [paths (element-content g)] - [path (first (drop (filter element? paths) n))] - [path-num (list-index (curry eq? path) paths)] - [style-index (list-index (lambda (x) (eq? 'style (attribute-name x))) - (element-attributes path))] - [attr (list-ref (element-attributes path) style-index)] - [new-attr (make-attribute (source-start attr) - (source-stop attr) - (attribute-name attr) - new-style)] - [new-path (make-element (source-start path) - (source-stop path) - (element-name path) - (list-set (element-attributes path) - style-index new-attr) - (element-content path))] - [new-g (make-element (source-start g) - (source-stop g) - (element-name g) - (element-attributes g) - (list-set paths path-num new-path))] - [root-contents (list-set (element-content root) 8 new-g)]) - (make-document (document-prolog doc) - (make-element (source-start root) - (source-stop root) - (element-name root) - (element-attributes root) - root-contents) - (document-misc doc)))) - -``` - -The reason for this is that while structs are immutable, they don't support functional updates. Whenever you're working with immutable data structures, you want to be able to say "give me a new version of this data, but with field `x` replaced by the value of `(f (lookup x))`". Racket can [do this with dictionaries][11] but not with structs2. If you want a modified version you have to create a fresh one3. - -### Lenses to the rescue? - -![first lensman][12] - -When I brought this up in the `#racket` channel on Freenode, I was helpfully pointed to the 3rd-party [Lens][13] library. Lenses are a general-purpose way of composing arbitrarily nested lookups and updates. Unfortunately at this time there's [a flaw][14] preventing them from working with `xml` structs, so it seemed I was out of luck. - -But then I was pointed to [X-expressions][15] as an alternative to structs. The [`xml->xexpr`][16] function turns the structs into a deeply-nested list tree with symbols and strings in it. The tag is the first item in the list, followed by an associative list of attributes, then the element's children. While this gives you fewer up-front guarantees about the structure of the data, it does work around the lens issue. - -For this to work, we need to compose a new lens based on the "path" we want to use to drill down into the `n`th country and its `style` attribute. The [`lens-compose`][17] function lets us do that. Note that the order here might be backwards from what you'd expect; it works deepest-first (the way [`compose`][18] works for functions). Also note that defining one lens gives us the ability to both get nested values (with [`lens-view`][19]) and update them. -``` -(define (style-lens n) - (lens-compose (dict-ref-lens 'style) - second-lens - (list-ref-lens (add1 (* n 2))) - (list-ref-lens 10))) -``` - -Our `` XML elements are under the 10th item of the root xexpr, (hence the [`list-ref-lens`][20] with 10) and they are interspersed with whitespace, so we have to double `n` to find the `` we want. The [`second-lens`][21] call gets us to that element's attribute alist, and [`dict-ref-lens`][22] lets us zoom in on the `'style` key out of that alist. - -Once we have our lens, it's just a matter of replacing `set-style` with a call to [`lens-set`][23] in our `update` function we had above, and then we're off: -``` -(define (update doc categorizations) - (for/fold ([d doc]) - ([category (cons 'select (unbox categorizations))] - [n (in-range (length (unbox categorizations)) 0 -1)]) - (lens-set (style-lens n) d (list (style-for category))))) -``` - -![second stage lensman][24] - -Often times the trade-off between freeform maps/hashes vs structured data feels like one of convenience vs long-term maintainability. While it's unfortunate that they can't be used with the `xml` structs4, lenses provide a way to get the best of both worlds, at least in some situations. - -The final version of the code clocks in at 51 lines and is is available [on GitLab][25]. - -๛ - --------------------------------------------------------------------------------- - -via: https://technomancy.us/185 - -作者:[Phil Hagelberg][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://technomancy.us/ -[1]:https://con.racket-lang.org/ -[2]:https://technomancy.us/i/chronicles-of-lensmen.jpg -[3]:https://docs.racket-lang.org/reference/struct-generics.html -[4]:https://docs.racket-lang.org/reference/boxes.html?q=box#%28def._%28%28quote._~23~25kernel%29._box%29%29 -[5]:https://commons.wikimedia.org/wiki/File:BlankMap-World_gray.svg -[6]:https://docs.racket-lang.org/reference/port-lib.html#(def._((lib._racket%2Fport..rkt)._call-with-input-string)) -[7]:https://docs.racket-lang.org/xml/index.html?q=read-xml#%28def._%28%28lib._xml%2Fmain..rkt%29._read-xml%2Fdocument%29%29 -[8]:https://docs.racket-lang.org/xml/#%28def._%28%28lib._xml%2Fmain..rkt%29._document%29%29 -[9]:https://docs.racket-lang.org/reference/for.html?q=for%2Ffold#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for%2Ffold%29%29 -[10]:https://docs.racket-lang.org/pict/Rendering.html?q=draw-pict#%28def._%28%28lib._pict%2Fmain..rkt%29._draw-pict%29%29 -[11]:https://docs.racket-lang.org/reference/dicts.html?q=dict-update#%28def._%28%28lib._racket%2Fdict..rkt%29._dict-update%29%29 -[12]:https://technomancy.us/i/first-lensman.jpg -[13]:https://docs.racket-lang.org/lens/lens-guide.html -[14]:https://github.com/jackfirth/lens/issues/290 -[15]:https://docs.racket-lang.org/pollen/second-tutorial.html?q=xexpr#%28part._.X-expressions%29 -[16]:https://docs.racket-lang.org/xml/index.html?q=xexpr#%28def._%28%28lib._xml%2Fmain..rkt%29._xml-~3exexpr%29%29 -[17]:https://docs.racket-lang.org/lens/lens-reference.html#%28def._%28%28lib._lens%2Fcommon..rkt%29._lens-compose%29%29 -[18]:https://docs.racket-lang.org/reference/procedures.html#%28def._%28%28lib._racket%2Fprivate%2Flist..rkt%29._compose%29%29 -[19]:https://docs.racket-lang.org/lens/lens-reference.html?q=lens-view#%28def._%28%28lib._lens%2Fcommon..rkt%29._lens-view%29%29 -[20]:https://docs.racket-lang.org/lens/lens-reference.html?q=lens-view#%28def._%28%28lib._lens%2Fdata%2Flist..rkt%29._list-ref-lens%29%29 -[21]:https://docs.racket-lang.org/lens/lens-reference.html?q=lens-view#%28def._%28%28lib._lens%2Fdata%2Flist..rkt%29._second-lens%29%29 -[22]:https://docs.racket-lang.org/lens/lens-reference.html?q=lens-view#%28def._%28%28lib._lens%2Fdata%2Fdict..rkt%29._dict-ref-lens%29%29 -[23]:https://docs.racket-lang.org/lens/lens-reference.html?q=lens-view#%28def._%28%28lib._lens%2Fcommon..rkt%29._lens-set%29%29 -[24]:https://technomancy.us/i/second-stage-lensman.jpg -[25]:https://gitlab.com/technomancy/world-color/blob/master/world-color.rkt diff --git a/sources/talk/20180124 Security Chaos Engineering- A new paradigm for cybersecurity.md b/sources/talk/20180124 Security Chaos Engineering- A new paradigm for cybersecurity.md deleted file mode 100644 index 35c89150c8..0000000000 --- a/sources/talk/20180124 Security Chaos Engineering- A new paradigm for cybersecurity.md +++ /dev/null @@ -1,87 +0,0 @@ -Security Chaos Engineering: A new paradigm for cybersecurity -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_bank_vault_secure_safe.png?itok=YoW93h7C) - -Security is always changing and failure always exists. - -This toxic scenario requires a fresh perspective on how we think about operational security. We must understand that we are often the primary cause of our own security flaws. The industry typically looks at cybersecurity and failure in isolation or as separate matters. We believe that our lack of insight and operational intelligence into our own security control failures is one of the most common causes of security incidents and, subsequently, data breaches. - -> Fall seven times, stand up eight." --Japanese proverb - -The simple fact is that "to err is human," and humans derive their success as a direct result of the failures they encounter. Their rate of failure, how they fail, and their ability to understand that they failed in the first place are important building blocks to success. Our ability to learn through failure is inherent in the systems we build, the way we operate them, and the security we use to protect them. Yet there has been a lack of focus when it comes to how we approach preventative security measures, and the spotlight has trended toward the evolving attack landscape and the need to buy or build new solutions. - -### Security spending is continually rising and so are security incidents - -We spend billions on new information security technologies, however, we rarely take a proactive look at whether those security investments perform as expected. This has resulted in a continual increase in security spending on new solutions to keep up with the evolving attacks. - -Despite spending more on security, data breaches are continuously getting bigger and more frequent across all industries. We have marched so fast down this path of the "get-ahead-of-the-attacker" strategy that we haven't considered that we may be a primary cause of our own demise. How is it that we are building more and more security measures, but the problem seems to be getting worse? Furthermore, many of the notable data breaches over the past year were not the result of an advanced nation-state or spy-vs.-spy malicious advanced persistent threats (APTs); rather the principal causes of those events were incomplete implementation, misconfiguration, design flaws, and lack of oversight. - -The 2017 Ponemon Cost of a Data Breach Study breaks down the [root causes of data breaches][1] into three areas: malicious or criminal attacks, human factors or errors, and system glitches, including both IT and business-process failure. Of the three categories, malicious or criminal attacks comprises the largest distribution (47%), followed by human error (28%), and system glitches (25%). Cybersecurity vendors have historically focused on malicious root causes of data breaches, as it is the largest sole cause, but together human error and system glitches total 53%, a larger share of the overall problem. - -What is not often understood, whether due to lack of insight, reporting, or analysis, is that malicious or criminal attacks are often successful due to human error and system glitches. Both human error and system glitches are, at their root, primary markers of the existence of failure. Whether it's IT system failures, failures in process, or failures resulting from humans, it begs the question: "Should we be focusing on finding a method to identify, understand, and address our failures?" After all, it can be an arduous task to predict the next malicious attack, which often requires investment of time to sift threat intelligence, dig through forensic data, or churn threat feeds full of unknown factors and undetermined motives. Failure instrumentation, identification, and remediation are mostly comprised of things that we know, have the ability to test, and can measure. - -Failures we can analyze consist not only of IT, business, and general human factors but also the way we design, build, implement, configure, operate, observe, and manage security controls. People are the ones designing, building, monitoring, and managing the security controls we put in place to defend against malicious attackers. How often do we proactively instrument what we designed, built, and are operationally managing to determine if the controls are failing? Most organizations do not discover that their security controls were failing until a security incident results from that failure. The worst time to find out your security investment failed is during a security incident at 3 a.m. - -> Security incidents are not detective measures and hope is not a strategy when it comes to operating effective security controls. - -We hypothesize that a large portion of data breaches are caused not by sophisticated nation-state actors or hacktivists, but rather simple things rooted in human error and system glitches. Failure in security controls can arise from poor control placement, technical misconfiguration, gaps in coverage, inadequate testing practices, human error, and numerous other things. - -### The journey into Security Chaos Testing - -Our venture into this new territory of Security Chaos Testing has shifted our thinking about the root cause of many of our notable security incidents and data breaches. - -We were brought together by [Bruce Wong][2], who now works at Stitch Fix with Charles, one of the authors of this article. Prior to Stitch Fix, Bruce was a founder of the Chaos Engineering and System Reliability Engineering (SRE) practices at Netflix, the company commonly credited with establishing the field. Bruce learned about this article's other author, Aaron, through the open source [ChaoSlingr][3] Security Chaos Testing tool project, on which Aaron was a contributor. Aaron was interested in Bruce's perspective on the idea of applying Chaos Engineering to cybersecurity, which led Bruce to connect us to share what we had been working on. As security practitioners, we were both intrigued by the idea of Chaos Engineering and had each begun thinking about how this new method of instrumentation might have a role in cybersecurity. - -Within a short timeframe, we began finishing each other's thoughts around testing and validating security capabilities, which we collectively call "Security Chaos Engineering." We directly challenged many of the concepts we had come to depend on in our careers, such as compensating security controls, defense-in-depth, and how to design preventative security. Quickly we realized that we needed to challenge the status quo "set-it-and-forget-it" model and instead execute on continuous instrumentation and validation of security capabilities. - -Businesses often don't fully understand whether their security capabilities and controls are operating as expected until they are not. We had both struggled throughout our careers to provide measurements on security controls that go beyond simple uptime metrics. Our journey has shown us there is a need for a more pragmatic approach that emphasizes proactive instrumentation and experimentation over blind faith. - -### Defining new terms - -In the security industry, we have a habit of not explaining terms and assuming we are speaking the same language. To correct that, here are a few key terms in this new approach: - - * **(Security) Chaos Experiments** are foundationally rooted in the scientific method, in that they seek not to validate what is already known to be true or already known to be false, rather they are focused on deriving new insights about the current state. - * **Security Chaos Engineering** is the discipline of instrumentation, identification, and remediation of failure within security controls through proactive experimentation to build confidence in the system's ability to defend against malicious conditions in production. - - - -### Security and distributed systems - -Consider the evolving nature of modern application design where systems are becoming more and more distributed, ephemeral, and immutable in how they operate. In this shifting paradigm, it is becoming difficult to comprehend the operational state and health of our systems' security. Moreover, how are we ensuring that it remains effective and vigilant as the surrounding environment is changing its parameters, components, and methodologies? - -What does it mean to be effective in terms of security controls? After all, a single security capability could easily be implemented in a wide variety of diverse scenarios in which failure may arise from many possible sources. For example, a standard firewall technology may be implemented, placed, managed, and configured differently depending on complexities in the business, web, and data logic. - -It is imperative that we not operate our business products and services on the assumption that something works. We must constantly, consistently, and proactively instrument our security controls to ensure they cut the mustard when it matters. This is why Security Chaos Testing is so important. What Security Chaos Engineering does is it provides a methodology for the experimentation of the security of distributed systems in order to build confidence in the ability to withstand malicious conditions. - -In Security Chaos Engineering: - - * Security capabilities must be end-to-end instrumented. - * Security must be continuously instrumented to build confidence in the system's ability to withstand malicious conditions. - * Readiness of a system's security defenses must be proactively assessed to ensure they are battle-ready and operating as intended. - * The security capability toolchain must be instrumented from end to end to drive new insights into not only the effectiveness of the functionality within the toolchain but also to discover where added value and improvement can be injected. - * Practiced instrumentation seeks to identify, detect, and remediate failures in security controls. - * The focus is on vulnerability and failure identification, not failure management. - * The operational effectiveness of incident management is sharpened. - - - -As Henry Ford said, "Failure is only the opportunity to begin again, this time more intelligently." Security Chaos Engineering and Security Chaos Testing give us that opportunity. - -Would you like to learn more? Join the discussion by following [@aaronrinehart][4] and [@charles_nwatu][5] on Twitter. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/new-paradigm-cybersecurity - -作者:[Aaron Rinehart][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/aaronrinehart -[1]:https://www.ibm.com/security/data-breach -[2]:https://twitter.com/bruce_m_wong?lang=en -[3]:https://github.com/Optum/ChaoSlingr -[4]:https://twitter.com/aaronrinehart -[5]:https://twitter.com/charles_nwatu diff --git a/sources/talk/20180131 How to write a really great resume that actually gets you hired.md b/sources/talk/20180131 How to write a really great resume that actually gets you hired.md deleted file mode 100644 index b54b3944ae..0000000000 --- a/sources/talk/20180131 How to write a really great resume that actually gets you hired.md +++ /dev/null @@ -1,395 +0,0 @@ -How to write a really great resume that actually gets you hired -============================================================ - - -![](https://cdn-images-1.medium.com/max/2000/1*k7HRLZAsuINP9vIs2BIh1g.png) - -This is a data-driven guide to writing a resume that actually gets you hired. I’ve spent the past four years analyzing which resume advice works regardless of experience, role, or industry. The tactics laid out below are the result of what I’ve learned. They helped me land offers at Google, Microsoft, and Twitter and have helped my students systematically land jobs at Amazon, Apple, Google, Microsoft, Facebook, and more. - -### Writing Resumes Sucks. - -It’s a vicious cycle. - -We start by sifting through dozens of articles by career “gurus,” forced to compare conflicting advice and make our own decisions on what to follow. - -The first article says “one page MAX” while the second says “take two or three and include all of your experience.” - -The next says “write a quick summary highlighting your personality and experience” while another says “summaries are a waste of space.” - -You scrape together your best effort and hit “Submit,” sending your resume into the ether. When you don’t hear back, you wonder what went wrong: - - _“Was it the single page or the lack of a summary? Honestly, who gives a s**t at this point. I’m sick of sending out 10 resumes every day and hearing nothing but crickets.”_ - - -![](https://cdn-images-1.medium.com/max/1000/1*_zQqAjBhB1R4fz55InrrIw.jpeg) -How it feels to try and get your resume read in today’s world. - -Writing resumes sucks but it’s not your fault. - -The real reason it’s so tough to write a resume is because most of the advice out there hasn’t been proven against the actual end goal of getting a job. If you don’t know what consistently works, you can’t lay out a system to get there. - -It’s easy to say “one page works best” when you’ve seen it happen a few times. But how does it hold up when we look at 100 resumes across different industries, experience levels, and job titles? - -That’s what this article aims to answer. - -Over the past four years, I’ve personally applied to hundreds of companies and coached hundreds of people through the job search process. This has given me a huge opportunity to measure, analyze, and test the effectiveness of different resume strategies at scale. - -This article is going to walk through everything I’ve learned about resumes over the past 4 years, including: - -* Mistakes that more than 95% of people make, causing their resumes to get tossed immediately - -* Three things that consistently appear in the resumes of highly effective job searchers (who go on to land jobs at the world’s best companies) - -* A quick hack that will help you stand out from the competition and instantly build relationships with whomever is reading your resume (increasing your chances of hearing back and getting hired) - -* The exact resume template that got me interviews and offers at Google, Microsoft, Twitter, Uber, and more - -Before we get to the unconventional strategies that will help set you apart, we need to make sure our foundational bases are covered. That starts with understanding the mistakes most job seekers make so we can make our resume bulletproof. - -### Resume Mistakes That 95% Of People Make - -Most resumes that come through an online portal or across a recruiter’s desk are tossed out because they violate a simple rule. - -When recruiters scan a resume, the first thing they look for is mistakes. Your resume could be fantastic, but if you violate a rule like using an unprofessional email address or improper grammar, it’s going to get tossed out. - -Our goal is to fully understand the triggers that cause recruiters/ATS systems to make the snap decisions on who stays and who goes. - -In order to get inside the heads of these decision makers, I collected data from dozens of recruiters and hiring mangers across industries. These people have several hundred years of hiring experience under their belts and they’ve reviewed 100,000+ resumes across industries. - -They broke down the five most common mistakes that cause them to cut resumes from the pile: - - -![](https://cdn-images-1.medium.com/max/1000/1*5Zbr3HFeKSjvPGZdq_LCKA.png) - -### The Five Most Common Resume Mistakes (According To Recruiters & Hiring Managers) - -Issue #1: Sloppiness (typos, spelling errors, & grammatical mistakes). Close to 60% of resumes have some sort of typo or grammatical issue. - -Solution: Have your resume reviewed by three separate sources — spell checking software, a friend, and a professional. Spell check should be covered if you’re using Microsoft Word or Google Docs to create your resume. - -A friend or family member can cover the second base, but make sure you trust them with reviewing the whole thing. You can always include an obvious mistake to see if they catch it. - -Finally, you can hire a professional editor on [Upwork][1]. It shouldn’t take them more than 15–20 minutes to review so it’s worth paying a bit more for someone with high ratings and lots of hours logged. - -Issue #2: Summaries are too long and formal. Many resumes include summaries that consist of paragraphs explaining why they are a “driven, results oriented team player.” When hiring managers see a block of text at the top of the resume, you can bet they aren’t going to read the whole thing. If they do give it a shot and read something similar to the sentence above, they’re going to give up on the spot. - -Solution: Summaries are highly effective, but they should be in bullet form and showcase your most relevant experience for the role. For example, if I’m applying for a new business sales role my first bullet might read “Responsible for driving $11M of new business in 2018, achieved 168% attainment (#1 on my team).” - -Issue #3: Too many buzz words. Remember our driven team player from the last paragraph? Phrasing like that makes hiring managers cringe because your attempt to stand out actually makes you sound like everyone else. - -Solution: Instead of using buzzwords, write naturally, use bullets, and include quantitative results whenever possible. Would you rather hire a salesperson who “is responsible for driving new business across the healthcare vertical to help companies achieve their goals” or “drove $15M of new business last quarter, including the largest deal in company history”? Skip the buzzwords and focus on results. - -Issue #4: Having a resume that is more than one page. The average employer spends six seconds reviewing your resume — if it’s more than one page, it probably isn’t going to be read. When asked, recruiters from Google and Barclay’s both said multiple page resumes “are the bane of their existence.” - -Solution: Increase your margins, decrease your font, and cut down your experience to highlight the most relevant pieces for the role. It may seem impossible but it’s worth the effort. When you’re dealing with recruiters who see hundreds of resumes every day, you want to make their lives as easy as possible. - -### More Common Mistakes & Facts (Backed By Industry Research) - -In addition to personal feedback, I combed through dozens of recruitment survey results to fill any gaps my contacts might have missed. Here are a few more items you may want to consider when writing your resume: - -* The average interviewer spends 6 seconds scanning your resume - -* The majority of interviewers have not looked at your resume until -  you walk into the room - -* 76% of resumes are discarded for an unprofessional email address - -* Resumes with a photo have an 88% rejection rate - -* 58% of resumes have typos - -* Applicant tracking software typically eliminates 75% of resumes due to a lack of keywords and phrases being present - -Now that you know every mistake you need to avoid, the first item on your to-do list is to comb through your current resume and make sure it doesn’t violate anything mentioned above. - -Once you have a clean resume, you can start to focus on more advanced tactics that will really make you stand out. There are a few unique elements you can use to push your application over the edge and finally get your dream company to notice you. - - -![](https://cdn-images-1.medium.com/max/1000/1*KthhefFO33-8tm0kBEPbig.jpeg) - -### The 3 Elements Of A Resume That Will Get You Hired - -My analysis showed that highly effective resumes typically include three specific elements: quantitative results, a simple design, and a quirky interests section. This section breaks down all three elements and shows you how to maximize their impact. - -### Quantitative Results - -Most resumes lack them. - -Which is a shame because my data shows that they make the biggest difference between resumes that land interviews and resumes that end up in the trash. - -Here’s an example from a recent resume that was emailed to me: - -> Experience - -> + Identified gaps in policies and processes and made recommendations for solutions at the department and institution level - -> + Streamlined processes to increase efficiency and enhance quality - -> + Directly supervised three managers and indirectly managed up to 15 staff on multiple projects - -> + Oversaw execution of in-house advertising strategy - -> + Implemented comprehensive social media plan - -As an employer, that tells me absolutely nothing about what to expect if I hire this person. - -They executed an in-house marketing strategy. Did it work? How did they measure it? What was the ROI? - -They also also identified gaps in processes and recommended solutions. What was the result? Did they save time and operating expenses? Did it streamline a process resulting in more output? - -Finally, they managed a team of three supervisors and 15 staffers. How did that team do? Was it better than the other teams at the company? What results did they get and how did those improve under this person’s management? - -See what I’m getting at here? - -These types of bullets talk about daily activities, but companies don’t care about what you do every day. They care about results. By including measurable metrics and achievements in your resume, you’re showcasing the value that the employer can expect to get if they hire you. - -Let’s take a look at revised versions of those same bullets: - -> Experience - -> + Managed a team of 20 that consistently outperformed other departments in lead generation, deal size, and overall satisfaction (based on our culture survey) - -> + Executed in-house marketing strategy that resulted in a 15% increase in monthly leads along with a 5% drop in the cost per lead - -> + Implemented targeted social media campaign across Instagram & Pintrest, which drove an additional 50,000 monthly website visits and generated 750 qualified leads in 3 months - -If you were in the hiring manager’s shoes, which resume would you choose? - -That’s the power of including quantitative results. - -### Simple, Aesthetic Design That Hooks The Reader - -These days, it’s easy to get carried away with our mission to “stand out.” I’ve seen resume overhauls from graphic designers, video resumes, and even resumes [hidden in a box of donuts.][2] - -While those can work in very specific situations, we want to aim for a strategy that consistently gets results. The format I saw the most success with was a black and white Word template with sections in this order: - -* Summary - -* Interests - -* Experience - -* Education - -* Volunteer Work (if you have it) - -This template is effective because it’s familiar and easy for the reader to digest. - -As I mentioned earlier, hiring managers scan resumes for an average of 6 seconds. If your resume is in an unfamiliar format, those 6 seconds won’t be very comfortable for the hiring manager. Our brains prefer things we can easily recognize. You want to make sure that a hiring manager can actually catch a glimpse of who you are during their quick scan of your resume. - -If we’re not relying on design, this hook needs to come from the  _Summary_ section at the top of your resume. - -This section should be done in bullets (not paragraph form) and it should contain 3–4 highlights of the most relevant experience you have for the role. For example, if I was applying for a New Business Sales position, my summary could look like this: - -> Summary - -> Drove quarterly average of $11M in new business with a quota attainment of 128% (#1 on my team) - -> Received award for largest sales deal of the year - -> Developed and trained sales team on new lead generation process that increased total leads by 17% in 3 months, resulting in 4 new deals worth $7M - -Those bullets speak directly to the value I can add to the company if I was hired for the role. - -### An “Interests” Section That’s Quirky, Unique, & Relatable - -This is a little “hack” you can use to instantly build personal connections and positive associations with whomever is reading your resume. - -Most resumes have a skills/interests section, but it’s usually parked at the bottom and offers little to no value. It’s time to change things up. - -[Research shows][3] that people rely on emotions, not information, to make decisions. Big brands use this principle all the time — emotional responses to advertisements are more influential on a person’s intent to buy than the content of an ad. - -You probably remember Apple’s famous “Get A Mac” campaign: - - -When it came to specs and performance, Macs didn’t blow every single PC out of the water. But these ads solidified who was “cool” and who wasn’t, which was worth a few extra bucks to a few million people. - -By tugging at our need to feel “cool,” Apple’s campaign led to a [42% increase in market share][4] and a record sales year for Macbooks. - -Now we’re going to take that same tactic and apply it to your resume. - -If you can invoke an emotional response from your recruiter, you can influence the mental association they assign to you. This gives you a major competitive advantage. - -Let’s start with a question — what could you talk about for hours? - -It could be cryptocurrency, cooking, World War 2, World of Warcraft, or how Google’s bet on segmenting their company under the Alphabet is going to impact the technology sector over the next 5 years. - -Did a topic (or two) pop into year head? Great. - -Now think about what it would be like to have a conversation with someone who was just as passionate and knew just as much as you did on the topic. It’d be pretty awesome, right?  _Finally, _ someone who gets it! - -That’s exactly the kind of emotional response we’re aiming to get from a hiring manager. - -There are five “neutral” topics out there that people enjoy talking about: - -1. Food/Drink - -2. Sports - -3. College - -4. Hobbies - -5. Geography (travel, where people are from, etc.) - -These topics are present in plenty of interest sections but we want to take them one step further. - -Let’s say you had the best night of your life at the Full Moon Party in Thailand. Which of the following two options would you be more excited to read: - -* Traveling - -* Ko Pha Ngan beaches (where the full moon party is held) - -Or, let’s say that you went to Duke (an ACC school) and still follow their basketball team. Which would you be more pumped about: - -* College Sports - -* ACC Basketball (Go Blue Devils!) - -In both cases, the second answer would probably invoke a larger emotional response because it is tied directly to your experience. - -I want you to think about your interests that fit into the five categories I mentioned above. - -Now I want you to write a specific favorite associated with each category in parentheses next to your original list. For example, if you wrote travel you can add (ask me about the time I was chased by an elephant in India) or (specifically meditation in a Tibetan monastery). - -Here is the [exact set of interests][5] I used on my resume when I interviewed at Google, Microsoft, and Twitter: - - _ABC Kitchen’s Atmosphere, Stumptown Coffee (primarily cold brew), Michael Lewis (Liar’s Poker), Fishing (especially fly), Foods That Are Vehicles For Hot Sauce, ACC Sports (Go Deacs!) & The New York Giants_ - - -![](https://cdn-images-1.medium.com/max/1000/1*ONxtGr_xUYmz4_Xe66aeng.jpeg) - -If you want to cheat here, my experience shows that anything about hot sauce is an instant conversation starter. - -### The Proven Plug & Play Resume Template - -Now that we have our strategies down, it’s time to apply these tactics to a real resume. Our goal is to write something that increases your chances of hearing back from companies, enhances your relationships with hiring managers, and ultimately helps you score the job offer. - -The example below is the exact resume that I used to land interviews and offers at Microsoft, Google, and Twitter. I was targeting roles in Account Management and Sales, so this sample is tailored towards those positions. We’ll break down each section below: - - -![](https://cdn-images-1.medium.com/max/1000/1*B2RQ89ue2dGymRdwMY2lBA.png) - -First, I want you to notice how clean this is. Each section is clearly labeled and separated and flows nicely from top to bottom. - -My summary speaks directly to the value I’ve created in the past around company culture and its bottom line: - -* I consistently exceeded expectations - -* I started my own business in the space (and saw real results) - -* I’m a team player who prioritizes culture - -I purposefully include my Interests section right below my Summary. If my hiring manager’s six second scan focused on the summary, I know they’ll be interested. Those bullets cover all the subconscious criteria for qualification in sales. They’re going to be curious to read more in my Experience section. - -By sandwiching my Interests in the middle, I’m upping their visibility and increasing the chance of creating that personal connection. - -You never know — the person reading my resume may also be a hot sauce connoisseur and I don’t want that to be overlooked because my interests were sitting at the bottom. - -Next, my Experience section aims to flesh out the points made in my Summary. I mentioned exceeding my quota up top, so I included two specific initiatives that led to that attainment, including measurable results: - -* A partnership leveraging display advertising to drive users to a gamified experience. The campaign resulted in over 3000 acquisitions and laid the groundwork for the 2nd largest deal in company history. - -* A partnership with a top tier agency aimed at increasing conversions for a client by improving user experience and upgrading tracking during a company-wide website overhaul (the client has ~20 brand sites). Our efforts over 6 months resulted in a contract extension worth 316% more than their original deal. - -Finally, I included my education at the very bottom starting with the most relevant coursework. - -Download My Resume Templates For Free - -You can download a copy of the resume sample above as well as a plug and play template here: - -Austin’s Resume: [Click To Download][6] - -Plug & Play Resume Template: [Click To Download][7] - -### Bonus Tip: An Unconventional Resume “Hack” To Help You Beat Applicant Tracking Software - -If you’re not already familiar, Applicant Tracking Systems are pieces of software that companies use to help “automate” the hiring process. - -After you hit submit on your online application, the ATS software scans your resume looking for specific keywords and phrases (if you want more details, [this article][8] does a good job of explaining ATS). - -If the language in your resume matches up, the software sees it as a good fit for the role and will pass it on to the recruiter. However, even if you’re highly qualified for the role but you don’t use the right wording, your resume can end up sitting in a black hole. - -I’m going to teach you a little hack to help improve your chances of beating the system and getting your resume in the hands of a human: - -Step 1: Highlight and select the entire job description page and copy it to your clipboard. - -Step 2: Head over to [WordClouds.com][9] and click on the “Word List” button at the top. Towards the top of the pop up box, you should see a link for Paste/Type Text. Go ahead and click that. - -Step 3: Now paste the entire job description into the box, then hit “Apply.” - -WordClouds is going to spit out an image that showcases every word in the job description. The larger words are the ones that appear most frequently (and the ones you want to make sure to include when writing your resume). Here’s an example for a data a science role: - - -![](https://cdn-images-1.medium.com/max/1000/1*O7VO1C9nhC9LZct7vexTbA.png) - -You can also get a quantitative view by clicking “Word List” again after creating your cloud. That will show you the number of times each word appeared in the job description: - -9 data - -6 models - -4 experience - -4 learning - -3 Experience - -3 develop - -3 team - -2 Qualifications - -2 statistics - -2 techniques - -2 libraries - -2 preferred - -2 research - -2 business - -When writing your resume, your goal is to include those words in the same proportions as the job description. - -It’s not a guaranteed way to beat the online application process, but it will definitely help improve your chances of getting your foot in the door! - -* * * - -### Want The Inside Info On Landing A Dream Job Without Connections, Without “Experience,” & Without Applying Online? - -[Click here to get the 5 free strategies that my students have used to land jobs at Google, Microsoft, Amazon, and more without applying online.][10] - - _Originally published at _ [_cultivatedculture.com_][11] _._ - --------------------------------------------------------------------------------- - -作者简介: - -I help people land jobs they love and salaries they deserve at CultivatedCulture.com - ----------- - -via: https://medium.freecodecamp.org/how-to-write-a-really-great-resume-that-actually-gets-you-hired-e18533cd8d17 - -作者:[Austin Belcak ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://medium.freecodecamp.org/@austin.belcak -[1]:http://www.upwork.com/ -[2]:https://www.thrillist.com/news/nation/this-guy-hides-his-resume-in-boxes-of-donuts-to-score-job-interviews -[3]:https://www.psychologytoday.com/blog/inside-the-consumer-mind/201302/how-emotions-influence-what-we-buy -[4]:https://www.businesswire.com/news/home/20070608005253/en/Apple-Mac-Named-Successful-Marketing-Campaign-2007 -[5]:http://cultivatedculture.com/resume-skills-section/ -[6]:https://drive.google.com/file/d/182gN6Kt1kBCo1LgMjtsGHOQW2lzATpZr/view?usp=sharing -[7]:https://drive.google.com/open?id=0B3WIcEDrxeYYdXFPVlcyQlJIbWc -[8]:https://www.jobscan.co/blog/8-things-you-need-to-know-about-applicant-tracking-systems/ -[9]:https://www.wordclouds.com/ -[10]:https://cultivatedculture.com/dreamjob/ -[11]:https://cultivatedculture.com/write-a-resume/ \ No newline at end of file diff --git a/sources/talk/20180206 UQDS- A software-development process that puts quality first.md b/sources/talk/20180206 UQDS- A software-development process that puts quality first.md deleted file mode 100644 index e9f7bb94ac..0000000000 --- a/sources/talk/20180206 UQDS- A software-development process that puts quality first.md +++ /dev/null @@ -1,99 +0,0 @@ -UQDS: A software-development process that puts quality first -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/build_structure_tech_program_code_construction.png?itok=nVsiLuag) - -The Ultimate Quality Development System (UQDS) is a software development process that provides clear guidelines for how to use branches, tickets, and code reviews. It was invented more than a decade ago by Divmod and adopted by [Twisted][1], an event-driven framework for Python that underlies popular commercial platforms like HipChat as well as open source projects like Scrapy (a web scraper). - -Divmod, sadly, is no longer around—it has gone the way of many startups. Luckily, since many of its products were open source, its legacy lives on. - -When Twisted was a young project, there was no clear process for when code was "good enough" to go in. As a result, while some parts were highly polished and reliable, others were alpha quality software—with no way to tell which was which. UQDS was designed as a process to help an existing project with definite quality challenges ramp up its quality while continuing to add features and become more useful. - -UQDS has helped the Twisted project evolve from having frequent regressions and needing multiple release candidates to get a working version, to achieving its current reputation of stability and reliability. - -### UQDS's building blocks - -UQDS was invented by Divmod back in 2006. At that time, Continuous Integration (CI) was in its infancy and modern version control systems, which allow easy branch merging, were barely proofs of concept. Although Divmod did not have today's modern tooling, it put together CI, some ad-hoc tooling to make [Subversion branches][2] work, and a lot of thought into a working process. Thus the UQDS methodology was born. - -UQDS is based upon fundamental building blocks, each with their own carefully considered best practices: - - 1. Tickets - 2. Branches - 3. Tests - 4. Reviews - 5. No exceptions - - - -Let's go into each of those in a little more detail. - -#### Tickets - -In a project using the UQDS methodology, no change is allowed to happen if it's not accompanied by a ticket. This creates a written record of what change is needed and—more importantly—why. - - * Tickets should define clear, measurable goals. - * Work on a ticket does not begin until the ticket contains goals that are clearly defined. - - - -#### Branches - -Branches in UQDS are tightly coupled with tickets. Each branch must solve one complete ticket, no more and no less. If a branch addresses either more or less than a single ticket, it means there was a problem with the ticket definition—or with the branch. Tickets might be split or merged, or a branch split and merged, until congruence is achieved. - -Enforcing that each branch addresses no more nor less than a single ticket—which corresponds to one logical, measurable change—allows a project using UQDS to have fine-grained control over the commits: A single change can be reverted or changes may even be applied in a different order than they were committed. This helps the project maintain a stable and clean codebase. - -#### Tests - -UQDS relies upon automated testing of all sorts, including unit, integration, regression, and static tests. In order for this to work, all relevant tests must pass at all times. Tests that don't pass must either be fixed or, if no longer relevant, be removed entirely. - -Tests are also coupled with tickets. All new work must include tests that demonstrate that the ticket goals are fully met. Without this, the work won't be merged no matter how good it may seem to be. - -A side effect of the focus on tests is that the only platforms that a UQDS-using project can say it supports are those on which the tests run with a CI framework—and where passing the test on the platform is a condition for merging a branch. Without this restriction on supported platforms, the quality of the project is not Ultimate. - -#### Reviews - -While automated tests are important to the quality ensured by UQDS, the methodology never loses sight of the human factor. Every branch commit requires code review, and each review must follow very strict rules: - - 1. Each commit must be reviewed by a different person than the author. - 2. Start with a comment thanking the contributor for their work. - 3. Make a note of something that the contributor did especially well (e.g., "that's the perfect name for that variable!"). - 4. Make a note of something that could be done better (e.g., "this line could use a comment explaining the choices."). - 5. Finish with directions for an explicit next step, typically either merge as-is, fix and merge, or fix and submit for re-review. - - - -These rules respect the time and effort of the contributor while also increasing the sharing of knowledge and ideas. The explicit next step allows the contributor to have a clear idea on how to make progress. - -#### No exceptions - -In any process, it's easy to come up with reasons why you might need to flex the rules just a little bit to let this thing or that thing slide through the system. The most important fundamental building block of UQDS is that there are no exceptions. The entire community works together to make sure that the rules do not flex, not for any reason whatsoever. - -Knowing that all code has been approved by a different person than the author, that the code has complete test coverage, that each branch corresponds to a single ticket, and that this ticket is well considered and complete brings a piece of mind that is too valuable to risk losing, even for a single small exception. The goal is quality, and quality does not come from compromise. - -### A downside to UQDS - -While UQDS has helped Twisted become a highly stable and reliable project, this reliability hasn't come without cost. We quickly found that the review requirements caused a slowdown and backlog of commits to review, leading to slower development. The answer to this wasn't to compromise on quality by getting rid of UQDS; it was to refocus the community priorities such that reviewing commits became one of the most important ways to contribute to the project. - -To help with this, the community developed a bot in the [Twisted IRC channel][3] that will reply to the command `review tickets` with a list of tickets that still need review. The [Twisted review queue][4] website returns a prioritized list of tickets for review. Finally, the entire community keeps close tabs on the number of tickets that need review. It's become an important metric the community uses to gauge the health of the project. - -### Learn more - -The best way to learn about UQDS is to [join the Twisted Community][5] and see it in action. If you'd like more information about the methodology and how it might help your project reach a high level of reliability and stability, have a look at the [UQDS documentation][6] in the Twisted wiki. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/uqds - -作者:[Moshe Zadka][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/moshez -[1]:https://twistedmatrix.com/trac/ -[2]:http://structure.usc.edu/svn/svn.branchmerge.html -[3]:http://webchat.freenode.net/?channels=%23twisted -[4]:https://twisted.reviews -[5]:https://twistedmatrix.com/trac/wiki/TwistedCommunity -[6]:https://twistedmatrix.com/trac/wiki/UltimateQualityDevelopmentSystem diff --git a/sources/talk/20180207 Why Mainframes Aren-t Going Away Any Time Soon.md b/sources/talk/20180207 Why Mainframes Aren-t Going Away Any Time Soon.md deleted file mode 100644 index 7a1a837ff9..0000000000 --- a/sources/talk/20180207 Why Mainframes Aren-t Going Away Any Time Soon.md +++ /dev/null @@ -1,73 +0,0 @@ -Why Mainframes Aren't Going Away Any Time Soon -====== - -![](http://www.datacenterknowledge.com/sites/datacenterknowledge.com/files/styles/article_featured_standard/public/ibm%20z13%20mainframe%202015%20getty.jpg?itok=uB8agshi) - -IBM's last earnings report showed the [first uptick in revenue in more than five years.][1] Some of that growth was from an expected source, cloud revenue, which was up 24 percent year over year and now accounts for 21 percent of Big Blue's take. Another major boost, however, came from a spike in mainframe revenue. Z series mainframe sales were up 70 percent, the company said. - -This may sound somewhat akin to a return to vacuum tube technology in a world where transistors are yesterday's news. In actuality, this is only a sign of the changing face of IT. - -**Related:** [One Click and Voilà, Your Entire Data Center is Encrypted][2] - -Modern mainframes definitely aren't your father's punch card-driven machines that filled entire rooms. These days, they most often run Linux and have found a renewed place in the data center, where they're being called upon to do a lot of heavy lifting. Want to know where the largest instance of Oracle's database runs? It's on a Linux mainframe. How about the largest implementation of SAP on the planet? Again, Linux on a mainframe. - -"Before the advent of Linux on the mainframe, the people who bought mainframes primarily were people who already had them," Leonard Santalucia explained to Data Center Knowledge several months back at the All Things Open conference. "They would just wait for the new version to come out and upgrade to it, because it would run cheaper and faster. - -**Related:** [IBM Designs a “Performance Beast” for AI][3] - -"When Linux came out, it opened up the door to other customers that never would have paid attention to the mainframe. In fact, probably a good three to four hundred new clients that never had mainframes before got them. They don't have any old mainframes hanging around or ones that were upgraded. These are net new mainframes." - -Although Santalucia is CTO at Vicom Infinity, primarily an IBM reseller, at the conference he was wearing his hat as chairperson of the Linux Foundation's Open Mainframe Project. He was joined in the conversation by John Mertic, the project's director of program management. - -Santalucia knows IBM's mainframes from top to bottom, having spent 27 years at Big Blue, the last eight as CTO for the company's systems and technology group. - -"Because of Linux getting started with it back in 1999, it opened up a lot of doors that were closed to the mainframe," he said. "Beforehand it was just z/OS, z/VM, z/VSE, z/TPF, the traditional operating systems. When Linux came along, it got the mainframe into other areas that it never was, or even thought to be in, because of how open it is, and because Linux on the mainframe is no different than Linux on any other platform." - -The focus on Linux isn't the only motivator behind the upsurge in mainframe use in data centers. Increasingly, enterprises with heavy IT needs are finding many advantages to incorporating modern mainframes into their plans. For example, mainframes can greatly reduce power, cooling, and floor space costs. In markets like New York City, where real estate is at a premium, electricity rates are high, and electricity use is highly taxed to reduce demand, these are significant advantages. - -"There was one customer where we were able to do a consolidation of 25 x86 cores to one core on a mainframe," Santalucia said. "They have several thousand machines that are ten and twenty cores each. So, as far as the eye could see in this data center, [x86 server workloads] could be picked up and moved onto this box that is about the size of a sub-zero refrigerator in your kitchen." - -In addition to saving on physical data center resources, this customer by design would likely see better performance. - -"When you look at the workload as it's running on an x86 system, the math, the application code, the I/O to manage the disk, and whatever else is attached to that system, is all run through the same chip," he explained. "On a Z, there are multiple chip architectures built into the system. There's one specifically just for the application code. If it senses the application needs an I/O or some mathematics, it sends it off to a separate processor to do math or I/O, all dynamically handled by the underlying firmware. Your Linux environment doesn't have to understand that. When it's running on a mainframe, it knows it's running on a mainframe and it will exploit that architecture." - -The operating system knows it's running on a mainframe because when IBM was readying its mainframe for Linux it open sourced something like 75,000 lines of code for Linux distributions to use to make sure their OS's were ready for IBM Z. - -"A lot of times people will hear there's 170 processors on the Z14," Santalucia said. "Well, there's actually another 400 other processors that nobody counts in that count of application chips, because it is taken for granted." - -Mainframes are also resilient when it comes to disaster recovery. Santalucia told the story of an insurance company located in lower Manhattan, within sight of the East River. The company operated a large data center in a basement that among other things housed a mainframe backed up to another mainframe located in Upstate New York. When Hurricane Sandy hit in 2012, the data center flooded, electrocuting two employees and destroying all of the servers, including the mainframe. But the mainframe's workload was restored within 24 hours from the remote backup. - -The x86 machines were all destroyed, and the data was never recovered. But why weren't they also backed up? - -"The reason they didn't do this disaster recovery the same way they did with the mainframe was because it was too expensive to have a mirror of all those distributed servers someplace else," he explained. "With the mainframe, you can have another mainframe as an insurance policy that's lower in price, called Capacity BackUp, and it just sits there idling until something like this happens." - -Mainframes are also evidently tough as nails. Santalucia told another story in which a data center in Japan was struck by an earthquake strong enough to destroy all of its x86 machines. The center's one mainframe fell on its side but continued to work. - -The mainframe also comes with built-in redundancy to guard against situations that would be disastrous with x86 machines. - -"What if a hard disk fails on a node in x86?" the Open Mainframe Project's Mertic asked. "You're taking down a chunk of that cluster potentially. With a mainframe you're not. A mainframe just keeps on kicking like nothing's ever happened." - -Mertic added that a motherboard can be pulled from a running mainframe, and again, "the thing keeps on running like nothing's ever happened." - -So how do you figure out if a mainframe is right for your organization? Simple, says Santalucia. Do the math. - -"The approach should be to look at it from a business, technical, and financial perspective -- not just a financial, total-cost-of-acquisition perspective," he said, pointing out that often, costs associated with software, migration, networking, and people are not considered. The break-even point, he said, comes when at least 20 to 30 servers are being migrated to a mainframe. After that point the mainframe has a financial advantage. - -"You can get a few people running the mainframe and managing hundreds or thousands of virtual servers," he added. "If you tried to do the same thing on other platforms, you'd find that you need significantly more resources to maintain an environment like that. Seven people at ADP handle the 8,000 virtual servers they have, and they need seven only in case somebody gets sick. - -"If you had eight thousand servers on x86, even if they're virtualized, do you think you could get away with seven?" - --------------------------------------------------------------------------------- - -via: http://www.datacenterknowledge.com/hardware/why-mainframes-arent-going-away-any-time-soon - -作者:[Christine Hall][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.datacenterknowledge.com/archives/author/christine-hall -[1]:http://www.datacenterknowledge.com/ibm/mainframe-sales-fuel-growth-ibm -[2]:http://www.datacenterknowledge.com/design/one-click-and-voil-your-entire-data-center-encrypted -[3]:http://www.datacenterknowledge.com/design/ibm-designs-performance-beast-ai diff --git a/sources/talk/20180209 Arch Anywhere Is Dead, Long Live Anarchy Linux.md b/sources/talk/20180209 Arch Anywhere Is Dead, Long Live Anarchy Linux.md deleted file mode 100644 index c3c78e84ad..0000000000 --- a/sources/talk/20180209 Arch Anywhere Is Dead, Long Live Anarchy Linux.md +++ /dev/null @@ -1,127 +0,0 @@ -Arch Anywhere Is Dead, Long Live Anarchy Linux -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/anarchy_main.jpg?itok=fyBpTjQW) - -Arch Anywhere was a distribution aimed at bringing Arch Linux to the masses. Due to a trademark infringement, Arch Anywhere has been completely rebranded to [Anarchy Linux][1]. And I’m here to say, if you’re looking for a distribution that will enable you to enjoy Arch Linux, a little Anarchy will go a very long way. This distribution is seriously impressive in what it sets out to do and what it achieves. In fact, anyone who previously feared Arch Linux can set those fears aside… because Anarchy Linux makes Arch Linux easy. - -Let’s face it; Arch Linux isn’t for the faint of heart. The installation alone will turn off many a new user (and even some seasoned users). That’s where distributions like Anarchy make for an easy bridge to Arch. With a live ISO that can be tested and then installed, Arch becomes as user-friendly as any other distribution. - -Anarchy Linux goes a little bit further than that, however. Let’s fire it up and see what it does. - -### The installation - -The installation of Anarchy Linux isn’t terribly challenging, but it’s also not quite as simple as for, say, [Ubuntu][2], [Linux Mint][3], or [Elementary OS][4]. Although you can run the installer from within the default graphical desktop environment (Xfce4), it’s still much in the same vein as Arch Linux. In other words, you’re going to have to do a bit of work—all within a text-based installer. - -To start, the very first step of the installer (Figure 1) requires you to update the mirror list, which will likely trip up new users. - -![Updating the mirror][6] - -Figure 1: Updating the mirror list is a necessity for the Anarchy Linux installation. - -[Used with permission][7] - -From the options, select Download & Rank New Mirrors. Tab down to OK and hit Enter on your keyboard. You can then select the nearest mirror (to your location) and be done with it. The next few installation screens are simple (keyboard layout, language, timezone, etc.). The next screen should surprise many an Arch fan. Anarchy Linux includes an auto partition tool. Select Auto Partition Drive (Figure 2), tab down to Ok, and hit Enter on your keyboard. - -![partitioning][9] - -Figure 2: Anarchy makes partitioning easy. - -[Used with permission][7] - -You will then have to select the drive to be used (if you only have one drive this is only a matter of hitting Enter). Once you’ve selected the drive, choose the filesystem type to be used (ext2/3/4, btrfs, jfs, reiserfs, xfs), tab down to OK, and hit Enter. Next you must choose whether you want to create SWAP space. If you select Yes, you’ll then have to define how much SWAP to use. The next window will stop many new users in their tracks. It asks if you want to use GPT (GUID Partition Table). This is different than the traditional MBR (Master Boot Record) partitioning. GPT is a newer standard and works better with UEFI. If you’ll be working with UEFI, go with GPT, otherwise, stick with the old standby, MBR. Finally select to write the changes to the disk, and your installation can continue. - -The next screen that could give new users pause, requires the selection of the desired installation. There are five options: - - * Anarchy-Desktop - - * Anarchy-Desktop-LTS - - * Anarchy-Server - - * Anarchy-Server-LTS - - * Anarchy-Advanced - - - - -If you want long term support, select Anarchy-Desktop-LTS, otherwise click Anarchy-Desktop (the default), and tab down to Ok. Click Enter on your keyboard. After you select the type of installation, you will get to select your desktop. You can select from five options: Budgie, Cinnamon, GNOME, Openbox, and Xfce4. -Once you’ve selected your desktop, give the machine a hostname, set the root password, create a user, and enable sudo for the new user (if applicable). The next section that will raise the eyebrows of new users is the software selection window (Figure 3). You must go through the various sections and select which software packages to install. Don’t worry, if you miss something, you can always installed it later. - - -![software][11] - -Figure 3: Selecting the software you want on your system. - -[Used with permission][7] - -Once you’ve made your software selections, tab to Install (Figure 4), and hit Enter on your keyboard. - -![ready to install][13] - -Figure 4: Everything is ready to install. - -[Used with permission][7] - -Once the installation completes, reboot and enjoy Anarchy. - -### Post install - -I installed two versions of Anarchy—one with Budgie and one with GNOME. Both performed quite well, however you might be surprised to see that the version of GNOME installed is decked out with a dock. In fact, comparing the desktops side-by-side and they do a good job of resembling one another (Figure 5). - -![GNOME and Budgie][15] - -Figure 5: GNOME is on the right, Budgie is on the left. - -[Used with permission][7] - -My guess is that you’ll find all desktop options for Anarchy configured in such a way to offer a similar look and feel. Of course, the second you click on the bottom left “buttons”, you’ll see those similarities immediately disappear (Figure 6). - -![GNOME and Budgie][17] - -Figure 6: The GNOME Dash and the Budgie menu are nothing alike. - -[Used with permission][7] - -Regardless of which desktop you select, you’ll find everything you need to install new applications. Open up your desktop menu of choice and select Packages to search for and install whatever is necessary for you to get your work done. - -### Why use Arch Linux without the “Arch”? - -This is a valid question. The answer is simple, but revealing. Some users may opt for a distribution like [Arch Linux][18] because they want the feeling of “elitism” that comes with using, say, [Gentoo][19], without having to go through that much hassle. With regards to complexity, Arch rests below Gentoo, which means it’s accessible to more users. However, along with that complexity in the platform, comes a certain level of dependability that may not be found in others. So if you’re looking for a Linux distribution with high stability, that’s not quite as challenging as Gentoo or Arch to install, Anarchy might be exactly what you want. In the end, you’ll wind up with an outstanding desktop platform that’s easy to work with (and maintain), based on a very highly regarded distribution of Linux. - -That’s why you might opt for Arch Linux without the Arch. - -Anarchy Linux is one of the finest “user-friendly” takes on Arch Linux I’ve ever had the privilege of using. Without a doubt, if you’re looking for a friendlier version of a rather challenging desktop operating system, you cannot go wrong with Anarchy. - -Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/learn/intro-to-linux/2018/2/arch-anywhere-dead-long-live-anarchy-linux - -作者:[Jack Wallen][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/jlwallen -[1]:https://anarchy-linux.org/ -[2]:https://www.ubuntu.com/ -[3]:https://linuxmint.com/ -[4]:https://elementary.io/ -[6]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/anarchy_install_1.jpg?itok=WgHRqFTf (Updating the mirror) -[7]:https://www.linux.com/licenses/category/used-permission -[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/anarchy_install_2.jpg?itok=D7HkR97t (partitioning) -[10]:/files/images/anarchyinstall3jpg -[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/anarchy_install_3.jpg?itok=5-9E2u0S (software) -[12]:/files/images/anarchyinstall4jpg -[13]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/anarchy_install_4.jpg?itok=fuSZqtZS (ready to install) -[14]:/files/images/anarchyinstall5jpg -[15]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/anarchy_install_5.jpg?itok=4y9kiC8I (GNOME and Budgie) -[16]:/files/images/anarchyinstall6jpg -[17]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/anarchy_install_6.jpg?itok=fJ7Lmdci (GNOME and Budgie) -[18]:https://www.archlinux.org/ -[19]:https://www.gentoo.org/ -[20]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/talk/20180209 How writing can change your career for the better, even if you don-t identify as a writer.md b/sources/talk/20180209 How writing can change your career for the better, even if you don-t identify as a writer.md deleted file mode 100644 index 55618326c6..0000000000 --- a/sources/talk/20180209 How writing can change your career for the better, even if you don-t identify as a writer.md +++ /dev/null @@ -1,149 +0,0 @@ -How writing can change your career for the better, even if you don't identify as a writer -====== -Have you read Marie Kondo's book [The Life-Changing Magic of Tidying Up][1]? Or did you, like me, buy it and read a little bit and then add it to the pile of clutter next to your bed? - -Early in the book, Kondo talks about keeping possessions that "spark joy." In this article, I'll examine ways writing about what we and other people are doing in the open source world can "spark joy," or at least how writing can improve your career in unexpected ways. - -Because I'm a community manager and editor on Opensource.com, you might be thinking, "She just wants us to [write for Opensource.com][2]." And that is true. But everything I will tell you about why you should write is true, even if you never send a story in to Opensource.com. Writing can change your career for the better, even if you don't identify as a writer. Let me explain. - -### How I started writing - -Early in the first decade of my career, I transitioned from a customer service-related role at a tech publishing company into an editing role on Sys Admin Magazine. I was plugging along, happily laying low in my career, and then that all changed when I started writing about open source technologies and communities, and the people in them. But I did _not_ start writing voluntarily. The tl;dr: of it is that my colleagues at Linux New Media eventually talked me into launching our first blog on the [Linux Pro Magazine][3] site. And as it turns out, it was one of the best career decisions I've ever made. I would not be working on Opensource.com today had I not started writing about what other people in open source were doing all those years ago. - -When I first started writing, my goal was to raise awareness of the company I worked for and our publications, while also helping raise the visibility of women in tech. But soon after I started writing, I began seeing unexpected results. - -#### My network started growing - -When I wrote about a person, an organization, or a project, I got their attention. Suddenly the people I wrote about knew who I was. And because I was sharing knowledge—that is to say, I wasn't being a critic—I'd generally become an ally, and in many cases, a friend. I had a platform and an audience, and I was sharing them with other people in open source. - -#### I was learning - -In addition to promoting our website and magazine and growing my network, the research and fact-checking I did when writing articles helped me become more knowledgeable in my field and improve my tech chops. - -#### I started meeting more people IRL - -When I went to conferences, I found that my blog posts helped me meet people. I introduced myself to people I'd written about or learned about during my research, and I met new people to interview. People started knowing who I was because they'd read my articles. Sometimes people were even excited to meet me because I'd highlighted them, their projects, or someone or something they were interested in. I had no idea writing could be so exciting and interesting away from the keyboard. - -#### My conference talks improved - -I started speaking at events about a year after launching my blog. A few years later, I started writing articles based on my talks prior to speaking at events. The process of writing the articles helps me organize my talks and slides, and it was a great way to provide "notes" for conference attendees, while sharing the topic with a larger international audience that wasn't at the event in person. - -### What should you write about? - -Maybe you're interested in writing, but you struggle with what to write about. You should write about two things: what you know, and what you don't know. - -#### Write about what you know - -Writing about what you know can be relatively easy. For example, a script you wrote to help automate part of your daily tasks might be something you don't give any thought to, but it could make for a really exciting article for someone who hates doing that same task every day. That could be a relatively quick, short, and easy article for you to write, and you might not even think about writing it. But it could be a great contribution to the open source community. - -#### Write about what you don't know - -Writing about what you don't know can be much harder and more time consuming, but also much more fulfilling and help your career. I've found that writing about what I don't know helps me learn, because I have to research it and understand it well enough to explain it. - -> "When I write about a technical topic, I usually learn a lot more about it. I want to make sure my article is as good as it can be. So even if I'm writing about something I know well, I'll research the topic a bit more so I can make sure to get everything right." ~Jim Hall, FreeDOS project leader - -For example, I wanted to learn about machine learning, and I thought narrowing down the topic would help me get started. My team mate Jason Baker suggested that I write an article on the [Top 3 machine learning libraries for Python][4], which gave me a focus for research. - -The process of researching that article inspired another article, [3 cool machine learning projects using TensorFlow and the Raspberry Pi][5]. That article was also one of our most popular last year. I'm not an _expert_ on machine learning now, but researching the topic with writing an article in mind allowed me to give myself a crash course in the topic. - -### Why people in tech write - -Now let's look at a few benefits of writing that other people in tech have found. I emailed the Opensource.com writers' list and asked, and here's what writers told me. - -#### Grow your network or your project community - -Xavier Ho wrote for us for the first time last year ("[A programmer's cleaning guide for messy sensor data][6]"). He says: "I've been getting Twitter mentions from all over the world, including Spain, US, Australia, Indonesia, the UK, and other European countries. It shows the article is making some impact... This is the kind of reach I normally don't have. Hope it's really helping someone doing similar work!" - -#### Help people - -Writing about what other people are working on is a great way to help your fellow community members. Antoine Thomas, who wrote "[Linux helped me grow as a musician][7]", says, "I began to use open source years ago, by reading tutorials and documentation. That's why now I share my tips and tricks, experience or knowledge. It helped me to get started, so I feel that it's my turn to help others to get started too." - -#### Give back to the community - -[Jim Hall][8], who started the [FreeDOS project][9], says, "I like to write ... because I like to support the open source community by sharing something neat. I don't have time to be a program maintainer anymore, but I still like to do interesting stuff. So when something cool comes along, I like to write about it and share it." - -#### Highlight your community - -Emilio Velis wrote an article, "[Open hardware groups spread across the globe][10]", about projects in Central and South America. He explains, "I like writing about specific aspects of the open culture that are usually enclosed in my region (Latin America). I feel as if smaller communities and their ideas are hidden from the mainstream, so I think that creating this sense of broadness in participation is what makes some other cultures as valuable." - -#### Gain confidence - -[Don Watkins][11] is one of our regular writers and a [community moderator][12]. He says, "When I first started writing I thought I was an impostor, later I realized that many people feel that way. Writing and contributing to Opensource.com has been therapeutic, too, as it contributed to my self esteem and helped me to overcome feelings of inadequacy. … Writing has given me a renewed sense of purpose and empowered me to help others to write and/or see the valuable contributions that they too can make if they're willing to look at themselves in a different light. Writing has kept me younger and more open to new ideas." - -#### Get feedback - -One of our writers described writing as a feedback loop. He said that he started writing as a way to give back to the community, but what he found was that community responses give back to him. - -Another writer, [Stuart Keroff][13] says, "Writing for Opensource.com about the program I run at school gave me valuable feedback, encouragement, and support that I would not have had otherwise. Thousands upon thousands of people heard about the Asian Penguins because of the articles I wrote for the website." - -#### Exhibit expertise - -Writing can help you show that you've got expertise in a subject, and having writing samples on well-known websites can help you move toward better pay at your current job, get a new role at a different organization, or start bringing in writing income. - -[Jeff Macharyas][14] explains, "There are several ways I've benefitted from writing for Opensource.com. One, is the credibility I can add to my social media sites, resumes, bios, etc., just by saying 'I am a contributing writer to Opensource.com.' … I am hoping that I will be able to line up some freelance writing assignments, using my Opensource.com articles as examples, in the future." - -### Where should you publish your articles? - -That depends. Why are you writing? - -You can always post on your personal blog, but if you don't already have a lot of readers, your article might get lost in the noise online. - -Your project or company blog is a good option—again, you'll have to think about who will find it. How big is your company's reach? Or will you only get the attention of people who already give you their attention? - -Are you trying to reach a new audience? A bigger audience? That's where sites like Opensource.com can help. We attract more than a million page views a month, and more than 700,000 unique visitors. Plus you'll work with editors who will polish and help promote your article. - -We aren't the only site interested in your story. What are your favorite sites to read? They might want to help you share your story, and it's ok to pitch to multiple publications. Just be transparent about whether your article has been shared on other sites when working with editors. Occasionally, editors can even help you modify articles so that you can publish variations on multiple sites. - -#### Do you want to get rich by writing? (Don't count on it.) - -If your goal is to make money by writing, pitch your article to publications that have author budgets. There aren't many of them, the budgets don't tend to be huge, and you will be competing with experienced professional tech journalists who write seven days a week, 365 days a year, with large social media followings and networks. I'm not saying it can't be done—I've done it—but I am saying don't expect it to be easy or lucrative. It's not. (And frankly, I've found that nothing kills my desire to write much like having to write if I want to eat...) - -A couple of people have asked me whether Opensource.com pays for content, or whether I'm asking someone to write "for exposure." Opensource.com does not have an author budget, but I won't tell you to write "for exposure," either. You should write because it meets a need. - -If you already have a platform that meets your needs, and you don't need editing or social media and syndication help: Congratulations! You are privileged. - -### Spark joy! - -Most people don't know they have a story to tell, so I'm here to tell you that you probably do, and my team can help, if you just submit a proposal. - -Most people—myself included—could use help from other people. Sites like Opensource.com offer one way to get editing and social media services at no cost to the writer, which can be hugely valuable to someone starting out in their career, someone who isn't a native English speaker, someone who wants help with their project or organization, and so on. - -If you don't already write, I hope this article helps encourage you to get started. Or, maybe you already write. In that case, I hope this article makes you think about friends, colleagues, or people in your network who have great stories and experiences to share. I'd love to help you help them get started. - -I'll conclude with feedback I got from a recent writer, [Mario Corchero][15], a Senior Software Developer at Bloomberg. He says, "I wrote for Opensource because you told me to :)" (For the record, I "invited" him to write for our [PyCon speaker series][16] last year.) He added, "And I am extremely happy about it—not only did it help me at my workplace by gaining visibility, but I absolutely loved it! The article appeared in multiple email chains about Python and was really well received, so I am now looking to publish the second :)" Then he [wrote for us][17] again. - -I hope you find writing to be as fulfilling as we do. - -You can connect with Opensource.com editors, community moderators, and writers in our Freenode [IRC][18] channel #opensource.com, and you can reach me and the Opensource.com team by email at [open@opensource.com][19]. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/career-changing-magic-writing - -作者:[Rikki Endsley][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/rikki-endsley -[1]:http://tidyingup.com/books/the-life-changing-magic-of-tidying-up-hc -[2]:https://opensource.com/how-submit-article -[3]:http://linuxpromagazine.com/ -[4]:https://opensource.com/article/17/2/3-top-machine-learning-libraries-python -[5]:https://opensource.com/article/17/2/machine-learning-projects-tensorflow-raspberry-pi -[6]:https://opensource.com/article/17/9/messy-sensor-data -[7]:https://opensource.com/life/16/9/my-linux-story-musician -[8]:https://opensource.com/users/jim-hall -[9]:http://www.freedos.org/ -[10]:https://opensource.com/article/17/6/open-hardware-latin-america -[11]:https://opensource.com/users/don-watkins -[12]:https://opensource.com/community-moderator-program -[13]:https://opensource.com/education/15/3/asian-penguins-Linux-middle-school-club -[14]:https://opensource.com/users/jeffmacharyas -[15]:https://opensource.com/article/17/5/understanding-datetime-python-primer -[16]:https://opensource.com/tags/pycon -[17]:https://opensource.com/article/17/9/python-logging -[18]:https://opensource.com/article/16/6/getting-started-irc -[19]:mailto:open@opensource.com diff --git a/sources/talk/20180209 Why an involved user community makes for better software.md b/sources/talk/20180209 Why an involved user community makes for better software.md deleted file mode 100644 index 2b51023e44..0000000000 --- a/sources/talk/20180209 Why an involved user community makes for better software.md +++ /dev/null @@ -1,47 +0,0 @@ -Why an involved user community makes for better software -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_cubestalk.png?itok=Ozw4NhGW) - -Imagine releasing a major new infrastructure service based on open source software only to discover that the product you deployed had evolved so quickly that the documentation for the version you released is no longer available. At Bloomberg, we experienced this problem firsthand in our deployment of OpenStack. In late 2016, we spent six months testing and rolling out [Liberty][1] on our OpenStack environment. By that time, Liberty was about a year old, or two versions behind the latest build. - -As our users started taking advantage of its new functionality, we found ourselves unable to solve a few tricky problems and to answer some detailed questions about its API. When we went looking for Liberty's documentation, it was nowhere to be found on the OpenStack website. Liberty, it turned out, had been labeled "end of life" and was no longer supported by the OpenStack developer community. - -The disappearance wasn't intentional, rather the result of a development community that had not anticipated the real-world needs of users. The documentation was stored in the source branch along with the source code, and, as Liberty was superseded by newer versions, it had been deleted. Worse, in the intervening months, the documentation for the newer versions had been completely restructured, and there was no way to easily rebuild it in a useful form. And believe me, we tried. - -The disappearance wasn't intentional, rather the result of a development community that had not anticipated the real-world needs of users. ]After consulting other users and our vendor, we found that OpenStack's development cadence of two releases per year had created some unintended, yet deeply frustrating, consequences. Older releases that were typically still widely in use were being superseded and effectively killed for the purposes of support. - -Eventually, conversations took place between OpenStack users and developers that resulted in changes. Documentation was moved out of the source branch, and users can now build documentation for whatever version they're using—more or less indefinitely. The problem was solved. (I'm especially indebted to my colleague [Chris Morgan][2], who was knee-deep in this effort and first wrote about it in detail for the [OpenStack Superuser blog][3].) - -Many other enterprise users were in the same boat as Bloomberg—running older versions of OpenStack that are three or four versions behind the latest build. There's a good reason for that: On average it takes a reasonably large enterprise about six months to qualify, test, and deploy a new version of OpenStack. And, from my experience, this is generally true of most open source infrastructure projects. - -For most of the past decade, companies like Bloomberg that adopted open source software relied on distribution vendors to incorporate, test, verify, and support much of it. These vendors provide long-term support (LTS) releases, which enable enterprise users to plan for upgrades on a two- or three-year cycle, knowing they'll still have support for a year or two, even if their deployment schedule slips a bit (as they often do). In the past few years, though, infrastructure software has advanced so rapidly that even the distribution vendors struggle to keep up. And customers of those vendors are yet another step removed, so many are choosing to deploy this type of software without vendor support. - -Losing vendor support also usually means there are no LTS releases; OpenStack, Kubernetes, and Prometheus, and many more, do not yet provide LTS releases of their own. As a result, I'd argue that healthy interaction between the development and user community should be high on the list of considerations for adoption of any open source infrastructure. Do the developers building the software pay attention to the needs—and frustrations—of the people who deploy it and make it useful for their enterprise? - -There is a solid model for how this should happen. We recently joined the [Cloud Native Computing Foundation][4], part of The Linux Foundation. It has a formal [end-user community][5], whose members include organizations just like us: enterprises that are trying to make open source software useful to their internal customers. Corporate members also get a chance to have their voices heard as they vote to select a representative to serve on the CNCF [Technical Oversight Committee][6]. Similarly, in the OpenStack community, Bloomberg is involved in the semi-annual Operators Meetups, where companies who deploy and support OpenStack for their own users get together to discuss their challenges and provide guidance to the OpenStack developer community. - -The past few years have been great for open source infrastructure. If you're working for a large enterprise, the opportunity to deploy open source projects like the ones mentioned above has made your company more productive and more agile. - -As large companies like ours begin to consume more open source software to meet their infrastructure needs, they're going to be looking at a long list of considerations before deciding what to use: license compatibility, out-of-pocket costs, and the health of the development community are just a few examples. As a result of our experiences, we'll add the presence of a vibrant and engaged end-user community to the list. - -Increased reliance on open source infrastructure projects has also highlighted a key problem: People in the development community have little experience deploying the software they work on into production environments or supporting the people who use it to get things done on a daily basis. The fast pace of updates to these projects has created some unexpected problems for the people who deploy and use them. There are numerous examples I can cite where open source projects are updated so frequently that new versions will, usually unintentionally, break backwards compatibility. - -As open source increasingly becomes foundational to the operation of so many enterprises, this cannot be allowed to happen, and members of the user community should assert themselves accordingly and press for the creation of formal representation. In the end, the software can only be better. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/important-conversation - -作者:[Kevin P.Fleming][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/kpfleming -[1]:https://releases.openstack.org/liberty/ -[2]:https://www.linkedin.com/in/mihalis68/ -[3]:http://superuser.openstack.org/articles/openstack-at-bloomberg/ -[4]:https://www.cncf.io/ -[5]:https://www.cncf.io/people/end-user-community/ -[6]:https://www.cncf.io/people/technical-oversight-committee/ diff --git a/sources/talk/20180214 Can anonymity and accountability coexist.md b/sources/talk/20180214 Can anonymity and accountability coexist.md deleted file mode 100644 index 8b15ed169c..0000000000 --- a/sources/talk/20180214 Can anonymity and accountability coexist.md +++ /dev/null @@ -1,79 +0,0 @@ -Can anonymity and accountability coexist? -========================================= - -Anonymity might be a boon to more open, meritocratic organizational cultures. But does it conflict with another important value: accountability? - -![Can anonymity and accountability coexist?](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/GOV_Transparency_B.png?itok=SkP1mUt5 "Can anonymity and accountability coexist?") - -Image by :opensource.com - -### Get the newsletter - -Join the 85,000 open source advocates who receive our giveaway alerts and article roundups. - -Whistleblowing protections, crowdsourcing, anonymous voting processes, and even Glassdoor reviews—anonymous speech may take many forms in organizations. - -As well-established and valued as these anonymous feedback mechanisms may be, anonymous speech becomes a paradoxical idea when one considers how to construct a more open organization. While an inability to discern speaker identity seems non-transparent, an opportunity for anonymity may actually help achieve a _more inclusive and meritocratic_ environment. - -More about open organizations - -* [Download free Open Org books](https://opensource.com/open-organization/resources/book-series?src=too_resource_menu1a) -* [What is an Open Organization?](https://opensource.com/open-organization/resources/open-org-definition?src=too_resource_menu2a) -* [How open is your organization?](https://opensource.com/open-organization/resources/open-org-maturity-model?src=too_resource_menu3a) -* [What is an Open Decision?](https://opensource.com/open-organization/resources/open-decision-framework?src=too_resource_menu4a) -* [The Open Org two years later](https://www.redhat.com/en/about/blog/open-organization-two-years-later-and-going-strong?src=too_resource_menu4b&intcmp=70160000000h1s6AAA) - -But before allowing outlets for anonymous speech to propagate, however, leaders of an organization should carefully reflect on whether an organization's "closed" practices make anonymity the unavoidable alternative to free, non-anonymous expression. Though some assurance of anonymity is necessary in a few sensitive and exceptional scenarios, dependence on anonymous feedback channels within an organization may stunt the normalization of a culture that encourages diversity and community. - -### The benefits of anonymity - -In the case of [_Talley v. California (1960)_](https://supreme.justia.com/cases/federal/us/362/60/case.html), the Supreme Court voided a city ordinance prohibiting the anonymous distribution of handbills, asserting that "there can be no doubt that such an identification requirement would tend to restrict freedom to distribute information and thereby freedom of expression." Our judicial system has legitimized the notion that the protection of anonymity facilitates the expression of otherwise unspoken ideas. A quick scroll through any [subreddit](https://www.reddit.com/reddits/) exemplifies what the Court has codified: anonymity can foster [risk-taking creativity](https://www.reddit.com/r/sixwordstories/) and the [inclusion and support of marginalized voices](https://www.reddit.com/r/MyLittleSupportGroup/). Anonymity empowers individuals by granting them the safety to speak without [detriment to their reputations or, more importantly, their physical selves.](https://www.psychologytoday.com/blog/the-compassion-chronicles/201711/why-dont-victims-sexual-harassment-come-forward-sooner) - -For example, an anonymous suggestion program to garner ideas from members or employees in an organization may strengthen inclusivity and enhance the diversity of suggestions the organization receives. It would also make for a more meritocratic decision-making process, as anonymity would ensure that the quality of the articulated idea, rather than the rank and reputation of the articulator, is what's under evaluation. Allowing members to anonymously vote for anonymously-submitted ideas would help curb the influence of office politics in decisions affecting the organization's growth. - -### The harmful consequences of anonymity - -Yet anonymity and the open value of _accountability_ may come into conflict with one another. For instance, when establishing anonymous programs to drive greater diversity and more meritocratic evaluation of ideas, organizations may need to sacrifice the ability to hold speakers accountable for the opinions they express. - -Reliance on anonymous speech for serious organizational decision-making may also contribute to complacency in an organizational culture that falls short of openness. Outlets for anonymous speech may be as similar to open as crowdsourcing is—or rather, is not. [Like efforts to crowdsource creative ideas](https://opensource.com/business/10/4/why-open-source-way-trumps-crowdsourcing-way), anonymous suggestion programs may create an organizational environment in which diverse perspectives are only valued when an organization's leaders find it convenient to take advantage of members' ideas. - -Anonymity and the open value of accountability may come into conflict with one another. - -A similar concern holds for anonymous whistle-blowing or concern submission. Though anonymity is important for sexual harassment and assault reporting, regularly redirecting member concerns and frustrations to a "complaints box" makes it more difficult for members to hold their organization's leaders accountable for acting on concerns. It may also hinder intra-organizational support networks and advocacy groups from forming around shared concerns, as members would have difficulty identifying others with similar experiences. For example, many working mothers might anonymously submit requests for a lactation room in their workplace, then falsely attribute a lack of action from leaders to a lack of similar concerns from others. - -### An anonymity checklist - -Organizations in which anonymous speech is the primary mode of communication, like subreddits, have generated innovative works and thought-provoking discourse. These anonymous networks call attention to the potential for anonymity to help organizations pursue open values of diversity and meritocracy. Organizations in which anonymous speech is _not_ the main form of communication should acknowledge the strengths of anonymous speech, but carefully consider whether anonymity is the wisest means to the goal of sustainable openness. - -Leaders may find reflecting on the following questions useful prior to establishing outlets for anonymous feedback within their organizations: - -1\. _Availability of additional communication mechanisms_: Rather than investing time and resources into establishing a new, anonymous channel for communication, can the culture or structure of existing avenues of communication be reconfigured to achieve the same goal? This question echoes the open source affinity toward realigning, rather than reinventing, the wheel. - -2\. _Failure of other communication avenues:_ How and why is the organization ill-equipped to handle the sensitive issue/situation at hand through conventional (i.e. non-anonymous) means of communication? - -Careful deliberation on these questions may help prevent outlets for anonymous speech from leading to a dangerous sense of complacency. - -3\. _Consequences of anonymity:_ If implemented, could the anonymous mechanism stifle the normalization of face-to-face discourse about issues important to the organization's growth? If so, how can leaders ensure that members consider the anonymous communication channel a "last resort," without undermining the legitimacy of the anonymous system? - -4\. _Designing the anonymous communication channel:_ How can accountability be promoted in anonymous communication without the ability to determine the identity of speakers? - -5\. _Long-term considerations_: Is the anonymous feedback mechanism sustainable, or a temporary solution to a larger organizational issue? If the latter, is [launching a campaign](https://opensource.com/open-organization/16/6/8-steps-more-open-communications) to address overarching problems with the organization's communication culture feasible? - -These five points build off of one another to help leaders recognize the tradeoffs involved in legitimizing anonymity within their organization. Careful deliberation on these questions may help prevent outlets for anonymous speech from leading to a dangerous sense of complacency with a non-inclusive organizational structure. - -About the author ----------------- - -[![](https://opensource.com/sites/default/files/styles/profile_pictures/public/osdc_default_avatar_1.png?itok=mmbfqFXm)](https://opensource.com/users/susiechoi) - -Susie Choi - Susie is an undergraduate student studying computer science at Duke University. She is interested in the implications of technological innovation and open source principles for issues relating to education and socioeconomic inequality. - -[More about me](https://opensource.com/users/susiechoi) - -* * * - -via: [https://opensource.com/open-organization/18/1/balancing-accountability-and-anonymity](https://opensource.com/open-organization/18/1/balancing-accountability-and-anonymity) - -作者: [Susie Choi](https://opensource.com/users/susiechoi) 选题者: [@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/) 荣誉推出 \ No newline at end of file diff --git a/sources/talk/20180216 Q4OS Makes Linux Easy for Everyone.md b/sources/talk/20180216 Q4OS Makes Linux Easy for Everyone.md deleted file mode 100644 index a868ed28d5..0000000000 --- a/sources/talk/20180216 Q4OS Makes Linux Easy for Everyone.md +++ /dev/null @@ -1,140 +0,0 @@ -Q4OS Makes Linux Easy for Everyone -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/q4os-main.png?itok=WDatcV-a) - -Modern Linux distributions tend to target a variety of users. Some claim to offer a flavor of the open source platform that anyone can use. And, I’ve seen some such claims succeed with aplomb, while others fall flat. [Q4OS][1] is one of those odd distributions that doesn’t bother to make such a claim but pulls off the feat anyway. - -So, who is the primary market for Q4OS? According to its website, the distribution is a: - -“fast and powerful operating system based on the latest technologies while offering highly productive desktop environment. We focus on security, reliability, long-term stability and conservative integration of verified new features. System is distinguished by speed and very low hardware requirements, runs great on brand new machines as well as legacy computers. It is also very applicable for virtualization and cloud computing.” - -What’s very interesting here is that the Q4OS developers offer commercial support for the desktop. Said support can cover the likes of system customization (including core level API programming) as well as user interface modifications. - -Once you understand this (and have installed Q4OS), the target audience becomes quite obvious: Business users looking for a Windows XP/7 replacement. But that should not prevent home users from giving Q4OS at try. It’s a Linux distribution that has a few unique tools that come together to make a solid desktop distribution. - -Let’s take a look at Q4OS and see if it’s a version of Linux that might work for you. - -### What Q4OS all about - -Q4OS that does an admirable job of being the open source equivalent of Windows XP/7. Out of the box, it pulls this off with the help of the [Trinity Desktop][2] (a fork of KDE). With a few tricks up its sleeve, Q4OS turns the Trinity Desktop into a remarkably similar desktop (Figure 1). - -![default desktop][4] - -Figure 1: The Q4OS default desktop. - -[Used with permission][5] - -When you fire up the desktop, you will be greeted by a Welcome screen that makes it very easy for new users to start setting up their desktop with just a few clicks. From this window, you can: - - * Run the Desktop Profiler (which allows you to select which desktop environment to use as well as between a full-featured desktop, a basic desktop, or a minimal desktop—Figure 2). - - * Install applications (which opens the Synaptic Package Manager). - - * Install proprietary codecs (which installs all the necessary media codecs for playing audio and video). - - * Turn on Desktop effects (if you want more eye candy, turn this on). - - * Switch to Kickoff start menu (switches from the default start menu to the newer kickoff menu). - - * Set Autologin (allows you to set login such that it won’t require your password upon boot). - - - - -![Desktop Profiler][7] - -Figure 2: The Desktop Profiler allows you to further customize your desktop experience. - -[Used with permission][5] - -If you want to install a different desktop environment, open up the Desktop Profiler and then click the Desktop environments drop-down, in the upper left corner of the window. A new window will appear, where you can select your desktop of choice from the drop-down (Figure 3). Once back at the main Profiler Window, select which type of desktop profile you want, and then click Install. - -![Desktop Profiler][9] - -Figure 3: Installing a different desktop is quite simple from within the Desktop Profiler. - -[Used with permission][5] - -Note that installing a different desktop will not wipe the default desktop. Instead, it will allow you to select between the two desktops (at the login screen). - -### Installed software - -After selecting full-featured desktop, from the Desktop Profiler, I found the following user applications ready to go: - - * LibreOffice 5.2.7.2 - - * VLC 2.2.7 - - * Google Chrome 64.0.3282 - - * Thunderbird 52.6.0 (Includes Lightning addon) - - * Synaptic 0.84.2 - - * Konqueror 14.0.5 - - * Firefox 52.6.0 - - * Shotwell 0.24.5 - - - - -Obviously some of those applications are well out of date. Since this distribution is based on Debian, we can run and update/upgrade with the commands: -``` -sudo apt update - -sudo apt upgrade - -``` - -However, after running both commands, it seems everything is up to date. This particular release (2.4) is an LTS release (supported until 2022). Because of this, expect software to be a bit behind. If you want to test out the bleeding edge version (based on Debian “Buster”), you can download the testing image [here][10]. - -### Security oddity - -There is one rather disturbing “feature” found in Q4OS. In the developer’s quest to make the distribution closely resemble Windows, they’ve made it such that installing software (from the command line) doesn’t require a password! You read that correctly. If you open the Synaptic package manager, you’re asked for a password. However (and this is a big however), open up a terminal window and issue a command like sudo apt-get install gimp. At this point, the software will install… without requiring the user to type a sudo password. - -Did you cringe at that? You should. - -I get it, the developers want to ease away the burden of Linux and make a platform the masses could easily adapt to. They’ve done a splendid job of doing just that. However, in the process of doing so, they’ve bypassed a crucial means of security. Is having as near an XP/7 clone as you can find on Linux worth that lack of security? I would say that if it enables more people to use Linux, then yes. But the fact that they’ve required a password for Synaptic (the GUI tool most Windows users would default to for software installation) and not for the command-line tool makes no sense. On top of that, bypassing passwords for the apt and dpkg commands could make for a significant security issue. - -Fear not, there is a fix. For those that prefer to require passwords for the command line installation of software, you can open up the file /etc/sudoers.d/30_q4os_apt and comment out the following three lines: -``` -%sudo ALL = NOPASSWD: /usr/bin/apt-get * - -%sudo ALL = NOPASSWD: /usr/bin/apt-key * - -%sudo ALL = NOPASSWD: /usr/bin/dpkg * - -``` - -Once commented out, save and close the file, and reboot the system. At this point, users will now be prompted for a password, should they run the apt-get, apt-key, or dpkg commands. - -### A worthy contender - -Setting aside the security curiosity, Q4OS is one of the best attempts at recreating Windows XP/7 I’ve come across in a while. If you have users who fear change, and you want to migrate them away from Windows, this distribution might be exactly what you need. I would, however, highly recommend you re-enable passwords for the apt-get, apt-key, and dpkg commands… just to be on the safe side. - -In any case, the addition of the Desktop Profiler, and the ability to easily install alternative desktops, makes Q4OS a distribution that just about anyone could use. - -Learn more about Linux through the free ["Introduction to Linux" ][11]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/learn/intro-to-linux/2018/2/q4os-makes-linux-easy-everyone - -作者:[JACK WALLEN][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/jlwallen -[1]:https://q4os.org -[2]:https://www.trinitydesktop.org/ -[4]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/q4os_1.jpg?itok=dalJk9Xf (default desktop) -[5]:/licenses/category/used-permission -[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/q4os_2.jpg?itok=GlouIm73 (Desktop Profiler) -[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/q4os_3.jpg?itok=riSTP_1z (Desktop Profiler) -[10]:https://q4os.org/downloads2.html -[11]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/talk/20180220 4 considerations when naming software development projects.md b/sources/talk/20180220 4 considerations when naming software development projects.md deleted file mode 100644 index 1e1add0b68..0000000000 --- a/sources/talk/20180220 4 considerations when naming software development projects.md +++ /dev/null @@ -1,91 +0,0 @@ -4 considerations when naming software development projects -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/hello-name-sticker-badge-tag.png?itok=fAgbMgBb) - -Working on a new open source project, you're focused on the code—getting that great new idea released so you can share it with the world. And you'll want to attract new contributors, so you need a terrific **name** for your project. - -We've all read guides for creating names, but how do you go about choosing the right one? Keeping that cool science fiction reference you're using internally might feel fun, but it won't mean much to new users you're trying to attract. A better approach is to choose a name that's memorable to new users and developers searching for your project. - -Names set expectations. Your project's name should showcase its functionality in the ecosystem and explain to users what your story is. In the crowded open source software world, it's important not to get entangled with other projects out there. Taking a little extra time now, before sending out that big announcement, will pay off later. - -Here are four factors to keep in mind when choosing a name for your project. - -### What does your project's code do? - -Start with your project: What does it do? You know the code intimately—but can you explain what it does to a new developer? Can you explain it to a CTO or non-developer at another company? What kinds of problems does your project solve for users? - -Your project's name needs to reflect what it does in a way that makes sense to newcomers who want to use or contribute to your project. That means considering the ecosystem for your technology and understanding if there are any naming styles or conventions used for similar kinds of projects. Imagine that you're trying to evaluate someone else's project: Would the name be appealing to you? - -Any distribution channels you push to are also part of the ecosystem. If your code will be in a Linux distribution, [npm][1], [CPAN][2], [Maven][3], or in a Ruby Gem, you need to review any naming standards or common practices for that package manager. Review any similar existing names in that distribution channel, and get a feel for naming styles of other programs there. - -### Who are the users and developers you want to attract? - -The hardest aspect of choosing a new name is putting yourself in the shoes of new users. You built this project; you already know how powerful it is, so while your cool name may sound great, it might not draw in new people. You need a name that is interesting to someone new, and that tells the world what problems your project solves. - -Great names depend on what kind of users you want to attract. Are you building an [Eclipse][4] plugin or npm module that's focused on developers? Or an analytics toolkit that brings visualizations to the average user? Understanding your user base and the kinds of open source contributors you want to attract is critical. - -Great names depend on what kind of users you want to attract. - -Take the time to think this through. Who does your project most appeal to, and how can it help them do their job? What kinds of problems does your code solve for end users? Understanding the target user helps you focus on what users need, and what kind of names or brands they respond to. - -Take the time to think this through. Who does your project most appeal to, and how can it help them do their job? What kinds of problems does your code solve for end users? Understanding the target user helps you focus on what users need, and what kind of names or brands they respond to. - -When you're open source, this equation changes a bit—your target is not just users; it's also developers who will want to contribute code back to your project. You're probably a developer, too: What kinds of names and brands excite you, and what images would entice you to try out someone else's new project? - -Once you have a better feel of what users and potential contributors expect, use that knowledge to refine your names. Remember, you need to step outside your project and think about how the name would appeal to someone who doesn't know how amazing your code is—yet. Once someone gets to your website, does the name synchronize with what your product does? If so, move to the next step. - -### Who else is using similar names for software? - -Now that you've tried on a user's shoes to evaluate potential names, what's next? Figuring out if anyone else is already using a similar name. It sometimes feels like all the best names are taken—but if you search carefully, you'll find that's not true. - -The first step is to do a few web searches using your proposed name. Search for the name, plus "software", "open source", and a few keywords for the functionality that your code provides. Look through several pages of results for each search to see what's out there in the software world. - -The first step is to do a few web searches using your proposed name. - -Unless you're using a completely made-up word, you'll likely get a lot of hits. The trick is understanding which search results might be a problem. Again, put on the shoes of a new user to your project. If you were searching for this great new product and saw the other search results along with your project's homepage, would you confuse them? Are the other search results even software products? If your product solves a similar problem to other search results, that's a problem: Users may gravitate to an existing product instead of a new one. - -Unless you're using a completely made-up word, you'll likely get a lot of hits. The trick is understanding which search results might be a problem. Again, put on the shoes of a new user to your project. If you were searching for this great new product and saw the other search results along with your project's homepage, would you confuse them? Are the other search results even software products? If your product solves a similar problem to other search results, that's a problem: Users may gravitate to an existing product instead of a new one. - -Similar non-software product names are rarely an issue unless they are famous trademarks—like Nike or Red Bull, for example—where the companies behind them won't look kindly on anyone using a similar name. Using the same name as a less famous non-software product might be OK, depending on how big your project gets. - -### How big do you plan to grow your project? - -Are you building a new node module or command-line utility, but not planning a career around it? Is your new project a million-dollar business idea, and you're thinking startup? Or is it something in between? - -If your project is a basic developer utility—something useful that developers will integrate into their workflow—then you have enough data to choose a name. Think through the ecosystem and how a new user would see your potential names, and pick one. You don't need perfection, just a name you're happy with that seems right for your project. - -If you're planning to build a business around your project, use these tips to develop a shortlist of names, but do more vetting before announcing the winner. Use for a business or major project requires some level of registered trademark search, which is usually performed by a law firm. - -### Common pitfalls - -Finally, when choosing a name, avoid these common pitfalls: - - * Using an esoteric acronym. If new users don't understand the name, they'll have a hard time finding you. - - * Using current pop-culture references. If you want your project's appeal to last, pick a name that will last. - - * Failing to consider non-English speakers. Does the name have a specific meaning in another language that might be confusing? - - * Using off-color jokes or potentially unsavory references. Even if it seems funny to developers, it may fall flat for newcomers and turn away contributors. - - - - -Good luck—and remember to take the time to step out of your shoes and consider how a newcomer to your project will think of the name. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/choosing-project-names-four-key-considerations - -作者:[Shane Curcuru][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/shane-curcuru -[1]:https://www.npmjs.com/ -[2]:https://www.cpan.org/ -[3]:https://maven.apache.org/ -[4]:https://www.eclipse.org/ diff --git a/sources/talk/20180221 3 warning flags of DevOps metrics.md b/sources/talk/20180221 3 warning flags of DevOps metrics.md deleted file mode 100644 index a103a2bbca..0000000000 --- a/sources/talk/20180221 3 warning flags of DevOps metrics.md +++ /dev/null @@ -1,42 +0,0 @@ -3 warning flags of DevOps metrics -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_graph_stats_blue.png?itok=OKCc_60D) - -Metrics. Measurements. Data. Monitoring. Alerting. These are all big topics for DevOps and for cloud-native infrastructure and application development more broadly. In fact, acm Queue, a magazine published by the Association of Computing Machinery, recently devoted an [entire issue][1] to the topic. - -I've argued before that we conflate a lot of things under the "metrics" term, from key performance indicators to critical failure alerts to data that may be vaguely useful someday for something or other. But that's a topic for another day. What I want to discuss here is how metrics affect behavior. - -In 2008, Daniel Ariely published [Predictably Irrational][2] , 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 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][3]? 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][4]. "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," writes Ariely. - -Think developers and operations folks are immune from such behaviors? Think again. Let's consider some problematic measurements. They're not all bad or wrong but, if you rely too much on them, warning flags should go up. - -### Three warning signs for DevOps metrics - -First, there are the quantity metrics. Lines of code or bugs fixed are perhaps self-evidently absurd. But there are also the deployments per week or per month that are so widely quoted to illustrate DevOps velocity relative to more traditional development and deployment practices. Speed is good. It's one of the reasons you're probably doing DevOps—but don't reward people on it excessively relative to quality and other measures. - -Second, it's obvious that you want to reward individuals who do their work quickly and well. Yes. But. Whether it's your local pro sports team or some project team you've been on, you can probably name someone who was really a talent, but was just so toxic and such a distraction for everyone else that they were a net negative for the team. Moral: Don't provide incentives that solely encourage individual behaviors. You may also want to put in place programs, such as peer rewards, that explicitly value collaboration. [As Red Hat's Jen Krieger told me][5] in a podcast last year: "Having those automated pots of awards, or some sort of system that's tracked for that, can only help teams feel a little more cooperative with one another as in, 'Hey, we're all working together to get something done.'" - -The third red flag area is incentives that don't actually incent because neither the individual nor the team has a meaningful ability to influence the outcome. It's often a good thing when DevOps metrics connect to business goals and outcomes. For example, customer ticket volume relates to perceived shortcomings in applications and infrastructure. And it's also a reasonable proxy for overall customer satisfaction, which certainly should be of interest to the executive suite. The best reward systems to drive DevOps behaviors should be tied to specific individual and team actions as opposed to just company success generally. - -You've probably noticed a common theme. That theme is balance. Velocity is good but so is quality. Individual achievement is good but not when it damages the effectiveness of the team. The overall success of the business is certainly important, but the best reward systems also tie back to actions and behaviors within development and operations. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/three-warning-flags-devops-metrics - -作者:[Gordon Haff][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/ghaff -[1]:https://queue.acm.org/issuedetail.cfm?issue=3178368 -[2]:https://en.wikipedia.org/wiki/Predictably_Irrational -[3]:https://en.wikipedia.org/wiki/Spiff -[4]:https://hbr.org/2010/06/column-you-are-what-you-measure -[5]:http://bitmason.blogspot.com/2015/09/podcast-making-devops-succeed-with-red.html diff --git a/sources/talk/20180222 3 reasons to say -no- in DevOps.md b/sources/talk/20180222 3 reasons to say -no- in DevOps.md deleted file mode 100644 index 5f27fbaf47..0000000000 --- a/sources/talk/20180222 3 reasons to say -no- in DevOps.md +++ /dev/null @@ -1,105 +0,0 @@ -3 reasons to say 'no' in DevOps -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_DesirePath.png?itok=N_zLVWlK) - -DevOps, it has often been pointed out, is a culture that emphasizes mutual respect, cooperation, continual improvement, and aligning responsibility with authority. - -Instead of saying no, it may be helpful to take a hint from improv comedy and say, "Yes, and..." or "Yes, but...". This opens the request from the binary nature of "yes" and "no" toward having a nuanced discussion around priority, capacity, and responsibility. - -However, sometimes you have no choice but to give a hard "no." These should be rare and exceptional, but they will occur. - -### Protecting yourself - -Both Agile and DevOps have been touted as ways to improve value to the customer and business, ultimately leading to greater productivity. While reasonable people can understand that the improvements will take time to yield, and the improvements will result in higher quality of work being done, and a better quality of life for those performing it, I think we can all agree that not everyone is reasonable. The less understanding that a person has of the particulars of a given task, the more likely they are to expect that it is a combination of "simple" and "easy." - -"You told me that [Agile/DevOps] is supposed to be all about us getting more productivity. Since we're doing [Agile/DevOps] now, you can take care of my need, right?" - -Like "Agile," some people have tried to use "DevOps" as a stick to coerce people to do more work than they can handle. Whether the person confronting you with this question is asking in earnest or is being manipulative doesn't really matter. - -The biggest areas of concern for me have been **capacity** , **firefighting/maintenance** , **level of quality** , and **" future me."** Many of these ultimately tie back to capacity, but they relate to a long-term effort in different respects. - -#### Capacity - -Capacity is simple: You know what your workload is, and how much flex occurs due to the unexpected. Exceeding your capacity will not only cause undue stress, but it could decrease the quality of your work and can injure your reputation with regards to making commitments. - -There are several avenues of discussion that can happen from here. The simplest is "Your request is reasonable, but I don't have the capacity to work on it." This seldom ends the conversation, and a discussion will often run up the flagpole to clarify priorities or reassign work. - -#### Firefighting/maintenance - -It's possible that the thing that you're being asked for won't take long to do, but it will require maintenance that you'll be expected to perform, including keeping it alive and fulfilling requests for it on behalf of others. - -An example in my mind is the Jenkins server that you're asked to stand up for someone else, but somehow end up being the sole owner and caretaker of. Even if you're careful to scope your level of involvement early on, you might be saddled with responsibility that you did not agree to. Should the service become unavailable, for example, you might be the one who is called. You might be called on to help triage a build that is failing. This is additional firefighting and maintenance work that you did not sign up for and now must fend off. - -This needs to be addressed as soon and publicly as possible. I'm not saying that (again, for example) standing up a Jenkins instance is a "no," but rather a ["Yes, but"][1]—where all parties understand that they take on the long-term care, feeding, and use of the product. Make sure to include all your bosses in this conversation so they can have your back. - -#### Level of quality - -There may be times when you are presented with requirements that include a timeframe that is...problematic. Perhaps you could get a "minimum (cough) viable (cough) product" out in that time. But it wouldn't be resilient or in any way ready for production. It might impact your time and productivity. It could end up hurting your reputation. - -The resulting conversation can get into the weeds, with lots of horse-trading about time and features. Another approach is to ask "What is driving this deadline? Where did that timeframe come from?" Discussing the bigger picture might lead to a better option, or that the timeline doesn't depend on the original date. - -#### Future me - -Ultimately, we are trying to protect "future you." These are lessons learned from the many times that "past me" has knowingly left "current me" to clean up. Sometimes we joke that "that's a problem for 'future me,'" but don't forget that 'future you' will just be 'you' eventually. I've cursed "past me" as a jerk many times. Do your best to keep other people from making "past you" be a jerk to "future you." - -I recognize that I have a significant amount of privilege in this area, but if you are told that you cannot say "no" on behalf of your own welfare, you should consider whether you are respected enough to maintain your autonomy. - -### Protecting the user experience - -Everyone should be an advocate for the user. Regardless of whether that user is right next to you, someone down the hall, or someone you have never met and likely never will, you must care for the customer. - -Behavior that is actively hostile to the user—whether it's a poor user experience or something more insidious like quietly violating reasonable expectations of privacy—deserves a "no." A common example of this would be automatically including people into a service or feature, forcing them to explicitly opt-out. - -If a "no" is not welcome, it bears considering, or explicitly asking, what the company's relationship with its customers is, who the company thinks of as it's customers, and what it thinks of them. - -When bringing up your objections, be clear about what they are. Additionally, remember that your coworkers are people too, and make it clear that you are not attacking their character; you simply find the idea disagreeable. - -### Legal, ethical, and moral grounds - -There might be situations that don't feel right. A simple test is to ask: "If this were to become public, or come up in a lawsuit deposition, would it be a scandal?" - -#### Ethics and morals - -If you are asked to lie, that should be a hard no. - -Remember if you will the Volkswagen Emissions Scandal of 2017? The emissions systems software was written such that it recognized that the vehicle was operated in a manner consistent with an emissions test, and would run more efficiently than under normal driving conditions. - -I don't know what you do in your job, or what your office is like, but I have a hard time imagining the Individual Contributor software engineer coming up with that as a solution on their own. In fact, I imagine a comment along the lines of "the engine engineers can't make their product pass the tests, so I need to hack the performance so that it will!" - -When the Volkswagen scandal came public, Volkswagen officials blamed the engineers. I find it unlikely that it came from the mind and IDE of an individual software engineer. Rather, it's more likely indicates significant systemic problems within the company culture. - -If you are asked to lie, get the request in writing, citing that the circumstances are suspect. If you are so privileged, decide whether you may decline the request on the basis that it is fundamentally dishonest and hostile to the customer, and would break the public's trust. - -#### Legal - -I am not a lawyer. If your work should involve legal matters, including requests from law enforcement, involve your company's legal counsel or speak with a private lawyer. - -With that said, if you are asked to provide information for law enforcement, I believe that you are within your rights to see the documentation that justifies the request. There should be a signed warrant. You should be provided with a copy of it, or make a copy of it yourself. - -When in doubt, begin recording and request legal counsel. - -It has been well documented that especially in the early years of the U.S. Patriot Act, law enforcement placed so many requests of telecoms that they became standard work, and the paperwork started slipping. While tedious and potentially stressful, make sure that the legal requirements for disclosure are met. - -If for no other reason, we would not want the good work of law enforcement to be put at risk because key evidence was improperly acquired, making it inadmissible. - -### Wrapping up - -You are going to be your single biggest advocate. There may be times when you are asked to compromise for the greater good. However, you should feel that your dignity is preserved, your autonomy is respected, and that your morals remain intact. - -If you don't feel that this is the case, get it on record, doing your best to communicate it calmly and clearly. - -Nobody likes being declined, but if you don't have the ability to say no, there may be a bigger problem than your environment not being DevOps. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/3-reasons-say-no-devops - -作者:[H. "Waldo" Grunenwal][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/gwaldo -[1]:http://gwaldo.blogspot.com/2015/12/fear-and-loathing-in-systems.html diff --git a/sources/talk/20180223 Plasma Mobile Could Give Life to a Mobile Linux Experience.md b/sources/talk/20180223 Plasma Mobile Could Give Life to a Mobile Linux Experience.md deleted file mode 100644 index 583714836e..0000000000 --- a/sources/talk/20180223 Plasma Mobile Could Give Life to a Mobile Linux Experience.md +++ /dev/null @@ -1,123 +0,0 @@ -Plasma Mobile Could Give Life to a Mobile Linux Experience -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/plasma-mobile_0.png?itok=uUIQFRcm) - -In the past few years, it’s become clear that, outside of powering Android, Linux on mobile devices has been a resounding failure. Canonical came close, even releasing devices running Ubuntu Touch. Unfortunately, the idea of [Scopes][1]was doomed before it touched down on its first piece of hardware and subsequently died a silent death. - -The next best hope for mobile Linux comes in the form of the [Samsung DeX][2] program. With DeX, users will be able to install an app (Linux On Galaxy—not available yet) on their Samsung devices, which would in turn allow them to run a full-blown Linux distribution. The caveat here is that you’ll be running both Android and Linux at the same time—which is not exactly an efficient use of resources. On top of that, most Linux distributions aren’t designed to run on such small form factors. The good news for DeX is that, when you run Linux on Galaxy and dock your Samsung device to DeX, that Linux OS will be running on your connected monitor—so form factor issues need not apply. - -Outside of those two options, a pure Linux on mobile experience doesn’t exist. Or does it? - -You may have heard of the [Purism Librem 5][3]. It’s a crowdfunded device that promises to finally bring a pure Linux experience to the mobile landscape. This device will be powered by a i.MX8 SoC chip, so it should run most any Linux operating system. - -Out of the box, the device will run an encrypted version of [PureOS][4]. However, last year Purism and KDE joined together to create a mobile version of the KDE desktop that could run on the Librem 5. Recently [ISOs were made available for a beta version of Plasma Mobile][5] and, judging from first glance, they’re onto something that makes perfect sense for a mobile Linux platform. I’ve booted up a live instance of Plasma Mobile to kick the tires a bit. - -What I saw seriously impressed me. Let’s take a look. - -### Testing platform - -Before you download the ISO and attempt to fire it up as a VirtualBox VM, you should know that it won’t work well. Because Plasma Mobile uses Wayland (and VirtualBox has yet to play well with that particular X replacement), you’ll find VirtualBox VM a less-than-ideal platform for the beta release. Also know that the Calamares installer doesn’t function well either. In fact, I have yet to get the OS installed on a non-mobile device. And since I don’t own a supported mobile device, I’ve had to run it as a live session on either a laptop or an [Antsle][6] antlet VM every time. - -### What makes Plasma Mobile special? - -This could be easily summed up by saying, Plasma Mobile got it all right. Instead of Canonical re-inventing a perfectly functioning wheel, the developers of KDE simply re-tooled the interface such that a full-functioning Linux distribution (complete with all the apps you’ve grown to love and depend upon) could work on a smaller platform. And they did a spectacular job. Even better, they’ve created an interface that any user of a mobile device could instantly feel familiar with. - -What you have with the Plasma Mobile interface (Figure 1) are the elements common to most Android home screens: - - * Quick Launchers - - * Notification Shade - - * App Drawer - - * Overview button (so you can go back to a previously used app, still running in memory) - - * Home button - - - - -![KDE mobile][8] - -Figure 1: The Plasma Mobile desktop interface. - -[Used with permission][9] - -Because KDE went this route with the UX, it means there’s zero learning curve. And because this is an actual Linux platform, it takes that user-friendly mobile interface and overlays it onto a system that allows for easy installation and usage of apps like: - - * GIMP - - * LibreOffice - - * Audacity - - * Clementine - - * Dropbox - - * And so much more - - - - -Unfortunately, without being able to install Plasma Mobile, you cannot really kick the tires too much, as the live user doesn’t have permission to install applications. However, once Plasma Mobile is fully installed, the Discover software center will allow you to install a host of applications (Figure 2). - - -![Discover center][11] - -Figure 2: The Discover software center on Plasma Mobile. - -[Used with permission][9] - -Swipe up (or scroll down—depending on what hardware you’re using) to reveal the app drawer, where you can launch all of your installed applications (Figure 3). - -![KDE mobile][13] - -Figure 3: The Plasma Mobile app drawer ready to launch applications. - -[Used with permission][9] - -Open up a terminal window and you can take care of standard Linux admin tasks, such as using SSH to log into a remote server. Using apt, you can install all of the developer tools you need to make Plasma Mobile a powerful development platform. - -We’re talking serious mobile power—either from a phone or a tablet. - -### A ways to go - -Clearly Plasma Mobile is still way too early in development for it to be of any use to the average user. And because most virtual machine technology doesn’t play well with Wayland, you’re likely to get too frustrated with the current ISO image to thoroughly try it out. However, even without being able to fully install the platform (or get full usage out of it), it’s obvious KDE and Purism are going to have the ideal platform that will put Linux into the hands of mobile users. - -If you want to test the waters of Plasma Mobile on an actual mobile device, a handy list of supported hardware can be found [here][14] (for PostmarketOS) or [here][15] (for Halium). If you happen to be lucky enough to have a device that also includes Wi-Fi support, you’ll find you get more out of testing the environment. - -If you do have a supported device, you’ll need to use either [PostmarketOS][16] (a touch-optimized, pre-configured Alpine Linux that can be installed on smartphones and other mobile devices) or [Halium][15] (an application that creates an minimal Android layer which allows a new interface to interact with the Android kernel). Using Halium further limits the number of supported devices, as it has only been built for select hardware. However, if you’re willing, you can build your own Halium images (documentation for this process is found [here][17]). If you want to give PostmarketOS a go, [here are the necessary build instructions][18]. - -Suffice it to say, Plasma Mobile isn’t nearly ready for mass market. If you’re a Linux enthusiast and want to give it a go, let either PostmarketOS or Halium help you get the operating system up and running on your device. Otherwise, your best bet is to wait it out and hope Purism and KDE succeed in bringing this oustanding mobile take on Linux to the masses. - -Learn more about Linux through the free ["Introduction to Linux" ][19]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/learn/intro-to-linux/2018/2/plasma-mobile-could-give-life-mobile-linux-experience - -作者:[JACK WALLEN][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/jlwallen -[1]:https://launchpad.net/unity-scopes -[2]:http://www.samsung.com/global/galaxy/apps/samsung-dex/ -[3]:https://puri.sm/shop/librem-5/ -[4]:https://www.pureos.net/ -[5]:http://blog.bshah.in/2018/01/26/trying-out-plasma-mobile/ -[6]:https://antsle.com/ -[8]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/kdemobile_1.jpg?itok=EK3_vFVP (KDE mobile) -[9]:https://www.linux.com/licenses/category/used-permission -[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/kdemobile_2.jpg?itok=CiUQ-MnB (Discover center) -[13]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/kdemobile_3.jpg?itok=i6V8fgK8 (KDE mobile) -[14]:http://blog.bshah.in/2018/02/02/trying-out-plasma-mobile-part-two/ -[15]:https://github.com/halium/projectmanagement/issues?q=is%3Aissue+is%3Aopen+label%3APorts -[16]:https://postmarketos.org/ -[17]:http://docs.halium.org/en/latest/ -[18]:https://wiki.postmarketos.org/wiki/Installation_guide -[19]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/talk/20180223 Why culture is the most important issue in a DevOps transformation.md b/sources/talk/20180223 Why culture is the most important issue in a DevOps transformation.md deleted file mode 100644 index 8fe1b6f273..0000000000 --- a/sources/talk/20180223 Why culture is the most important issue in a DevOps transformation.md +++ /dev/null @@ -1,91 +0,0 @@ -Why culture is the most important issue in a DevOps transformation -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_community2.png?itok=1blC7-NY) - -You've been appointed the DevOps champion in your organisation: congratulations. So, what's the most important issue that you need to address? - -It's the technology—tools and the toolchain—right? Everybody knows that unless you get the right tools for the job, you're never going to make things work. You need integration with your existing stack (though whether you go with tight or loose integration will be an interesting question), a support plan (vendor, third party, or internal), and a bug-tracking system to go with your source code management system. And that's just the start. - -No! Don't be ridiculous: It's clearly the process that's most important. If the team doesn't agree on how stand-ups are run, who participates, the frequency and length of the meetings, and how many people are required for a quorum, then you'll never be able to institute a consistent, repeatable working pattern. - -In fact, although both the technology and the process are important, there's a third component that is equally important, but typically even harder to get right: culture. Yup, it's that touch-feely thing we techies tend to struggle with.1 - -### Culture - -I was visiting a midsized government institution a few months ago (not in the UK, as it happens), and we arrived a little early to meet the CEO and CTO. We were ushered into the CEO's office and waited for a while as the two of them finished participating in the daily stand-up. They apologised for being a minute or two late, but far from being offended, I was impressed. Here was an organisation where the culture of participation was clearly infused all the way up to the top. - -Not that culture can be imposed from the top—nor can you rely on it percolating up from the bottom3—but these two C-level execs were not only modelling the behaviour they expected from the rest of their team, but also seemed, from the brief discussion we had about the process afterwards, to be truly invested in it. If you can get management to buy into the process—and be seen buying in—you are at least likely to have problems with other groups finding plausible excuses to keep their distance and get away with it. - -So let's assume management believes you should give DevOps a go. Where do you start? - -Developers may well be your easiest target group. They are often keen to try new things and find ways to move things along faster, so they are often the group that can be expected to adopt new technologies and methodologies. DevOps arguably has been driven mainly by the development community. - -But you shouldn't assume all developers will be keen to embrace this change. For some, the way things have always been done—your Rick Parfitts of dev, if you will7—is fine. Finding ways to help them work efficiently in the new world is part of your job, not just theirs. If you have superstar developers who aren't happy with change, you risk alienating and losing them if you try to force them into your brave new world. What's worse, if they dig their heels in, you risk the adoption of your DevSecOps vision being compromised when they explain to their managers that things aren't going to change if it makes their lives more difficult and reduces their productivity. - -Maybe you're not going to be able to move all the systems and people to DevOps immediately. Maybe you're going to need to choose which apps start with and who will be your first DevOps champions. Maybe it's time to move slowly. - -### Not maybe: definitely - -No—I lied. You're definitely going to need to move slowly. Trying to change everything at once is a recipe for disaster. - -This goes for all elements of the change—which people to choose, which technologies to choose, which applications to choose, which user base to choose, which use cases to choose—bar one. For those elements, if you try to move everything in one go, you will fail. You'll fail for a number of reasons. You'll fail for reasons I can't imagine and, more importantly, for reasons you can't imagine. But some of the reasons will include: - - * People—most people—don't like change. - * Technologies don't like change (you can't just switch and expect everything to still work). - * Applications don't like change (things worked before, or at least failed in known ways). You want to change everything in one go? Well, they'll all fail in new and exciting9 ways. - * Users don't like change. - * Use cases don't like change. - - - -### The one exception - -You noticed I wrote "bar one" when discussing which elements you shouldn't choose to change all in one go? Well done. - -What's that exception? It's the initial team. When you choose your initial application to change and you're thinking about choosing the team to make that change, select the members carefully and select a complete set. This is important. If you choose just developers, just test folks, just security folks, just ops folks, or just management—if you leave out one functional group from your list—you won't have proved anything at all. Well, you might have proved to a small section of your community that it kind of works, but you'll have missed out on a trick. And that trick is: If you choose keen people from across your functional groups, it's much harder to fail. - -Say your first attempt goes brilliantly. How are you going to convince other people to replicate your success and adopt DevOps? Well, the company newsletter, of course. And that will convince how many people, exactly? Yes, that number.12 If, on the other hand, you have team members from across the functional parts or the organisation, when you succeed, they'll tell their colleagues and you'll get more buy-in next time. - -If it fails, if you've chosen your team wisely—if they're all enthusiastic and know that "fail often, fail fast" is good—they'll be ready to go again. - -Therefore, you need to choose enthusiasts from across your functional groups. They can work on the technologies and the process, and once that's working, it's the people who will create that cultural change. You can just sit back and enjoy. Until the next crisis, of course. - -1\. OK, you're right. It should be "with which we techies tend to struggle."2 - -2\. You thought I was going to qualify that bit about techies struggling with touchy-feely stuff, didn't you? Read it again: I put "tend to." That's the best you're getting. - -3\. Is percolating a bottom-up process? I don't drink coffee,4 so I wouldn't know. - -4\. Do people even use percolators to make coffee anymore? Feel free to let me know in the comments. I may pretend interest if you're lucky. - -5\. For U.S. readers (and some other countries, maybe?), please substitute "check" for "tick" here.6 - -6\. For U.S. techie readers, feel free to perform `s/tick/check/;`. - -7\. This is a Status Quo8 reference for which I'm extremely sorry. - -8\. For millennial readers, please consult your favourite online reference engine or just roll your eyes and move on. - -9\. For people who say, "but I love excitement," try being on call at 2 a.m. on a Sunday at the end of the quarter when your chief financial officer calls you up to ask why all of last month's sales figures have been corrupted with the letters "DEADBEEF."10 - -10\. For people not in the know, this is a string often used by techies as test data because a) it's non-numerical; b) it's numerical (in hexadecimal); c) it's easy to search for in debug files; and d) it's funny.11 - -11\. Though see.9 - -12\. It's a low number, is all I'm saying. - -This article originally appeared on [Alice, Eve, and Bob – a security blog][1] and is republished with permission. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/most-important-issue-devops-transformation - -作者:[Mike Bursell][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/mikecamel -[1]:https://aliceevebob.com/2018/02/06/moving-to-devops-whats-most-important/ diff --git a/sources/talk/20180301 How to hire the right DevOps talent.md b/sources/talk/20180301 How to hire the right DevOps talent.md deleted file mode 100644 index bcf9bb3d20..0000000000 --- a/sources/talk/20180301 How to hire the right DevOps talent.md +++ /dev/null @@ -1,48 +0,0 @@ -How to hire the right DevOps talent -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/desk_clock_job_work.jpg?itok=Nj4fuhl6) - -DevOps culture is quickly gaining ground, and demand for top-notch DevOps talent is greater than ever at companies all over the world. With the [annual base salary for a junior DevOps engineer][1] now topping $100,000, IT professionals are hurrying to [make the transition into DevOps.][2] - -But how do you choose the right candidate to fill your DevOps role? - -### Overview - -Most teams are looking for candidates with a background in operations and infrastructure, software engineering, or development. This is in conjunction with skills that relate to configuration management, continuous integration, and deployment (CI/CD), as well as cloud infrastructure. Knowledge of container orchestration is also in high demand. - -In a perfect world, the two backgrounds would meet somewhere in the middle to form Dev and Ops, but in most cases, candidates lean toward one side or the other. Yet they must possess the skills necessary to understand the needs of their counterparts to work effectively as a team to achieve continuous delivery and deployment. Since every company is different, there is no single right or wrong since so much depends on a company’s tech stack and infrastructure, as well as the goals and the skills of other team members. So how do you focus your search? - -### Decide on the background - -Begin by assessing the strength of your current team. Do you have rock-star software engineers but lack infrastructure knowledge? Focus on closing the skill gaps. Just because you have the budget to hire a DevOps engineer doesn’t mean you should spend weeks, or even months, trying to find the best software engineer who also happens to use Kubernetes and Docker because they are currently the trend. Instead, look for someone who will provide the most value in your environment, and see how things go from there. - -### There is no “Ctrl + F” solution - -Instead of concentrating on specific tools, concentrate on a candidate's understanding of DevOps and CI/CD-related processes. You'll be better off with someone who understands methodologies over tools. It is more important to ensure that candidates comprehend the concept of CI/CD than to ask if they prefer Jenkins, Bamboo, or TeamCity. Don’t get too caught up in the exact toolchain—rather, focus on problem-solving skills and the ability to increase efficiency, save time, and automate manual processes. You don't want to miss out on the right candidate just because the word “Puppet” was not on their resume. - -### Check your ego - -As mentioned above, DevOps is a rapidly growing field, and DevOps engineers are in hot demand. That means candidates have great buying power. You may have an amazing company or product, but hiring top talent is no longer as simple as putting up a “Help Wanted” sign and waiting for top-quality applicants to rush in. I'm not suggesting that maintaining a reputation a great place to work is unimportant, but in today's environment, you need to make an effort to sell your position. Flaws or glitches in the hiring process, such as abruptly canceling interviews or not offering feedback after interviews, can lead to negative reviews spreading across the industry. Remember, it takes just a couple of minutes to leave a negative review on Glassdoor. - -### Contractor or permanent employee? - -Most recruiters and hiring managers immediately start searching for a full-time employee, even though they may have other options. If you’re looking to design, build, and implement a new DevOps environment, why not hire a senior person who has done this in the past? Consider hiring a senior contractor, along with a junior full-time hire. That way, you can tap the knowledge and experience of the contractor by having them work with the junior employee. Contractors can be expensive, but they bring invaluable knowledge—especially if the work can be done within a short timeframe. - -### Cultivate from within - -With so many companies competing for talent, it is difficult to find the right DevOps engineer. Not only will you need to pay top dollar to hire this person, but you must also consider that the search can take several months. However, since few companies are lucky enough to find the ideal DevOps engineer, consider searching for a candidate internally. You might be surprised at the talent you can cultivate from within your own organization. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/how-hire-right-des-talentvop - -作者:[Stanislav Ivaschenko][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/ilyadudkin -[1]:https://www.glassdoor.com/Salaries/junior-devops-engineer-salary-SRCH_KO0,22.htm -[2]:https://squadex.com/insights/system-administrator-making-leap-devops/ diff --git a/sources/talk/20180302 Beyond metrics- How to operate as team on today-s open source project.md b/sources/talk/20180302 Beyond metrics- How to operate as team on today-s open source project.md deleted file mode 100644 index fb5454bbe4..0000000000 --- a/sources/talk/20180302 Beyond metrics- How to operate as team on today-s open source project.md +++ /dev/null @@ -1,53 +0,0 @@ -Beyond metrics: How to operate as team on today's open source project -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/diversity-women-meeting-team.png?itok=BdDKxT1w) - -How do we traditionally think about community health and vibrancy? - -We might quickly zero in on metrics related primarily to code contributions: How many companies are contributing? How many individuals? How many lines of code? Collectively, these speak to both the level of development activity and the breadth of the contributor base. The former speaks to whether the project continues to be enhanced and expanded; the latter to whether it has attracted a diverse group of developers or is controlled primarily by a single organization. - -The [Linux Kernel Development Report][1] tracks these kinds of statistics and, unsurprisingly, it appears extremely healthy on all counts. - -However, while development cadence and code contributions are still clearly important, other aspects of the open source communities are also coming to the forefront. This is in part because, increasingly, open source is about more than a development model. It’s also about making it easier for users and other interested parties to interact in ways that go beyond being passive recipients of code. Of course, there have long been user groups. But open source streamlines the involvement of users, just as it does software development. - -This was the topic of my discussion with Diane Mueller, the director of community development for OpenShift. - -When OpenShift became a container platform based in part on Kubernetes in version 3, Mueller saw a need to broaden the community beyond the core code contributors. In part, this was because OpenShift was increasingly touching a broad range of open source projects and organizations such those associated with the [Open Container Initiative (OCI)][2] and the [Cloud Native Computing Foundation (CNCF)][3]. In addition to users, cloud service providers who were offering managed services also wanted ways to get involved in the project. - -“What we tried to do was open up our minds about what the community constituted,” Mueller explained, adding, “We called it the [Commons][4] because Red Hat's near Boston, and I'm from that area. Boston Common is a shared resource, the grass where you bring your cows to graze, and you have your farmer's hipster market or whatever it is today that they do on Boston Common.” - -This new model, she said, was really “a new ecosystem that incorporated all of those different parties and different perspectives. We used a lot of virtual tools, a lot of new tools like Slack. We stepped up beyond the mailing list. We do weekly briefings. We went very virtual because, one, I don't scale. The Evangelist and Dev Advocate team didn't scale. We need to be able to get all that word out there, all this new information out there, so we went very virtual. We worked with a lot of people to create online learning stuff, a lot of really good tooling, and we had a lot of community help and support in doing that.” - -![diane mueller open shift][6] - -Diane Mueller, director of community development at Open Shift, discusses the role of strong user communities in open source software development. (Credit: Gordon Haff, CC BY-SA 4.0) - -However, one interesting aspect of the Commons model is that it isn’t just virtual. We see the same pattern elsewhere in many successful open source communities, such as the Linux kernel. Lots of day-to-day activities happen on mailings lists, IRC, and other collaboration tools. But this doesn’t eliminate the benefits of face-to-face time that allows for both richer and informal discussions and exchanges. - -This interview with Mueller took place in London the day after the [OpenShift Commons Gathering][7]. Gatherings are full-day events, held a number of times a year, which are typically attended by a few hundred people. Much of the focus is on users and user stories. In fact, Mueller notes, “Here in London, one of the Commons members, Secnix, was really the major reason we actually hosted the gathering here. Justin Cook did an amazing job organizing the venue and helping us pull this whole thing together in less than 50 days. A lot of the community gatherings and things are driven by the Commons members.” - -Mueller wants to focus on users more and more. “The OpenShift Commons gathering at [Red Hat] Summit will be almost entirely case studies,” she noted. “Users talking about what's in their stack. What lessons did they learn? What are the best practices? Sharing those ideas that they've done just like we did here in London.” - -Although the Commons model grew out of some specific OpenShift needs at the time it was created, Mueller believes it’s an approach that can be applied more broadly. “I think if you abstract what we've done, you can apply it to any existing open source community,” she said. “The foundations still, in some ways, play a nice role in giving you some structure around governance, and helping incubate stuff, and helping create standards. I really love what OCI is doing to create standards around containers. There's still a role for that in some ways. I think the lesson that we can learn from the experience and we can apply to other projects is to open up the community so that it includes feedback mechanisms and gives the podium away.” - -The evolution of the community model though approaches like the OpenShift Commons mirror the healthy evolution of open source more broadly. Certainly, some users have been involved in the development of open source software for a long time. What’s striking today is how widespread and pervasive direct user participation has become. Sure, open source remains central to much of modern software development. But it’s also becoming increasingly central to how users learn from each other and work together with their partners and developers. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/how-communities-are-evolving - -作者:[Gordon Haff][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/ghaff -[1]:https://www.linuxfoundation.org/2017-linux-kernel-report-landing-page/ -[2]:https://www.opencontainers.org/ -[3]:https://www.cncf.io/ -[4]:https://commons.openshift.org/ -[5]:/file/388586 -[6]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/39369010275_7df2c3c260_z.jpg?itok=gIhnBl6F (diane mueller open shift) -[7]:https://www.meetup.com/London-OpenShift-User-Group/events/246498196/ diff --git a/sources/talk/20180303 4 meetup ideas- Make your data open.md b/sources/talk/20180303 4 meetup ideas- Make your data open.md deleted file mode 100644 index a431b8376a..0000000000 --- a/sources/talk/20180303 4 meetup ideas- Make your data open.md +++ /dev/null @@ -1,75 +0,0 @@ -4 meetup ideas: Make your data open -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/people_team_community_group.png?itok=Nc_lTsUK) - -[Open Data Day][1] (ODD) is an annual, worldwide celebration of open data and an opportunity to show the importance of open data in improving our communities. - -Not many individuals and organizations know about the meaningfulness of open data or why they might want to liberate their data from the restrictions of copyright, patents, and more. They also don't know how to make their data open—that is, publicly available for anyone to use, share, or republish with modifications. - -This year ODD falls on Saturday, March 3, and there are [events planned][2] in every continent except Antarctica. While it might be too late to organize an event for this year, it's never too early to plan for next year. Also, since open data is important every day of the year, there's no reason to wait until ODD 2019 to host an event in your community. - -There are many ways to build local awareness of open data. Here are four ideas to help plan an excellent open data event any time of year. - -### 1. Organize an entry-level event - -You can host an educational event at a local library, college, or another public venue about how open data can be used and why it matters for all of us. If possible, invite a [local speaker][3] or have someone present remotely. You could also have a roundtable discussion with several knowledgeable people in your community. - -Consider offering resources such as the [Open Data Handbook][4], which not only provides a guide to the philosophy and rationale behind adopting open data, but also offers case studies, use cases, how-to guides, and other material to support making data open. - -### 2. Organize an advanced-level event - -For a deeper experience, organize a hands-on training event for open data newbies. Ideas for good topics include [training teachers on open science][5], [creating audiovisual expressions from open data][6], and using [open government data][7] in meaningful ways. - -The options are endless. To choose a topic, think about what is locally relevant, identify issues that open data might be able to address, and find people who can do the training. - -### 3. Organize a hackathon - -Open data hackathons can be a great way to bring open data advocates, developers, and enthusiasts together under one roof. Hackathons are more than just training sessions, though; the idea is to build prototypes or solve real-life challenges that are tied to open data. In a hackathon, people in various groups can contribute to the entire assembly line in multiple ways, such as identifying issues by working collaboratively through [Etherpad][8] or creating focus groups. - -Once the hackathon is over, make sure to upload all the useful data that is produced to the internet with an open license. - -### 4. Release or relicense data as open - -Open data is about making meaningful data publicly available under open licenses while protecting any data that might put people's private information at risk. (Learn [how to protect private data][9].) Try to find existing, interesting, and useful data that is privately owned by individuals or organizations and negotiate with them to relicense or release the data online under any of the [recommended open data licenses][10]. The widely popular [Creative Commons licenses][11] (particularly the CC0 license and the 4.0 licenses) are quite compatible with relicensing public data. (See this FAQ from Creative Commons for more information on [openly licensing data][12].) - -Open data can be published on multiple platforms—your website, [GitHub][13], [GitLab][14], [DataHub.io][15], or anywhere else that supports open standards. - -### Tips for event success - -No matter what type of event you decide to do, here are some general planning tips to improve your chances of success. - - * Find a venue that's accessible to the people you want to reach, such as a library, a school, or a community center. - * Create a curriculum that will engage the participants. - * Invite your target audience—make sure to distribute information through social media, community events calendars, Meetup, and the like. - - - -Have you attended or hosted a successful open data event? If so, please share your ideas in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/celebrate-open-data-day - -作者:[Subhashish Panigraphi][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/psubhashish -[1]:http://www.opendataday.org/ -[2]:http://opendataday.org/#map -[3]:https://openspeakers.org/ -[4]:http://opendatahandbook.org/ -[5]:https://docs.google.com/forms/d/1BRsyzlbn8KEMP8OkvjyttGgIKuTSgETZW9NHRtCbT1s/viewform?edit_requested=true -[6]:http://dattack.lv/en/ -[7]:https://www.eventbrite.co.nz/e/open-data-open-potential-event-friday-2-march-2018-tickets-42733708673 -[8]:http://etherpad.org/ -[9]:https://ssd.eff.org/en/module/keeping-your-data-safe -[10]:https://opendatacommons.org/licenses/ -[11]:https://creativecommons.org/share-your-work/licensing-types-examples/ -[12]:https://wiki.creativecommons.org/wiki/Data#Frequently_asked_questions_about_data_and_CC_licenses -[13]:https://github.com/MartinBriza/MediaWriter -[14]:https://about.gitlab.com/ -[15]:https://datahub.io/ diff --git a/sources/talk/20180314 How to apply systems thinking in DevOps.md b/sources/talk/20180314 How to apply systems thinking in DevOps.md deleted file mode 100644 index c35eb041bd..0000000000 --- a/sources/talk/20180314 How to apply systems thinking in DevOps.md +++ /dev/null @@ -1,89 +0,0 @@ -How to apply systems thinking in DevOps -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_kid_education.png?itok=3lRp6gFa) -For most organizations, adopting DevOps requires a mindset shift. Unless you understand the core of [DevOps][1], you might think it's hype or just another buzzword—or worse, you might believe you have already adopted DevOps because you are using the right tools. - -Let’s dig deeper into what DevOps means, and explore how to apply systems thinking in your organization. - -### What is systems thinking? - -Systems thinking is a holistic approach to problem-solving. It's the opposite of analytical thinking, which separates a problem from the "bigger picture" to better understand it. Instead, systems thinking studies all the elements of a problem, along with the interactions between these elements. - -Most people are not used to thinking this way. Since childhood, most of us were taught math, science, and every other subject separately, by different teachers. This approach to learning follows us throughout our lives, from school to university to the workplace. When we first join an organization, we typically work in only one department. - -Unfortunately, the world is not that simple. Complexity, unpredictability, and sometimes chaos are unavoidable and require a broader way of thinking. Systems thinking helps us understand the systems we are part of, which in turn enables us to manage them rather than be controlled by them. - -According to systems thinking, everything is a system: your body, your family, your neighborhood, your city, your company, and even the communities you belong to. These systems evolve organically; they are alive and fluid. The better you understand a system's behavior, the better you can manage and leverage it. You become their change agent and are accountable for them. - -### Systems thinking and DevOps - -All systems include properties that DevOps addresses through its practices and tools. Awareness of these properties helps us properly adapt to DevOps. Let's look at the properties of a system and how DevOps relates to each one. - -### How systems work - -The figure below represents a system. To reach a goal, the system requires input, which is processed and generates output. Feedback is essential for moving the system toward the goal. Without a purpose, the system dies. - -![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/system.png?itok=UlqAf39I) - -If an organization is a system, its departments are subsystems. The flow of work moves through each department, starting with identifying a market need (the first input on the left) and moving toward releasing a solution that meets that need (the last output on the right). The output that each department generates serves as required input for the next department in the chain. - -The more specialized teams an organization has, the more handoffs happen between departments. The process of generating value to clients is more likely to create bottlenecks and thus it takes longer to deliver value. Also, when work is passed between teams, the gap between the goal and what has been done widens. - -DevOps aims to optimize the flow of work throughout the organization to deliver value to clients faster—in other words, DevOps reduces time to market. This is done in part by maximizing automation, but mainly by targeting the organization's goals. This empowers prioritization and reduces duplicated work and other inefficiencies that happen during the delivery process. - -### System deterioration - -All systems are affected by entropy. Nothing can prevent system degradation; that's irreversible. The tendency to decline shows the failure nature of systems. Moreover, systems are subject to threats of all types, and failure is a matter of time. - -To mitigate entropy, systems require constant maintenance and improvements. The effects of entropy can be delayed only when new actions are taken or input is changed. - -This pattern of deterioration and its opposite force, survival, can be observed in living organisms, social relationships, and other systems as well as in organizations. In fact, if an organization is not evolving, entropy is guaranteed to be increasing. - -DevOps attempts to break the entropy process within an organization by fostering continuous learning and improvement. With DevOps, the organization becomes fault-tolerant because it recognizes the inevitability of failure. DevOps enables a blameless culture that offers the opportunity to learn from failure. The [postmortem][2] is an example of a DevOps practice used by organizations that embrace inherent failure. - -The idea of intentionally embracing failure may sound counterintuitive, but that's exactly what happens in techniques like [Chaos Monkey][3]: Failure is intentionally introduced to improve availability and reliability in the system. DevOps suggests that putting some pressure into the system in a controlled way is not a bad thing. Like a muscle that gets stronger with exercise, the system benefits from the challenge. - -### System complexity - -The figure below shows how complex the systems can be. In most cases, one effect can have multiple causes, and one cause can generate multiple effects. The more elements and interactions a system has, the more complex the system. - -![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/system-complexity.png?itok=GYZS00Lm) - -In this scenario, we can't immediately identify the reason for a particular event. Likewise, we can't predict with 100% certainty what will happen if a specific action is taken. We are constantly making assumptions and dealing with hypotheses. - -System complexity can be explained using the scientific method. In a recent study, for example, mice that were fed excess salt showed suppressed cerebral blood flow. This same experiment would have had different results if, say, the mice were fed sugar and salt. One variable can radically change results in complex systems. - -DevOps handles complexity by encouraging experimentation—for example, using the scientific method—and reducing feedback cycles. Smaller changes inserted into the system can be tested and validated more quickly. With a "[fail-fast][4]" approach, organizations can pivot quickly and achieve resiliency. Reacting rapidly to changes makes organizations more adaptable. - -DevOps also aims to minimize guesswork and maximize understanding by making the process of delivering value more tangible. By measuring processes, revealing flaws and advantages, and monitoring as much as possible, DevOps helps organizations discover the changes they need to make. - -### System limitations - -All systems have constraints that limit their performance; a system's overall capacity is delimited by its restrictions. Most of us have learned from experience that systems operating too long at full capacity can crash, and most systems work better when they function with some slack. Ignoring limitations puts systems at risk. For example, when we are under too much stress for a long time, we get sick. Similarly, overused vehicle engines can be damaged. - -This principle also applies to organizations. Unfortunately, organizations can't put everything into a system at once. Although this limitation may sometimes lead to frustration, the quality of work usually improves when input is reduced. - -Consider what happened when the speed limit on the main roads in São Paulo, Brazil was reduced from 90 km/h to 70 km/h. Studies showed that the number of accidents decreased by 38.5% and the average speed increased by 8.7%. In other words, the entire road system improved and more vehicles arrived safely at their destinations. - -For organizations, DevOps suggests global rather than local improvements. It doesn't matter if some improvement is put after a constraint because there's no effect on the system at all. One constraint that DevOps addresses, for instance, is dependency on specialized teams. DevOps brings to organizations a more collaborative culture, knowledge sharing, and cross-functional teams. - -### Conclusion - -Before adopting DevOps, understand what is involved and how you want to apply it to your organization. Systems thinking will help you accomplish that while also opening your mind to new possibilities. DevOps may be seen as a popular trend today, but in 10 or 20 years, it will be status quo. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/how-apply-systems-thinking-devops - -作者:[Gustavo Muniz do Carmo][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/gustavomcarmo -[1]:https://opensource.com/tags/devops -[2]:https://landing.google.com/sre/book/chapters/postmortem-culture.html -[3]:https://medium.com/netflix-techblog/the-netflix-simian-army-16e57fbab116 -[4]:https://en.wikipedia.org/wiki/Fail-fast diff --git a/sources/talk/20180315 6 ways a thriving community will help your project succeed.md b/sources/talk/20180315 6 ways a thriving community will help your project succeed.md deleted file mode 100644 index cf15b7f06f..0000000000 --- a/sources/talk/20180315 6 ways a thriving community will help your project succeed.md +++ /dev/null @@ -1,111 +0,0 @@ -6 ways a thriving community will help your project succeed -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_community_lead.jpg?itok=F9KKLI7x) -NethServer is an open source product that my company, [Nethesis][1], launched just a few years ago. [The product][2] wouldn't be [what it is today][3] without the vibrant community that surrounds and supports it. - -In my previous article, I [discussed what organizations should expect to give][4] if they want to experience the benefits of thriving communities. In this article, I'll describe what organizations should expect to receive in return for their investments in the passionate people that make up their communities. - -Let's review six benefits. - -### 1\. Innovation - -"Open innovation" occurs when a company sharing information also listens to the feedback and suggestions from outside the company. As a company, we don't just look at the crowd for ideas. We innovate in, with, and through communities. - -You may know that "[the best way to have a good idea is to have a lot of ideas][5]." You can't always expect to have the right idea on your own, so having different point of views on your product is essential. How many truly disruptive ideas can a small company (like Nethesis) create? We're all young, caucasian, and European—while in our community, we can pick up a set of inspirations from a variety of people, with different genders, backgrounds, skills, and ethnicities. - -So the ability to invite the entire world to continuously improve the product is now no longer a dream; it's happening before our eyes. Your community could be the idea factory for innovation. With the community, you can really leverage the power of the collective. - -No matter who you are, most of the smartest people work for someone else. And community is the way to reach those smart people and work with them. - -### 2\. Research - -A community can be your strongest source of valuable product research. - -First, it can help you avoid "ivory tower development." [As Stack Exchange co-founder Jeff Atwood has said][6], creating an environment where developers have no idea who the users are is dangerous. Isolated developers, who have worked for years in their high towers, often encounter bad results because they don't have any clue about how users actually use their software. Developing in an Ivory tower keeps you away from your users and can only lead to bad decisions. A community brings developers back to reality and helps them stay grounded. Gone are the days of developers working in isolation with limited resources. In this day and age, thanks to the advent of open source communities research department is opening up to the entire world. - -No matter who you are, most of the smartest people work for someone else. And community is the way to reach those smart people and work with them. - -Second, a community can be an obvious source of product feedback—always necessary as you're researching potential paths forward. If someone gives you feedback, it means that person cares about you. It's a big gift. The community is a good place to acquire such invaluable feedback. Receiving early feedback is super important, because it reduces the cost of developing something that doesn't work in your target market. You can safely fail early, fail fast, and fail often. - -And third, communities help you generate comparisons with other projects. You can't know all the features, pros, and cons of your competitors' offerings. [The community, however, can.][7] Ask your community. - -### 3\. Perspective - -Communities enable companies to look at themselves and their products [from the outside][8], letting them catch strengths and weaknesses, and mostly realize who their products' audiences really are. - -Let me offer an example. When we launched the NethServer, we chose a catchy tagline for it. We were all convinced the following sentence was perfect: - -> [NethServer][9] is an operating system for Linux enthusiasts, designed for small offices and medium enterprises. - -Two years have passed since then. And we've learned that sentence was an epic fail. - -We failed to realize who our audience was. Now we know: NethServer is not just for Linux enthusiasts; actually, Windows users are the majority. It's not just for small offices and medium enterprises; actually, several home users install NethServer for personal use. Our community helps us to fully understand our product and look at it from our users' eyes. - -### 4\. Development - -In open source communities especially, communities can be a welcome source of product development. - -They can, first of all, provide testing and bug reporting. In fact, if I ask my developers about the most important community benefit, they'd answer "testing and bug reporting." Definitely. But because your code is freely available to the whole world, practically anyone with a good working knowledge of it (even hobbyists and other companies) has the opportunity to play with it, tweak it, and constantly improve it (even develop additional modules, as in our case). People can do more than just report bugs; they can fix those bugs, too, if they have the time and knowledge. - -But the community doesn't just create code. It can also generate resources like [how-to guides,][10] FAQs, support documents, and case studies. How much would it cost to fully translate your product in seven different languages? At NethServer, we got that for free—thanks to our community members. - -### 5\. Marketing - -Communities can help your company go global. Our small Italian company, for example, wasn't prepared for a global market. The community got us prepared. For example, we needed to study and improve our English so we could read and write correctly or speak in public without looking foolish for an audience. The community gently forced us to organize [our first NethServer Conference][11], too—only in English. - -A strong community can also help your organization attain the holy grail of marketers everywhere: word of mouth marketing (or what Seth Godin calls "[tribal marketing][12]"). - -Communities ensure that your company's messaging travels not only from company to tribe but also "sideways," from tribe member to potential tribe member. The community will become your street team, spreading word of your organization and its projects to anyone who will listen. - -In addition, communities help organizations satisfy one of the most fundamental members needs: the desire to belong, to be involved in something bigger than themselves, and to change the world together. - -Never forget that working with communities is always a matter of giving and taking—striking a delicate balance between the company and the community. - -### 6\. Loyalty - -Attracting new users costs a business five times as much as keeping an existing one. So loyalty can have a huge impact on your bottom line. Quite simply, community helps us build brand loyalty. It's much more difficult to leave a group of people you're connected to than a faceless product or company. In a community, you're building connections with people, which is way more powerful than features or money (trust me!). - -### Conclusion - -Never forget that working with communities is always a matter of giving and taking—striking a delicate balance between the company and the community. - -And I wouldn't be honest with you if I didn't admit that the approach has some drawbacks. Doing everything in the open means moderating, evaluating, and processing of all the data you're receiving. Supporting your members and leading the discussions definitely takes time and resources. But, if you look at what a community enables, you'll see that all this is totally worth the effort. - -As my friend and mentor [David Spinks keeps saying over and over again][13], "Companies fail their communities when when they treat community as a tactic instead of making it a core part of their business philosophy." And [as I've said][4]: Communities aren't simply extensions of your marketing teams; "community" isn't an efficient short-term strategy. When community is a core part of your business philosophy, it can do so much more than give you short-term returns. - -At Nethesis we experience that every single day. As a small company, we could never have achieved the results we have without our community. Never. - -Community can completely set your business apart from every other company in the field. It can redefine markets. It can inspire millions of people, give them a sense of belonging, and make them feel an incredible bond with your company. - -And it can make you a whole lot of money. - -Community-driven companies will always win. Remember that. - -[Subscribe to our weekly newsletter][14] to learn more about open organizations. - --------------------------------------------------------------------------------- - -via: https://opensource.com/open-organization/18/3/why-build-community-3 - -作者:[Alessio Fattorini][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/alefattorini -[1]:http://www.nethesis.it/ -[2]:https://www.nethserver.org/ -[3]:https://distrowatch.com/table.php?distribution=nethserver -[4]:https://opensource.com/open-organization/18/2/why-build-community-2 -[5]:https://www.goodreads.com/author/quotes/52938.Linus_Pauling -[6]:https://blog.codinghorror.com/ivory-tower-development/ -[7]:https://community.nethserver.org/tags/comparison -[8]:https://community.nethserver.org/t/improve-our-communication/2569 -[9]:http://www.nethserver.org/ -[10]:https://community.nethserver.org/c/howto -[11]:https://community.nethserver.org/t/nethserver-conference-in-italy-sept-29-30-2017/6404 -[12]:https://www.ted.com/talks/seth_godin_on_the_tribes_we_lead -[13]:http://cmxhub.com/article/community-business-philosophy-tactic/ -[14]:https://opensource.com/open-organization/resources/newsletter diff --git a/sources/talk/20180315 Lessons Learned from Growing an Open Source Project Too Fast.md b/sources/talk/20180315 Lessons Learned from Growing an Open Source Project Too Fast.md deleted file mode 100644 index 6ae7cbea2c..0000000000 --- a/sources/talk/20180315 Lessons Learned from Growing an Open Source Project Too Fast.md +++ /dev/null @@ -1,40 +0,0 @@ -Lessons Learned from Growing an Open Source Project Too Fast -====== -![open source project][1] - -Are you managing an open source project or considering launching one? If so, it may come as a surprise that one of the challenges you can face is rapid growth. Matt Butcher, Principal Software Development Engineer at Microsoft, addressed this issue in a presentation at Open Source Summit North America. His talk covered everything from teamwork to the importance of knowing your goals and sticking to them. - -Butcher is no stranger to managing open source projects. As [Microsoft invests more deeply into open source][2], Butcher has been involved with many projects, including toolkits for Kubernetes and QueryPath, the jQuery-like library for PHP. - -Butcher described a case study involving Kubernetes Helm, a package system for Kubernetes. Helm arose from a company team-building hackathon, with an original team of three people giving birth to it. Within 18 months, the project had hundreds of contributors and thousands of active users. - -### Teamwork - -“We were stretched to our limits as we learned to grow,” Butcher said. “When you’re trying to set up your team of core maintainers and they’re all trying to work together, you want to spend some actual time trying to optimize for a process that lets you be cooperative. You have to adjust some expectations regarding how you treat each other. When you’re working as a group of open source collaborators, the relationship is not employer/employee necessarily. It’s a collaborative effort.” - -In addition to focusing on the right kinds of teamwork, Butcher and his collaborators learned that managing governance and standards is an ongoing challenge. “You want people to understand who makes decisions, how they make decisions and why they make the decisions that they make,” he said. “When we were a small project, there might have been two paragraphs in one of our documents on standards, but as a project grows and you get growing pains, these documented things gain a life of their own. They get their very own repositories, and they just keep getting bigger along with the project.” - -Should all discussion surrounding a open source project go on in public, bathed in the hot lights of community scrutiny? Not necessarily, Butcher noted. “A minor thing can get blown into catastrophic proportions in a short time because of misunderstandings and because something that should have been done in private ended up being public,” he said. “Sometimes we actually make architectural recommendations as a closed group. The reason we do this is that we don’t want to miscue the community. The people who are your core maintainers are core maintainers because they’re experts, right? These are the people that have been selected from the community because they understand the project. They understand what people are trying to do with it. They understand the frustrations and concerns of users.” - -### Acknowledge Contributions - -Butcher added that it is essential to acknowledge people’s contributions to keep the environment surrounding a fast-growing project from becoming toxic. “We actually have an internal rule in our core maintainers guide that says, ‘Make sure that at least one comment that you leave on a code review, if you’re asking for changes, is a positive one,” he said. “It sounds really juvenile, right? But it serves a specific purpose. It lets somebody know, ‘I acknowledge that you just made a gift of your time and your resources.” - -Want more tips on successfully launching and managing open source projects? Stay tuned for more insight from Matt Butcher’s talk, in which he provides specific project management issues faced by Kubernetes Helm. - -For more information, be sure to check out [The Linux Foundation’s growing list of Open Source Guides for the Enterprise][3], covering topics such as starting an open source project, improving your open source impact, and participating in open source communities. - --------------------------------------------------------------------------------- - -via: https://www.linuxfoundation.org/blog/lessons-learned-from-growing-an-open-source-project-too-fast/ - -作者:[Sam Dean][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linuxfoundation.org/author/sdean/ -[1]:https://www.linuxfoundation.org/wp-content/uploads/2018/03/huskies-2279627_1920.jpg -[2]:https://thenewstack.io/microsoft-shifting-emphasis-open-source/ -[3]:https://www.linuxfoundation.org/resources/open-source-guides/ diff --git a/sources/talk/20180316 How to avoid humiliating newcomers- A guide for advanced developers.md b/sources/talk/20180316 How to avoid humiliating newcomers- A guide for advanced developers.md deleted file mode 100644 index e433e85d5f..0000000000 --- a/sources/talk/20180316 How to avoid humiliating newcomers- A guide for advanced developers.md +++ /dev/null @@ -1,119 +0,0 @@ -How to avoid humiliating newcomers: A guide for advanced developers -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy) -Every year in New York City, a few thousand young men come to town, dress up like Santa Claus, and do a pub crawl. One year during this SantaCon event, I was walking on the sidewalk and minding my own business, when I saw an extraordinary scene. There was a man dressed up in a red hat and red jacket, and he was talking to a homeless man who was sitting in a wheelchair. The homeless man asked Santa Claus, "Can you spare some change?" Santa dug into his pocket and brought out a $5 bill. He hesitated, then gave it to the homeless man. The homeless man put the bill in his pocket. - -In an instant, something went wrong. Santa yelled at the homeless man, "I gave you $5. I wanted to give you one dollar, but five is the smallest I had, so you oughtta be grateful. This is your lucky day, man. You should at least say thank you!" - -This was a terrible scene to witness. First, the power difference was terrible: Santa was an able-bodied white man with money and a home, and the other man was black, homeless, and using a wheelchair. It was also terrible because Santa Claus was dressed like the very symbol of generosity! And he was behaving like Santa until, in an instant, something went wrong and he became cruel. - -This is not merely a story about Drunk Santa, however; this is a story about technology communities. We, too, try to be generous when we answer new programmers' questions, and every day our generosity turns to rage. Why? - -### My cruelty - -I'm reminded of my own bad behavior in the past. I was hanging out on my company's Slack when a new colleague asked a question. - -> **New Colleague:** Hey, does anyone know how to do such-and-such with MongoDB? -> **Jesse:** That's going to be implemented in the next release. -> **New Colleague:** What's the ticket number for that feature? -> **Jesse:** I memorize all ticket numbers. It's #12345. -> **New Colleague:** Are you sure? I can't find ticket 12345. - -He had missed my sarcasm, and his mistake embarrassed him in front of his peers. I laughed to myself, and then I felt terrible. As one of the most senior programmers at MongoDB, I should not have been setting this example. And yet, such behavior is commonplace among programmers everywhere: We get sarcastic with newcomers, and we humiliate them. - -### Why does it matter? - -Perhaps you are not here to make friends; you are here to write code. If the code works, does it matter if we are nice to each other or not? - -A few months ago on the Stack Overflow blog, David Robinson showed that [Python has been growing dramatically][1], and it is now the top language that people view questions about on Stack Overflow. Even in the most pessimistic forecast, it will far outgrow the other languages this year. - -![Projections for programming language popularity][2] - -If you are a Python expert, then the line surging up and to the right is good news for you. It does not represent competition, but confirmation. As more new programmers learn Python, our expertise becomes ever more valuable, and we will see that reflected in our salaries, our job opportunities, and our job security. - -But there is a danger. There are soon to be more new Python programmers than ever before. To sustain this growth, we must welcome them, and we are not always a welcoming bunch. - -### The trouble with Stack Overflow - -I searched Stack Overflow for rude answers to beginners' questions, and they were not hard to find. - -![An abusive answer on StackOverflow][3] - -The message is plain: If you are asking a question this stupid, you are doomed. Get out. - -I immediately found another example of bad behavior: - -![Another abusive answer on Stack Overflow][4] - -Who has never been confused by Unicode in Python? Yet the message is clear: You do not belong here. Get out. - -Do you remember how it felt when you needed help and someone insulted you? It feels terrible. And it decimates the community. Some of our best experts leave every day because they see us treating each other this way. Maybe they still program Python, but they are no longer participating in conversations online. This cruelty drives away newcomers, too, particularly members of groups underrepresented in tech who might not be confident they belong. People who could have become the great Python programmers of the next generation, but if they ask a question and somebody is cruel to them, they leave. - -This is not in our interest. It hurts our community, and it makes our skills less valuable because we drive people out. So, why do we act against our own interests? - -### Why generosity turns to rage - -There are a few scenarios that really push my buttons. One is when I act generously but don't get the acknowledgment I expect. (I am not the only person with this resentment: This is probably why Drunk Santa snapped when he gave a $5 bill to a homeless man and did not receive any thanks.) - -Another is when answering requires more effort than I expect. An example is when my colleague asked a question on Slack and followed-up with, "What's the ticket number?" I had judged how long it would take to help him, and when he asked for more help, I lost my temper. - -These scenarios boil down to one problem: I have expectations for how things are going to go, and when those expectations are violated, I get angry. - -I've been studying Buddhism for years, so my understanding of this topic is based in Buddhism. I like to think that the Buddha discussed the problem of expectations in his first tech talk when, in his mid-30s, he experienced a breakthrough after years of meditation and convened a small conference to discuss his findings. He had not rented a venue, so he sat under a tree. The attendees were a handful of meditators the Buddha had met during his wanderings in northern India. The Buddha explained that he had discovered four truths: - - * First, that to be alive is to be dissatisfied—to want things to be better than they are now. - * Second, this dissatisfaction is caused by wants; specifically, by our expectation that if we acquire what we want and eliminate what we do not want, it will make us happy for a long time. This expectation is unrealistic: If I get a promotion or if I delete 10 emails, it is temporarily satisfying, but it does not make me happy over the long-term. We are dissatisfied because every material thing quickly disappoints us. - * The third truth is that we can be liberated from this dissatisfaction by accepting our lives as they are. - * The fourth truth is that the way to transform ourselves is to understand our minds and to live a generous and ethical life. - - - -I still get angry at people on the internet. It happened to me recently, when someone posted a comment on [a video I published about Python co-routines][5]. It had taken me months of research and preparation to create this video, and then a newcomer commented, "I want to master python what should I do." - -![Comment on YouTube][6] - -This infuriated me. My first impulse was to be sarcastic, "For starters, maybe you could spell Python with a capital P and end a question with a question mark." Fortunately, I recognized my anger before I acted on it, and closed the tab instead. Sometimes liberation is just a Command+W away. - -### What to do about it - -If you joined a community with the intent to be helpful but on occasion find yourself flying into a rage, I have a method to prevent this. For me, it is the step when I ask myself, "Am I angry?" Knowing is most of the battle. Online, however, we can lose track of our emotions. It is well-established that one reason we are cruel on the internet is because, without seeing or hearing the other person, our natural empathy is not activated. But the other problem with the internet is that, when we use computers, we lose awareness of our bodies. I can be angry and type a sarcastic message without even knowing I am angry. I do not feel my heart pound and my neck grow tense. So, the most important step is to ask myself, "How do I feel?" - -If I am too angry to answer, I can usually walk away. As [Thumper learned in Bambi][7], "If you can't say something nice, don't say nothing at all." - -### The reward - -Helping a newcomer is its own reward, whether you receive thanks or not. But it does not hurt to treat yourself to a glass of whiskey or a chocolate, or just a sigh of satisfaction after your good deed. - -But besides our personal rewards, the payoff for the Python community is immense. We keep the line surging up and to the right. Python continues growing, and that makes our own skills more valuable. We welcome new members, people who might not be sure they belong with us, by reassuring them that there is no such thing as a stupid question. We use Python to create an inclusive and diverse community around writing code. And besides, it simply feels good to be part of a community where people treat each other with respect. It is the kind of community that I want to be a member of. - -### The three-breath vow - -There is one idea I hope you remember from this article: To control our behavior online, we must occasionally pause and notice our feelings. I invite you, if you so choose, to repeat the following vow out loud: - -> I vow -> to take three breaths -> before I answer a question online. - -This article is based on a talk, [Why Generosity Turns To Rage, and What To Do About It][8], that Jesse gave at PyTennessee in February. For more insight for Python developers, attend [PyCon 2018][9], May 9-17 in Cleveland, Ohio. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/avoid-humiliating-newcomers - -作者:[A. Jesse][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/emptysquare -[1]:https://stackoverflow.blog/2017/09/06/incredible-growth-python/ -[2]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/projections.png?itok=5QTeJ4oe (Projections for programming language popularity) -[3]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/abusive-answer-1.jpg?itok=BIWW10Rl (An abusive answer on StackOverflow) -[4]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/abusive-answer-2.jpg?itok=0L-n7T-k (Another abusive answer on Stack Overflow) -[5]:https://www.youtube.com/watch?v=7sCu4gEjH5I -[6]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/i-want-to-master-python.png?itok=Y-2u1XwA (Comment on YouTube) -[7]:https://www.youtube.com/watch?v=nGt9jAkWie4 -[8]:https://www.pytennessee.org/schedule/presentation/175/ -[9]:https://us.pycon.org/2018/ diff --git a/sources/talk/20180320 Easily Fund Open Source Projects With These Platforms.md b/sources/talk/20180320 Easily Fund Open Source Projects With These Platforms.md deleted file mode 100644 index 8c02ca228b..0000000000 --- a/sources/talk/20180320 Easily Fund Open Source Projects With These Platforms.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Easily Fund Open Source Projects With These Platforms) -[#]: via: (https://itsfoss.com/open-source-funding-platforms/) -[#]: author: ([Ambarish Kumar](https://itsfoss.com/author/ambarish/)) -[#]: url: ( ) - -Easily Fund Open Source Projects With These Platforms -====== - -**Brief: We list out some funding platforms you can use to financially support open source projects. ** - -Financial support is one of the many ways to [help Linux and Open Source community][1]. This is why you see “Donate” option on the websites of most open source projects. - -While the big corporations have the necessary funding and resources, most open source projects are developed by individuals in their spare time. However, it does require one’s efforts, time and probably includes some overhead costs too. Monetary supports surely help drive the project development. - -If you would like to support open source projects financially, let me show you some platforms dedicated to open source and/or Linux. - -### Funding platforms for Open Source projects - -![Open Source funding platforms][2] - -Just to clarify, we are not associated with any of the funding platforms mentioned here. - -#### 1\. Liberapay - -[Gratipay][3] was probably the biggest platform for funding open source projects and people associated with the project, which got shut down at the end of the year 2017. However, there’s a fork – Liberapay that works as a recurrent donation platform for the open source projects and the contributors. - -[Liberapay][4] is a non-profit, open source organization that helps in a periodic donation to a project. You can create an account as a contributor and ask the people who would really like to help (usually the consumer of your products) to donate. - -To receive a donation, you will have to create an account on Liberapay, brief what you do and about your project, reasons for asking for the donation and what will be done with the money you receive. - -For someone who would like to donate, they would have to add money to their accounts and set up a period for payment that can be weekly, monthly or yearly to someone. There’s a mail triggered when there is not much left to donate. - -The currency supported are dollars and Euro as of now and you can always put up a badge on Github, your Twitter profile or website for a donation. - -#### 2\. Bountysource - -[Bountysource][5] is a funding platform for open source software that has a unique way of paying a developer for his time and work int he name of Bounties. - -There are basically two campaigns, bounties and salt campaign. - -Under the Bounties, users declare bounties aka cash prizes on open issues that they believe should be fixed or any new features which they want to see in the software they are using. A developer can then go and fix it to receive the cash prize. - -Salt Campaign is like any other funding, anyone can pay a recurring amount to a project or an individual working for an open source project for as long as they want. - -Bountysource accepts any software that is approved by Free Software Foundation or Open Source Initiatives. The bounties can be placed using PayPal, Bitcoin or the bounty itself if owned previously. Bountysource supports a no. of issue tracker currently like GitHub, Bugzilla, Google Code, Jira, Launchpad etc. - -#### 3\. Open Collective - -[Open Collective][6] is another popular funding initiative where a person who is willing to receive the donation for the work he is doing in Open Source world can create a page. He can submit the expense reports for the project he is working on. A contributor can add money to his account and pay him for his expenses. - -The complete process is transparent and everyone can track whoever is associated with Open Collective. The contributions are visible along with the unpaid expenses. There is also the option to contribute on a recurring basis. - -Open Collective currently has more than 500 collectives being backed up by more than 5000 users. - -The fact that it is transparent and you know what you are contributing to, drives more accountability. Some common example of collective include hosting costs, community maintenance, travel expenses etc. - -Though Open Collective keeps 10% of all the transactions, it is still a nice way to get your expenses covered in the process of contributing towards an open source project. - -#### 4\. Open Source Grants - -[Open Source Grants][7] is still in its beta stage and has not matured yet. They are looking for projects that do not have any stable funding and adds value to open source community. Most open source projects are run by a small community in a free time and they are trying to fund them so that the developers can work full time on the projects. - -They are equally searching for companies that want to help open source enthusiasts. The process of submitting a project is still being worked upon, and hopefully, in coming days we will see a working way of funding. - -### Final Words - -In the end, I would also like to mention [Patreon][8]. This funding platform is not exclusive to open source but is focused on creators of all kinds. Some projects like [elementary OS have created their accounts on Patreon][9] so that you can support the project on a recurring basis. - -Think Free Speech, not Free Beer. Your small contribution to a project can help it sustain in the long run. For the developers, the above platform can provide a good way to cover up their expenses. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/open-source-funding-platforms/ - -作者:[Ambarish 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://itsfoss.com/author/ambarish/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/help-linux-grow/ -[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/03/Fund-Open-Source-projects.png?resize=800%2C450&ssl=1 -[3]: https://itsfoss.com/gratipay-open-source/ -[4]: https://liberapay.com/ -[5]: https://www.bountysource.com/ -[6]: https://opencollective.com/ -[7]: https://foundation.travis-ci.org/grants/ -[8]: https://www.patreon.com/ -[9]: https://www.patreon.com/elementary diff --git a/sources/talk/20180321 8 tips for better agile retrospective meetings.md b/sources/talk/20180321 8 tips for better agile retrospective meetings.md deleted file mode 100644 index ec45bf17f0..0000000000 --- a/sources/talk/20180321 8 tips for better agile retrospective meetings.md +++ /dev/null @@ -1,66 +0,0 @@ -8 tips for better agile retrospective meetings -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_meeting.png?itok=4_CivQgp) -I’ve often thought that retrospectives should be called prospectives, as that term concerns the future rather than focusing on the past. The retro itself is truly future-looking: It’s the space where we can ask the question, “With what we know now, what’s the next experiment we need to try for improving our lives, and the lives of our customers?” - -### What’s a retro supposed to look like? - -There are two significant loops in product development: One produces the desired potentially shippable nugget. The other is where we examine how we’re working—not only to avoid doing what didn’t work so well, but also to determine how we can amplify the stuff we do well—and devise an experiment to pull into the next production loop to improve how our team is delighting our customers. This is the loop on the right side of this diagram: - - -![Retrospective 1][2] - -### When retros implode - -While attending various teams' iteration retrospective meetings, I saw a common thread of malcontent associated with a relentless focus on continuous improvement. - -One of the engineers put it bluntly: “[Our] continuous improvement feels like we are constantly failing.” - -The teams talked about what worked, restated the stuff that didn’t work (perhaps already feeling like they were constantly failing), nodded to one another, and gave long sighs. Then one of the engineers (already late for another meeting) finally summed up the meeting: “Ok, let’s try not to submit all of the code on the last day of the sprint.” There was no opportunity to amplify the good, as the good was not discussed. - -In effect, here’s what the retrospective felt like: - -![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/retro_2.jpg?itok=HrDkppCG) - -The anti-pattern is where retrospectives become dreaded sessions where we look back at the last iteration, make two columns—what worked and what didn’t work—and quickly come to some solution for the next iteration. There is no [scientific method][3] involved. There is no data gathering and research, no hypothesis, and very little deep thought. The result? You don’t get an experiment or a potential improvement to pull into the next iteration. - -### 8 tips for better retrospectives - - 1. Amplify the good! Instead of focusing on what didn’t work well, why not begin the retro by having everyone mention one positive item first? - 2. Don’t jump to a solution. Thinking about a problem deeply instead of trying to solve it right away might be a better option. - 3. If the retrospective doesn’t make you feel excited about an experiment, maybe you shouldn’t try it in the next iteration. - 4. If you’re not analyzing how to improve, ([5 Whys][4], [force-field analysis][5], [impact mapping][6], or [fish-boning][7]), you might be jumping to solutions too quickly. - 5. Vary your methods. If every time you do a retrospective you ask, “What worked, what didn’t work?” and then vote on the top item from either column, your team will quickly get bored. [Retromat][8] is a great free retrospective tool to help vary your methods. - 6. End each retrospective by asking for feedback on the retro itself. This might seem a bit meta, but it works: Continually improving the retrospective is recursively improving as a team. - 7. Remove the impediments. Ask how you are enabling the team's search for improvement, and be prepared to act on any feedback. - 8. There are no "iteration police." Take breaks as needed. Deriving hypotheses from analysis and coming up with experiments involves creativity, and it can be taxing. Every once in a while, go out as a team and enjoy a nice retrospective lunch. - - - -This article was inspired by [Retrospective anti-pattern: continuous improvement should not feel like constantly failing][9], posted at [Podojo.com][10]. - -**[See our related story,[How to build a business case for DevOps transformation][11].]** - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/tips-better-agile-retrospective-meetings - -作者:[Catherine Louis][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/catherinelouis -[1]:/file/389021 -[2]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/retro_1.jpg?itok=bggmHN1Q (Retrospective 1) -[3]:https://en.wikipedia.org/wiki/Scientific_method -[4]:https://en.wikipedia.org/wiki/5_Whys -[5]:https://en.wikipedia.org/wiki/Force-field_analysis -[6]:https://opensource.com/open-organization/17/6/experiment-impact-mapping -[7]:https://en.wikipedia.org/wiki/Ishikawa_diagram -[8]:https://plans-for-retrospectives.com/en/?id=28 -[9]:http://www.podojo.com/retrospective-anti-pattern-continuous-improvement-should-not-feel-like-constantly-failing/ -[10]:http://www.podojo.com/ -[11]:https://opensource.com/article/18/2/how-build-business-case-devops-transformation diff --git a/sources/talk/20180323 7 steps to DevOps hiring success.md b/sources/talk/20180323 7 steps to DevOps hiring success.md deleted file mode 100644 index cdea0c65ac..0000000000 --- a/sources/talk/20180323 7 steps to DevOps hiring success.md +++ /dev/null @@ -1,56 +0,0 @@ -7 steps to DevOps hiring success -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/desk_clock_job_work.jpg?itok=Nj4fuhl6) -As many of us in the DevOps scene know, most companies are hiring, or, at least, trying to do so. The required skills and job descriptions can change entirely from company to company. As a broad overview, most teams are looking for a candidate from either an operations and infrastructure background or someone from a software engineering and development background, then combined with key skills relating to continuous integration, configuration management, continuous delivery/deployment, and cloud infrastructure. Currently in high-demand is knowledge of container orchestration. - -In the ideal world, the two backgrounds will meet somewhere in the middle to form Dev and Ops, but in most cases, there is a lean toward one side or the other while maintaining sufficient skills to understand the needs and demands of their counterparts to work collaboratively and achieve the end goal of continuous delivery/deployment. Every company is different and there isn’t necessarily a right or wrong here. It all depends on your infrastructure, tech stack, other team members’ skills, and the individual goals you hope to achieve by hiring this individual. - -### Focus your hiring - -Now, given the various routes to becoming a DevOps practitioner, how do hiring managers focus their search and selection process to ensure that they’re hitting the mark? - -#### Decide on the background - -Assess the strengths of your existing team. Do you already have some amazing software engineers but you’re lacking the infrastructure knowledge? Aim to close these gaps in skills. You may have been given the budget to hire for DevOps, but you don’t have to spend weeks/months searching for the best software engineer who happens to use Docker and Kubernetes because they are the current hot trends in this space. Find the person who will provide the most value in your environment and go from there. - -#### Contractor or permanent employee? - -Many hiring managers will automatically start searching for a full-time permanent employee when their needs may suggest that they have other options. Sometimes a contractor is your best bet or maybe contract-hire. If you’re aiming to design, implement and build a new DevOps environment, why not find a senior person who has done this a number of times already? Try hiring a senior contractor and bring on a junior full-time hire in parallel; this way, you’ll be able to retain the external contractor knowledge by having them work alongside the junior hire. Contractors can be expensive, but the knowledge they bring can be invaluable, especially if the work can be completed over a shorter time frame. Again, this is just another point of view and you might be best off with a full-time hire to grow the team. - -#### CTRL F is not the solution - -Focus on their understanding of DevOps and CI/CD-related processes over specific tools. I believe the best approach is to focus on finding someone who understands the methodologies over the tools. Does your candidate understand the concept of continuous integration or the concept of continuous delivery? That’s more important than asking whether your candidate uses Jenkins versus Bamboo versus TeamCity and so on. Try not to get caught up in the exact tool chain. The focus should be on the candidates’ ability to solve problems. Are they obsessed with increasing efficiency, saving time, automating manual processes and constantly searching for flaws in the system? They might be the person you were looking for, but you missed them because you didn’t see the word "Puppet" on the resume. - -#### Work closely with your internal talent acquisition team and/or an external recruiter - -Be clear and precise with what you’re looking for and have an ongoing, open communication with recruiters. They can and will help you if used effectively. The job of these recruiters is to save you time by sourcing candidates while you’re focusing on your day-to-day role. Work closely with them and deliver in the same way that you would expect them to deliver for you. If you say you will review a candidate by X time, do it. If they say they’ll have a candidate in your inbox by Y time, make sure they do it, too. Start by setting up an initial call to talk through your requirement, lay out a timeline in which you expect candidates by a specific time, and explain your process in terms of when you will interview, how many interview rounds, and how soon after you will be able to make a final decision on whether to offer or reject the candidates. If you can get this relationship working well, you’ll save lots of time. And make sure your internal teams are focused on supporting your process, not blocking it. - -#### $$$ - -Decide how much you want to pay. It’s not all about the money, but you can waste a lot of your and other people’s time if you don’t lock down the ballpark salary or hourly rate that you can afford. If your budget doesn’t stretch as far as your competitors’, you need to consider what else can help sell the opportunity. Flexible working hours and remote working options are some great ways to do this. Most companies have snacks, beer, and cool offices nowadays, so focus on the real value such as the innovative work your team is doing and how awesome your game-changing product might be. - -#### Drop the ego - -You may have an amazing company and/or product, but you also have some hot competition. Everyone is hiring in this space and candidates have a lot of the buying power. It is no longer as simple as saying, "We are hiring" and the awesome candidates come flowing in. You need to sell your opportunities. Maintaining a reputation as a great place to work is also important. A poor hiring process, such as interviewing without giving feedback, can contribute to bad rumors being spread across the industry. It only takes a few minutes to leave a sour review on Glassdoor. - -#### A smooth process is a successful One - -"Let’s get every single person within the company to do a one-hour interview with the new DevOps person we are hiring!" No, let’s not do that. Two or three stages should be sufficient. You have managers and directors for a reason. Trust your instinct and use your experience to make decisions on who will fit into your organization. Some of the most successful companies can do one phone screen followed by an in-person meeting. During the in-person interview, spend a morning or afternoon allowing the candidate to meet the relevant leaders and senior members of their direct team, then take them for lunch, dinner, or drinks where you can see how they are on a social level. If you can’t have a simple conversation with them, then you probably won’t enjoy working with them. If the thumbs are up, make the hire and don’t wait around. A good candidate will usually have numerous offers on the table at the same time. - -If all goes well, you should be inviting your shiny new employee or contractor into the office in the next few weeks and hopefully many more throughout the year. - -This article was originally published on [DevOps.com][1] and republished with author permission. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/7-steps-devops-hiring-success - -作者:[Conor Delanbanque][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/cdelanbanque -[1]:https://devops.com/7-steps-devops-hiring-success/ diff --git a/sources/talk/20180330 Meet OpenAuto, an Android Auto emulator for Raspberry Pi.md b/sources/talk/20180330 Meet OpenAuto, an Android Auto emulator for Raspberry Pi.md deleted file mode 100644 index bac0819e74..0000000000 --- a/sources/talk/20180330 Meet OpenAuto, an Android Auto emulator for Raspberry Pi.md +++ /dev/null @@ -1,81 +0,0 @@ -Meet OpenAuto, an Android Auto emulator for Raspberry Pi -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb_computer_person_general_.png?itok=BRGJXU7e) - -In 2015, Google introduced [Android Auto][1], a system that allows users to project certain apps from their Android smartphones onto a car's infotainment display. Android Auto's driver-friendly interface, with larger touchscreen buttons and voice commands, aims to make it easier and safer for drivers to control navigation, music, podcasts, radio, phone calls, and more while keeping their eyes on the road. Android Auto can also run as an app on an Android smartphone, enabling owners of older-model vehicles without modern head unit displays to take advantage of these features. - -While there are many [apps][2] available for Android Auto, developers are working to add to its catalog. A new, open source tool named [OpenAuto][3] is hoping to make that easier by giving developers a way to emulate Android Auto on a Raspberry Pi. With OpenAuto, developers can test their applications in conditions similar to how they'll work on an actual car head unit. - -OpenAuto's creator, Michal Szwaj, answered some questions about his project for Opensource.com. Some responses have been edited for conciseness and clarity. - -### What is OpenAuto? - -In a nutshell, OpenAuto is an emulator for the Android Auto head unit. It emulates the head unit software and allows you to use Android Auto on your PC or on any other embedded platform like Raspberry Pi 3. - -Head unit software is a frontend for the Android Auto projection. All magic related to the Android Auto, like navigation, Google Voice Assistant, or music playback, is done on the Android device. Projection of Android Auto on the head unit is accomplished using the [H.264][4] codec for video and [PCM][5] codec for audio streaming. This is what the head unit software mostly does—it decodes the H.264 video stream and PCM audio streams and plays them back together. Another function of the head unit is providing user inputs. OpenAuto supports both touch events and hard keys. - -### What platforms does OpenAuto run on? - -My target platform for deployment of the OpenAuto is Raspberry Pi 3 computer. For successful deployment, I needed to implement support of video hardware acceleration using the Raspberry Pi 3 GPU (VideoCore 4). Thanks to this, Android Auto projection on the Raspberry Pi 3 computer can be handled even using 1080p@60 fps resolution. I used [OpenMAX IL][6] and IL client libraries delivered together with the Raspberry Pi firmware to implement video hardware acceleration. - -Taking advantage of the fact that the Raspberry Pi operating system is Raspbian based on Debian Linux, OpenAuto can be also built for any other Linux-based platform that provides support for hardware video decoding. Most of the Linux-based platforms provide support for hardware video decoding directly in GStreamer. Thanks to highly portable libraries like Boost and [Qt][7], OpenAuto can be built and run on the Windows platform. Support of MacOS is being implemented by the community and should be available soon. - -![][https://www.youtube.com/embed/k9tKRqIkQs8?origin=https://opensource.com&enablejsapi=1] - -### What software libraries does the project use? - -The core of the OpenAuto is the [aasdk][8] library, which provides support for all Android Auto features. aasdk library is built on top of the Boost, libusb, and OpenSSL libraries. [libusb][9] implements communication between the head unit and an Android device (via USB bus). [Boost][10] provides support for the asynchronous mechanisms for communication. It is required for high efficiency and scalability of the head unit software. [OpenSSL][11] is used for encrypting communication. - -The aasdk library is designed to be fully reusable for any purposes related to implementation of the head unit software. You can use it to build your own head unit software for your desired platform. - -Another very important library used in OpenAuto is Qt. It provides support for OpenAuto's multimedia, user input, and graphical interface. And the build system OpenAuto is using is [CMake][12]. - -Note: The Android Auto protocol is taken from another great Android Auto head unit project called [HeadUnit][13]. The people working on this project did an amazing job in reverse engineering the AndroidAuto protocol and creating the protocol buffers that structurize all messages. - -### What equipment do you need to run OpenAuto on Raspberry Pi? - -In addition to a Raspberry Pi 3 computer and an Android device, you need: - - * **USB sound card:** The Raspberry Pi 3 doesn't have a microphone input, which is required to use Google Voice Assistant - * **Video output device:** You can use either a touchscreen or any other video output device connected to HDMI or composite output (RCA) - * **Input device:** For example, a touchscreen or a USB keyboard - - - -### What else do you need to get started? - -In order to use OpenAuto, you must build it first. On the OpenAuto's wiki page you can find [detailed instructions][14] for how to build it for the Raspberry Pi 3 platform. On other Linux-based platforms, the build process will look very similar. - -On the wiki page you can also find other useful instructions, such as how to configure the Bluetooth Hands-Free Profile (HFP) and Advanced Audio Distribution Profile (A2DP) and PulseAudio. - -### What else should we know about OpenAuto? - -OpenAuto allows anyone to create a head unit based on the Raspberry Pi 3 hardware. Nevertheless, you should always be careful about safety and keep in mind that OpenAuto is just an emulator. It was not certified by any authority and was not tested in a driving environment, so using it in a car is not recommended. - -OpenAuto is licensed under GPLv3. For more information, visit the [project's GitHub page][3], where you can find its source code and other information. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/openauto-emulator-Raspberry-Pi - -作者:[Michal Szwaj][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/michalszwaj -[1]:https://www.android.com/auto/faq/ -[2]:https://play.google.com/store/apps/collection/promotion_3001303_android_auto_all -[3]:https://github.com/f1xpl/openauto -[4]:https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC -[5]:https://en.wikipedia.org/wiki/Pulse-code_modulation -[6]:https://www.khronos.org/openmaxil -[7]:https://www.qt.io/ -[8]:https://github.com/f1xpl/aasdk -[9]:http://libusb.info/ -[10]:http://www.boost.org/ -[11]:https://www.openssl.org/ -[12]:https://cmake.org/ -[13]:https://github.com/gartnera/headunit -[14]:https://github.com/f1xpl/ diff --git a/sources/talk/20180403 3 pitfalls everyone should avoid with hybrid multicloud.md b/sources/talk/20180403 3 pitfalls everyone should avoid with hybrid multicloud.md deleted file mode 100644 index b128be62f0..0000000000 --- a/sources/talk/20180403 3 pitfalls everyone should avoid with hybrid multicloud.md +++ /dev/null @@ -1,87 +0,0 @@ -3 pitfalls everyone should avoid with hybrid multicloud -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_darwincloud_520x292_0311LL.png?itok=74DLgd8Q) - -This article was co-written with [Roel Hodzelmans][1]. - -We're all told the cloud is the way to ensure a digital future for our businesses. But which cloud? From cloud to hybrid cloud to hybrid multi-cloud, you need to make choices, and these choices don't preclude the daily work of enhancing your customers' experience or agile delivery of the applications they need. - -This article is the first in a four-part series on avoiding pitfalls in hybrid multi-cloud computing. Let's start by examining multi-cloud, hybrid cloud, and hybrid multi-cloud and what makes them different from one another. - -### Hybrid vs. multi-cloud - -There are many conversations you may be having in your business around moving to the cloud. For example, you may want to take your on-premises computing capacity and turn it into your own private cloud. You may wish to provide developers with a cloud-like experience using the same resources you already have. A more traditional reason for expansion is to use external computing resources to augment those in your own data centers. The latter leads you to the various public cloud providers, as well as to our first definition, multi-cloud. - -#### Multi-cloud - -Multi-cloud means using multiple clouds from multiple providers for multiple tasks. - -![Multi-cloud][3] - -Figure 1. Multi-cloud IT with multiple isolated cloud environments - -Typically, multi-cloud refers to the use of several different public clouds in order to achieve greater flexibility, lower costs, avoid vendor lock-in, or use specific regional cloud providers. - -A challenge of the multi-cloud approach is achieving consistent policies, compliance, and management with different providers involved. - -Multi-cloud is mainly a strategy to expand your business while leveraging multi-vendor cloud solutions and spreading the risk of lock-in. Figure 1 shows the isolated nature of cloud services in this model, without any sort of coordination between the services and business applications. Each is managed separately, and applications are isolated to services found in their environments. - -#### Hybrid cloud - -Hybrid cloud solves issues where isolation and coordination are central to the solution. It is a combination of one or more public and private clouds with at least a degree of workload portability, integration, orchestration, and unified management. - -![Hybrid cloud][5] - -Figure 2. Hybrid clouds may be on or off premises, but must have a degree of interoperability - -The key issue here is that there is an element of interoperability, migration potential, and a connection between tasks running in public clouds and on-premises infrastructure, even if it's not always seamless or otherwise fully implemented. - -If your cloud model is missing portability, integration, orchestration, and management, then it's just a bunch of clouds, not a hybrid cloud. - -The cloud environments in Fig. 2 include at least one private and public cloud. They can be off or on premises, but they have some degree of the following: - - * Interoperability - * Application portability - * Data portability - * Common management - - - -As you can probably guess, combining multi-cloud and hybrid cloud results in a hybrid multi-cloud. But what does that look like? - -### Hybrid multi-cloud - -Hybrid multi-cloud pulls together multiple clouds and provides the tools to ensure interoperability between the various services in hybrid and multi-cloud solutions. - -![Hybrid multi-cloud][7] - -Figure 3. Hybrid multi-cloud solutions using open technologies - -Bringing these together can be a serious challenge, but the result ensures better use of resources without isolation in their respective clouds. - -Fig. 3 shows an example of hybrid multi-cloud based on open technologies for interoperability, workload portability, and management. - -### Moving forward: Pitfalls of hybrid multi-cloud - -In part two of this series, we'll look at the first of three pitfalls to avoid with hybrid multi-cloud. Namely, why cost is not always the obvious motivator when determining how to transition your business to the cloud. - -This article is based on "[3 pitfalls everyone should avoid with hybrid multi-cloud][8]," a talk the authors will be giving at [Red Hat Summit 2018][9], which will be held May 8-10 in San Francisco. [Register by May 7][9] to save US$ 500 off of registration. Use discount code **OPEN18** on the payment page to apply the discount. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/4/pitfalls-hybrid-multi-cloud - -作者:[Eric D.Schabell][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/eschabell -[1]:https://opensource.com/users/roelh -[3]:https://opensource.com/sites/default/files/u128651/multi-cloud.png (Multi-cloud) -[5]:https://opensource.com/sites/default/files/u128651/hybrid-cloud.png (Hybrid cloud) -[7]:https://opensource.com/sites/default/files/u128651/hybrid-multicloud.png (Hybrid multi-cloud) -[8]:https://agenda.summit.redhat.com/SessionDetail.aspx?id=153892 -[9]:https://www.redhat.com/en/summit/2018 diff --git a/sources/talk/20180404 Is the term DevSecOps necessary.md b/sources/talk/20180404 Is the term DevSecOps necessary.md deleted file mode 100644 index 96b544e7c4..0000000000 --- a/sources/talk/20180404 Is the term DevSecOps necessary.md +++ /dev/null @@ -1,51 +0,0 @@ -Is the term DevSecOps necessary? -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2) -First came the term "DevOps." - -It has many different aspects. For some, [DevOps][1] is mostly about a culture valuing collaboration, openness, and transparency. Others focus more on key practices and principles such as automating everything, constantly iterating, and instrumenting heavily. And while DevOps isn’t about specific tools, certain platforms and tooling make it a more practical proposition. Think containers and associated open source cloud-native technologies like [Kubernetes][2] and CI/CD pipeline tools like [Jenkins][3]—as well as native Linux capabilities. - -However, one of the earliest articulated concepts around DevOps was the breaking down of the “wall of confusion” specifically between developers and operations teams. This was rooted in the idea that developers didn’t think much about operational concerns and operators didn’t think much about application development. Add the fact that developers want to move quickly and operators care more about (and tend to be measured on) stability than speed, and it’s easy to see why it was difficult to get the two groups on the same page. Hence, DevOps came to symbolize developers and operators working more closely together, or even merging roles to some degree. - -Of course, calls for improved communications and better-integrated workflows were never just about dev and ops. Business owners should be part of conversations as well. And there are the actual users of the software. Indeed, you can write up an almost arbitrarily long list of stakeholders concerned with the functionality, cost, reliability, and other aspects of software and its associated infrastructure. Which raises the question that many have asked: “What’s so special about security that we need a DevSecOps term?” - -I’m glad you asked. - -The first is simply that it serves as a useful reminder. If developers and operations were historically two of the most common silos in IT organizations, security was (and often still is) another. Security people are often thought of as conservative gatekeepers for whom “no” often seems the safest response to new software releases and technologies. Security’s job is to protect the company, even if that means putting the brakes on a speedy development process. - -Many aspects of traditional security, and even its vocabulary, can also seem arcane to non-specialists. This has also contributed to the notion that security is something apart from mainstream IT. I often share the following anecdote: A year or two ago I was leading a security discussion at a [DevOpsDays][4] event in London in which we were talking about traditional security roles. One of the participants raised his hand and admitted that he was one of those security gatekeepers. He went on to say that this was the first time in his career that he had ever been to a conference that wasn’t a traditional security conference like RSA. (He also noted that he was going to broaden both his and his team’s horizons more.) - -So DevSecOps perhaps shouldn’t be a needed term. But explicitly calling it out seems like a good practice at a time when software security threats are escalating. - -The second reason is that the widespread introduction of cloud-native technologies, particularly those built around containers, are closely tied to DevOps practices. These new technologies are both leading to and enabling greater scale and more dynamic infrastructures. Static security policies and checklists no longer suffice. Security must become a continuous activity. And it must be considered at every stage of your application and infrastructure lifecycle. - -**Here are a few examples:** - -You need to secure the pipeline and applications. You need to use trusted sources for content so that you know who has signed off on container images and that they’re up-to-date with the most recent patches. Your continuous integration system must integrate automated security testing. You’ll sometimes hear people talking about “shifting security left,” which means earlier in the process so that problems can be dealt with sooner. But it’s actually better to think about embedding security throughout the entire pipeline at each step of the testing, integration, deployment, and ongoing management process. - -You need to secure the underlying infrastructure. This means securing the host Linux kernel from container escapes and securing containers from each other. It means using a container orchestration platform with integrated security features. It means defending the network by using network namespaces to isolate applications from other applications within a cluster and isolate environments (such as dev, test, and production) from each other. - -And it means taking advantage of the broader security ecosystem such as container content scanners and vulnerability management tools. - -In short, it’s DevSecOps because modern application development and container platforms require a new type of Dev and a new type of Ops. But they also require a new type of Sec. Thus, DevSecOps. - -**[See our related story,[Security and the SRE: How chaos engineering can play a key role][5].]** - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/4/devsecops - -作者:[Gordon Haff][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/ghaff -[1]:https://opensource.com/resources/devops -[2]:https://kubernetes.io/ -[3]:https://jenkins.io/ -[4]:https://www.devopsdays.org/ -[5]:https://opensource.com/article/18/3/through-looking-glass-security-sre diff --git a/sources/talk/20180405 Rethinking -ownership- across the organization.md b/sources/talk/20180405 Rethinking -ownership- across the organization.md deleted file mode 100644 index d41a3a86dc..0000000000 --- a/sources/talk/20180405 Rethinking -ownership- across the organization.md +++ /dev/null @@ -1,125 +0,0 @@ -Rethinking "ownership" across the organization -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chain.png?itok=sgAjswFf) -Differences in organizational design don't necessarily make some organizations better than others—just better suited to different purposes. Any style of organization must account for its models of ownership (the way tasks get delegated, assumed, executed) and responsibility (the way accountability for those tasks gets distributed and enforced). Conventional organizations and open organizations treat these issues differently, however, and those difference can be jarring for anyone hopping transitioning from one organizational model to another. But transitions are ripe for stumbling over—oops, I mean, learning from. - -Let's do that. - -### Ownership explained - -In most organizations (and according to typical project management standards), work on projects proceeds in five phases: - - * Initiation: Assess project feasibility, identify deliverables and stakeholders, assess benefits - * Planning (Design): Craft project requirements, scope, and schedule; develop communication and quality plans - * Executing: Manage task execution, implement plans, maintain stakeholder relationships - * Monitoring/Controlling: Manage project performance, risk, and quality of deliverables - * Closing: Sign-off on completion requirements, release resources - - - -The list above is not exhaustive, but I'd like to add one phase that is often overlooked: the "Adoption" phase, frequently needed for strategic projects where a change to the culture or organization is required for "closing" or completion. - - * Adoption: Socializing the work of the project; providing communication, training, or integration into processes and standard workflows. - - - -Examining project phases is one way contrast the expression of ownership and responsibility in organizations. - -### Two models, contrasted - -In my experience, "ownership" in a traditional software organization works like this. - -A manager or senior technical associate initiates a project with senior stakeholders and, with the authority to champion and guide the project, they bestow the project on an associate at some point during the planning and execution stages. Frequently, but not always, the groundwork or fundamental design of the work has already been defined and approved—sometimes even partially solved. Employees are expected to see the project through execution and monitoring to completion. - -Employees cut their teeth on a "starter project," where they prove their abilities to a management chain (for example, I recall several such starter projects that were already defined by a manager and architect, and I was assigned to help implement them). Employees doing a good job on a project for which they're responsible get rewarded with additional opportunities, like a coveted assignment, a new project, or increased responsibility. - -An associate acting as "owner" of work is responsible and accountable for that work (if someone, somewhere, doesn't do their job, then the responsible employee either does the necessary work herself or alerts a manager to the problem.) A sense of ownership begins to feel stable over time: Employees generally work on the same projects, and in the same areas for an extended period. For some employees, it means the development of deep expertise. That's because the social network has tighter integration between people and the work they do, so moving around and changing roles and projects is rather difficult. - -This process works differently in an open organization. - -Associates continually define the parameters of responsibility and ownership in an open organization—typically in light of their interests and passions. Associates have more agency to perform all the stages of the project themselves, rather than have pre-defined projects assigned to them. This places additional emphasis on leadership skills in an open organization, because the process is less about one group of people making decisions for others, and more about how an associate manages responsibilities and ownership (whether or not they roughly follow the project phases while being inclusive, adaptable, and community-focused, for example). - -Being responsible for all project phases can make ownership feel more risky for associates in an open organization. Proposing a new project, designing it, and leading its implementation takes initiative and courage—especially when none of this is pre-defined by leadership. It's important to get continuous buy-in, which comes with questions, criticisms, and resistance not only from leaders but also from peers. By default, in open organizations this makes associates leaders; they do much the same work that higher-level leaders do in conventional organizations. And incidentally, this is why Jim Whitehurst, in The Open Organization, cautions us about the full power of "transparency" and the trickiness of getting people's real opinions and thoughts whether we like them or not. The risk is not as high in a traditional organization, because in those organizations leaders manage some of it by shielding associates from heady discussions that arise. - -The reward in an Open Organization is more opportunity—offers of new roles, promotions, raises, etc., much like in a conventional organization. Yet in the case of open organizations, associates have developed reputations of excellence based on their own initiatives, rather than on pre-sanctioned opportunities from leadership. - -### Thinking about adoption - -Any discussion of ownership and responsibility involves addressing the issue of buy-in, because owning a project means we are accountable to our sponsors and users—our stakeholders. We need our stakeholders to buy-into our idea and direction, or we need users to adopt an innovation we've created with our stakeholders. Achieving buy-in for ideas and work is important in each type of organization, and it's difficult in both traditional and open systems—but for different reasons. - -Open organizations better allow highly motivated associates, who are ambitious and skilled, to drive their careers. But support for their ideas is required across the organization, rather than from leadership alone. - -Penetrating a traditional organization's closely knit social ties can be difficult, and it takes time. In such "command-and-control" environments, one would think that employees are simply "forced" to do whatever leaders want them to do. In some cases that's true (e.g., a travel reimbursement system). However, with more innovative programs, this may not be the case; the adoption of a program, tool, or process can be difficult to achieve by fiat, just like in an open organization. And yet these organizations tend to reduce redundancies of work and effort, because "ownership" here involves leaders exerting responsibility over clearly defined "domains" (and because those domains don't change frequently, knowing "who's who"—who's in charge, who to contact with a request or inquiry or idea—can be easier). - -Open organizations better allow highly motivated associates, who are ambitious and skilled, to drive their careers. But support for their ideas is required across the organization, rather than from leadership alone. Points of contact and sources of immediate support can be less obvious, and this means achieving ownership of a project or acquiring new responsibility takes more time. And even then someone's idea may never get adopted. A project's owner can change—and the idea of "ownership" itself is more flexible. Ideas that don't get adopted can even be abandoned, leaving a great idea unimplemented or incomplete. Because any associate can "own" an idea in an open organization, these organizations tend to exhibit more redundancy. (Some people immediately think this means "wasted effort," but I think it can augment the implementation and adoption of innovative solutions. By comparing these organizations, we can also see why Jim Whitehurst calls this kind of culture "chaotic" in The Open Organization). - -### Two models of ownership - -In my experience, I've seen very clear differences between conventional and open organizations when it comes to the issues of ownership and responsibility. - -In an traditional organization: - - * I couldn't "own" things as easily - * I felt frustrated, wanting to take initiative and always needing permission - * I could more easily see who was responsible because stakeholder responsibility was more clearly sanctioned and defined - * I could more easily "find" people, because the organizational network was more fixed and stable - * I more clearly saw what needed to happen (because leadership was more involved in telling me). - - - -Over time, I've learned the following about ownership and responsibility in an open organization: - - * People can feel good about what they are doing because the structure rewards behavior that's more self-driven - * Responsibility is less clear, especially in situations where there's no leader - * In cases where open organizations have "shared responsibility," there is the possibility that no one in the group identified with being responsible; often there is lack of role clarity ("who should own this?") - * More people participate - * Someone's leadership skills must be stronger because everyone is "on their own"; you are the leader. - - - -### Making it work - -On the subject of ownership, each type of organization can learn from the other. The important thing to remember here: Don't make changes to one open or conventional value without considering all the values in both organizations. - -Sound confusing? Maybe these tips will help. - -If you're a more conventional organization trying to act more openly: - - * Allow associates to take ownership out of passion or interest that align with the strategic goals of the organization. This enactment of meritocracy can help them build a reputation for excellence and execution. - * But don't be afraid sprinkle in a bit of "high-level perspective" in the spirit of transparency; that is, an associate should clearly communicate plans to their leadership, so the initiative doesn't create irrelevant or unneeded projects. - * Involving an entire community (as when, for example, the associate gathers feedback from multiple stakeholders and user groups) aids buy-in and creates beneficial feedback from the diversity of perspectives, and this helps direct the work. - * Exploring the work with the community [doesn't mean having to come to consensus with thousands of people][1]. Use the [Open Decision Framework][2] to set limits and be transparent about what those limits are so that feedback and participation is organized ad boundaries are understood. - - - -If you're already an open organization, then you should remember: - - * Although associates initiate projects from "the bottom up," leadership needs to be involved to provide guidance, input to the vision, and circulate centralized knowledge about ownership and responsibility creating a synchronicity of engagement that is transparent to the community. - * Ownership creates responsibility, and the definition and degree of these should be something both associates and leaders agree upon, increasing the transparency of expectations and accountability during the project. Don't make this a matter of oversight or babysitting, but rather [a collaboration where both parties give and take][3]—associates initiate, leaders guide; associates own, leaders support. - - - -Leadership education and mentorship, as it pertains to a particular organization, needs to be available to proactive associates, especially since there is often a huge difference between supporting individual contributors and guiding and coordinating a multiplicity of contributions. - -["Owning your own career"][4] can be difficult when "ownership" isn't a concept an organization completely understands. - -[Subscribe to our weekly newsletter][5] to learn more about open organizations. - --------------------------------------------------------------------------------- - -via: https://opensource.com/open-organization/18/4/rethinking-ownership-across-organization - -作者:[Heidi Hess von Ludewig][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/heidi-hess-von-ludewig -[1]:https://opensource.com/open-organization/17/8/achieving-alignment-in-openorg -[2]:https://opensource.com/open-organization/resources/open-decision-framework -[3]:https://opensource.com/open-organization/17/11/what-is-collaboration -[4]:https://opensource.com/open-organization/17/12/drive-open-career-forward -[5]:https://opensource.com/open-organization/resources/newsletter diff --git a/sources/talk/20180410 Microservices Explained.md b/sources/talk/20180410 Microservices Explained.md deleted file mode 100644 index 1d7e946a12..0000000000 --- a/sources/talk/20180410 Microservices Explained.md +++ /dev/null @@ -1,61 +0,0 @@ -Microservices Explained -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/cloud-microservices.jpg?itok=GpoWiDeG) -Microservices is not a new term. Like containers, the concept been around for a while, but it’s become a buzzword recently as many companies embark on their cloud native journey. But, what exactly does the term microservices mean? Who should care about it? In this article, we’ll take a deep dive into the microservices architecture. - -### Evolution of microservices - -Patrick Chanezon, Chief Developer Advocate for Docker provided a brief history lesson during our conversation: In the late 1990s, developers started to structure their applications into monoliths where massive apps hadall features and functionalities baked into them. Monoliths were easy to write and manage. Companies could have a team of developers who built their applications based on customer feedback through sales and marketing teams. The entire developer team would work together to build tightly glued pieces as an app that can be run on their own app servers. It was a popular way of writing and delivering web applications. - -There is a flip side to the monolithic coin. Monoliths slow everything and everyone down. It’s not easy to update one service or feature of the application. The entire app needs to be updated and a new version released. It takes time. There is a direct impact on businesses. Organizations could not respond quickly to keep up with new trends and changing market dynamics. Additionally, scalability was challenging. - -Around 2011, SOA (Service Oriented Architecture) became popular where developers could cram multi-tier web applications as software services inside a VM (virtual machine). It did allow them to add or update services independent of each other. However, scalability still remained a problem. - -“The scale out strategy then was to deploy multiple copies of the virtual machine behind a load balancer. The problems with this model are several. Your services can not scale or be upgraded independently as the VM is your lowest granularity for scale. VMs are bulky as they carry extra weight of an operating system, so you need to be careful about simply deploying multiple copies of VMs for scaling,” said Madhura Maskasky, co-founder and VP of Product at Platform9. - -Some five years ago when Docker hit the scene and containers became popular, SOA faded out in favor of “microservices” architecture. “Containers and microservices fix a lot of these problems. Containers enable deployment of microservices that are focused and independent, as containers are lightweight. The Microservices paradigm, combined with a powerful framework with native support for the paradigm, enables easy deployment of independent services as one or more containers as well as easy scale out and upgrade of these,” said Maskasky. - -### What’s are microservices? - -Basically, a microservice architecture is a way of structuring applications. With the rise of containers, people have started to break monoliths into microservices. “The idea is that you are building your application as a set of loosely coupled services that can be updated and scaled separately under the container infrastructure,” said Chanezon. - -“Microservices seem to have evolved from the more strictly defined service-oriented architecture (SOA), which in turn can be seen as an expression object oriented programming concepts for networked applications. Some would call it just a rebranding of SOA, but the term “microservices” often implies the use of even smaller functional components than SOA, RESTful APIs exchanging JSON, lighter-weight servers (often containerized, and modern web technologies and protocols,” said Troy Topnik, SUSE Senior Product Manager, Cloud Application Platform. - -Microservices provides a way to scale development and delivery of large, complex applications by breaking them down that allows the individual components to evolve independently from each other. - -“Microservices architecture brings more flexibility through the independence of services, enabling organizations to become more agile in how they deliver new business capabilities or respond to changing market conditions. Microservices allows for using the ‘right tool for the right task’, meaning that apps can be developed and delivered by the technology that will be best for the task, rather than being locked into a single technology, runtime or framework,” said Christian Posta, senior principal application platform specialist, Red Hat. - -### Who consumes microservices? - -“The main consumers of microservices architecture patterns are developers and application architects,” said Topnik. As far as admins and DevOps engineers are concerned their role is to build and maintain the infrastructure and processes that support microservices. - -“Developers have been building their applications traditionally using various design patterns for efficient scale out, high availability and lifecycle management of their applications. Microservices done along with the right orchestration framework help simplify their lives by providing a lot of these features out of the box. A well-designed application built using microservices will showcase its benefits to the customers by being easy to scale, upgrade, debug, but without exposing the end customer to complex details of the microservices architecture,” said Maskasky. - -### Who needs microservices? - -Everyone. Microservices is the modern approach to writing and deploying applications more efficiently. If an organization cares about being able to write and deploy its services at a faster rate they should care about it. If you want to stay ahead of your competitors, microservices is the fastest route. Security is another major benefit of the microservices architecture, as this approach allows developers to keep up with security and bug fixes, without having to worry about downtime. - -“Application developers have always known that they should build their applications in a modular and flexible way, but now that enough of them are actually doing this, those that don’t risk being left behind by their competitors,” said Topnik. - -If you are building a new application, you should design it as microservices. You never have to hold up a release if one team is late. New functionalities are available when they're ready, and the overall system never breaks. - -“We see customers using this as an opportunity to also fix other problems around their application deployment -- such as end-to-end security, better observability, deployment and upgrade issues,” said Maskasky. - -Failing to do so means you would be stuck in the traditional stack, which means microservices won’t be able to add any value to it. If you are building new applications, microservices is the way to go. - -Learn more about cloud-native at [KubeCon + CloudNativeCon Europe][1], coming up May 2-4 in Copenhagen, Denmark. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/2018/4/microservices-explained - -作者:[SWAPNIL BHARTIYA][a] -译者:[runningwater](https://github.com/runningwater) -校对:[校对者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/arnieswap -[1]:https://events.linuxfoundation.org/events/kubecon-cloudnativecon-europe-2018/attend/register/ diff --git a/sources/talk/20180412 Management, from coordination to collaboration.md b/sources/talk/20180412 Management, from coordination to collaboration.md deleted file mode 100644 index 1262f88300..0000000000 --- a/sources/talk/20180412 Management, from coordination to collaboration.md +++ /dev/null @@ -1,71 +0,0 @@ -Management, from coordination to collaboration -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_consensuscollab2.png?itok=uMO9zn5U) - -Any organization is fundamentally a pattern of interactions between people. The nature of those interactions—their quality, their frequency, their outcomes—is the most important product an organization can create. Perhaps counterintuitively, recognizing this fact has never been more important than it is today—a time when digital technologies are reshaping not only how we work but also what we do when we come together. - - -And yet many organizational leaders treat those interactions between people as obstacles or hindrances to avoid or eliminate, rather than as the powerful sources of innovation they really are. - -That's why we're observing that some of the most successful organizations today are those capable of shifting the way they think about the value of the interactions in the workplace. And to do that, they've radically altered their approach to management and leadership. - -### Moving beyond mechanical management - -Simply put, traditionally managed organizations treat unanticipated interactions between stakeholders as potentially destructive forces—and therefore as costs to be mitigated. - -This view has a long, storied history in the field of economics. But it's perhaps nowhere more clear than in the early writing of Nobel Prize-winning economist[Ronald Coase][1]. In 1937, Coase published "[The Nature of the Firm][2]," an essay about the reasons people organized into firms to work on large-scale projects—rather than tackle those projects alone. Coase argued that when the cost of coordinating workers together inside a firm is less than that of similar market transactions outside, people will tend to organize so they can reap the benefits of lower operating costs. - -But at some point, Coase's theory goes, the work of coordinating interactions between so many people inside the firm actually outweighs the benefits of having an organization in the first place. The complexity of those interactions becomes too difficult to handle. Management, then, should serve the function of decreasing this complexity. Its primary goal is coordination, eliminating the costs associated with messy interpersonal interactions that could slow the firm and reduce its efficiency. As one Fortune 100 CEO recently told me, "Failures happen most often around organizational handoffs." - -This makes sense to people practicing what I've called "[mechanical management][3]," where managing people is the act of keeping them focused on specific, repeatable, specialized tasks. Here, management's key function is optimizing coordination costs—ensuring that every specialized component of the finely-tuned organizational machine doesn't impinge on the others and slow them down. Managers work to avoid failures by coordinating different functions across the organization (accounts payable, research and development, engineering, human resources, sales, and so on) to get them to operate toward a common goal. And managers create value by controlling information flows, intervening only when functions become misaligned. - -Today, when so many of these traditionally well-defined tasks have become automated, value creation is much more a result of novel innovation and problem solving—not finding new ways to drive efficiency from repeatable processes. But numerous studies demonstrate that innovative, problem-solving activity occurs much more regularly when people work in cross-functional teams—not as isolated individuals or groups constrained by single-functional silos. This kind of activity can lead to what some call "accidental integration": the serendipitous innovation that occurs when old elements combine in new and unforeseen ways. - -That's why working collaboratively has now become a necessity that managers need to foster, not eliminate. - -### From coordination to collaboration - -Reframing the value of the firm—from something that coordinated individual transactions to something that produces novel innovations—means rethinking the value of the relations at the core of our organizations. And that begins with reimagining the task of management, which is no longer concerned primarily with minimizing coordination costs but maximizing cooperation opportunities. - -Too few of our tried-and-true management practices have this goal. If they're seeking greater innovation, managers need to encourage more interactions between people in different functional areas, not fewer. A cross-functional team may not be as efficient as one composed of people with the same skill sets. But a cross-functional team is more likely to be the one connecting points between elements in your organization that no one had ever thought to connect (the one more likely, in other words, to achieve accidental integration). - -Working collaboratively has now become a necessity that managers need to foster, not eliminate. - -I have three suggestions for leaders interested in making this shift: - -First, define organizations around processes, not functions. We've seen this strategy work in enterprise IT, for example, in the case of [DevOps][4], where teams emerge around end goals (like a mobile application or a website), not singular functions (like developing, testing, and production). In DevOps environments, the same team that writes the code is responsible for maintaining it once it's in production. (We've found that when the same people who write the code are the ones woken up when it fails at 3 a.m., we get better code.) - -Second, define work around the optimal organization rather than the organization around the work. Amazon is a good example of this strategy. Teams usually stick to the "[Two Pizza Rule][5]" when establishing optimal conditions for collaboration. In other words, Amazon leaders have determined that the best-sized team for maximum innovation is about 10 people, or a group they can feed with two pizzas. If the problem gets bigger than that two-pizza team can handle, they split the problem into two simpler problems, dividing the work between multiple teams rather than adding more people to the single team. - -And third, to foster creative behavior and really get people cooperating with one another, do whatever you can to cultivate a culture of honest and direct feedback. Be straightforward and, as I wrote in The Open Organization, let the sparks fly; have frank conversations and let the best ideas win. - -### Let it go - -I realize that asking managers to significantly shift the way they think about their roles can lead to fear and skepticism. Some managers define their performance (and their very identities) by the control they exert over information and people. But the more you dictate the specific ways your organization should do something, the more static and brittle that activity becomes. Agility requires letting go—giving up a certain degree of control. - -Front-line managers will see their roles morph from dictating and monitoring to enabling and supporting. Instead of setting individual-oriented goals, they'll need to set group-oriented goals. Instead of developing individual incentives, they'll need to consider group-oriented incentives. - -Because ultimately, their goal should be to[create the context in which their teams can do their best work][6]. - -[Subscribe to our weekly newsletter][7] to learn more about open organizations. - --------------------------------------------------------------------------------- - -via: https://opensource.com/open-organization/18/4/management-coordination-collaboration - -作者:[Jim Whitehurst][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/remyd -[1]:https://news.uchicago.edu/article/2013/09/02/ronald-h-coase-founding-scholar-law-and-economics-1910-2013 -[2]:http://onlinelibrary.wiley.com/doi/10.1111/j.1468-0335.1937.tb00002.x/full -[3]:https://opensource.com/open-organization/18/2/try-learn-modify -[4]:https://enterprisersproject.com/devops -[5]:https://www.fastcompany.com/3037542/productivity-hack-of-the-week-the-two-pizza-approach-to-productive-teamwork -[6]:https://opensource.com/open-organization/16/3/what-it-means-be-open-source-leader -[7]:https://opensource.com/open-organization/resources/newsletter diff --git a/sources/talk/20180416 For project safety back up your people, not just your data.md b/sources/talk/20180416 For project safety back up your people, not just your data.md deleted file mode 100644 index 0dc6d41fa5..0000000000 --- a/sources/talk/20180416 For project safety back up your people, not just your data.md +++ /dev/null @@ -1,79 +0,0 @@ -For project safety back up your people, not just your data -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/people_remote_teams_world.png?itok=_9DCHEel) -The [FSF][1] was founded in 1985, Perl in 1987 ([happy 30th birthday, Perl][2]!), and Linux in 1991. The [term open source][3] and the [Open Source Initiative][4] both came into being in 1998 (and [turn 20 years old][5] in 2018). Since then, free and open source software has grown to become the default choice for software development, enabling incredible innovation. - -We, the greater open source community, have come of age. Millions of open source projects exist today, and each year the [GitHub Octoverse][6] reports millions of new public repositories. We rely on these projects every day, and many of us could not operate our services or our businesses without them. - -So what happens when the leaders of these projects move on? How can we help ease those transitions while ensuring that the projects thrive? By teaching and encouraging **succession planning**. - -### What is succession planning? - -Succession planning is a popular topic among business executives, boards of directors, and human resources professionals, but it doesn't often come up with maintainers of free and open source projects. Because the concept is common in business contexts, that's where you'll find most resources and advice about establishing a succession plan. As you might expect, most of these articles aren't directly applicable to FOSS, but they do form a springboard from which we can launch our own ideas about succession planning. - -According to [Wikipedia][7]: - -> Succession planning is a process for identifying and developing new leaders who can replace old leaders when they leave, retire, or die. - -In my opinion, this definition doesn't apply very well to free and open source software projects. I primarily object to the use of the term leaders. For the collaborative projects of FOSS, everyone can be some form of leader. Roles other than "project founder" or "benevolent dictator for life" are just as important. Any project role that is measured by bus factor is one that can benefit from succession planning. - -> A project's bus factor is the number of team members who, if hit by a bus, would endanger the smooth operation of the project. The smallest and worst bus factor is 1: when only a single person's loss would put the project in jeopardy. It's a somewhat grim but still very useful concept. - -I propose that instead of viewing succession planning as a leadership pipeline, free and open source projects should view it as a skills pipeline. What sorts of skills does your project need to continue functioning well, and how can you make sure those skills always exist in your community? - -### Benefits of succession planning - -When I talk to project maintainers about succession planning, they often respond with something like, "We've been pretty successful so far without having to think about this. Why should we start now?" - -Aside from the fact that the phrase, "We've always done it this way" is probably one of the most dangerous in the English language, and hearing (or saying) it should send up red flags in any community, succession planning provides plenty of very real benefits: - - * **Continuity** : When someone leaves, what happens to the tasks they were performing? Succession planning helps ensure those tasks continue uninterrupted and no one is left hanging. - * **Avoiding a power vacuum** : When a person leaves a role with no replacement, it can lead to confusion, delays, and often most damaging, political woes. After all, it's much easier to fix delays than hurt feelings. A succession plan helps alleviate the insecure and unstable time when someone in a vital role moves on. - * **Increased project/organization longevity** : The thinking required for succession planning is the same sort of thinking that contributes to project longevity. Ensuring continuity in leadership, culture, and productivity also helps ensure the project will continue. It will evolve, but it will survive. - * **Reduced workload/pressure on current leaders** : When a single team member performs a critical role in the project, they often feel pressure to be constantly "on." This can lead to burnout and worse, resignations. A succession plan ensures that all important individuals have a backup or successor. The knowledge that someone can take over is often enough to reduce the pressure, but it also means that key players can take breaks or vacations without worrying that their role will be neglected in their absence. - * **Talent development** : Members of the FOSS community talk a lot about mentoring these days, and that's great. However, most of the conversation is around mentoring people to contribute code to a project. There are many different ways to contribute to free and open source software projects beyond programming. A robust succession plan recognizes these other forms of contribution and provides mentoring to prepare people to step into critical non-programming roles. - * **Inspiration for new members** : It can be very motivational for new or prospective community members to see that a project uses its succession plan. Not only does it show them that the project is well-organized and considers its own health and welfare as well as that of its members, but it also clearly shows new members how they can grow in the community. An obvious path to critical roles and leadership positions inspires new members to stick around to walk that path. - * **Diversity of thoughts/get out of a rut** : Succession plans provide excellent opportunities to bring in new people and ideas to the critical roles of a project. [Studies show][8] that diverse leadership teams are more effective and the projects they lead are more innovative. Using your project's succession plan to mentor people from different backgrounds and with different perspectives will help strengthen and evolve the project in a healthy way. - * **Enabling meritocracy** : Unfortunately, what often passes for meritocracy in many free and open source projects is thinly veiled hostility toward new contributors and diverse opinions—hostility that's delivered from within an echo chamber. Meritocracy without a mentoring program and healthy governance structure is simply an excuse to practice subjective discrimination while hiding behind unexpressed biases. A well-executed succession plan helps teams reach the goal of a true meritocracy. What counts as merit for any given role, and how to reach that level of merit, are openly, honestly, and completely documented. The entire community will be able to see and judge which members are on the path or deserve to take on a particular critical role. - - - -### Why it doesn't happen - -Succession planning isn't a panacea, and it won't solve all problems for all projects, but as described above, it offers a lot of worthwhile benefits to your project. - -Despite that, very few free and open source projects or organizations put much thought into it. I was curious why that might be, so I asked around. I learned that the reasons for not having a succession plan fall into one of five different buckets: - - * **Too busy** : Many people recognize succession planning (or lack thereof) as a problem for their project but just "hadn't ever gotten around to it" because there's "always something more important to work on." I understand and sympathize with this, but I suspect the problem may have more to do with prioritization than with time availability. - * **Don't think of it** : Some people are so busy and preoccupied that they haven't considered, "Hey, what would happen if Jen had to leave the project?" This never occurs to them. After all, Jen's always been there when they need her, right? And that will always be the case, right? - * **Don't want to think of it** : Succession planning shares a trait with estate planning: It's associated with negative feelings like loss and can make people address their own mortality. Some people are uncomfortable with this and would rather not consider it at all than take the time to make the inevitable easier for those they leave behind. - * **Attitude of current leaders** : A few of the people with whom I spoke didn't want to recognize that they're replaceable, or to consider that they may one day give up their power and influence on the project. While this was (thankfully) not a common response, it was alarming enough to deserve its own bucket. Failure of someone in a critical role to recognize or admit that they won't be around forever can set a project up for failure in the long run. - * **Don't know where to start** : Many people I interviewed realize that succession planning is something that their project should be doing. They were even willing to carve out the time to tackle this very large task. What they lacked was any guidance on how to start the process of creating a succession plan. - - - -As you can imagine, something as important and people-focused as a succession plan isn't easy to create, and it doesn't happen overnight. Also, there are many different ways to do it. Each project has its own needs and critical roles. One size does not fit all where succession plans are concerned. - -There are, however, some guidelines for how every project could proceed with the succession plan creation process. I'll cover these guidelines in my next article. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/4/passing-baton-succession-planning-foss-leadership - -作者:[VM(Vicky) Brasseur][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/vmbrasseur -[1]:http://www.fsf.org -[2]:https://opensource.com/article/17/10/perl-turns-30 -[3]:https://opensource.com/article/18/2/coining-term-open-source-software -[4]:https://opensource.org -[5]:https://opensource.org/node/910 -[6]:https://octoverse.github.com -[7]:https://en.wikipedia.org/wiki/Succession_planning -[8]:https://hbr.org/2016/11/why-diverse-teams-are-smarter diff --git a/sources/talk/20180417 How to develop the FOSS leaders of the future.md b/sources/talk/20180417 How to develop the FOSS leaders of the future.md deleted file mode 100644 index a65dc9dabd..0000000000 --- a/sources/talk/20180417 How to develop the FOSS leaders of the future.md +++ /dev/null @@ -1,93 +0,0 @@ -How to develop the FOSS leaders of the future -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_paperclips.png?itok=j48op49T) -Do you hold a critical role in a free and open source software project? Would you like to make it easier for the next person to step into your shoes, while also giving yourself the freedom to take breaks and avoid burnout? - -Of course you would! But how do you get started? - -Before you do anything, remember that this is a free or open source project. As with all things in FOSS, your succession planning should happen in collaboration with others. The [Principle of Least Astonishment][1] also applies: Don't work on your plan in isolation, then spring it on the entire community. Work together and publicly, so no one is caught off guard when the cultural or governance changes start happening. - -### Identify and analyse critical roles - -As a project leader, your first step is to identify the critical roles in your community. While it can help to ask each community members what role they perform, it's important to realize that most people perform multiple roles. Make sure you consider every role that each community member plays in the project. - -Once you've identified the roles and determined which ones are critical to your project, the next step is to list all of the duties and responsibilities for each of those critical roles. Be very honest here. List the duties and responsibilities you think each role has, then ask the person who performs that role to list the duties the role actually has. You'll almost certainly find that the second list is longer than the first. - -### Refactor large roles - -During this process, have you discovered any roles that encompass a large number of duties and responsibilities? Large roles are like large methods in your code: They're a sign of a problem, and they need to be refactored to make them easier to maintain. One of the easiest and most effective steps in succession planning for FOSS projects is to split up each large role into two or more smaller roles and distribute these to other community members. With that one step, you've greatly improved the [bus factor][2] for your project. Even better, you've made each one of those new, smaller roles much more accessible and less intimidating for new community members. People are much more likely to volunteer for a role if it's not a massive burden. - -### Limit role tenure - -Another way to make a role more enticing is to limit its tenure. Community members will be more willing to step into roles that aren't open-ended. They can look at their life and work plans and ask themselves, "Can I take on this role for the next eighteen months?" (or whatever term limit you set). - -Setting term limits also helps those who are currently performing the role. They know when they can set aside those duties and move on to something else, which can help alleviate burnout. Also, setting a term limit creates a pool of people who have performed the role and are qualified to step in if needed, which can also mitigate burnout. - -### Knowledge transfer - -Once you've identified and defined the critical roles in your project, most of what remains is knowledge transfer. Even small projects involve a lot of moving parts and knowledge that needs to be where everyone can see, share, use, and contribute to it. What sort of knowledge should you be collecting? The answer will vary by project, needs, and role, but here are some of the most common (and commonly overlooked) types of information needed to implement a succession plan: - - * **Roles and their duties** : You've spent a lot of time identifying, analyzing, and potentially refactoring roles and their duties. Make sure this information doesn't get lost. - * **Policies and procedures** : None of those duties occur in a vacuum. Each duty must be performed in a particular way (procedures) when particular conditions are met (policies). Take stock of these details for every duty of every role. - * **Resources** : What accounts are associated with the project, or are necessary for it to operate? Who helps you with meetup space, sponsorship, or in-kind services? Such information is vital to project operation but can be easily lost when the responsible community member moves on. - * **Credentials** : Ideally, every external service required by the project will use a login that goes to an email address designated for a specific role (`sre@project.org`) rather than to a personal address. Every role's address should include multiple people on the distribution list to ensure that important messages (such as downtime or bogus "forgot password" requests) aren't missed. The credentials for every service should be kept in a secure keystore, with access limited to the fewest number of people possible. - * **Project history** : All community members benefit greatly from learning the history of the project. Collecting project history information can clarify why decisions were made in the past, for example, and reveal otherwise unexpressed requirements and values of the community. Project histories can also help new community members understand "inside jokes," jargon, and other cultural factors. - * **Transition plans** : A succession plan doesn't do much good if project leaders haven't thought through how to transition a role from one person to another. How will you locate and prepare people to take over a critical role? Since the project has already done a lot of thinking and knowledge transfer, transition plans for each role may be easier to put together. - - - -Doing a complete knowledge transfer for all roles in a project can be an enormous undertaking, but the effort is worth it. To avoid being overwhelmed by such a daunting task, approach it one role at a time, finishing each one before you move onto the next. Limiting the scope in this way makes both progress and success much more likely. - -### Document, document, document! - -Succession planning takes time. The community will be making a lot of decisions and collecting a lot of information, so make sure nothing gets lost. It's important to document everything (not just in email threads). Where knowledge is concerned, documentation scales and people do not. Include even the things that you think are obvious—what's obvious to a more seasoned community member may be less so to a newbie, so don't skip steps or information. - -Gather these decisions, processes, policies, and other bits of information into a single place, even if it's just a collection of markdown files in the main project repository. The "how" and "where" of the documentation can be sorted out later. It's better to capture key information first and spend time [bike-shedding][3] a documentation system later. - -Once you've collected all of this information, you should understand that it's unlikely that anyone will read it. I know, it seems unfair, but that's just how things usually work out. The reason? There is simply too much documentation and too little time. To address this, add an abstract, or summary, at the top of each item. Often that's all a person needs, and if not, the complete document is there for a deep dive. Recognizing and adapting to how most people use documentation increases the likelihood that they will use yours. - -Above all, don't skip the documentation process. Without documentation, succession plans are impossible. - -### New leaders - -If you don't yet perform a critical role but would like to, you can contribute to the succession planning process while apprenticing your way into one of those roles. - -For starters, actively look for opportunities to learn and contribute. Shadow people in critical roles. You'll learn how the role is done, and you can document it to help with the succession planning process. You'll also get the opportunity to see whether it's a role you're interested in pursuing further. - -Asking for mentorship is a great way to get yourself closer to taking on a critical role in the project. Even if you haven't heard that mentoring is available, it's perfectly OK to ask about it. The people already in those roles are usually happy to mentor others, but often are too busy to think about offering mentorship. Asking is a helpful reminder to them that they should be helping to train people to take over their role when they need a break. - -As you perform your own tasks, actively seek out feedback. This will not only improve your skills, but it shows that you're interested in doing a better job for the community. This commitment will pay off when your project needs people to step into critical roles. - -Finally, as you communicate with more experienced community members, take note of anecdotes about the history of the project and how it operates. This history is very important, especially for new contributors or people stepping into critical roles. It provides the context necessary for new contributors to understand what things do or don't work and why. As you hear these stories, document them so they can be passed on to those who come after you. - -### Succession planning examples - -While too few FOSS projects are actively considering succession planning, some are doing a great job of trying to reduce their bus factor and prevent maintainer burnout. - -[Exercism][4] isn't just an excellent tool for gaining fluency in programming languages. It's also an [open source project][5] that goes out of its way to help contributors [land their first patch][6]. In 2016, the project reviewed the health of each language track and [discovered that many were woefully maintained][7]. There simply weren't enough people covering each language, so maintainers were burning out. The Exercism community recognized the risk this created and pushed to find new maintainers for as many language tracks as possible. As a result, the project was able to revive several tracks from near-death and develop a structure for inviting people to become maintainers. - -The purpose of the [Vox Pupuli][8] project is to serve as a sort of succession plan for the [Puppet module][9] community. When a maintainer no longer wishes or is able to work on their module, they can bequeath it to the Vox Pupuli community. This community of 30 collaborators shares responsibility for maintaining all the modules it accepts into the project. The large number of collaborators ensures that no single person bears the burden of maintenance while also providing a long and fruitful life for every module in the project. - -These are just two examples of how some FOSS projects are tackling succession planning. Share your stories in the comments below. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/4/succession-planning-how-develop-foss-leaders-future - -作者:[VM(Vicky) Brasseur)][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/vmbrasseur -[1]:https://en.wikipedia.org/wiki/Principle_of_least_astonishment -[2]:https://en.wikipedia.org/wiki/Bus_factor -[3]:https://en.wikipedia.org/wiki/Law_of_triviality -[4]:http://exercism.io -[5]:https://github.com/exercism/exercism.io -[6]:https://github.com/exercism/exercism.io/blob/master/CONTRIBUTING.md -[7]:https://tinyletter.com/exercism/letters/exercism-track-health-check-new-maintainers -[8]:https://voxpupuli.org -[9]:https://forge.puppet.com diff --git a/sources/talk/20180418 Is DevOps compatible with part-time community teams.md b/sources/talk/20180418 Is DevOps compatible with part-time community teams.md deleted file mode 100644 index e78b96959f..0000000000 --- a/sources/talk/20180418 Is DevOps compatible with part-time community teams.md +++ /dev/null @@ -1,73 +0,0 @@ -Is DevOps compatible with part-time community teams? -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1) -DevOps seems to be the talk of the IT world of late—and for good reason. DevOps has streamlined the process and production of IT development and operations. However, there is also an upfront cost to embracing a DevOps ideology, in terms of time, effort, knowledge, and financial investment. Larger companies may have the bandwidth, budget, and time to make the necessary changes, but is it feasible for part-time, resource-strapped communities? - -Part-time communities are teams of like-minded people who take on projects outside of their normal work schedules. The members of these communities are driven by passion and a shared purpose. For instance, one such community is the [ALM | DevOps Rangers][1]. With 100 rangers engaged across the globe, a DevOps solution may seem daunting; nonetheless, they took on the challenge and embraced the ideology. Through their example, we've learned that DevOps is not only feasible but desirable in smaller teams. To read about their transformation, check out [How DevOps eliminates development bottlenecks][2]. - -> “DevOps is the union of people, process, and products to enable continuous delivery of value to our end customers.” - Donovan Brown - -### The cost of DevOps - -As stated above, there is an upfront "cost" to DevOps. The cost manifests itself in many forms, such as the time and collaboration between development, operations, and other stakeholders, planning a smooth-flowing process that delivers continuous value, finding the best DevOps products, and training the team in new technologies, to name a few. This aligns directly with Donovan's definition of DevOps, in fact—a **process** for delivering **continuous value** and the **people** who make that happen. - -Streamlined DevOps takes a lot of planning and training just to create the process, and that doesn't even consider the testing phase. We also can't forget the existing in-flight projects that need to be converted into the new system. While the cost increases the more pervasive the transformation—for instance, if an organization aims to unify its entire development organization under a single process, then that would cost more versus transforming a single pilot or subset of the entire portfolio—these upfront costs must be addressed regardless of their scale. There are a lot of resources and products already out there that can be implemented for a smoother transition—but again, we face the time and effort that will be necessary just to research which ones might work best. - -In the case of the ALM | DevOps Rangers, they had to halt all projects for a couple of sprints to set up the initial process. Many organizations would not be able to do that. Even part-time groups might have very good reasons to keep things moving, which only adds to the complexity. In such scenarios, additional cutover planning (and therefore additional cost) is needed, and the overall state of the community is one of flux and change, which adds risk, which—you guessed it—requires more cost to mitigate. - -There is also an ongoing "cost" that teams will face with a DevOps mindset: Simple maintenance of the system, training and transitioning new team members, and keeping up with new, improved technologies are all a part of the process. - -### DevOps for a part-time community - -Whereas larger companies can dedicate a single manager or even a team to the task over overseeing the continuous integration and continuous deployment (CI/CD) pipelines, part-time community teams don't have the bandwidth to give. With such a massive undertaking we must ask: Is it even worth it for groups with fewer resources to take on DevOps for their community? Or should they abandon the idea of DevOps altogether? - -The answer to that is dependent on a few variables, such as the ability of the teams to be self-managing, the time and effort each member is willing to put into the transformation, and the dedication of the community to the process. - -### Example: Benefits of DevOps in a part-time community - -Luckily, we aren't without examples to demonstrate just how DevOps can benefit a smaller group. Let's take a quick look at the ALM Rangers again. The results from their transformation help us understand how DevOps changed their community: - -![](https://opensource.com/sites/default/files/images/life-uploads/devops.png) - -As illustrated, there are some huge benefits for part-time community teams. Planning goes from long, arduous design sessions to a quick prototyping and storyboarding process. Builds become automated, reliable, and resilient. Testing and bug detection are proactive instead of reactive, which turns into a happier clientele. Multiple full-time program managers are replaced with self-managing teams with a single part-time manager to oversee projects. Teams become smaller and more efficient, which equates to higher production rates and higher-quality project delivery. With results like these, it's hard to argue against DevOps. - -Still, the upfront and ongoing costs aren't right for every community. The number-one most important aspect of any DevOps transformation is the mindset of the people involved. Adopting the idea of self-managing teams who work in autonomy instead of the traditional chain-of-command scheme can be a challenge for any group. The members must be willing to work independently without a lot of oversight and take ownership of their features and user experience, but at the same time, work in a setting that is fully transparent to the rest of the community. **The success or failure of a DevOps strategy lies on the team.** - -### Making the DevOps transition in 4 steps - -Another important question to ask: How can a low-bandwidth group make such a massive transition? The good news is that a DevOps transformation doesn’t need to happen all at once. Taken in smaller, more manageable steps, organizations of any size can embrace DevOps. - - 1. Determine why DevOps may be the solution you need. Are your projects bottlenecking? Are they running over budget and over time? Of course, these concerns are common for any community, big or small. Answering these questions leads us to step two: - 2. Develop the right framework to improve the engineering process. DevOps is all about automation, collaboration, and streamlining. Rather than trying to fit everyone into the same process box, the framework should support the work habits, preferences, and delivery needs of the community. Some broad standards should be established (for example, that all teams use a particular version control system). Beyond that, however, let the teams decide their own best process. - 3. Use the current products that are already available if they meet your needs. Why reinvent the wheel? - 4. Finally, implement and test the actual DevOps solution. This is, of course, where the actual value of DevOps is realized. There will likely be a few issues and some heartburn, but it will all be worth it in the end because, once established, the products of the community’s work will be nimbler and faster for the users. - - - -### Reuse DevOps solutions - -One benefit to creating effective CI/CD pipelines is the reusability of those pipelines. Although there is no one-size fits all solution, anyone can adopt a process. There are several pre-made templates available for you to examine, such as build templates on VSTS, ARM templates to deploy Azure resources, and "cookbook"-style textbooks from technical publishers. Once it identifies a process that works well, a community can also create its own template by defining and establishing standards and making that template easily discoverable by the entire community. For more information on DevOps journeys and tools, check out [this site][3]. - -### Summary - -Overall, the success or failure of DevOps relies on the culture of a community. It doesn't matter if the community is a large, resource-rich enterprise or a small, resource-sparse, part-time group. DevOps will still bring solid benefits. The difference is in the approach for adoption and the scale of that adoption. There are both upfront and ongoing costs, but the value greatly outweighs those costs. Communities can use any of the powerful tools available today for their pipelines, and they can also leverage reusability, such as templates, to reduce upfront implementation costs. DevOps is most certainly feasible—and even critical—for the success of part-time community teams. - -**[See our related story,[How DevOps eliminates development bottlenecks][4].]** - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/4/devops-compatible-part-time-community-teams - -作者:[Edward Fry][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/edwardf -[1]:https://github.com/ALM-Rangers -[2]:https://opensource.com/article/17/11/devops-rangers-transformation -[3]:https://www.visualstudio.com/devops/ -[4]:https://opensource.com/article/17/11/devops-rangers-transformation diff --git a/sources/talk/20180419 3 tips for organizing your open source project-s workflow on GitHub.md b/sources/talk/20180419 3 tips for organizing your open source project-s workflow on GitHub.md deleted file mode 100644 index 29e4ea2f48..0000000000 --- a/sources/talk/20180419 3 tips for organizing your open source project-s workflow on GitHub.md +++ /dev/null @@ -1,109 +0,0 @@ -3 tips for organizing your open source project's workflow on GitHub -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ) - -Managing an open source project is challenging work, and the challenges grow as a project grows. Eventually, a project may need to meet different requirements and span multiple repositories. These problems aren't technical, but they are important to solve to scale a technical project. [Business process management][1] methodologies such as agile and [kanban][2] bring a method to the madness. Developers and managers can make realistic decisions for estimating deadlines and team bandwidth with an organized development focus. - -At the [UNICEF Office of Innovation][3], we use GitHub project boards to organize development on the MagicBox project. [MagicBox][4] is a full-stack application and open source platform to serve and visualize data for decision-making in humanitarian crises and emergencies. The project spans multiple GitHub repositories and works with multiple developers. With GitHub project boards, we organize our work across multiple repositories to better understand development focus and team bandwidth. - -Here are three tips from the UNICEF Office of Innovation on how to organize your open source projects with the built-in project boards on GitHub. - -### 1\. Bring development discussion to issues and pull requests - -Transparency is a critical part of an open source community. When mapping out new features or milestones for a project, the community needs to see and understand a decision or why a specific direction was chosen. Filing new GitHub issues for features and milestones is an easy way for someone to follow the project direction. GitHub issues and pull requests are the cards (or building blocks) of project boards. To be successful with GitHub project boards, you need to use issues and pull requests. - - -![GitHub issues for magicbox-maps, MagicBox's front-end application][6] - -GitHub issues for magicbox-maps, MagicBox's front-end application. - -The UNICEF MagicBox team uses GitHub issues to track ongoing development milestones and other tasks to revisit. The team files new GitHub issues for development goals, feature requests, or bugs. These goals or features may come from external stakeholders or the community. We also use the issues as a place for discussion on those tasks. This makes it easy to cross-reference in the future and visualize upcoming work on one of our projects. - -Once you begin using GitHub issues and pull requests as a way of discussing and using your project, organizing with project boards becomes easier. - -### 2\. Set up kanban-style project boards - -GitHub issues and pull requests are the first step. After you begin using them, it may become harder to visualize what work is in progress and what work is yet to begin. [GitHub's project boards][7] give you a platform to visualize and organize cards into different columns. - -There are two types of project boards available: - - * **Repository** : Boards for use in a single repository - * **Organization** : Boards for use in a GitHub organization across multiple repositories (but private to organization members) - - - -The choice you make depends on the structure and size of your projects. The UNICEF MagicBox team uses boards for development and documentation at the organization level, and then repository-specific boards for focused work (like our [community management board][8]). - -#### Creating your first board - -Project boards are found on your GitHub organization page or on a specific repository. You will see the Projects tab in the same row as Issues and Pull requests. From the page, you'll see a green button to create a new project. - -There, you can set a name and description for the project. You can also choose templates to set up basic columns and sorting for your board. Currently, the only options are for kanban-style boards. - - -![Creating a new GitHub project board.][10] - -Creating a new GitHub project board. - -After creating the project board, you can make adjustments to it as needed. You can create new columns, [set up automation][11], and add pre-existing GitHub issues and pull requests to the project board. - -You may notice new options for the metadata in each GitHub issue and pull request. Inside of an issue or pull request, you can add it to a project board. If you use automation, it will automatically enter a column you configured. - -### 3\. Build project boards into your workflow - -After you set up a project board and populate it with issues and pull requests, you need to integrate it into your workflow. Project boards are effective only when actively used. The UNICEF MagicBox team uses the project boards as a way to track our progress as a team, update external stakeholders on development, and estimate team bandwidth for reaching our milestones. - - -![Tracking progress][13] - -Tracking progress with GitHub project boards. - -If you are an open source project and community, consider using the project boards for development-focused meetings. It also helps remind you and other core contributors to spend five minutes each day updating progress as needed. If you're at a company using GitHub to do open source work, consider using project boards to update other team members and encourage participation inside of GitHub issues and pull requests. - -Once you begin using the project board, yours may look like this: - - -![Development progress board][15] - -Development progress board for all UNICEF MagicBox repositories in organization-wide GitHub project boards. - -### Open alternatives - -GitHub project boards require your project to be on GitHub to take advantage of this functionality. While GitHub is a popular repository for open source projects, it's not an open source platform itself. Fortunately, there are open source alternatives to GitHub with tools to replicate the workflow explained above. [GitLab Issue Boards][16] and [Taiga][17] are good alternatives that offer similar functionality. - -### Go forth and organize! - -With these tools, you can bring a method to the madness of organizing your open source project. These three tips for using GitHub project boards encourage transparency in your open source project and make it easier to track progress and milestones in the open. - -Do you use GitHub project boards for your open source project? Have any tips for success that aren't mentioned in the article? Leave a comment below to share how you make sense of your open source projects. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/4/keep-your-project-organized-git-repo - -作者:[Justin W.Flory][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/jflory -[1]:https://en.wikipedia.org/wiki/Business_process_management -[2]:https://en.wikipedia.org/wiki/Kanban_(development) -[3]:http://unicefstories.org/about/ -[4]:http://unicefstories.org/magicbox/ -[5]:/file/393356 -[6]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/github-open-issues.png?itok=OcWPX575 (GitHub issues for magicbox-maps, MagicBox's front-end application) -[7]:https://help.github.com/articles/about-project-boards/ -[8]:https://github.com/unicef/magicbox/projects/3?fullscreen=true -[9]:/file/393361 -[10]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/github-project-boards-create-board.png?itok=pp7SXH9g (Creating a new GitHub project board.) -[11]:https://help.github.com/articles/about-automation-for-project-boards/ -[12]:/file/393351 -[13]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/github-issues-metadata.png?itok=xp5auxCQ (Tracking progress) -[14]:/file/393366 -[15]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/github-project-boards-overview.png?itok=QSbOOOkF (Development progress board) -[16]:https://about.gitlab.com/features/issueboard/ -[17]:https://taiga.io/ diff --git a/sources/talk/20180420 What You Don-t Know About Linux Open Source Could Be Costing to More Than You Think.md b/sources/talk/20180420 What You Don-t Know About Linux Open Source Could Be Costing to More Than You Think.md deleted file mode 100644 index 10511c3a7d..0000000000 --- a/sources/talk/20180420 What You Don-t Know About Linux Open Source Could Be Costing to More Than You Think.md +++ /dev/null @@ -1,39 +0,0 @@ -What You Don’t Know About Linux Open Source Could Be Costing to More Than You Think -====== - -If you would like to test out Linux before completely switching it as your everyday driver, there are a number of means by which you can do it. Linux was not intended to run on Windows, and Windows was not meant to host Linux. To begin with, and perhaps most of all, Linux is open source computer software. In any event, Linux outperforms Windows on all your hardware. - -If you’ve always wished to try out Linux but were never certain where to begin, have a look at our how to begin guide for Linux. Linux is not any different than Windows or Mac OS, it’s basically an Operating System but the leading different is the fact that it is Free for everyone. Employing Linux today isn’t any more challenging than switching from one sort of smartphone platform to another. - -You’re most likely already using Linux, whether you are aware of it or not. Linux has a lot of distinct versions to suit nearly any sort of user. Today, Linux is a small no-brainer. Linux plays an essential part in keeping our world going. - -Even then, it is dependent on the build of Linux that you’re using. Linux runs a lot of the underbelly of cloud operations. Linux is also different in that, even though the core pieces of the Linux operating system are usually common, there are lots of distributions of Linux, like different software alternatives. While Linux might seem intimidatingly intricate and technical to the ordinary user, contemporary Linux distros are in reality very user-friendly, and it’s no longer the case you have to have advanced skills to get started using them. Linux was the very first major Internet-centred open-source undertaking. Linux is beginning to increase the range of patches it pushes automatically, but several of the security patches continue to be opt-in only. - -You are able to remove Linux later in case you need to. Linux plays a vital part in keeping our world going. Linux supplies a huge library of functionality which can be leveraged to accelerate development. - -Even then, it’s dependent on the build of Linux that you’re using. Linux is also different in that, even though the core pieces of the Linux operating system are typically common, there are lots of distributions of Linux, like different software alternatives. While Linux might seem intimidatingly intricate and technical to the ordinary user, contemporary Linux distros are in fact very user-friendly, and it’s no longer the case you require to have advanced skills to get started using them. Linux runs a lot of the underbelly of cloud operations. Linux is beginning to increase the range of patches it pushes automatically, but several of the security patches continue to be opt-in only. Read More, open source projects including Linux are incredibly capable because of the contributions that all these individuals have added over time. - -### Life After Linux Open Source - -The development edition of the manual typically has more documentation, but might also document new characteristics that aren’t in the released version. Fortunately, it’s so lightweight you can just jump to some other version in case you don’t like it. It’s extremely hard to modify the compiled version of the majority of applications and nearly not possible to see exactly the way the developer created different sections of the program. - -On the challenges of bottoms-up go-to-market It’s really really hard to grasp the difference between your organic product the product your developers use and love and your company product, which ought to be, effectively, a different product. As stated by the report, it’s going to be hard for developers to switch. Developers are now incredibly important and influential in the purchasing procedure. Some OpenWrt developers will attend the event and get ready to reply to your questions! - -When the program is installed, it has to be configured. Suppose you discover that the software you bought actually does not do what you would like it to do. Open source software is much more common than you believe, and an amazing philosophy to live by. Employing open source software gives an inexpensive method to bootstrap a business. It’s more difficult to deal with closed source software generally. So regarding Application and Software, you’re all set if you are prepared to learn an alternate software or finding a means to make it run on Linux. Possibly the most famous copyleft software is Linux. - -Article sponsored by [Vegas Palms online slots][1] - - --------------------------------------------------------------------------------- - -via: https://linuxaria.com/article/what-you-dont-know-about-linux-open-source-could-be-costing-to-more-than-you-think - -作者:[Marc Fisher][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://linuxaria.com -[1]:https://www.vegaspalmscasino.com/casino-games/slots/ diff --git a/sources/talk/20180424 There-s a Server in Every Serverless Platform.md b/sources/talk/20180424 There-s a Server in Every Serverless Platform.md deleted file mode 100644 index 9bc935c06d..0000000000 --- a/sources/talk/20180424 There-s a Server in Every Serverless Platform.md +++ /dev/null @@ -1,87 +0,0 @@ -There’s a Server in Every Serverless Platform -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/servers.jpg?itok=i_gyObMP) -Serverless computing or Function as a Service (FaaS) is a new buzzword created by an industry that loves to coin new terms as market dynamics change and technologies evolve. But what exactly does it mean? What is serverless computing? - -Before getting into the definition, let’s take a brief history lesson from Sirish Raghuram, CEO and co-founder of Platform9, to understand the evolution of serverless computing. - -“In the 90s, we used to build applications and run them on hardware. Then came virtual machines that allowed users to run multiple applications on the same hardware. But you were still running the full-fledged OS for each application. The arrival of containers got rid of OS duplication and process level isolation which made it lightweight and agile,” said Raghuram. - -Serverless, specifically, Function as a Service, takes it to the next level as users are now able to code functions and run them at the granularity of build, ship and run. There is no complexity of underlying machinery needed to run those functions. No need to worry about spinning containers using Kubernetes. Everything is hidden behind the scenes. - -“That’s what is driving a lot of interest in function as a service,” said Raghuram. - -### What exactly is serverless? - -There is no single definition of the term, but to build some consensus around the idea, the [Cloud Native Computing Foundation (CNCF)][1] Serverless Working Group wrote a [white paper][2] to define serverless computing. - -According to the white paper, “Serverless computing refers to the concept of building and running applications that do not require server management. It describes a finer-grained deployment model where applications, bundled as one or more functions, are uploaded to a platform and then executed, scaled, and billed in response to the exact demand needed at the moment.” - -Ken Owens, a member of the Technical Oversight Committee at CNCF said that the primary goal of serverless computing is to help users build and run their applications without having to worry about the cost and complexity of servers in terms of provisioning, management and scaling. - -“Serverless is a natural evolution of cloud-native computing. The CNCF is advancing serverless adoption through collaboration and community-driven initiatives that will enable interoperability,” [said][3] Chris Aniszczyk, COO, CNCF. - -### It’s not without servers - -First things first, don’t get fooled by the term “serverless.” There are still servers in serverless computing. Remember what Raghuram said: all the machinery is hidden; it’s not gone. - -The clear benefit here is that developers need not concern themselves with tasks that don’t add any value to their deliverables. Instead of worrying about managing the function, they can dedicate their time to adding featured and building apps that add business value. Time is money and every minute saved in management goes toward innovation. Developers don’t have to worry about scaling based on peaks and valleys; it’s automated. Because cloud providers charge only for the duration that functions are run, developers cut costs by not having to pay for blinking lights. - -But… someone still has to do the work behind the scenes. There are still servers offering FaaS platforms. - -In the case of public cloud offerings like Google Cloud Platform, AWS, and Microsoft Azure, these companies manage the servers and charge customers for running those functions. In the case of private cloud or datacenters, where developers don’t have to worry about provisioning or interacting with such servers, there are other teams who do. - -The CNCF white paper identifies two groups of professionals that are involved in the serverless movement: developers and providers. We have already talked about developers. But, there are also providers that offer serverless platforms; they deal with all the work involved in keeping that server running. - -That’s why many companies, like SUSE, refrain from using the term “serverless” and prefer the term function as a service, because they offer products that run those “serverless” servers. But what kind of functions are these? Is it the ultimate future of app delivery? - -### Event-driven computing - -Many see serverless computing as an umbrella that offers FaaS among many other potential services. According to CNCF, FaaS provides event-driven computing where functions are triggered by events or HTTP requests. “Developers run and manage application code with functions that are triggered by events or HTTP requests. Developers deploy small units of code to the FaaS, which are executed as needed as discrete actions, scaling without the need to manage servers or any other underlying infrastructure,” said the white paper. - -Does that mean FaaS is the silver bullet that solves all problems for developing and deploying applications? Not really. At least not at the moment. FaaS does solve problems in several use cases and its scope is expanding. A good use case of FaaS could be the functions that an application needs to run when an event takes place. - -Let’s take an example: a user takes a picture from a phone and uploads it to the cloud. Many things happen when the picture is uploaded - it’s scanned (exif data is read), a thumbnail is created, based on deep learning/machine learning the content of the image is analyzed, the information of the image is stored in the database. That one event of uploading that picture triggers all those functions. Those functions die once the event is over. That’s what FaaS does. It runs code quickly to perform all those tasks and then disappears. - -That’s just one example. Another example could be an IoT device where a motion sensor triggers an event that instructs the camera to start recording and sends the clip to the designated contant. Your thermostat may trigger the fan when the sensor detects a change in temperature. These are some of the many use cases where function as a service make more sense than the traditional approach. Which also says that not all applications (at least at the moment, but that will change as more organizations embrace the serverless platform) can be run as function as service. - -According to CNCF, serverless computing should be considered if you have these kinds of workloads: - - * Asynchronous, concurrent, easy to parallelize into independent units of work - - * Infrequent or has sporadic demand, with large, unpredictable variance in scaling requirements - - * Stateless, ephemeral, without a major need for instantaneous cold start time - - * Highly dynamic in terms of changing business requirements that drive a need for accelerated developer velocity - - - - -### Why should you care? - -Serverless is a very new technology and paradigm, just the way VMs and containers transformed the app development and delivery models, FaaS can also bring dramatic changes. We are still in the early days of serverless computing. As the market evolves, consensus is created and new technologies evolve, and FaaS may grow beyond the workloads and use cases mentioned here. - -What is becoming quite clear is that companies who are embarking on their cloud native journey must have serverless computing as part of their strategy. The only way to stay ahead of competitors is by keeping up with the latest technologies and trends. - -It’s about time to put serverless into servers. - -For more information, check out the CNCF Working Group's serverless whitepaper [here][2]. And, you can learn more at [KubeCon + CloudNativeCon Europe][4], coming up May 2-4 in Copenhagen, Denmark. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/2018/4/theres-server-every-serverless-platform - -作者:[SWAPNIL BHARTIYA][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/arnieswap -[1]:https://www.cncf.io/ -[2]:https://github.com/cncf/wg-serverless/blob/master/whitepaper/cncf_serverless_whitepaper_v1.0.pdf -[3]:https://www.cncf.io/blog/2018/02/14/cncf-takes-first-step-towards-serverless-computing/ -[4]:https://events.linuxfoundation.org/events/kubecon-cloudnativecon-europe-2018/attend/register/ diff --git a/sources/talk/20180511 Looking at the Lispy side of Perl.md b/sources/talk/20180511 Looking at the Lispy side of Perl.md deleted file mode 100644 index 1fa51b314c..0000000000 --- a/sources/talk/20180511 Looking at the Lispy side of Perl.md +++ /dev/null @@ -1,357 +0,0 @@ -Looking at the Lispy side of Perl -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_cloud_database.png?itok=lhhU42fg) -Some programming languages (e.g., C) have named functions only, whereas others (e.g., Lisp, Java, and Perl) have both named and unnamed functions. A lambda is an unnamed function, with Lisp as the language that popularized the term. Lambdas have various uses, but they are particularly well-suited for data-rich applications. Consider this depiction of a data pipeline, with two processing stages shown: - -![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/data_source.png?itok=OON2cC2R) - -### Lambdas and higher-order functions - -The filter and transform stages can be implemented as higher-order functions—that is, functions that can take a function as an argument. Suppose that the depicted pipeline is part of an accounts-receivable application. The filter stage could consist of a function named `filter_data`, whose single argument is another function—for example, a `high_buyers` function that filters out amounts that fall below a threshold. The transform stage might convert amounts in U.S. dollars to equivalent amounts in euros or some other currency, depending on the function plugged in as the argument to the higher-order `transform_data` function. Changing the filter or the transform behavior requires only plugging in a different function argument to the higher order `filter_data` or `transform_data` functions. - -Lambdas serve nicely as arguments to higher-order functions for two reasons. First, lambdas can be crafted on the fly, and even written in place as arguments. Second, lambdas encourage the coding of pure functions, which are functions whose behavior depends solely on the argument(s) passed in; such functions have no side effects and thereby promote safe concurrent programs. - -Perl has a straightforward syntax and semantics for lambdas and higher-order functions, as shown in the following example: - -### A first look at lambdas in Perl - -``` -#!/usr/bin/perl - -use strict; -use warnings; - -## References to lambdas that increment, decrement, and do nothing. -## $_[0] is the argument passed to each lambda. -my $inc = sub { $_[0] + 1 };  ## could use 'return $_[0] + 1' for clarity -my $dec = sub { $_[0] - 1 };  ## ditto -my $nop = sub { $_[0] };      ## ditto - -sub trace { -    my ($val, $func, @rest) = @_; -    print $val, " ", $func, " ", @rest, "\nHit RETURN to continue...\n"; -    <STDIN>; -} - -## Apply an operation to a value. The base case occurs when there are -## no further operations in the list named @rest. -sub apply { -    my ($val, $first, @rest) = @_; -    trace($val, $first, @rest) if 1;  ## 0 to stop tracing - -    return ($val, apply($first->($val), @rest)) if @rest; ## recursive case -    return ($val, $first->($val));                        ## base case -} - -my $init_val = 0; -my @ops = (                        ## list of lambda references -    $inc, $dec, $dec, $inc, -    $inc, $inc, $inc, $dec, -    $nop, $dec, $dec, $nop, -    $nop, $inc, $inc, $nop -    ); - -## Execute. -print join(' ', apply($init_val, @ops)), "\n"; -## Final line of output: 0 1 0 -1 0 1 2 3 2 2 1 0 0 0 1 2 2strictwarningstraceSTDINapplytraceapplyapply -``` - -The lispy program shown above highlights the basics of Perl lambdas and higher-order functions. Named functions in Perl start with the keyword `sub` followed by a name: -``` -sub increment { ... }   # named function - -``` - -An unnamed or anonymous function omits the name: -``` -sub {...}               # lambda, or unnamed function - -``` - -In the lispy example, there are three lambdas, and each has a reference to it for convenience. Here, for review, is the `$inc` reference and the lambda referred to: -``` -my $inc = sub { $_[0] + 1 }; - -``` - -The lambda itself, the code block to the right of the assignment operator `=`, increments its argument `$_[0]` by 1. The lambda’s body is written in Lisp style; that is, without either an explicit `return` or a semicolon after the incrementing expression. In Perl, as in Lisp, the value of the last expression in a function’s body becomes the returned value if there is no explicit `return` statement. In this example, each lambda has only one expression in its body—a simplification that befits the spirit of lambda programming. - -The `trace` function in the lispy program helps to clarify how the program works (as I'll illustrate below). The higher-order function `apply`, a nod to a Lisp function of the same name, takes a numeric value as its first argument and a list of lambda references as its second argument. The `apply` function is called initially, at the bottom of the program, with zero as the first argument and the list named `@ops` as the second argument. This list consists of 16 lambda references from among `$inc` (increment a value), `$dec` (decrement a value), and `$nop` (do nothing). The list could contain the lambdas themselves, but the code is easier to write and to understand with the more concise lambda references. - -The logic of the higher-order `apply` function can be clarified as follows: - - 1. The argument list passed to `apply` in typical Perl fashion is separated into three pieces: -``` -my ($val, $first, @rest) = @_; ## break the argument list into three elements - -``` - -The first element `$val` is a numeric value, initially `0`. The second element `$first` is a lambda reference, one of `$inc` `$dec`, or `$nop`. The third element `@rest` is a list of any remaining lambda references after the first such reference is extracted as `$first`. - - 2. If the list `@rest` is not empty after its first element is removed, then `apply` is called recursively. The two arguments to the recursively invoked `apply` are: - - * The value generated by applying lambda operation `$first` to numeric value `$val`. For example, if `$first` is the incrementing lambda to which `$inc` refers, and `$val` is 2, then the new first argument to `apply` would be 3. - * The list of remaining lambda references. Eventually, this list becomes empty because each call to `apply` shortens the list by extracting its first element. - - - -Here is some output from a sample run of the lispy program, with `%` as the command-line prompt: -``` -% ./lispy.pl - -0 CODE(0x8f6820) CODE(0x8f68c8)CODE(0x8f68c8)CODE(0x8f6820)CODE(0x8f6820)CODE(0x8f6820)... -Hit RETURN to continue... - -1 CODE(0x8f68c8) CODE(0x8f68c8)CODE(0x8f6820)CODE(0x8f6820)CODE(0x8f6820)CODE(0x8f6820)... -Hit RETURN to continue -``` - -The first output line can be clarified as follows: - - * The `0` is the numeric value passed as an argument in the initial (and thus non-recursive) call to function `apply`. The argument name is `$val` in `apply`. - * The `CODE(0x8f6820)` is a reference to one of the lambdas, in this case the lambda to which `$inc` refers. The second argument is thus the address of some lambda code. The argument name is `$first` in `apply` - * The third piece, the series of `CODE` references, is the list of lambda references beyond the first. The argument name is `@rest` in `apply`. - - - -The second line of output shown above also deserves a look. The numeric value is now `1`, the result of incrementing `0`: the initial lambda is `$inc` and the initial value is `0`. The extracted reference `CODE(0x8f68c8)` is now `$first`, as this reference is the first element in the `@rest` list after `$inc` has been extracted earlier. - -Eventually, the `@rest` list becomes empty, which ends the recursive calls to `apply`. In this case, the function `apply` simply returns a list with two elements: - - 1. The numeric value taken in as an argument (in the sample run, 2). - 2. This argument transformed by the lambda (also 2 because the last lambda reference happens to be `$nop` for do nothing). - - - -The lispy example underscores that Perl supports lambdas without any special fussy syntax: A lambda is just an unnamed code block, perhaps with a reference to it for convenience. Lambdas themselves, or references to them, can be passed straightforwardly as arguments to higher-order functions such as `apply` in the lispy example. Invoking a lambda through a reference is likewise straightforward. In the `apply` function, the call is: -``` -$first->($val)    ## $first is a lambda reference, $val a numeric argument passed to the lambda - -``` - -### A richer code example - -The next code example puts a lambda and a higher-order function to practical use. The example implements Conway’s Game of Life, a cellular automaton that can be represented as a matrix of cells. Such a matrix goes through various transformations, each yielding a new generation of cells. The Game of Life is fascinating because even relatively simple initial configurations can lead to quite complex behavior. A quick look at the rules governing cell birth, survival, and death is in order. - -Consider this 5x5 matrix, with a star representing a live cell and a dash representing a dead one: -``` - -----              ## initial configuration - --*-- - --*-- - --*-- - ----- -``` - -The next generation becomes: -``` - -----              ## next generation - ----- - -***- - ---- - ----- -``` - -As life continues, the generations oscillate between these two configurations. - -Here are the rules determining birth, death, and survival for a cell. A given cell has between three neighbors (a corner cell) and eight neighbors (an interior cell): - - * A dead cell with exactly three live neighbors comes to life. - * A live cell with more than three live neighbors dies from over-crowding. - * A live cell with two or three live neighbors survives; hence, a live cell with fewer than two live neighbors dies from loneliness. - - - -In the initial configuration shown above, the top and bottom live cells die because neither has two or three live neighbors. By contrast, the middle live cell in the initial configuration gains two live neighbors, one on either side, in the next generation. - -## Conway’s Game of Life -``` -#!/usr/bin/perl - -### A simple implementation of Conway's game of life. -# Usage: ./gol.pl [input file]  ;; If no file name given, DefaultInfile is used. - -use constant Dead  => "-"; -use constant Alive => "*"; -use constant DefaultInfile => 'conway.in'; - -use strict; -use warnings; - -my $dimension = undef; -my @matrix = (); -my $generation = 1; - -sub read_data { -    my $datafile = DefaultInfile; -    $datafile = shift @ARGV if @ARGV; -    die "File $datafile does not exist.\n" if !-f $datafile; -    open(INFILE, "<$datafile"); - -    ## Check 1st line for dimension; -    $dimension = <INFILE>; -    die "1st line of input file $datafile not an integer.\n" if $dimension !~ /\d+/; - -    my $record_count = 0; -    while (<INFILE>) { -        chomp($_); -        last if $record_count++ == $dimension; -        die "$_: bad input record -- incorrect length\n" if length($_) != $dimension; -        my @cells = split(//, $_); -        push @matrix, @cells; -    } -    close(INFILE); -    draw_matrix(); -} - -sub draw_matrix { -    my $n = $dimension * $dimension; -    print "\n\tGeneration $generation\n"; -    for (my $i = 0; $i < $n; $i++) { -        print "\n\t" if ($i % $dimension) == 0; -        print $matrix[$i]; -    } -    print "\n\n"; -    $generation++; -} - -sub has_left_neighbor { -    my ($ind) = @_; -    return ($ind % $dimension) != 0; -} - -sub has_right_neighbor { -    my ($ind) = @_; -    return (($ind + 1) % $dimension) != 0; -} - -sub has_up_neighbor { -    my ($ind) = @_; -    return (int($ind / $dimension)) != 0; -} - -sub has_down_neighbor { -    my ($ind) = @_; -    return (int($ind / $dimension) + 1) != $dimension; -} - -sub has_left_up_neighbor { -    my ($ind) = @_; -    ($ind) && has_up_neighbor($ind); -} - -sub has_right_up_neighbor { -    my ($ind) = @_; -    ($ind) && has_up_neighbor($ind); -} - -sub has_left_down_neighbor { -    my ($ind) = @_; -    ($ind) && has_down_neighbor($ind); -} - -sub has_right_down_neighbor { -    my ($ind) = @_; -    ($ind) && has_down_neighbor($ind); -} - -sub compute_cell { -    my ($ind) = @_; -    my @neighbors; - -    # 8 possible neighbors -    push(@neighbors, $ind - 1) if has_left_neighbor($ind); -    push(@neighbors, $ind + 1) if has_right_neighbor($ind); -    push(@neighbors, $ind - $dimension) if has_up_neighbor($ind); -    push(@neighbors, $ind + $dimension) if has_down_neighbor($ind); -    push(@neighbors, $ind - $dimension - 1) if has_left_up_neighbor($ind); -    push(@neighbors, $ind - $dimension + 1) if has_right_up_neighbor($ind); -    push(@neighbors, $ind + $dimension - 1) if has_left_down_neighbor($ind); -    push(@neighbors, $ind + $dimension + 1) if has_right_down_neighbor($ind); - -    my $count = 0; -    foreach my $n (@neighbors) { -        $count++ if $matrix[$n] eq Alive; -    } - -    if ($matrix[$ind] eq Alive) && (($count == 2) || ($count == 3)); ## survival -    if ($matrix[$ind] eq Dead)  && ($count == 3);                    ## birth -    ;                                                                  ## death -} - -sub again_or_quit { -    print "RETURN to continue, 'q' to quit.\n"; -    my $flag = <STDIN>; -    chomp($flag); -    return ($flag eq 'q') ? 1 : 0; -} - -sub animate { -    my @new_matrix; -    my $n = $dimension * $dimension - 1; - -    while (1) {                                       ## loop until user signals stop -        @new_matrix = map {compute_cell($_)} (0..$n); ## generate next matrix - -        splice @matrix;                               ## empty current matrix -        push @matrix, @new_matrix;                    ## repopulate matrix -        draw_matrix();                                ## display the current matrix - -        last if again_or_quit();                      ## continue? -        splice @new_matrix;                           ## empty temp matrix -    } -} - -### Execute -read_data();  ## read initial configuration from input file -animate();    ## display and recompute the matrix until user tires -``` - -The gol program (see [Conway’s Game of Life][1]) has almost 140 lines of code, but most of these involve reading the input file, displaying the matrix, and bookkeeping tasks such as determining the number of live neighbors for a given cell. Input files should be configured as follows: -``` - 5 - ----- - --*-- - --*-- - --*-- - ----- -``` - -The first record gives the matrix side, in this case 5 for a 5x5 matrix. The remaining rows are the contents, with stars for live cells and spaces for dead ones. - -The code of primary interest resides in two functions, `animate` and `compute_cell`. The `animate` function constructs the next generation, and this function needs to call `compute_cell` on every cell in order to determine the cell’s new status as either alive or dead. How should the `animate` function be structured? - -The `animate` function has a `while` loop that iterates until the user decides to terminate the program. Within this `while` loop the high-level logic is straightforward: - - 1. Create the next generation by iterating over the matrix cells, calling function `compute_cell` on each cell to determine its new status. At issue is how best to do the iteration. A loop nested inside the `while `loop would do, of course, but nested loops can be clunky. Another way is to use a higher-order function, as clarified shortly. - 2. Replace the current matrix with the new one. - 3. Display the next generation. - 4. Check if the user wants to continue: if so, continue; otherwise, terminate. - - - -Here, for review, is the call to Perl’s higher-order `map` function, with the function’s name again a nod to Lisp. This call occurs as the first statement within the `while` loop in `animate`: -``` -while (1) { -    @new_matrix = map {compute_cell($_)} (0..$n); ## generate next matrixcompute_cell -``` - -The `map` function takes two arguments: an unnamed code block (a lambda!), and a list of values passed to this code block one at a time. In this example, the code block calls the `compute_cell` function with one of the matrix indexes, 0 through the matrix size - 1. Although the matrix is displayed as two-dimensional, it is implemented as a one-dimensional list. - -Higher-order functions such as `map` encourage the code brevity for which Perl is famous. My view is that such functions also make code easier to write and to understand, as they dispense with the required but messy details of loops. In any case, lambdas and higher-order functions make up the Lispy side of Perl. - -If you're interested in more detail, I recommend Mark Jason Dominus's book, [Higher-Order Perl][2]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/5/looking-lispy-side-perl - -作者:[Marty Kalin][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/mkalindepauledu -[1]:https://trello-attachments.s3.amazonaws.com/575088ec94ca6ac38b49b30e/5ad4daf12f6b6a3ac2318d28/c0700c7379983ddf61f5ab5ab4891f0c/lispyPerl.html#gol (Conway’s Game of Life) -[2]:https://www.elsevier.com/books/higher-order-perl/dominus/978-1-55860-701-9 diff --git a/sources/talk/20180527 Whatever Happened to the Semantic Web.md b/sources/talk/20180527 Whatever Happened to the Semantic Web.md deleted file mode 100644 index 22d48c150a..0000000000 --- a/sources/talk/20180527 Whatever Happened to the Semantic Web.md +++ /dev/null @@ -1,106 +0,0 @@ -Whatever Happened to the Semantic Web? -====== -In 2001, Tim Berners-Lee, inventor of the World Wide Web, published an article in Scientific American. Berners-Lee, along with two other researchers, Ora Lassila and James Hendler, wanted to give the world a preview of the revolutionary new changes they saw coming to the web. Since its introduction only a decade before, the web had fast become the world’s best means for sharing documents with other people. Now, the authors promised, the web would evolve to encompass not just documents but every kind of data one could imagine. - -They called this new web the Semantic Web. The great promise of the Semantic Web was that it would be readable not just by humans but also by machines. Pages on the web would be meaningful to software programs—they would have semantics—allowing programs to interact with the web the same way that people do. Programs could exchange data across the Semantic Web without having to be explicitly engineered to talk to each other. According to Berners-Lee, Lassila, and Hendler, a typical day living with the myriad conveniences of the Semantic Web might look something like this: - -> The entertainment system was belting out the Beatles’ “We Can Work It Out” when the phone rang. When Pete answered, his phone turned the sound down by sending a message to all the other local devices that had a volume control. His sister, Lucy, was on the line from the doctor’s office: “Mom needs to see a specialist and then has to have a series of physical therapy sessions. Biweekly or something. I’m going to have my agent set up the appointments.” Pete immediately agreed to share the chauffeuring. At the doctor’s office, Lucy instructed her Semantic Web agent through her handheld Web browser. The agent promptly retrieved the information about Mom’s prescribed treatment within a 20-mile radius of her home and with a rating of excellent or very good on trusted rating services. It then began trying to find a match between available appointment times (supplied by the agents of individual providers through their Web sites) and Pete’s and Lucy’s busy schedules. - -The vision was that the Semantic Web would become a playground for intelligent “agents.” These agents would automate much of the work that the world had only just learned to do on the web. - -![][1] - -For a while, this vision enticed a lot of people. After new technologies such as AJAX led to the rise of what Silicon Valley called Web 2.0, Berners-Lee began referring to the Semantic Web as Web 3.0. Many thought that the Semantic Web was indeed the inevitable next step. A New York Times article published in 2006 quotes a speech Berners-Lee gave at a conference in which he said that the extant web would, twenty years in the future, be seen as only the “embryonic” form of something far greater. A venture capitalist, also quoted in the article, claimed that the Semantic Web would be “profound,” and ultimately “as obvious as the web seems obvious to us today.” - -Of course, the Semantic Web we were promised has yet to be delivered. In 2018, we have “agents” like Siri that can do certain tasks for us. But Siri can only do what it can because engineers at Apple have manually hooked it up to a medley of web services each capable of answering only a narrow category of questions. An important consequence is that, without being large and important enough for Apple to care, you cannot advertise your services directly to Siri from your own website. Unlike the physical therapists that Berners-Lee and his co-authors imagined would be able to hang out their shingles on the web, today we are stuck with giant, centralized repositories of information. Today’s physical therapists must enter information about their practice into Google or Yelp, because those are the only services that the smartphone agents know how to use and the only ones human beings will bother to check. The key difference between our current reality and the promised Semantic future is best captured by this throwaway aside in the excerpt above: “…appointment times (supplied by the agents of individual providers through **their** Web sites)…” - -In fact, over the last decade, the web has not only failed to become the Semantic Web but also threatened to recede as an idea altogether. We now hardly ever talk about “the web” and instead talk about “the internet,” which as of 2016 has become such a common term that newspapers no longer capitalize it. (To be fair, they stopped capitalizing “web” too.) Some might still protest that the web and the internet are two different things, but the distinction gets less clear all the time. The web we have today is slowly becoming a glorified app store, just the easiest way among many to download software that communicates with distant servers using closed protocols and schemas, making it functionally identical to the software ecosystem that existed before the web. How did we get here? If the effort to build a Semantic Web had succeeded, would the web have looked different today? Or have there been so many forces working against a decentralized web for so long that the Semantic Web was always going to be stillborn? - -### Semweb Hucksters and Their Metacrap - -To some more practically minded engineers, the Semantic Web was, from the outset, a utopian dream. - -The basic idea behind the Semantic Web was that everyone would use a new set of standards to annotate their webpages with little bits of XML. These little bits of XML would have no effect on the presentation of the webpage, but they could be read by software programs to divine meaning that otherwise would only be available to humans. - -The bits of XML were a way of expressing metadata about the webpage. We are all familiar with metadata in the context of a file system: When we look at a file on our computers, we can see when it was created, when it was last updated, and whom it was originally created by. Likewise, webpages on the Semantic Web would be able to tell your browser who authored the page and perhaps even where that person went to school, or where that person is currently employed. In theory, this information would allow Semantic Web browsers to answer queries across a large collection of webpages. In their article for Scientific American, Berners-Lee and his co-authors explain that you could, for example, use the Semantic Web to look up a person you met at a conference whose name you only partially remember. - -Cory Doctorow, a blogger and digital rights activist, published an influential essay in 2001 that pointed out the many problems with depending on voluntarily supplied metadata. A world of “exhaustive, reliable” metadata would be wonderful, he argued, but such a world was “a pipe-dream, founded on self-delusion, nerd hubris, and hysterically inflated market opportunities.” Doctorow had found himself in a series of debates over the Semantic Web at tech conferences and wanted to catalog the serious issues that the Semantic Web enthusiasts (Doctorow calls them “semweb hucksters”) were overlooking. The essay, titled “Metacrap,” identifies seven problems, among them the obvious fact that most web users were likely to provide either no metadata at all or else lots of misleading metadata meant to draw clicks. Even if users were universally diligent and well-intentioned, in order for the metadata to be robust and reliable, users would all have to agree on a single representation for each important concept. Doctorow argued that in some cases a single representation might not be appropriate, desirable, or fair to all users. - -Indeed, the web had already seen people abusing the HTML `` tag (introduced at least as early as HTML 4) in an attempt to improve the visibility of their webpages in search results. In a 2004 paper, Ben Munat, then an academic at Evergreen State College, explains how search engines once experimented with using keywords supplied via the `` tag to index results, but soon discovered that unscrupulous webpage authors were including tags unrelated to the actual content of their webpage. As a result, search engines came to ignore the `` tag in favor of using complex algorithms to analyze the actual content of a webpage. Munat concludes that a general-purpose Semantic Web is unworkable, and that the focus should be on specific domains within medicine and science. - -Others have also seen the Semantic Web project as tragically flawed, though they have located the flaw elsewhere. Aaron Swartz, the famous programmer and another digital rights activist, wrote in an unfinished book about the Semantic Web published after his death that Doctorow was “attacking a strawman.” Nobody expected that metadata on the web would be thoroughly accurate and reliable, but the Semantic Web, or at least a more realistically scoped version of it, remained possible. The problem, in Swartz’ view, was the “formalizing mindset of mathematics and the institutional structure of academics” that the “semantic Webheads” brought to bear on the challenge. In forums like the World Wide Web Consortium (W3C), a huge amount of effort and discussion went into creating standards before there were any applications out there to standardize. And the standards that emerged from these “Talmudic debates” were so abstract that few of them ever saw widespread adoption. The few that did, like XML, were “uniformly scourges on the planet, offenses against hardworking programmers that have pushed out sensible formats (like JSON) in favor of overly-complicated hairballs with no basis in reality.” The Semantic Web might have thrived if, like the original web, its standards were eagerly adopted by everyone. But that never happened because—as [has been discussed][2] on this blog before—the putative benefits of something like XML are not easy to sell to a programmer when the alternatives are both entirely sufficient and much easier to understand. - -### Building the Semantic Web - -If the Semantic Web was not an outright impossibility, it was always going to require the contributions of lots of clever people working in concert. - -The long effort to build the Semantic Web has been said to consist of four phases. The first phase, which lasted from 2001 to 2005, was the golden age of Semantic Web activity. Between 2001 and 2005, the W3C issued a slew of new standards laying out the foundational technologies of the Semantic future. - -The most important of these was the Resource Description Framework (RDF). The W3C issued the first version of the RDF standard in 2004, but RDF had been floating around since 1997, when a W3C working group introduced it in a draft specification. RDF was originally conceived of as a tool for modeling metadata and was partly based on earlier attempts by Ramanathan Guha, an Apple engineer, to develop a metadata system for files stored on Apple computers. The Semantic Web working groups at W3C repurposed RDF to represent arbitrary kinds of general knowledge. - -RDF would be the grammar in which Semantic webpages expressed information. The grammar is a simple one: Facts about the world are expressed in RDF as triplets of subject, predicate, and object. Tim Bray, who worked with Ramanathan Guha on an early version of RDF, gives the following example, describing TV shows and movies: - -``` -@prefix rdf: . - -@prefix ex: . - - -ex:vincent_donofrio ex:starred_in ex:law_and_order_ci . - -ex:law_and_order_ci rdf:type ex:tv_show . - -ex:the_thirteenth_floor ex:similar_plot_as ex:the_matrix . -``` - -The syntax is not important, especially since RDF can be represented in a number of formats, including XML and JSON. This example is in a format called Turtle, which expresses RDF triplets as straightforward sentences terminated by periods. The three essential sentences, which appear above after the `@prefix` preamble, state three facts: Vincent Donofrio starred in Law and Order, Law and Order is a type of TV Show, and the movie The Thirteenth Floor has a similar plot as The Matrix. (If you don’t know who Vincent Donofrio is and have never seen The Thirteenth Floor, I, too, was watching Nickelodeon and sipping Capri Suns in 1999.) - -Other specifications finalized and drafted during this first era of Semantic Web development describe all the ways in which RDF can be used. RDF in Attributes (RDFa) defines how RDF can be embedded in HTML so that browsers, search engines, and other programs can glean meaning from a webpage. RDF Schema and another standard called OWL allows RDF authors to demarcate the boundary between valid and invalid RDF statements in their RDF documents. RDF Schema and OWL, in other words, are tools for creating what are known as ontologies, explicit specifications of what can and cannot be said within a specific domain. An ontology might include a rule, for example, expressing that no person can be the mother of another person without also being a parent of that person. The hope was that these ontologies would be widely used not only to check the accuracy of RDF found in the wild but also to make inferences about omitted information. - -In 2006, Tim Berners-Lee posted a short article in which he argued that the existing work on Semantic Web standards needed to be supplemented by a concerted effort to make semantic data available on the web. Furthermore, once on the web, it was important that semantic data link to other kinds of semantic data, ensuring the rise of a data-based web as interconnected as the existing web. Berners-Lee used the term “linked data” to describe this ideal scenario. Though “linked data” was in one sense just a recapitulation of the original vision for the Semantic Web, it became a term that people could rally around and thus amounted to a rebranding of the Semantic Web project. - -Berners-Lee’s article launched the second phase of the Semantic Web’s development, where the focus shifted from setting standards and building toy examples to creating and popularizing large RDF datasets. Perhaps the most successful of these datasets was [DBpedia][3], a giant repository of RDF triplets extracted from Wikipedia articles. DBpedia, which made heavy use of the Semantic Web standards that had been developed in the first half of the 2000s, was a standout example of what could be accomplished using the W3C’s new formats. Today DBpedia describes 4.58 million entities and is used by organizations like the NY Times, BBC, and IBM, which employed DBpedia as a knowledge source for IBM Watson, the Jeopardy-winning artificial intelligence system. - -![][4] - -The third phase of the Semantic Web’s development involved adapting the W3C’s standards to fit the actual practices and preferences of web developers. By 2008, JSON had begun its meteoric rise to popularity. Whereas XML came packaged with a bunch of associated technologies of indeterminate purpose (XLST, XPath, XQuery, XLink), JSON was just JSON. It was less verbose and more readable. Manu Sporny, an entrepreneur and member of the W3C, had already started using JSON at his company and wanted to find an easy way for RDFa and JSON to work together. The result would be JSON-LD, which in essence was RDF reimagined for a world that had chosen JSON over XML. Sporny, together with his CTO, Dave Longley, issued a draft specification of JSON-LD in 2010. For the next few years, JSON-LD and an updated RDF specification would be the primary focus of Semantic Web work at the W3C. JSON-LD could be used on its own or it could be embedded within a `` +``` + +With: + + +``` +`` +``` + +Now the HTML5 version of your project runs in a web browser, whether the user is online or not. + +JClic also provides a reports function that can store test scores in an ODBC-compliant database. I have not explored this feature, as my tests and puzzles are mostly used for self-assessment and to prompt reflection by the learner, rather than as part of a formal scheme, so the scores are not very important. If you would like to learn about it, there is [documentation][14] on running JClic Reports Server with Tomcat and MySQL (or [mariaDB][15]). + +### Conclusion + +JClic offers a wide range of activity types that provide plenty of room to be creative in designing content to fit your subject area and type of learner. JClic is a valuable addition for anyone who needs a quick and easy way to develop educational resources. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/jclic-games-kids + +作者:[Peter Cheer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/petercheer +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/family_learning_kids_night_reading.png?itok=6K7sJVb1 (Family learning and reading together at night in a room) +[2]: https://opensource.com/article/18/5/exelearning +[3]: https://clic.xtec.cat/legacy/en/jclic/index.html +[4]: https://clic.xtec.cat/legacy/en/index.html +[5]: https://github.com/projectestac/jclic +[6]: https://adoptopenjdk.net/installation.html +[7]: https://clic.xtec.cat/repo/ +[8]: https://github.com/projectestac/jclic/wiki/JClic_Guide +[9]: https://opensource.com/sites/default/files/uploads/metadata.png (JClic metadata) +[10]: https://opensource.com/sites/default/files/uploads/media.png (JClic media) +[11]: https://opensource.com/sites/default/files/uploads/activities.png (JClic activities) +[12]: https://opensource.com/sites/default/files/uploads/sequence.png (JClic timeline) +[13]: http://projectestac.github.io/jclic.js/ +[14]: https://github.com/projectestac/jclic/wiki/Jclic-Reports-Server-with-Tomcat-and-MySQL-on-Ubuntu +[15]: https://mariadb.org/ From 10232b2ab1eeb386c76c8c827d1c5c133aa547bd Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 5 May 2020 01:24:09 +0800 Subject: [PATCH 1957/3057] TSL --- ...nd JPG for your online images- Use WebP.md | 144 ------------------ ...nd JPG for your online images- Use WebP.md | 143 +++++++++++++++++ 2 files changed, 143 insertions(+), 144 deletions(-) delete mode 100644 sources/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md create mode 100644 translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md diff --git a/sources/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md b/sources/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md deleted file mode 100644 index f4e6711933..0000000000 --- a/sources/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md +++ /dev/null @@ -1,144 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Drop PNG and JPG for your online images: Use WebP) -[#]: via: (https://opensource.com/article/20/4/webp-image-compression) -[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) - -Drop PNG and JPG for your online images: Use WebP -====== -Get started with this open source image editing tool to save time and -space. -![Painting art on a computer screen][1] - -WebP is an image format developed by Google in 2010 that provides superior lossless and lossy compression for images on the web. Using WebP, web developers can create smaller, richer images that improve site speed. A faster loading website is critical to the user experience and for the website's marketing effectiveness. - -For optimal loading across all devices and users, images on your site should not be larger than 500 KB in file size. - -WebP lossless images are often at least 25% smaller in size compared to PNGs. WebP lossy images are often anywhere from 25-34% smaller than comparable JPEG images at equivalent SSIM (structural similarity) quality index. - -Lossless WebP supports transparency, as well. For cases when lossy RGB compression is acceptable, lossy WebP also supports transparency, typically providing three times smaller file sizes compared to PNG. - -Google reports a 64% reduction in file size for images converted from animated GIFs to lossy WebP, and a 19% reduction when converted to lossless WebP. - -The WebP file format is based on the RIFF (resource interchange file format) document format. The file signature is **52 49 46 46** (RIFF), as you can see with [hexdump][2]: - - -``` -$ hexdump --canonical pixel.webp -00000000  52 49 46 46 26 00 00 00  [...]  |RIFF&...WEBPVP8 | -00000010  1a 00 00 00 30 01 00 9d  [...]  |....0....*......| -00000020  0e 25 a4 00 03 70 00 fe  [...]  |.%...p...`....| -0000002e -``` - -The standalone libwebp library serves as a reference implementation for the WebP specification and is available from Google's [Git repository][3] or as a tarball. - -The WebP format is compatible with 80% of the web browsers in use worldwide. At the time of this writing, it is not compatible with Apple's Safari browser. The workaround for this is to serve up a JPG/PNG alongside a WebP, and there are methods and Wordpress plugins to do that. - -### Why does this matter? - -Part of my job is to design and maintain our organization's website. Since the website is a marketing tool and site speed is a critical aspect of the user experience, I have been working to improve the speed, and reducing image sizes by converting them to WebP has been a good solution. - -To test the speed of one of the pages, I turned to **web.dev**, which is powered by Lighthouse, released under the Apache 2.0 license, and can be found at . - -According to its official description, "Lighthouse is an open source, automated tool for improving the quality of web pages. You can run it against any web page—public or requiring authentication. It has audits for performance, accessibility, progressive web apps, SEO, and more. You can run Lighthouse in Chrome DevTools, from the command line, or as a Node module. You give Lighthouse a URL to audit, it runs a series of audits against the page, and then it generates a report on how well the page did. From there, use the failing audits as indicators on how to improve the page. Each audit has a reference doc explaining why the audit is important, as well as how to fix it." - -### Creating a smaller WebP image - -The page I tested returned three images. In the report it generates, it provides recommendations and targets. I chose the "app-graphic" image, which, it reported, is 650 KB. By converting it to WebP, I should save 589 KB, reducing the image to 61 KB. I converted the image in Photoshop and saved it with the default WebP settings, and it returned a file size of 44.9 KB. Better than expected! As the screenshot from Photoshop shows, the images look identical in visual quality. - -![WebP vs JPG comparison][4] - -On the left: 650 KB (actual size). On the right: 589 KB (target size after conversion). - -Of course, the open source image editor [GIMP][5] also supports WebP as an export format. It offers several options for quality and compression profile: - -![GIMP dialog for exporting webp, as a webp][6] - -A zoomed-in look of another image: - -![WebP vs PNG comparison][7] - -PNG (left) and WebP (right), both converted from a JPG, shows the WebP, although smaller in size, is superior in visual quality. - -### Convert to an image to WebP - -To convert images on Linux from JPG/PNG to WebP, you can also use the command-line: - -Use **cwebp** on the command line to convert PNG or JPG image files to WebP format. You can convert a PNG image file to a WebP image with a quality range of 80 with the command: - - -``` -`cwebp -q 80 image.png -o image.webp` -``` - -Alternatively, you can also use [Image Magick][8], which is probably available in your distribution's software repository. The subcommand for conversion is **convert**, and all that's needed is an input and output file: - - -``` -`convert pixel.png pixel.webp` -``` - -### Convert an image to WebP with an editor - -To convert images to WebP with a photo editor, use [GIMP][9]. From version 2.10 on, it supports WebP natively. - -If you're a Photoshop user, you need a plugin to convert the files, as Photoshop does not include it natively. WebPShop 0.2.1, released under the Apache License 2.0 license, is a Photoshop module for opening and saving WebP images, including animations, and can be found at: . - -To use the plugin, put the file found in the **bin** folder inside your Photoshop plugin directory: - -Windows x64—C:\Program Files\Adobe\Adobe Photoshop\Plug-ins\WebPShop.8bi - -Mac—Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin - -### WebP on Wordpress - -Many websites are built using Wordpress (that's what I use). So, how does Wordpress handle uploading WebP images? At the time of this writing, it doesn't. But, there are, of course, plugins to enable it so you can serve up both WebP alongside PNG/JPG images (for the Apple crowd). - -Or there are these [instructions][10] from [Marius Hosting][11]: - -"How about directly uploading WebP images to Wordpress? This is easy. Just add some text line on your theme functions.php file. Wordpress does not natively support viewing and uploading WebP files, but I will explain to you how you can make it work in a few simple steps. Log in to your Wordpress admin area and go to Appearance/Theme Editor and find functions.php. Copy and paste the code below at the end of the file and save it.  - - -``` -`//** *Enable upload for webp image files.*/ function webp_upload_mimes($existing_mimes) { $existing_mimes['webp'] = 'image/webp'; return $existing_mimes; } add_filter('mime_types', 'webp_upload_mimes');` -``` - -If you want to see the thumbnail image preview when you go to Media/Library, you have to add the code below in the same functions.php file. To find the functions.php file, go to Appearance/Theme Editor and find functions.php, then copy and paste the code below at the end of the file and save it." - - -``` -`//** * Enable preview / thumbnail for webp image files.*/ function webp_is_displayable($result, $path) { if ($result === false) { $displayable_image_types = array( IMAGETYPE_WEBP ); $info = @getimagesize( $path ); if (empty($info)) { $result = false; } elseif (!in_array($info[2], $displayable_image_types)) { $result = false; } else { $result = true; } } return $result; } add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);` -``` - -### WebP and the future - -WebP is a robust and optimized format. It looks better, it has better compression ratio, and it has all the features of most other common image formats. There's no need to wait—start using it now. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/4/webp-image-compression - -作者:[Jeff Macharyas][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jeffmacharyas -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen) -[2]: https://opensource.com/article/19/8/dig-binary-files-hexdump -[3]: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html -[4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png (WebP vs JPG comparison) -[5]: http://gimp.org -[6]: https://opensource.com/sites/default/files/webp-gimp.webp (GIMP dialog for exporting webp, as a webp) -[7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png (WebP vs PNG comparison) -[8]: https://imagemagick.org -[9]: https://en.wikipedia.org/wiki/GIMP -[10]: https://mariushosting.com/how-to-upload-webp-files-on-wordpress/ -[11]: https://mariushosting.com/ diff --git a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md b/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md new file mode 100644 index 0000000000..3186cf5b00 --- /dev/null +++ b/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md @@ -0,0 +1,143 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Drop PNG and JPG for your online images: Use WebP" +[#]: via: "https://opensource.com/article/20/4/webp-image-compression" +[#]: author: "Jeff Macharyas https://opensource.com/users/jeffmacharyas" + +线上图片请抛弃 PNG 和 JPG 后缀:使用 WebP +====== +了解一下这个开源的图片编辑工具来节省时间和空间。 +![Painting art on a computer screen][1] + +WebP 是 2010 年 Google 开发的一种图片格式,能提供对网络图片的无损压缩和有损压缩。网络开发者们可以使用 WebP 来创建更小更丰富的图片,以此来提高网站的速度。更快的加载速度对于网站的用户体验和网站市场的效能是至关重要的。 + +为了提供领先于所有的设备和用户的图片加载能力,你网站上的图片文件大小不应该超过 500 KB。 + +WebP 无损图片通常比 PNG 图片文件小至少 25%。在相同的 SSIM(structural similarity,结构相似性)质量指标下,WebP 有损图片通常比 JPEG 图片小 25% 到 34%。 + +无损 WebP 也支持透明度。在有损 RGB 压缩可接受的情况下,有损 WebP 也支持透明度,PNG 文件的大小通常为 WebP 文件大小的四倍。 + +Google 报告把动图 GIF 文件转换为有损 WebP后文件大小减少了 64%,转换为无损 WebP 后文件大小减少了 19%。 + +WebP 文件格式是一种基于 RIFF(resource interchange file format,资源交换文件格式)的文档格式。你可以用 [hexdump][2] 看到文件的签名是 **52 49 46 46** (RIFF): + + +``` +$ hexdump --canonical pixel.webp +00000000  52 49 46 46 26 00 00 00  [...]  |RIFF&...WEBPVP8 | +00000010  1a 00 00 00 30 01 00 9d  [...]  |....0....*......| +00000020  0e 25 a4 00 03 70 00 fe  [...]  |.%...p...`....| +0000002e +``` + +独立的 libwebp 库以 WebP 技术规范的引用实现的方式提供服务,可以从 Google 的 [Git 仓库][3] 或下载 tar 包获得。 + +全球在用的 80% 的 web 浏览器兼容 WebP 格式。本文撰写时,Apple 的 Safari 浏览器还不兼容。对于不兼容的情况,应变方法是在 WebP 图片旁边准备一张 JPG/PNG 图片,我们有很多种方法和 Wordpress 插件来实现。 + +### 为什么这很重要? + +我的部分工作是设计和维护我们组织的网站。由于网站是个市场工具并且网站速度是衡量用户体验的重要指标,我一直致力于提高网站速度,通过把图片转换为 WebP 来减少图片大小是一个有效的解决方案。 + +我使用了 **web.dev** 来检测其中一个网页,该工具是由 Lighthouse 提供服务的,遵循 Apache 2.0 证书,可以在 找到。 + +根据官方描述,”LIghthouse 是一个开源的,旨在提升网页质量的自动化工具。你可以在任何网页上运行它 — 公共的或需要鉴权的。它有性能、可用性、积极的 web 应用、SEO和其他项目的审计。你可以使用命令行、作为一个 Node 模块或在 Chrome DevTools 里运行 Lighthouse。你输入一个 URL 给 Lighthouse,它对这个网页运行一系列的审计规则,之后生成这个网页的审计结果报告。从报告的失败审计条目中可以知道应该怎么优化网页。每条审计都有对应的文档解释为什么该项目是重要的,以及如何修复它。“ + +### 创建更小的 WebP 图片 + +我测试的页面返回了三张图片。在它生成的报告中,它提供了推荐和目标格式。我选择了它报告有 650 KB 的 ”app-graphic“ 图片。通过把它转换为 WebP 格式,预计可以图片大小降到 61 KB,节省 589 KB。我在 Photoshop 中把它转换了,用默认的 WebP 设置参数保存它,它的文件大小为 44.9 KB。比预期的还要好!从下面的 Photoshop 截图中可以看出,两张图在视觉上完全一样。 + +![WebP vs JPG comparison][4] + +左图:650 KB(实际大小)。右图: 589 KB(转换之后的目标大小)。 + +当然,也可以用开源图片编辑工具 [GIMP][5] 把图片导出为 WebP。它提供了几个质量和压缩的参数: + +![GIMP dialog for exporting webp, as a webp][6] + +另一张图拉近视野后: + +![WebP vs PNG comparison][7] + +PNG(左图)和 WebP(右图),都是从 JPG 转换而来,两图对比可以看出 WebP 不仅在文件大小更小,在视觉质量上也更优秀。 + +### 把图片转换为 WebP + +你也可以用 Linux 的命令行工具把图片从 JPG/PNG 转换为 WebP: + +在命令行使用 **cwebp** 把 PNG 或 JPG 图片文件转换为 WebP 格式。你可以用下面的命令把 PNG 图片文件转换为质量参数为 80 的 WebP 图片。 + + +``` +`cwebp -q 80 image.png -o image.webp` +``` + +你还可以用 [Image Magick][8],这个工具可能在你的发行版本软件仓库中可以找到。转换的子命令是 **convert**,它需要的所有参数就是输入和输出文件: + + +``` +`convert pixel.png pixel.webp` +``` + +### 使用编辑器把图片转换为 WebP + +使用 [GIMP][9] 图片编辑器来把图片转换为 WebP。从 2.10 版本开始,它原生地支持 WebP。 + +如果你是 Photoshop 用户,由于 Photoshop 默认不包含 WebP,因此你需要一个转换插件。遵循 Apache License 2.0 证书发行的 WebPShop 0.2.1 是一个用户打开和保存包括动图在内的 WebP 图片的 Photoshop 模块,在 可以找到。 + +为了能正常使用它,你需要把它放进 Photoshop 插件目录下的 **bin** 文件夹: + +Windows x64—C:\Program Files\Adobe\Adobe Photoshop\Plug-ins\WebPShop.8bi + +Mac—Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin + +### Wordpress 上的 WebP + +很多网站是用 Wordpress 搭建的(我的网站就是)。因此,Wordpress 怎么上传 WebP 图片?本文撰写时,它还不支持。但是,当然已经有插件来满足这种需求,因此你可以在你的网站上同时准备 WebP 和 PNG/JPG 图片(为 Apple 用户)。 + +在 [Marius Hosting][11] 有下面的指示: + +”直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 functions.php 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你陈述怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入 Appearance/Theme Editor 找到 functions.php。拷贝下面的代码粘贴到文件最后并保存。 + + +``` +`//** *Enable upload for webp image files.*/ function webp_upload_mimes($existing_mimes) { $existing_mimes['webp'] = 'image/webp'; return $existing_mimes; } add_filter('mime_types', 'webp_upload_mimes');` +``` + +"如果你想在 Media/Library 看缩略图预览,那么你需要把下面的代码也添加到 functions.php 文件。为了找到 functions.php 文件,进入 Appearance/Theme Editor 并搜索 functions.php,然后拷贝下面的代码粘贴到文件最后并保存。“ + + +``` +`//** * Enable preview / thumbnail for webp image files.*/ function webp_is_displayable($result, $path) { if ($result === false) { $displayable_image_types = array( IMAGETYPE_WEBP ); $info = @getimagesize( $path ); if (empty($info)) { $result = false; } elseif (!in_array($info[2], $displayable_image_types)) { $result = false; } else { $result = true; } } return $result; } add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);` +``` + +### WebP 和未来 + +WebP 是鲁棒的和最优的格式。它看起来更好,有更好的压缩率,它拥有其他大部分常见图片格式的所有特性。不必再等了,现在就使用它把。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/webp-image-compression + +作者:[Jeff Macharyas][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jeffmacharyas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ "Painting art on a computer screen" +[2]: https://opensource.com/article/19/8/dig-binary-files-hexdump +[3]: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html +[4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png "WebP vs JPG comparison" +[5]: http://gimp.org +[6]: https://opensource.com/sites/default/files/webp-gimp.webp "GIMP dialog for exporting webp, as a webp" +[7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png "WebP vs PNG comparison" +[8]: https://imagemagick.org +[9]: https://en.wikipedia.org/wiki/GIMP +[10]: https://mariushosting.com/how-to-upload-webp-files-on-wordpress/ +[11]: https://mariushosting.com/ From 791a3b784fe53c15897a82c879f44ba8adec921f Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 5 May 2020 11:58:11 +0800 Subject: [PATCH 1958/3057] update --- ...nd JPG for your online images- Use WebP.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md b/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md index 3186cf5b00..690f4c6c39 100644 --- a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md +++ b/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md @@ -1,11 +1,11 @@ -[#]: collector: "lujun9972" -[#]: translator: "lxbwolf" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "Drop PNG and JPG for your online images: Use WebP" -[#]: via: "https://opensource.com/article/20/4/webp-image-compression" -[#]: author: "Jeff Macharyas https://opensource.com/users/jeffmacharyas" +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Drop PNG and JPG for your online images: Use WebP) +[#]: via: (https://opensource.com/article/20/4/webp-image-compression) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) 线上图片请抛弃 PNG 和 JPG 后缀:使用 WebP ====== @@ -130,13 +130,13 @@ via: https://opensource.com/article/20/4/webp-image-compression [a]: https://opensource.com/users/jeffmacharyas [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ "Painting art on a computer screen" +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen) [2]: https://opensource.com/article/19/8/dig-binary-files-hexdump [3]: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html -[4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png "WebP vs JPG comparison" +[4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png (WebP vs JPG comparison) [5]: http://gimp.org -[6]: https://opensource.com/sites/default/files/webp-gimp.webp "GIMP dialog for exporting webp, as a webp" -[7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png "WebP vs PNG comparison" +[6]: https://opensource.com/sites/default/files/webp-gimp.webp (GIMP dialog for exporting webp, as a webp) +[7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png (WebP vs PNG comparison) [8]: https://imagemagick.org [9]: https://en.wikipedia.org/wiki/GIMP [10]: https://mariushosting.com/how-to-upload-webp-files-on-wordpress/ From fcd061d231551038992107c11607e3efe1c5970b Mon Sep 17 00:00:00 2001 From: qfzy1233 Date: Tue, 5 May 2020 15:36:41 +0800 Subject: [PATCH 1959/3057] translating by qfzy1233 --- ...Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md index c6857014ef..73e60dc17a 100644 --- a/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md +++ b/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qfzy1233) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 067db949bb992056f19c8b1462b3805cc1b96ab2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 May 2020 17:13:15 +0800 Subject: [PATCH 1960/3057] APL --- .../tech/20200429 The life-changing magic of git rebase -i.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200429 The life-changing magic of git rebase -i.md b/sources/tech/20200429 The life-changing magic of git rebase -i.md index 8afb9d7f8e..c6d4d904b4 100644 --- a/sources/tech/20200429 The life-changing magic of git rebase -i.md +++ b/sources/tech/20200429 The life-changing magic of git rebase -i.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ed5ce13ff18bc78f96d122c333d93dabbae5c606 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 May 2020 21:30:08 +0800 Subject: [PATCH 1961/3057] TSL --- ...he life-changing magic of git rebase -i.md | 80 ------------------- ...he life-changing magic of git rebase -i.md | 79 ++++++++++++++++++ 2 files changed, 79 insertions(+), 80 deletions(-) delete mode 100644 sources/tech/20200429 The life-changing magic of git rebase -i.md create mode 100644 translated/tech/20200429 The life-changing magic of git rebase -i.md diff --git a/sources/tech/20200429 The life-changing magic of git rebase -i.md b/sources/tech/20200429 The life-changing magic of git rebase -i.md deleted file mode 100644 index c6d4d904b4..0000000000 --- a/sources/tech/20200429 The life-changing magic of git rebase -i.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The life-changing magic of git rebase -i) -[#]: via: (https://opensource.com/article/20/4/git-rebase-i) -[#]: author: (Dave Neary https://opensource.com/users/dneary) - -The life-changing magic of git rebase -i -====== -Make everyone think you write perfect code the first time (and make your -patches easier to review and merge). -![Hands programming][1] - -Software development is messy. So many wrong turns, typos to fix, quick hacks and kludges to correct later, off-by-one errors you find late in the process. With version control, you have a pristine record of every wrong turn and correction made during the process of creating the "perfect" final product—a patch ready to submit upstream. Like the outtakes from movies, they are a little embarrassing and sometimes amusing. - -Wouldn't it be great if you could use version control to save your work regularly at waypoints, and then when you have something you are ready to submit for review, you could hide all of that private drafting work and just submit a single, perfect patch? Meet **git rebase -i**, the perfect way to rewrite history and make everyone think that you produce perfect code the first time! - -### What does git rebase do? - -In case you're not familiar with the intricacies of Git, here is a brief overview. Under the covers, Git associates different versions of your project with a unique identifier, which is made up of a hash of the parent node's unique identifier, and the difference between the new version and its parent node. This creates a tree of revisions, and each person who checks out the project gets their own copy. Different people can take the project in different directions, each starting from potentially different branch points. - -![Master branch vs. private branch][2] - -The master branch in the "origin" repo on the left and the private branch on your personal copy on the right. - -There are two ways to integrate your work back with the master branch in the original repository: one is to use **git merge**, and the other is to use **git rebase**. They work in very different ways. - -When you use **git merge**, a new commit is created on the master branch that includes all of the changes from origin plus all of your local changes. If there are any conflicts (for example, if someone else has changed a file you are also working with), these will be marked, and you have an opportunity to resolve the conflicts before committing this merge commit to your local repository. When you push your changes back to the parent repository, all of your local work will appear as a branch for other users of the Git repository. - -But **git rebase** works differently. It rewinds your commits and replays those commits again from the tip of the master branch. This results in two main changes. First, since your commits are now branching off a different parent node, their hashes will be recalculated, and anyone who has cloned your repository may now have a broken copy of the repository. Second, you do not have a merge commit, so any merge conflicts are identified as your changes are being replayed onto the master branch, and you need to fix them before proceeding with the rebase. When you push your changes now, your work does not appear on a branch, and it looks as though you wrote all of your changes off the very latest commit to the master branch. - -![Merge commits preserve history, and rebase rewrites history.][3] - -Merge commits (left) preserve history, while rebase (right) rewrites history. - -However, both of these options come with a downside: everyone can see all your scribbles and edits as you worked through problems locally before you were ready to share your code. This is where the **\--interactive** (or **-i** for short) flag to **git rebase** comes into the picture. - -### Introducing git rebase -i - -The big advantage of **git rebase** is that it rewrites history. But why stop at just pretending you branched off a later point? There is a way to go even further and rewrite how you arrived at your ready-to-propose code: **git rebase -i**, an interactive **git rebase**. - -This feature is the "magic time machine" function in Git. The flag allows you to make sophisticated changes to revision history while doing a rebase. You can hide your mistakes! Merge many small changes into one pristine feature patch! Reorder how things appear in revision history! - -![output of git rebase -i][4] - -When you run **git rebase -i**, you get an editor session listing all of the commits that are being rebased and a number of options for what you can do to them. The default choice is **pick**. - - * **Pick** maintains the commit in your history. - * **Reword** allows you to change a commit message, perhaps to fix a typo or add additional commentary. - * **Edit** allows you to make changes to the commit while in the process of replaying the branch. - * **Squash** merges multiple commits into one. - * You can reorder commits by moving them around in the file. - - - -When you are finished, simply save the final result, and the rebase will execute. At each stage where you have chosen to modify a commit (either with **reword**, **edit**, **squash**, or when there is a conflict), the rebase stops and allows you to make the appropriate changes before continuing. - -The example above results in "One-liner bug fix" and "Integrate new header everywhere" being merged into one commit, and "New header for docs website" and "D'oh - typo. Fixed" into another. Like magic, the work that went into the other commits is still there on your branch, but the associated commits have disappeared from your history! - -This makes it easy to submit a clean patch to an upstream project using **git send-email** or by creating a pull request against the parent repository with your newly tidied up patchset. This has a number of advantages, including that it makes your code easier to review, easier to accept, and easier to merge. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/4/git-rebase-i - -作者:[Dave Neary][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/dneary -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) -[2]: https://opensource.com/sites/default/files/uploads/master-private-branches.png (Master branch vs. private branch) -[3]: https://opensource.com/sites/default/files/uploads/merge-commit-vs-rebase.png (Merge commits preserve history, and rebase rewrites history.) -[4]: https://opensource.com/sites/default/files/uploads/git-rebase-i.png (output of git rebase -i) diff --git a/translated/tech/20200429 The life-changing magic of git rebase -i.md b/translated/tech/20200429 The life-changing magic of git rebase -i.md new file mode 100644 index 0000000000..91739d2789 --- /dev/null +++ b/translated/tech/20200429 The life-changing magic of git rebase -i.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The life-changing magic of git rebase -i) +[#]: via: (https://opensource.com/article/20/4/git-rebase-i) +[#]: author: (Dave Neary https://opensource.com/users/dneary) + +完美生活:git rebase -i +====== + +> 让大家觉得你一次就能写出完美的代码,并让你的补丁更容易审核和合并。 + +![Hands programming][1] + +软件开发是混乱的。有很多错误的转折、有需要修复的错别字、有需要修正的错误、有需要稍后纠正临时和粗陋的代码,还有在开发过程中以后发现的错位问题。有了版本控制,在创建“完美”的最终产品(即准备提交给上游的补丁)的过程中,你会有一个记录着每一个错误的转折和修正的原始记录。就像电影中的片段一样,它们有些尴尬,有时还很有趣。就像电影中的花絮一样,它们会让人有点尴尬,有时也会让人觉得好笑。 + +如果你能使用版本控制来定期保存你的工作线索,然后当你准备提交审核的东西时,可以隐藏所有这些私人草稿工作,只需提交一份单一的、完美的补丁就可以了,那不是很好吗?`git rebase -i`,是重写历史记录的完美方法,可以让大家觉得你一次就写出了完美的代码。 + +### git rebase 的作用是什么? + +如果你不熟悉 Git 的复杂性,这里简单介绍一下。在幕后,Git 将项目的不同版本与唯一标识符关联起来,这个标识符由父节点的唯一标识符的哈希以及新版本与其父节点的差异组成。这样就形成了一棵修订树,每个检出项目的人都会得到自己的副本。不同的人可以把项目往不同的方向发展,每个人的出发点都可能是不同的分支点。 + +![Master branch vs. private branch][2] + +*左边是 `origin` 版本库中的主分支,右边是你个人副本中的私有分支。* + +有两种方法可以将你的工作与原始版本库中的主分支整合起来:一种是使用 合并:`git merge`,另一种是使用变基:`git rebase`。它们的工作方式非常不同。 + +当你使用 `git merge` 时,会在主分支上创建一个新的提交,其中包括所有来自 `origin` 的修改和所有本地的修改。如果有任何冲突(例如,如果别人修改了你也在修改的文件),则将这些冲突标记出来,并且你有机会在将该“合并提交”提交到本地版本库之前解决这些冲突。当你将更改推送回父版本库时,所有的本地工作都会以分支的形式出现在 Git 仓库的其他用户面前。 + +但是 `git rebase` 的工作方式不同。它回滚你的提交,并从主分支的顶端再次重放这些提交。这导致了两个主要的变化。首先,由于你的提交现在从一个不同的父节点分支出来,它们的哈希值会被重新计算,并且任何克隆了你的仓库的人都可能会有一个残破的仓库副本。第二,你没有一个合并提交,所以在将更改重放到主分支上时会识别出任何合并冲突,所以任何合并冲突都会被识别出来,因此,你需要在进行变基rebase之前修复它们。当你现在推送你的修改时,你的工作不会出现在分支上,并且看起来像是你把所有的修改都写到了主分支的最新的提交上。 + +![Merge commits preserve history, and rebase rewrites history.][3] + +*合并提交(左)保留了历史,而变基(右)重写历史。* + +然而,这两种方式都有一个坏处:在你准备好分享代码之前,每个人都可以看到你在本地处理问题时的所有涂鸦和编辑。这就是 `git rebase` 的 `--interactive`(或简写 `-i`)标志的作用。 + +### 介绍 git rebase -i + +`git rebase` 的最大优点是它重写了历史。但是,为什么仅止于假装你从后面的点分支出来呢?有一种更进一步方法可以重写你是如何准备就绪这些代码的:`git rebase -i`,交互式的 `git rebase`。 + +这个功能就是 Git 中的 "神奇的时间机器” 功能。这个标志允许你在做变基时对修订历史记录进行复杂的修改。你可以隐藏你的错误! 将许多小的修改合并到一个原始的功能补丁中! 重新排序修改历史记录中的内容 + +![output of git rebase -i][4] + +当你运行 `git rebase -i` 时,你会得到一个编辑器会话,其中列出了所有正在被变基的提交,并有一些选项可以对它们做什么。默认的选择是 `pick`。 + + * `Pick`:会在你的历史记录中保留该提交。 + * `Reword`:允许你修改提交信息,可能是修复一个错别字或添加额外的注释。 + * `Edit`:允许你在重放分支的过程中对提交进行修改。 + * `Squash`:可以将多个提交合并为一个。 + * 你可以通过移动文件中的提交来重新排序。 + +当你完成后,只需保存最终结果,变基就会执行。在每个阶段,当你选择了修改提交(无论是用 `reword`、`edit`、`squash` 还是有冲突时),变基会停止,并允许你在继续提交之前进行适当的修改。 + +上面这个例子的结果是 “One-liner bug fix” 和 “Integate new header everywhere” 被合并到一个提交中,而 “New header for docs website” 和 “D'oh - typo. Fixed” 合并到另一个提交中。就像变魔术一样,其他提交的工作还在你的分支中,但相关的提交已经从你的历史记录中消失了!这样一来,你就可以很容易地提交干净的提交。 + +这使得使用 `git send-email` 或者用你新整理好的补丁集在父版本库中创建一个拉取请求来提交一个干净的补丁给上游项目变得很容易。这有很多好处,包括让你的代码更容易审核,更容易接受,也更容易合并。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/git-rebase-i + +作者:[Dave Neary][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dneary +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/sites/default/files/uploads/master-private-branches.png (Master branch vs. private branch) +[3]: https://opensource.com/sites/default/files/uploads/merge-commit-vs-rebase.png (Merge commits preserve history, and rebase rewrites history.) +[4]: https://opensource.com/sites/default/files/uploads/git-rebase-i.png (output of git rebase -i) From c65cba5b8db89928c2ce6b829bcbed9a9e5a4b73 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 May 2020 22:36:16 +0800 Subject: [PATCH 1962/3057] PRF @robsean --- ...re SFTP Server with Chroot in Debian 10.md | 84 ++++++++++--------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/translated/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md b/translated/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md index a30b6ee817..4fe8afb9a2 100644 --- a/translated/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md +++ b/translated/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md @@ -7,61 +7,63 @@ [#]: via: (https://www.linuxtechi.com/configure-sftp-chroot-debian10/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) -如何在 Debian 10 中使用 Chroot 配置 SFTP 服务 +如何在 Debian 10 中配置 Chroot 环境的 SFTP 服务 ====== -**SFTP** 代表安全文件传输协议 / SSH 文件传输协议,它是最常用的一个方法,用于通过ssh将文件从本地系统安全地传输到远程服务器,反之亦然。sftp 的主要优点是,除 ‘**openssh-server**’ 之外,我们不需要安装任何额外的软件包,在大多数的 Linux 发行版中,‘openssh-server’ 软件包是默认安装的一部分。sftp 的另外一个好处是,我们可以允许用户使用 sftp ,而不允许使用 ssh 。 +SFTP 意思是“安全文件传输协议Secure File Transfer Protocol” 或 “SSH 文件传输协议SSH File Transfer Protocol”,它是最常用的用于通过 `ssh` 将文件从本地系统安全地传输到远程服务器的方法,反之亦然。`sftp` 的主要优点是,除 `openssh-server` 之外,我们不需要安装任何额外的软件包,在大多数的 Linux 发行版中,`openssh-server` 软件包是默认安装的一部分。`sftp` 的另外一个好处是,我们可以允许用户使用 `sftp` ,而不允许使用 `ssh` 。 -[![配置-sftp-debian10][1]][2] - -当前 Debian 10 ,代号‘Buster’,已经发布,在这篇文章中,我们将演示如何在 Debian 10 系统中使用 Chroot ‘Jail’ 类似的环境配置 sftp 。在这里,Chroot Jail 类似环境意味着,用户不能超出各自的 home 目录,或者用户不能从各自的 home 目录更改目录。下面实验的详细情况: - - * OS = Debian 10 - * IP 地址 = 192.168.56.151 +![](https://img.linux.net.cn/data/attachment/album/202005/05/223518ip4mbdi4nggbdtgu.jpg) +当前发布的 Debian 10 代号为 ‘Buster’,在这篇文章中,我们将演示如何在 Debian 10 系统中在 “监狱式的” Chroot 环境中配置 `sftp`。在这里,Chroot 监狱式环境意味着,用户不能超出各自的家目录,或者用户不能从各自的家目录更改目录。下面实验的详细情况: +* OS = Debian 10 +* IP 地址 = 192.168.56.151 让我们跳转到 SFTP 配置步骤, -### 步骤:1) 为 sftp 使用 groupadd 命令创建一个组 +### 步骤 1、使用 groupadd 命令给 sftp 创建一个组 -打开终端,使用下面的 groupadd 命令创建一个名为的“**sftp_users**”组, +打开终端,使用下面的 `groupadd` 命令创建一个名为的 `sftp_users` 组: ``` root@linuxtechi:~# groupadd sftp_users ``` -### 步骤:2) 添加用户到组 ‘sftp_users’ 并设置权限 +### 步骤 2、添加用户到组 sftp_users 并设置权限 -假设你想创建新的用户,并且想添加该用户到 ‘sftp_users’ 组中,那么运行下面的命令, +假设你想创建新的用户,并且想添加该用户到 `sftp_users` 组中,那么运行下面的命令, -**语法:** # useradd -m -G sftp_users +**语法:** -让我们假设用户名是 ’Jonathan’ +``` +# useradd -m -G sftp_users <用户名> +``` + +让我们假设用户名是 `jonathan`: ``` root@linuxtechi:~# useradd -m -G sftp_users jonathan ``` -使用下面的 chpasswd 命令设置密码, +使用下面的 `chpasswd` 命令设置密码: ``` -root@linuxtechi:~# echo "jonathan:" | chpasswd +root@linuxtechi:~# echo "jonathan:<输入密码>" | chpasswd ``` -假设你想添加现有的用户到 ‘sftp_users’ 组中,那么运行下面的 usermod 命令,让我们假设已经存在的用户名称是 ‘chris’ +假设你想添加现有的用户到 `sftp_users` 组中,那么运行下面的 `usermod` 命令,让我们假设已经存在的用户名称是 `chris`: ``` root@linuxtechi:~# usermod -G sftp_users chris ``` -现在设置用户所需的权限, +现在设置用户所需的权限: ``` root@linuxtechi:~# chown root /home/jonathan /home/chris/ ``` -在各用户的 home 目录中都创建一个上传目录,并设置正确地所有权, +在各用户的家目录中都创建一个上传目录,并设置正确地所有权: ``` root@linuxtechi:~# mkdir /home/jonathan/upload @@ -72,14 +74,14 @@ root@linuxtechi:~# chown chris /home/chris/upload **注意:** 像 Jonathan 和 Chris 之类的用户可以从他们的本地系统上传文件和目录。 -### 步骤:3) 编辑 sftp 配置文件 (/etc/ssh/sshd_config) +### 步骤 3、编辑 sftp 配置文件 /etc/ssh/sshd_config -正如我们已经陈述的,sftp 操作是通过 ssh 完成的,所以它的配置文件是 “**/etc/ssh/sshd_config**“, 在做任何更改前,我建议首先备份文件,然后再编辑该文件,接下来添加下面的内容, +正如我们已经陈述的,`sftp` 操作是通过 `ssh` 完成的,所以它的配置文件是 `/etc/ssh/sshd_config`,在做任何更改前,我建议首先备份文件,然后再编辑该文件,接下来添加下面的内容: ``` root@linuxtechi:~# cp /etc/ssh/sshd_config /etc/ssh/sshd_config-org root@linuxtechi:~# vim /etc/ssh/sshd_config -……… +...... #Subsystem sftp /usr/lib/openssh/sftp-server Subsystem sftp internal-sftp @@ -88,28 +90,28 @@ Match Group sftp_users AllowTcpForwarding no ChrootDirectory %h ForceCommand internal-sftp -………… +...... ``` 保存并退出文件。 -为使上述更改生效,使用下面的 systemctl 命令来重新启动 ssh 服务 +为使上述更改生效,使用下面的 `systemctl` 命令来重新启动 `ssh` 服务: ``` root@linuxtechi:~# systemctl restart sshd ``` -在上面的 ‘sshd_config’ 文件中,我们已经注释掉了以 “Subsystem”开头的行,并添加了新的条目 “Subsystem sftp internal-sftp” 和新的行,像, +在上面的 `sshd_config` 文件中,我们已经注释掉了以 `Subsystem` 开头的行,并添加了新的条目 `Subsystem sftp internal-sftp` 和新的行。而 -“**Match Group sftp_users”** –> 它意味着如果用户是 ‘sftp_users’ 组中的一员,那么将应用下面提到的规则到这个条目。 +`Match Group sftp_users` –> 它意味着如果用户是 `sftp_users` 组中的一员,那么将应用下面提到的规则到这个条目。 -“**ChrootDierctory %h**” –> 它意味着用户只能在他们自己各自的 home 目录中更改目录,而不能超出他们各自的 home 目录。或者换句话说,我们可以说用户是不允许更改目录的。他们将在他们的目录中获得 jai 类似环境,并且不能访问其他用户的目录和系统的目录。 +`ChrootDierctory %h` –> 它意味着用户只能在他们自己各自的家目录中更改目录,而不能超出他们各自的家目录。或者换句话说,我们可以说用户是不允许更改目录的。他们将在他们的目录中获得监狱一样的环境,并且不能访问其他用户的目录和系统的目录。 -“**ForceCommand internal-sftp**” –> 它意味着用户仅被限制到 sftp 命令。 +`ForceCommand internal-sftp` –> 它意味着用户仅被限制到只能使用 `sftp` 命令。 -### 步骤:4) 测试和验证 sftp +### 步骤 4、测试和验证 sftp -登录到你的 sftp 服务器的同一个网络上的任何其它的 Linux 系统,然后通过我们在 ‘sftp_users’ 组中映射的用户来尝试 ssh sftp 服务。 +登录到你的 `sftp` 服务器的同一个网络上的任何其它的 Linux 系统,然后通过我们放入 `sftp_users` 组中的用户来尝试 ssh 和 sftp 服务。 ``` [root@linuxtechi ~]# ssh root@linuxtechi @@ -121,7 +123,7 @@ Write failed: Broken pipe [root@linuxtechi ~]# ``` -以上操作证实用户不允许 SSH ,现在使用下面的命令尝试 sftp , +以上操作证实用户不允许 `ssh` ,现在使用下面的命令尝试 `sftp`: ``` [root@linuxtechi ~]# sftp root@linuxtechi @@ -133,7 +135,7 @@ drwxr-xr-x 2 root 1001 4096 Sep 14 07:52 debian10-pkgs drwxr-xr-x 2 1001 1002 4096 Sep 14 08:29 upload ``` -让我们使用 sftp ‘**get**‘ 命令来尝试下载一个文件 +让我们使用 sftp 的 `get` 命令来尝试下载一个文件: ``` sftp> get devops-actions.txt @@ -147,9 +149,9 @@ Couldn't stat remote file: No such file or directory sftp> ``` -上面的输出证实我们能从我们的 sftp 服务器下载文件到本地机器,除此之外,我们也必需测试用户不能更改目录。 +上面的输出证实我们能从我们的 sftp 服务器下载文件到本地机器,除此之外,我们也必须测试用户不能更改目录。 -让我们在 **upload**”目录下尝试上传一个文件, +让我们在 `upload` 目录下尝试上传一个文件: ``` sftp> cd upload/ @@ -163,17 +165,17 @@ sftp> 这证实我们已经成功地从我们的本地系统上传一个文件到 sftp 服务中。 -现在使用 winscp 工具来测试 SFTP 服务,输入 sftp 服务器 ip 地址和用户的凭证, +现在使用 winscp 工具来测试 sftp 服务,输入 sftp 服务器 IP 地址和用户的凭证: -[![Winscp-sftp-debian10][1]][3] +![][3] -在 Login 上单击,然后尝试下载和上传文件 +在 “Login” 上单击,然后尝试下载和上传文件: -[![下载-文件-winscp-debian10-sftp][1]][4] +![][4] -现在,在 upload 文件夹中尝试上传文件, +现在,在 `upload` 文件夹中尝试上传文件: -[![使用-winscp-Debian10-sftp-上传-文件][1]][5] +![][5] 上面的窗口证实上传是完好地工作的,这就是这篇文章的全部。如果这些步骤能帮助你在 Debian 10 中使用 chroot 环境配置 SFTP 服务器s,那么请分享你的反馈和评论。 @@ -184,7 +186,7 @@ via: https://www.linuxtechi.com/configure-sftp-chroot-debian10/ 作者:[Pradeep Kumar][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f2866dc8c6d1f412e0ca0c7324089a85e7a96e69 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 May 2020 22:39:46 +0800 Subject: [PATCH 1963/3057] PUB @robsean https://linux.cn/article-12186-1.html --- ...How to Configure SFTP Server with Chroot in Debian 10.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20190915 How to Configure SFTP Server with Chroot in Debian 10.md (98%) diff --git a/translated/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md b/published/20190915 How to Configure SFTP Server with Chroot in Debian 10.md similarity index 98% rename from translated/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md rename to published/20190915 How to Configure SFTP Server with Chroot in Debian 10.md index 4fe8afb9a2..51a75f3521 100644 --- a/translated/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md +++ b/published/20190915 How to Configure SFTP Server with Chroot in Debian 10.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12186-1.html) [#]: subject: (How to Configure SFTP Server with Chroot in Debian 10) [#]: via: (https://www.linuxtechi.com/configure-sftp-chroot-debian10/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) From 06b002218761300f5686e3c1a766ae099b216df2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 May 2020 23:21:47 +0800 Subject: [PATCH 1964/3057] PRF @wxy --- ...0 ways to analyze binary files on Linux.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20200430 10 ways to analyze binary files on Linux.md b/translated/tech/20200430 10 ways to analyze binary files on Linux.md index 80577dfbcf..c5dbfc6f61 100644 --- a/translated/tech/20200430 10 ways to analyze binary files on Linux.md +++ b/translated/tech/20200430 10 ways to analyze binary files on Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (10 ways to analyze binary files on Linux) @@ -12,11 +12,11 @@ > 这些简单的命令和工具可以帮助你轻松完成分析二进制文件的任务。 -![Tux with binary code background][1] +![](https://img.linux.net.cn/data/attachment/album/202005/05/232115nn0oduodo4oztv0a.jpg) “这个世界上有 10 种人:懂二进制的人和不懂二进制的人。” -我们每天都在与二进制文件打交道,但我们对二进制文件却知之甚少。我所说的二进制,是指你每天运行的可执行文件,从你的命令行工具到成熟的应用程序都是。 +我们每天都在与二进制文件打交道,但我们对二进制文件却知之甚少。我所说的二进制,是指你每天运行的可执行文件,从命令行工具到成熟的应用程序都是。 Linux 提供了一套丰富的工具,让分析二进制文件变得轻而易举。无论你的工作角色是什么,如果你在 Linux 上工作,了解这些工具的基本知识将帮助你更好地理解你的系统。 @@ -26,7 +26,7 @@ Linux 提供了一套丰富的工具,让分析二进制文件变得轻而易 它的作用:帮助确定文件类型。 -这将是你进行二进制分析的出发点。我们每天都在与文件打交道。并非所有的文件都是可执行类型,除此之外还有各种各样的文件类型。在你开始之前,你需要了解要分析的文件类型。它是二进制文件、库文件、ASCII 文本文件、视频文件、图片文件、PDF、数据文件等等。 +这将是你进行二进制分析的起点。我们每天都在与文件打交道,并非所有的文件都是可执行类型,除此之外还有各种各样的文件类型。在你开始之前,你需要了解要分析的文件类型。是二进制文件、库文件、ASCII 文本文件、视频文件、图片文件、PDF、数据文件等文件吗? `file` 命令将帮助你确定你所处理的文件类型。 @@ -66,11 +66,11 @@ $ ### ltrace -它的作用:一个库调用跟踪器。 +它的作用:库调用跟踪器。 我们现在知道如何使用 `ldd` 命令找到一个可执行程序所依赖的库。然而,一个库可以包含数百个函数。在这几百个函数中,哪些是我们的二进制程序正在使用的实际函数? -`ltrace` 命令可以显示在运行时从库中调用的所有函数。在下面的例子中,你可以看到被调用的函数名称,以及传递给该函数的参数。你也可以在输出的最右边看到这些函数返回的内容。 +`ltrace` 命令可以显示运行时从库中调用的所有函数。在下面的例子中,你可以看到被调用的函数名称,以及传递给该函数的参数。你也可以在输出的最右边看到这些函数返回的内容。 ``` $ ltrace ls @@ -95,7 +95,7 @@ $ 它的作用:以 ASCII、十进制、十六进制或八进制显示文件内容。 -通常情况下,当你用一个应用程序打开一个文件,而它不知道如何处理该文件时,就会出现这种情况。尝试用 `vim` 打开一个可执行文件或视频文件,你会看到的只是屏幕上抛出的乱码。 +通常情况下,当你用一个应用程序打开一个文件,而它不知道如何处理该文件时,就会出现这种情况。尝试用 `vim` 打开一个可执行文件或视频文件,你屏幕上会看到的只是抛出的乱码。 在 `hexdump` 中打开未知文件,可以帮助你看到文件的具体内容。你也可以选择使用一些命令行选项来查看用 ASCII 表示的文件数据。这可能会帮助你了解到它是什么类型的文件。 @@ -132,7 +132,7 @@ $ strings /bin/ls ELF(可执行和可链接文件格式Executable and Linkable File Format)是可执行文件或二进制文件的主流格式,不仅是 Linux 系统,也是各种 UNIX 系统的主流文件格式。如果你已经使用了像 `file` 命令这样的工具,它告诉你文件是 ELF 格式,那么下一步就是使用 `readelf` 命令和它的各种选项来进一步分析文件。 -在使用 `readelf` 命令时,有一个实际的 ELF 规范的参考是非常有用的。你可以在[这里][2]找到规范。  +在使用 `readelf` 命令时,有一份实际的 ELF 规范的参考是非常有用的。你可以在[这里][2]找到该规范。  ``` $ readelf -h /bin/ls @@ -163,9 +163,9 @@ $ 它的作用:从对象文件中显示信息。 -二进制文件是通过你编写源码的创建的,这些源码会通过一个叫做编译器的工具进行编译。这个编译器会生成相当于源代码的机器语言指令,然后由 CPU 执行,以执行特定的任务。这些机器语言代码可以通过被称为汇编语言的助记词来解读。汇编语言是一组指令,它可以帮助你理解由程序所进行并最终在 CPU 上执行的操作。 +二进制文件是通过你编写的源码创建的,这些源码会通过一个叫做编译器的工具进行编译。这个编译器会生成相对于源代码的机器语言指令,然后由 CPU 执行特定的任务。这些机器语言代码可以通过被称为汇编语言的助记词来解读。汇编语言是一组指令,它可以帮助你理解由程序所进行并最终在 CPU 上执行的操作。 -`objdump` 实用程序读取二进制或可执行文件,并将汇编语言指令转储到屏幕上。汇编语言知识对于理解 `objdump` 命令的输出是至关重要的。 +`objdump` 实用程序读取二进制或可执行文件,并将汇编语言指令转储到屏幕上。汇编语言知识对于理解 `objdump` 命令的输出至关重要。 请记住:汇编语言是特定于体系结构的。 @@ -174,7 +174,6 @@ $ objdump -d /bin/ls | head /bin/ls: file format elf64-x86-64 - Disassembly of section .init: 0000000000402150 <_init@@Base>: @@ -219,7 +218,7 @@ $ 它的作用:列出对象文件中的符号。 -如果你所使用的二进制文件没有被剥离,`nm` 命令将为你提供在编译过程中嵌入到二进制文件中的有价值的信息。`nm` 可以帮助你从二进制文件中识别变量和函数。你可以想象一下,如果你无法访问二进制文件的源代码,这将是多么有用。 +如果你所使用的二进制文件没有被剥离,`nm` 命令将为你提供在编译过程中嵌入到二进制文件中的有价值的信息。`nm` 可以帮助你从二进制文件中识别变量和函数。你可以想象一下,如果你无法访问二进制文件的源代码时,这将是多么有用。 为了展示 `nm`,我们快速编写了一个小程序,用 `-g` 选项编译,我们会看到这个二进制文件没有被剥离。 @@ -264,7 +263,7 @@ $ 分析这些路径的唯一方法是在运行时环境,在任何给定的位置停止或暂停程序,并能够分析信息,然后再往下执行。 -这就是调试器的作用,在 Linux 上,`gdb` 就是调试器的事实标准。它可以帮助你加载程序,在特定的地方设置断点,分析内存和 CPU 的寄存器,还有更多的功能。它是对上面提到的其他工具的补充,可以让你做更多的运行时分析。 +这就是调试器的作用,在 Linux 上,`gdb` 就是调试器的事实标准。它可以帮助你加载程序,在特定的地方设置断点,分析内存和 CPU 的寄存器,以及更多的功能。它是对上面提到的其他工具的补充,可以让你做更多的运行时分析。 有一点需要注意的是,一旦你使用 `gdb` 加载一个程序,你会看到它自己的 `(gdb)` 提示符。所有进一步的命令都将在这个 `gdb` 命令提示符中运行,直到你退出。 @@ -290,7 +289,8 @@ Missing separate debuginfos, use: debuginfo-install glibc-2.17-260.el7_6.6.x86_6 Continuing. Hello world![Inferior 1 (process 29620) exited normally] (gdb) q -$``` +$ +``` ### 结语 @@ -303,7 +303,7 @@ via: https://opensource.com/article/20/4/linux-binary-analysis 作者:[Gaurav Kamathe][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2fc33688b14ace7d116b6ce18319b1c4820f600b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 May 2020 23:22:14 +0800 Subject: [PATCH 1965/3057] PUB @wxy https://linux.cn/article-12187-1.html --- .../20200430 10 ways to analyze binary files on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200430 10 ways to analyze binary files on Linux.md (99%) diff --git a/translated/tech/20200430 10 ways to analyze binary files on Linux.md b/published/20200430 10 ways to analyze binary files on Linux.md similarity index 99% rename from translated/tech/20200430 10 ways to analyze binary files on Linux.md rename to published/20200430 10 ways to analyze binary files on Linux.md index c5dbfc6f61..35fedf607a 100644 --- a/translated/tech/20200430 10 ways to analyze binary files on Linux.md +++ b/published/20200430 10 ways to analyze binary files on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12187-1.html) [#]: subject: (10 ways to analyze binary files on Linux) [#]: via: (https://opensource.com/article/20/4/linux-binary-analysis) [#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) From 56e24096621276c48184a8f01b1bbb0a3ec65973 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 5 May 2020 23:45:17 +0800 Subject: [PATCH 1966/3057] APL --- .../20200505 Browse the Peer-to-peer Web With Beaker Browser.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md b/sources/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md index 82129f00a5..319b8a18c5 100644 --- a/sources/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md +++ b/sources/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0bb37bb6aec7a6661c022baa6fa47a9bae504636 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 May 2020 00:54:57 +0800 Subject: [PATCH 1967/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200506=20Thre?= =?UTF-8?q?e=20Methods=20to=20Check=20Uptime=20of=20MySQL/MariaDB=20Databa?= =?UTF-8?q?se=20Server=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md --- ... MySQL-MariaDB Database Server on Linux.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md diff --git a/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md b/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md new file mode 100644 index 0000000000..be88629967 --- /dev/null +++ b/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Three Methods to Check Uptime of MySQL/MariaDB Database Server on Linux) +[#]: via: (https://www.2daygeek.com/check-mysql-mariadb-database-server-uptime-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Three Methods to Check Uptime of MySQL/MariaDB Database Server on Linux +====== + +We all know the purpose of the uptime command in Linux. + +This is used to check the **[uptime of the Linux system][1]** and how long the system runs without restarting. + +The Linux admin job is to keep the system up and running. + +If you want to check how long other services like **[Apache][2]**, MySQL, MariaDB, sftp, etc., are running on Linux, how do you do that? + +Each service has their own command to check the uptime of service. + +But you can also use other commands for this purpose. + +### Method-1: How to Check the Uptime of a MySQL/MariaDB Database Server on Linux Using the ps Command + +The **[ps command][3]** stands for process status. This is one of the most basic commands that shows the system running processes with details. + +To do so, you first need to find the PID of **[MySQL][4]**/MariaDB using the **[pidof command][5]**. + +``` +# pidof mysqld | cut -d" " -f1 + +2412 +``` + +Once you have the MySQL/[**MariaDB**][6] PID, use the “etime” option with the ps command and get the uptime. + + * **etime:** elapsed time since the process was started, in the form of [[DD-]hh:]mm:ss. + + + +``` +# ps -p 2412 -o etime + + ELAPSED +2-08:49:30 +``` + +Alternatively, use the “lstart” option with the ps command to get the uptime of a given PID. + +``` +# ps -p 2412 -o lstart + + STARTED +Sat May 2 03:02:15 2020 +``` + +The MySQL/MariaDB process has been running for 2 days, 03 hours, 02 minutes and 15 seconds. + +### Method-2: How to Check the Uptime of a MySQL/MariaDB Database Server on Linux Using the Systemctl Command + +The **[systemctl command][7]** is used to control the systemd system and service manager. + +systemd is a new init system and system manager, that was adopted by most of Linux distributions now over the traditional SysVinit manager. + +``` +# systemctl status mariadb +or +# systemctl status mysql + +● mariadb.service - MariaDB 10.1.44 database server + Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) + Drop-In: /etc/systemd/system/mariadb.service.d + └─migrated-from-my.cnf-settings.conf + Active: active (running) since Sat 2020-05-02 03:02:18 UTC; 2 days ago + Docs: man:mysqld(8) + https://mariadb.com/kb/en/library/systemd/ + Process: 2448 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) + Process: 2388 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=/usr/bin/galera_recovery; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS) + Process: 2386 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) + Main PID: 2412 (mysqld) + Status: "Taking your SQL requests now…" + CGroup: /system.slice/mariadb.service + └─2412 /usr/sbin/mysqld + +May 03 21:41:26 ns2.2daygeek.com mysqld[2412]: 2020-05-03 21:41:26 140328136861440 [Warning] Host name '1.1.1.1' could not be resolved: … not known +May 04 02:00:46 ns2.2daygeek.com mysqld[2412]: 2020-05-04 2:00:46 140328436418304 [Warning] IP address '1.1.1.1' has been resolved to the host name '2…ss itself. +May 04 03:01:31 ns2.2daygeek.com mysqld[2412]: 2020-05-04 3:01:31 140328436111104 [Warning] IP address '1.1.1.1' could not be resolved: Temporary fai…resolution +May 04 04:03:06 ns2.2daygeek.com mysqld[2412]: 2020-05-04 4:03:06 140328136861440 [Warning] IP address '1.1.1.1' could not be resolved: Name or ser… not known +May 04 07:23:54 ns2.2daygeek.com mysqld[2412]: 2020-05-04 7:23:54 140328435189504 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +May 04 08:03:31 ns2.2daygeek.com mysqld[2412]: 2020-05-04 8:03:31 140328436418304 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +May 04 08:25:56 ns2.2daygeek.com mysqld[2412]: 2020-05-04 8:25:56 140328135325440 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable. +Hint: Some lines were ellipsized, use -l to show in full. +``` + +### Method-3: How to Check the Uptime of a MySQL/MariaDB Database Server on Linux Using the MySQLAdmin Command + +**[MySQLAdmin][8]** is a command-line utility for MySQL Server that is installed when installing the MySQL package. + +The MySQLAdmin client allows you to perform some basic administrative functions on the MySQL server. + +It is used to create a database, drop a database, set a root password, change the root password, check MySQL status, verify MySQL functionality, monitor mysql processes, and verify the configuration of the server. + +``` +# mysqladmin -u root -pPassword version + +mysqladmin Ver 8.42 Distrib 5.7.27, for Linux on x86_64 +Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Server version 5.7.27 +Protocol version 10 +Connection Localhost via UNIX socket +UNIX socket /var/lib/mysql/mysql.sock +Uptime: 1 day 10 hours 44 min 13 sec +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/check-mysql-mariadb-database-server-uptime-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-system-server-uptime-check/ +[2]: https://www.2daygeek.com/check-find-apache-httpd-web-server-uptime-linux/ +[3]: https://www.2daygeek.com/linux-ps-command-find-running-process-monitoring/ +[4]: https://www.2daygeek.com/category/mysql/ +[5]: https://www.2daygeek.com/check-find-parent-process-id-pid-ppid-linux/ +[6]: https://www.2daygeek.com/category/mariadb/ +[7]: https://www.2daygeek.com/sysvinit-vs-systemd-cheatsheet-systemctl-command-usage/ +[8]: https://www.2daygeek.com/linux-mysqladmin-command-administrate-mysql-mariadb-server/ From fa8df9c7325af368c5190b99fc02e19f09f2c868 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 May 2020 01:16:16 +0800 Subject: [PATCH 1968/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200506=20Afte?= =?UTF-8?q?r=20More=20Than=203=20Years,=20Inkscape=201.0=20is=20Finally=20?= =?UTF-8?q?Here=20With=20Tons=20of=20Feature=20Improvements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md --- ... Here With Tons of Feature Improvements.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md diff --git a/sources/tech/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md b/sources/tech/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md new file mode 100644 index 0000000000..b036d7a56a --- /dev/null +++ b/sources/tech/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements) +[#]: via: (https://itsfoss.com/inkscape-1-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements +====== + +Even though I’m not an expert, it is safe to say that Inkscape is one of the [best vector graphics editors][1]. + +Not just limited to the reason that it is free and open-source software – but it is indeed a useful application for digital artists creating something on it. + +The last release (version 0.92) was about 3 years ago. And, now, finally, [Inkscape announced its 1.0 release][2] – with a bunch of new features, additions, and improvements. + +### Inkscape 1.0: What’s New? + +![Inkscape 1.0][3] + +Here, let me highlight the important key changes that you need to know about Inkscape 1.0 release: + +#### First native macOS application + +It’s always good to have a proper cross-platform support for amazing tools like Inkscape. And, with the latest release, a native macOS application has been made available as well. + +Do note that the macOS app is still a **preview** version and has room for a lot of improvements. However, with a better system integration without needing [XQuartz][4], it should be a promising progress for macOS users. + +#### Performance Improvements + +Any kind of application/tool benefits from a significant performance boost. And, so does Inkscape. + +With its 1.0 release, they mention that you will be able to notice the smoother performance when using Inkscape for all the creative work you do. + +Except on macOS (which is still a “preview” version), Inkscape should run just fine on Linux and Windows. + +#### Improved UI and HiDPI Support + +![][5] + +In their release notes, they’ve mentioned: + +> A major milestone was achieved in enabling Inkscape to use a more recent version of the software used to build the editor’s user interface (namely GTK+3). Users with HiDPI (high resolution) screens can thank teamwork that took place during the 2018 Boston Hackfest for setting the updated-GTK wheels in motion. + +So, starting from GTK +3 user interface to the HiDPI support for high-resolution screens, it is a wonderful upgrade. + +Not to forget, you get more customization options to tweak the look and feel as well. + +#### New Feature Additions + +![][6] + +On paper, the list of new features sounds good. Depending on your expertise and what you prefer, the latest additions should come in handy. + +Here’s an overview of the new features: + + * New and improved Live Path Effect (LPE) features + * A new searchable LPE selection dialog + * Freestyle drawing users can now mirror and rotate the canvas + * The new PowerPencil mode of the Pencil tool provides pressure-dependent width and it is finally possible to create closed paths. + * New path effects that will appeal to the artistic user include Offset, PowerClip, and PowerMask LPEs. + * Ability to create a duplicate guide, aligning grids to the page, the Measure tool’s path length indicator, and the inverted Y-axis. + * Ability to export PDFs with clickable links and metadata + * New palettes and mesh gradients that work in the web browser + + + +While I’ve tried to compile the list of the key features added to this release, you can get all the nitty gritty details in their [release notes][7]. + +#### Other Important Changes + +Along with all the major changes, Inkscape 1.0 now supports Python 3. And, with that going forward, you might notice some extensions that don’t work with the latest version. + +So, if your work depends on the workflow of your extensions, I suggest you to take a closer look at their [release notes][7] to get all the technical details. + +### Download & Install Inkscape 1.0 on Linux + +Inkscape 1.0 is available in AppImage and Snap format for Linux. You can download it from Inkscape’s website. + +[Download Inkscape 1.0 for Linux][8] + +If you aren’t aware, you can check [how to use AppImage file on Linux][9] to get started. You may also refer to [this Snap guide][10]. + +Ubuntu users can find the snap version of Inskcape 1.0 in the Ubuntu Software Center. + +I used the AppImage file on [Pop OS 20.04][11] and it worked just fine to get started. You can test drive all the features in detail to see how it works out for you. + +Have you tried it yet? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/inkscape-1-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/vector-graphics-editors-linux/ +[2]: https://inkscape.org/news/2020/05/04/introducing-inkscape-10/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-1-0.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/XQuartz +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-ui-customization.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-live-path-effects.jpg?ssl=1 +[7]: https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0 +[8]: https://inkscape.org/release/1.0/gnulinux/ +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://itsfoss.com/install-snap-linux/ +[11]: https://itsfoss.com/pop-os-20-04-review/ From 73f3fbc0b669c5f0b41702b3c47ee465a5588d9a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 May 2020 01:17:47 +0800 Subject: [PATCH 1969/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200505=2011?= =?UTF-8?q?=20DevOps=20lessons=20from=20My=20Little=20Pony?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200505 11 DevOps lessons from My Little Pony.md --- ...5 11 DevOps lessons from My Little Pony.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/tech/20200505 11 DevOps lessons from My Little Pony.md diff --git a/sources/tech/20200505 11 DevOps lessons from My Little Pony.md b/sources/tech/20200505 11 DevOps lessons from My Little Pony.md new file mode 100644 index 0000000000..f550f871a1 --- /dev/null +++ b/sources/tech/20200505 11 DevOps lessons from My Little Pony.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (11 DevOps lessons from My Little Pony) +[#]: via: (https://opensource.com/article/20/5/devops-lessons) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +11 DevOps lessons from My Little Pony +====== +What you never thought you could learn about DevOps for Twilight Sparkle +and her friends. +![My Little Pony][1] + +In 2010, the My Little Pony franchise was rebooted with the animated show _My Little Pony: Friendship is Magic_. The combination of accessibility to children with the sophisticated themes the show tackled garnered a following that cut across ages. I was swept up in the wave and discovered there is a lot to learn about DevOps from the show. + +### Discovering technical debt + +The show begins with Twilight Sparkle reading obscure documentation, only to realize that Equestria, where the show is set, is due to suffer a calamity. Though someone named Nightmare Moon has been imprisoned for a thousand years, there is a prophecy she will return. + +#### Lesson 1: Technical debt matters. + +Nightmare Moon is a perfect stand-in for technical debt. Document it. Pay attention to the signs of risk no matter how infrequently they occur. Have a plan to resolve it. + +Twilight Sparkle goes to her manager with the news, only to be told that it is not a current priority. She is sent to Ponyville to prepare for the coming celebration, instead. + +#### Lesson 2: Communication with management is key. + +Twilight Sparkle communicated her priority (the risk of technical debt) but did not convince her management that it was more important than the celebration (of the next release or a new customer). + +We all need to make clear what the business case is for resolving critical issues. It is also not straightforward to explain technical debt in business terms. If management does not agree on the severity, find new ways to communicate the risk, and team up with others who speak that language. + +### When technical debt becomes an outage + +As the prophecy has foreseen, Nightmare Moon returns and declares eternal night. (In this DevOps story, this marks the beginning of a catastrophic outage.) Twilight quickly understands that she cannot resolve the issue by herself, and she recruits the ponies who will become, with her, the "Mane Six." They each stand for a different element of harmony—Applejack stands for Honesty, Fluttershy for Kindness, Pinkie Pie for Laughter, Rarity for Generosity, Rainbow Dash for Loyalty, and Twilight Sparkle herself for Magic. This team-building is full of lessons: + +#### Lesson 3: Few are the issues that can be resolved by one person. + +When facing an outage, reach out to other people with complementary skills who can help you. It is best if they are different than you: different backgrounds leads to differing perspectives, and that can lead to better problem-solving. + +#### Lesson 4: When resolving an outage, honest communication is key. + +Throughout the struggle against the eternal night, the Mane Six have to speak openly and honestly about what's not working. Their [blameless communication][2] is part of problem-solving. + +#### Lesson 5: When resolving an outage, kindness to yourself and to others is crucial. + +Though tempers flare hot in the land of Equestria, we all benefit from coming back to working together. + +#### Lesson 6: Laughter is important. + +Even when everything comes crashing down, remember to take a break, drink a glass of water, and take a deep breath. Stressing out does not help anything. + +#### Lesson 7: Be generous. + +Even if you are not on-call right now, if your help is needed to resolve a problem, help out as you hope your colleagues will do for you. + +#### Lesson 8: Be loyal. + +An outage is not a time to settle rivalries between teams. Focus on how to collaborate and resolve the outage as a team. + +#### Lesson 9: Though people skills are important, you have to understand the technology on a deep level. + +Keep your skills sharp. Expertise is not only the ability to learn; it is knowing when that information is needed. Part of being an expert is practice. + +### Growing into a culture of continual improvement + +After the issue is resolved, Princess Celestia realizes that the Mane Six are crucial to the long-term survival of Equestria, and tells Twilight Sparkle to stay in Ponyville and keep researching the magic of friendship. + +#### Lesson 10: After an outage is resolved, conduct a review, take concrete lessons, and act on them. + +I could go on, episode by episode, detailing lessons relevant for DevOps, but I will wrap up with one of my favorite ones. In the "Winter Wrap-Up" episode, all the ponies in Ponyville help in preparing for the spring. As per tradition, they do not use magic, leaving Twilight Sparkle to wonder how she can contribute. Eventually, she realizes that she can help by making a checklist to make sure everything is done in the right order. + +#### Lesson 11: When automation is impossible or inadvisable, write a solid checklist, and follow it. Do not depend on your memory. + +Twilight Sparkle and the Mane Six overcome great obstacles as a team, and now have a system to improve as a team. + +### A story of DevOps + +This story reflects how many organizations slowly adopt DevOps. The transition from recognizing a fear of technical debt toward addressing it is not simple. With courageous leadership, teamwork, and a willingness to improve, all organizations can come out on the other side with a similar story to Twilight Sparkle and her friends. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/devops-lessons + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/my-little-pony.jpg?itok=X-rwAGuE (My Little Pony) +[2]: https://opensource.com/article/19/4/psychology-behind-blameless-retrospective From a0e4f624b4db19d7fde9a83a4a8ccc29bca27ec6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 May 2020 01:18:47 +0800 Subject: [PATCH 1970/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200505=208=20?= =?UTF-8?q?open=20source=20video=20games=20to=20play?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200505 8 open source video games to play.md --- ...00505 8 open source video games to play.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20200505 8 open source video games to play.md diff --git a/sources/tech/20200505 8 open source video games to play.md b/sources/tech/20200505 8 open source video games to play.md new file mode 100644 index 0000000000..ac0577d96b --- /dev/null +++ b/sources/tech/20200505 8 open source video games to play.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 open source video games to play) +[#]: via: (https://opensource.com/article/20/5/open-source-fps-games) +[#]: author: (Aman Gaur https://opensource.com/users/amangaur) + +8 open source video games to play +====== +These games are fun and free to play, a way to connect with friends, and +an opportunity to make an old favorite even better. +![Gaming on a grid with penguin pawns][1] + +Video games are a big business. That's great for the industry's longevity—not to mention for all the people working in programming and graphics. But it can take a lot of work, time, and money to keep up with all the latest gaming crazes. If you feel like playing a few quick rounds of a video game without investing in a new console or game franchise, then you'll be happy to know that there are plenty of open source combat games you can download, play, share, and even modify (if you're inclined to programming) for free. + +First-person shooters (FPS) are one of the most popular categories of video games. They are centered around the perspective of the protagonist (the player), and they often offer weapon-based advancement. As you get better at the game, you survive longer, you get better weapons, and you increase your power. FPS games have a distinct look and feel, which is reflected in the category's name: players see everything—their weapons and the game world—in first person, as if they're looking through their player character's eyes. + +If you want to give one a try, check out the following eight great open source FPS games. + +### Xonotic + +![Xonotic][2] + +[Xonotic][3] is a fast-paced, arena-based FPS game. It is a popular game in the open source world. One reason could be the fact that it has never been a mainstream game. It offers a variety of weapons and enemies that are thrown right at you mercilessly from the start. Demanding quick action and response, it is an experience that will keep you on the edge of your seats. The game is available under the GPLv3+ license. + +### Wolfenstein Enemy Territory + +![Wolfenstein Enemy Territory][4] + +Wolfenstein has been a major franchise in gaming for many years. If you are a fan of gore and glory, then you've probably already heard of this game (if not, you'll love it once you try it). [Wolfenstein Enemy Territory][5] is an early iteration of the popular World War II game. It became free to play in 2003, and its [source code][6] is provided under the GPLv3. To play, however, you must own the game data (or recreate it yourself) separately (which remains under its original EULA). + +### Doom + +![Doom][7] + +[Doom][8] is a wildly popular game that was also an early example of games on Linux—way back in 2004. There are many iterations of the game, many of which have been released as open source. The game is about acquiring a teleportation device that's been captured by demons, so the violence, while gory, is low on realism. The source code for the game was provided under the GPL, but many versions require that you own the game for the game assets. There are dozens of ports and adaptations, including [Freedoom][9] (with free assets), [Dhewm3][10], [RBDoom-3-BFG][11], and many more. Try a few and pick your favorite! + +### Smokin' Guns + +![Smokin' Guns][12] + +If you're a fan of the Old West and six-shooters, this FPS is for you. From cowboys to gunslingers and with a captivating background score, [Smokin' Guns][13] has it all. It's a semi-realistic simulation of the old spaghetti western. On your way through the game, you face multiple enemies and get multiple weapons, so there's always the promise of excitement and danger around the corner. The game is free and open source under the terms of the GPLv2. + +### Nexuiz + +![Nexuiz][14] + +[Nexuiz][15] (classic) is another great FPS that's free to play on multiple platforms. The game is based on the Quake engine and has been made open source under the GNU GPLv2. The game offers multiple modes, including online, LAN party, and bot training. The game features sophisticated weapons and fast action. It's brutal and exciting, with an objective: kill as many opponents as possible before they get you. + +Note that the open source version of Nexuiz is not the same as the version built on CryEngine3 that is sold on Steam. + +### .kkrieger + +![kkrieger][16] + +[.Kkrieger][17] was developed in 2004 by .theprodukkt, a German demogroup. The game was developed using an unreleased (at the time) engine known as Werkkzeug. This game might feel a little slow to many, but it still offers an intense experience. The approaching enemies are slow, but their sheer number makes it confusing to know which one to take down first. It's an onslaught, and you have to shoot through layers of enemies before you reach the final boss. It was released in a rather raw form on [GitHub][18] by its creators under a BSD license with some public domain components. + +### Warsow + +![Warsow][19] + +If you've ever played Borderlands 2, then imagine [Warsow][20] as an arena-style Borderlands. The game is built on a modernized Quake II engine, and its plot takes a simple approach: Kill as many opponents as possible. The team with the most number of kills wins. Despite its simplicity, it features amazing weaponry and lots of great trick moves, like circle jumping, bunny hopping, double jumping, ramp sliding, and so on. It makes for an engaging multiplayer session, and it's been recognized by multiple online leagues as a worthy game for their competitions. Get the source code from [GitHub][21] or install the game from your software repository. + +### World of Padman + +![World of Padman][22] + +[The World of Padman][23] may be the last game on this list, but it's one of the most unique. Designed by PadWorld Entertainment, World of Padman takes a different twist graphically and introduces you to quirky and whimsical characters in a colorful (albeit cartoonishly violent) world. It's based on the ioquake3 engine, and its unique style and uproarious gameplay have earned it a featured place in multiple gaming magazines. You can download the source code from [GitHub][24]. + +### Give one a shot + +A game that becomes open source can act as a template for something great, whether it's a wholly open source version of an old classic, a remix of a beloved game, or an entirely new platform built on an old reliable engine. + +Open source gaming is important for many reasons: it provides users with a fun diversion, a way to connect with friends, and an opportunity for programmers and designers to hack within an existing framework. If titles like Doom weren't made open source, a little bit of video game history would be lost. Instead, it endures and has the opportunity to grow even more. + +Try an open source game, and watch your six. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/open-source-fps-games + +作者:[Aman Gaur][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/amangaur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game_pawn_grid_linux.png?itok=4gERzRkg (Gaming on a grid with penguin pawns) +[2]: https://opensource.com/sites/default/files/uploads/xonotic.jpg (Xonotic) +[3]: https://www.xonotic.org/download/ +[4]: https://opensource.com/sites/default/files/uploads/wolfensteinenemyterritory.jpg (Wolfenstein Enemy Territory) +[5]: https://www.splashdamage.com/games/wolfenstein-enemy-territory/ +[6]: https://github.com/id-Software/Enemy-Territory +[7]: https://opensource.com/sites/default/files/uploads/doom.jpg (Doom) +[8]: https://github.com/id-Software/DOOM +[9]: https://freedoom.github.io/ +[10]: https://dhewm3.org/ +[11]: https://github.com/RobertBeckebans/RBDOOM-3-BFG/ +[12]: https://opensource.com/sites/default/files/uploads/smokinguns.jpg (Smokin' Guns) +[13]: https://www.smokin-guns.org/downloads +[14]: https://opensource.com/sites/default/files/uploads/nexuiz.jpg (Nexuiz) +[15]: https://sourceforge.net/projects/nexuiz/ +[16]: https://opensource.com/sites/default/files/uploads/kkrieger.jpg (kkrieger) +[17]: https://web.archive.org/web/20120204065621/http://www.theprodukkt.com/kkrieger +[18]: https://github.com/farbrausch/fr_public +[19]: https://opensource.com/sites/default/files/uploads/warsow.jpg (Warsow) +[20]: https://www.warsow.net/download +[21]: https://github.com/Warsow +[22]: https://opensource.com/sites/default/files/uploads/padman.jpg (World of Padman) +[23]: https://worldofpadman.net/en/ +[24]: https://github.com/PadWorld-Entertainment From 20388ad705e6854d78dd86f496f84b9d6b4e80c2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 May 2020 01:19:38 +0800 Subject: [PATCH 1971/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200505=20Anal?= =?UTF-8?q?yzing=20data=20science=20code=20with=20R=20and=20Emacs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200505 Analyzing data science code with R and Emacs.md --- ...zing data science code with R and Emacs.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20200505 Analyzing data science code with R and Emacs.md diff --git a/sources/tech/20200505 Analyzing data science code with R and Emacs.md b/sources/tech/20200505 Analyzing data science code with R and Emacs.md new file mode 100644 index 0000000000..ebcfadbe92 --- /dev/null +++ b/sources/tech/20200505 Analyzing data science code with R and Emacs.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Analyzing data science code with R and Emacs) +[#]: via: (https://opensource.com/article/20/5/r-emacs-data-science) +[#]: author: (Peter Prevos https://opensource.com/users/danderzei) + +Analyzing data science code with R and Emacs +====== +Emacs' versatility and extensibility bring the editor's full power into +play for writing data science code. +![metrics and data shown on a computer screen][1] + +Way back in 2012, _Harvard Business Review_ published an article that proclaimed "data scientist" to be the [sexiest job][2] of the 21st century. Interest in data science has exploded since then. Many great open source projects, such as [Python][3] and the [R language][4] for statistical computing, have facilitated the rapid developments in how we analyze data. + +I started my career using pencil and paper and moved to spreadsheets. Now the R language is my weapon of choice when I need to create value from data. Emacs is another one of my favorite tools. This article briefly explains how to use the [Emacs Speaks Statistics][5] (ESS) package to get started with developing R projects in this venerable editor. + +The vast majority of R developers use the [RStudio][6] IDE to manage their projects. RStudio is a powerful open source editor with specialized functionality to develop data science projects. RStudio is a great integrated development environment (IDE), but its editing functions are limited. + +Using Emacs to write data science code means that you have access to the full power of this extensible editor. I prefer using Emacs for my data science projects because I can do many other tasks within the same application, leveraging the multifunctionality of this venerable editor. If you are just getting started with Emacs, then please first read Seth Kenlon's [Emacs getting started][7] article. + +### Setting up Emacs for R + +Emacs is an almost infinitely extensible text editor, which unfortunately means that many things don't work the way you want them to out of the box. Before you can write and execute R scripts, you need to install some packages and configure them. The ESS package provides an interface between Emacs and R. Other packages, such as [Company][8] and [highlight-parentheses][9] help with completion and balancing parentheses. + +Emacs uses a version of Lisp for configuration. The lines of [Emacs Lisp][10] code below install the required extensions and define a minimal configuration to get you started. These lines were tested for GNU Emacs version 26.3. + +Copy these lines and save them in a file named **init.el** in your **.emacs.d** folder. This is the folder that Emacs uses to store configurations, including the [init file][11]. If you already have an init file, then you can append these lines to your config. This minimal configuration is enough to get you started. + + +``` +;; Elisp file for R coding with Emacs + +;; Add MELPA repository and initialise the package manager +(require 'package) +(add-to-list 'package-archives +             '("melpa" . "")) +(package-initialize) + +;; Install use-package,in case it does not exist yet +;; The use-package software will install all other packages as required +(unless (package-installed-p 'use-package) +  (package-refresh-contents) +  (package-install 'use-package)) + +;; ESS configurationEmacs Speaks Statistics +(use-package ess +  :ensure t +) + +;; Auto completion +(use-package company +  :ensure t +  :config +  (setq company-idle-delay 0) +  (setq company-minimum-prefix-length 2) +  (global-company-mode t) +) + +; Parentheses +(use-package highlight-parentheses +  :ensure t +  :config +  (progn +    (highlight-parentheses-mode) +    (global-highlight-parentheses-mode)) +  ) +``` + +### Using the R console + +To start an R console session, press **M-x R** and hit **Enter** (**M** is the Emacs way to denote the **Alt** or **Command** key). ESS will ask you to nominate a working directory, which defaults to the folder of the current buffer. You can use more than one console in the same Emacs session by repeating the R command. + +Emacs opens a new buffer for your new R console. You can also use the **Up** and **Down** arrow keys to go to previous lines and re-run them. Use the **Ctrl** and **Up/Down** arrow keys to recycle old commands. + +The Company ("complete anything") package manages autocompletion in both the console and R scripts. When entering a function, the mini-buffer at the bottom of the screen shows the relevant parameters. When the autocompletion dropdown menu appears, you can press **F1** to view the chosen option's Help file before you select it. + +The [highlight-parentheses][9] package does what its name suggests. Several other Emacs packages are available to help you balance parentheses and other structural elements in your code. + +### Writing R scripts + +Emacs recognizes R mode for any buffer with a **.R** extension (the file extension is case-sensitive). Open or create a new file with the **C-x C-f** shortcut and type the path and file name. You can start writing your code and use all of the powerful editing techniques that Emacs provides. + +Several functions are available to evaluate the code. You can evaluate each line separately with **C-<return>**, while **C-c C-c** will evaluate a contiguous region. Keying **C-c C-b** will evaluate the whole buffer. + +When you evaluate some code, Emacs will use any running console or ask you to open a new console to run the code. + +The output of any plotting functions appears in a window outside of Emacs. If you prefer to view the output within Emacs, then you need to save the output to disk and open the resulting file in a separate buffer. + +![Literate programming in Org mode, the ESS buffer, and graphics output.][12] + +Literate programming in Org mode, the ESS buffer, and graphics output. + +### Advanced use + +This article provides a brief introduction to using R in Emacs. Many parameters can be fine-tuned to make Emacs behave according to your preferences, but it would take too much space to cover them here. The [ESS manual][13] describes these in detail. You can also extend functionality with additional packages. + +Org mode can integrate R code, providing a productive platform for literate programming. If you prefer to use RMarkdown, the [Polymode][14] package has you covered. + +Emacs has various packages to make your editing experience more efficient. The best part of using Emacs to write R code is that the program is more than just an IDE; it is a malleable computer system that you can configure to match your favorite workflow. + +Learning how to configure Emacs can be daunting. The best way to learn quickly is to copy ideas from people who share their configurations. Miles McBain manages a [list of Emacs configurations][15] that could be useful if you want to explore using the R language in Emacs further. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/r-emacs-data-science + +作者:[Peter Prevos][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/danderzei +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://hbr.org/2012/10/data-scientist-the-sexiest-job-of-the-21st-century +[3]: https://www.python.org/ +[4]: https://www.r-project.org/ +[5]: https://ess.r-project.org/ +[6]: https://opensource.com/article/18/2/getting-started-RStudio-IDE +[7]: https://opensource.com/article/20/3/getting-started-emacs +[8]: https://company-mode.github.io/ +[9]: https://github.com/tsdh/highlight-parentheses.el +[10]: https://en.wikipedia.org/wiki/Emacs_Lisp +[11]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html +[12]: https://opensource.com/sites/default/files/uploads/r-ess-screenshot.jpg (Literate programming in Org mode, the ESS buffer, and graphics output.) +[13]: https://ess.r-project.org/index.php?Section=documentation&subSection=manuals +[14]: https://github.com/polymode/polymode +[15]: https://github.com/MilesMcBain/esscss From bbb7192034188dc2b21697981518e40fc3701d04 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 May 2020 08:22:48 +0800 Subject: [PATCH 1972/3057] Rename sources/tech/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md to sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md --- ...scape 1.0 is Finally Here With Tons of Feature Improvements.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md (100%) diff --git a/sources/tech/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md b/sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md similarity index 100% rename from sources/tech/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md rename to sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md From 1a966c068ded416f55cdfc4bd145d11dcfb4cf5f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 May 2020 08:25:33 +0800 Subject: [PATCH 1973/3057] Rename sources/tech/20200505 11 DevOps lessons from My Little Pony.md to sources/talk/20200505 11 DevOps lessons from My Little Pony.md --- .../20200505 11 DevOps lessons from My Little Pony.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200505 11 DevOps lessons from My Little Pony.md (100%) diff --git a/sources/tech/20200505 11 DevOps lessons from My Little Pony.md b/sources/talk/20200505 11 DevOps lessons from My Little Pony.md similarity index 100% rename from sources/tech/20200505 11 DevOps lessons from My Little Pony.md rename to sources/talk/20200505 11 DevOps lessons from My Little Pony.md From 40bb59f0f21f43ea281031b80bc42dc2edffc89c Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 6 May 2020 08:35:34 +0800 Subject: [PATCH 1974/3057] translated --- ...and Folders on Desktop Screen in Ubuntu.md | 100 ------------------ ...and Folders on Desktop Screen in Ubuntu.md | 100 ++++++++++++++++++ 2 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 sources/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md create mode 100644 translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md diff --git a/sources/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md b/sources/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md deleted file mode 100644 index 32eeaa9c95..0000000000 --- a/sources/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md +++ /dev/null @@ -1,100 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using Files and Folders on Desktop Screen in Ubuntu) -[#]: via: (https://itsfoss.com/add-files-on-desktop-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Using Files and Folders on Desktop Screen in Ubuntu -====== - -_**This beginner tutorial discusses a few difficulties you may face while adding files and folders on the desktop screen on Ubuntu.**_ - -I know a few people who are habitual of putting all the important/frequently used files on the desktop screen for quick access. - -![][1] - -I am not a fan of a cluttered desktop screen but I can imagine that it might actually be helpful to some people. - -For the past few releases, it has been difficult to add files on the desktop screen in Ubuntu’s default GNOME desktop. It’s not really Ubuntu’s fault. - -The [GNOME][2] developers thinks that there is no place for icons and files on the desktop screen. There is no need of putting files on the desktop when you can easily search for it in the menu. And that’s part true. - -This is why the newer version of [GNOME’s File Manager Nautilus][3] doesn’t support icons and files on the desktop very well. - -That said, it’s not impossible to add files and folders on the desktop. Let me show you how you can still use it. - -### Adding files and folders on the desktop screen in Ubuntu - -![][4] - -I am using Ubuntu 20.04 in this tutorial. The steps may or may not vary for other Ubuntu versions. - -#### Add the files and folders to the “Desktop folder” - -If you open the file manager, you should see an entry called Desktop in the left sidebar or in the folders list. This folder represents your desktop screen (in a way). - -![Desktop folder can be used to add files to the desktop screen][5] - -Anything you add to this folder will be reflected on the desktop screen. - -![Anything added to the Desktop folder will be reflected on the desktop screen][6] - -If you delete files from this ‘Desktop folder’, it will be removed from the desktop screen as well. - -#### Drag and drop files to desktop screen doesn’t work - -Now, if you try to drag and drop files from the file manager on the desktop, it won’t work. It’s not a bug, it’s a feature that irks a lot of people. - -A workaround would be to open two instances of the file manager. Open Desktop folder in one of them and then drag and drop files to this folder and they will be added on the desktop. - -I know that’s not ideal but you don’t have a lot of choices here. - -#### You cannot use Ctrl+C and Ctrl+V to copy-paste on the desktop, use the right click menu - -To add salt to injury, you cannot use Ctrl+V the famous keyboard shortcut to paste files on the desktop screen. - -But you can still use the right click context menu and select Paste from there to put the copied files on the desktop. You can even create new folders this way. - -![Right click menu can be used for copy-pasting files to desktop][7] - -Does it make sense? Not to me but that’s how it is in Ubuntu 20.04. - -#### You cannot delete files and folder using the Delete key, use the right click menu again - -What’s worse is that you cannot use the delete key or shift delete key to remove files from the desktop screen. But you can still right click on the files or folders and select “Move to trash” to delete the file. - -![Delete files from desktop using right click][8] - -Alright, so now you know that at least there is a way to add files on the desktop with some restrictions. But it doesn’t end here unfortunately. - -You cannot search for files with their names on the desktop screen. Normally, if you start typing ‘abc’, files starting with ‘abc’ are highlighted. You don’t get it here. - -I don’t know why so many restrictions have been put on adding files on the desktop. Thankfully, I don’t use it a lot otherwise I have been way too frustrated. - -If interested, you may read about [adding application shortcut on the desktop in Ubuntu][9] as well. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/add-files-on-desktop-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://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/files-on-desktop-ubuntu.jpg?ssl=1 -[2]: https://www.gnome.org/ -[3]: https://wiki.gnome.org/Apps/Files -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-files-desktop-ubuntu.png?ssl=1 -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/desktop-folder-ubuntu.png?ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-files-desktop-screen-ubuntu.jpg?ssl=1 -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-new-files-ubuntu-desktop.jpg?ssl=1 -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/delete-files-from-desktop-ubuntu.jpg?ssl=1 -[9]: https://itsfoss.com/ubuntu-desktop-shortcut/ diff --git a/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md b/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md new file mode 100644 index 0000000000..984bb4dedb --- /dev/null +++ b/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Files and Folders on Desktop Screen in Ubuntu) +[#]: via: (https://itsfoss.com/add-files-on-desktop-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Ubuntu 桌面中使用文件和文件夹 +====== + +_**此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可能遇到的一些困难。**_ + +我认识一些习惯将所有重要/常用文件放在桌面上以便快速访问的人。 + +![][1] + +我不喜欢杂乱的桌面,但是我可以想象它实际上可能对某些人有所帮助。 + +在过去的几个版本中,很难在 Ubuntu 的默认 GNOME 桌面上添加文件。这并不是 Ubuntu 的错。 + +[GNOME][2] 的开发者认为,桌面上没有图标和文件的位置。当你可以在菜单中轻松搜索文件时,无需将文件放在桌面上。这部分是事实。 + +这就是为什么 [GNOME 的文件管理器 Nautilus][3]的较新版本不能很好地支持桌面上的图标和文件的原因。 + +也就是说,在桌面上添加文件和文件夹并非没有可能。让我告诉你如何做。 + +### 在 Ubuntu 的桌面上添加文件和文件夹 + +![][4] + +我在本教程中使用的是 Ubuntu 20.04。对于其他 Ubuntu 版本,步骤可能会有所不同。 + +#### 将文件和文件夹添加到“桌面文件夹” + +如果打开文件管理器,你应该在左侧边栏或文件夹列表中看到一个名为“桌面”的条目。此文件夹(以某种方式)代表你的桌面。 + +![Desktop folder can be used to add files to the desktop screen][5] + +你添加到此文件夹的所有内容都会反应在桌面上。 + +![Anything added to the Desktop folder will be reflected on the desktop screen][6] + +如果你从“桌面文件夹”中删除文件,那么文件也会从桌面中删除。 + +#### 将文件拖放到桌面不起作用 + +现在,如果你尝试在桌面上从文件管理器拖放文件,它会不起使用。这不是一个 bug,它是一个使很多人恼火的功能。 + +一种临时方案是打开两个文件管理器。在其中一个打开“桌面”文件夹,然后将文件拖放到该文件夹​​中,它们将被添加到桌面上。 + +我知道这并不理想,但是你没有太多选择。 + +#### 你不能使用 Ctrl+C 和 Ctrl+V 在桌面上复制粘贴,请使用右键单击菜单 + +更恼人的是,你不能使用 Ctrl+V(著名的键盘快捷键)将文件粘贴到桌面上。 + +但是,你仍然可以使用右键单击,然后选择“粘贴”,将文件复制到桌面上。你甚至可以通过这种方式创建新文件夹。 + +![Right click menu can be used for copy-pasting files to desktop][7] + +是否有意义?对我来说不是,但这就是 Ubuntu 20.04 的方式。 + +#### 你无法使用 Delete 键删除文件和文件夹,请再次使用右键菜单 + +更糟糕的是,你无法使用 Delete 键或 Shift+Delete 键从桌面上删除文件。但是你仍然可以右键单击文件或文件夹,然后选择“移至回收站”来删除文件。 + +![Delete files from desktop using right click][8] + +好了,你现在知道至少有一种方法可以在桌面上添加文件,但有一些限制。不幸的是,这还没有结束。 + +你无法在桌面上用名称搜索文件。通常,如果你开始输入 “abc”,那么以 “abc” 开头的文件会高亮显示。你并不明白。 + +我不知道为什么在桌面上添加文件受到了如此多的限制。值得庆幸的是,我不会经常使用它,否则我会感到非常沮丧。 + +如果有兴趣,你也可以阅读[在 Ubuntu 桌面上添加应用快捷方式][9]这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/add-files-on-desktop-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/files-on-desktop-ubuntu.jpg?ssl=1 +[2]: https://www.gnome.org/ +[3]: https://wiki.gnome.org/Apps/Files +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-files-desktop-ubuntu.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/desktop-folder-ubuntu.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-files-desktop-screen-ubuntu.jpg?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-new-files-ubuntu-desktop.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/delete-files-from-desktop-ubuntu.jpg?ssl=1 +[9]: https://itsfoss.com/ubuntu-desktop-shortcut/ From bc09a3b5a8ce1d3a1e221f6f9dc6e8af9b04238f Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 6 May 2020 08:39:07 +0800 Subject: [PATCH 1975/3057] translating --- .../20200501 Using mergerfs to increase your virtual storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200501 Using mergerfs to increase your virtual storage.md b/sources/tech/20200501 Using mergerfs to increase your virtual storage.md index 06f26abf51..734af93148 100644 --- a/sources/tech/20200501 Using mergerfs to increase your virtual storage.md +++ b/sources/tech/20200501 Using mergerfs to increase your virtual storage.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From bfd297b16f67a07453d9db0fe6f0e15755626336 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 May 2020 08:39:28 +0800 Subject: [PATCH 1976/3057] APL --- ...ape 1.0 is Finally Here With Tons of Feature Improvements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md b/sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md index b036d7a56a..feb249b973 100644 --- a/sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md +++ b/sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8cfbdd4cb35e28c472c41ee509314be828b5048a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 May 2020 09:41:33 +0800 Subject: [PATCH 1977/3057] TSL&PRF --- ... Here With Tons of Feature Improvements.md | 115 ------------------ ... Here With Tons of Feature Improvements.md | 115 ++++++++++++++++++ 2 files changed, 115 insertions(+), 115 deletions(-) delete mode 100644 sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md create mode 100644 translated/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md diff --git a/sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md b/sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md deleted file mode 100644 index feb249b973..0000000000 --- a/sources/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md +++ /dev/null @@ -1,115 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements) -[#]: via: (https://itsfoss.com/inkscape-1-release/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements -====== - -Even though I’m not an expert, it is safe to say that Inkscape is one of the [best vector graphics editors][1]. - -Not just limited to the reason that it is free and open-source software – but it is indeed a useful application for digital artists creating something on it. - -The last release (version 0.92) was about 3 years ago. And, now, finally, [Inkscape announced its 1.0 release][2] – with a bunch of new features, additions, and improvements. - -### Inkscape 1.0: What’s New? - -![Inkscape 1.0][3] - -Here, let me highlight the important key changes that you need to know about Inkscape 1.0 release: - -#### First native macOS application - -It’s always good to have a proper cross-platform support for amazing tools like Inkscape. And, with the latest release, a native macOS application has been made available as well. - -Do note that the macOS app is still a **preview** version and has room for a lot of improvements. However, with a better system integration without needing [XQuartz][4], it should be a promising progress for macOS users. - -#### Performance Improvements - -Any kind of application/tool benefits from a significant performance boost. And, so does Inkscape. - -With its 1.0 release, they mention that you will be able to notice the smoother performance when using Inkscape for all the creative work you do. - -Except on macOS (which is still a “preview” version), Inkscape should run just fine on Linux and Windows. - -#### Improved UI and HiDPI Support - -![][5] - -In their release notes, they’ve mentioned: - -> A major milestone was achieved in enabling Inkscape to use a more recent version of the software used to build the editor’s user interface (namely GTK+3). Users with HiDPI (high resolution) screens can thank teamwork that took place during the 2018 Boston Hackfest for setting the updated-GTK wheels in motion. - -So, starting from GTK +3 user interface to the HiDPI support for high-resolution screens, it is a wonderful upgrade. - -Not to forget, you get more customization options to tweak the look and feel as well. - -#### New Feature Additions - -![][6] - -On paper, the list of new features sounds good. Depending on your expertise and what you prefer, the latest additions should come in handy. - -Here’s an overview of the new features: - - * New and improved Live Path Effect (LPE) features - * A new searchable LPE selection dialog - * Freestyle drawing users can now mirror and rotate the canvas - * The new PowerPencil mode of the Pencil tool provides pressure-dependent width and it is finally possible to create closed paths. - * New path effects that will appeal to the artistic user include Offset, PowerClip, and PowerMask LPEs. - * Ability to create a duplicate guide, aligning grids to the page, the Measure tool’s path length indicator, and the inverted Y-axis. - * Ability to export PDFs with clickable links and metadata - * New palettes and mesh gradients that work in the web browser - - - -While I’ve tried to compile the list of the key features added to this release, you can get all the nitty gritty details in their [release notes][7]. - -#### Other Important Changes - -Along with all the major changes, Inkscape 1.0 now supports Python 3. And, with that going forward, you might notice some extensions that don’t work with the latest version. - -So, if your work depends on the workflow of your extensions, I suggest you to take a closer look at their [release notes][7] to get all the technical details. - -### Download & Install Inkscape 1.0 on Linux - -Inkscape 1.0 is available in AppImage and Snap format for Linux. You can download it from Inkscape’s website. - -[Download Inkscape 1.0 for Linux][8] - -If you aren’t aware, you can check [how to use AppImage file on Linux][9] to get started. You may also refer to [this Snap guide][10]. - -Ubuntu users can find the snap version of Inskcape 1.0 in the Ubuntu Software Center. - -I used the AppImage file on [Pop OS 20.04][11] and it worked just fine to get started. You can test drive all the features in detail to see how it works out for you. - -Have you tried it yet? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/inkscape-1-release/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/vector-graphics-editors-linux/ -[2]: https://inkscape.org/news/2020/05/04/introducing-inkscape-10/ -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-1-0.jpg?ssl=1 -[4]: https://en.wikipedia.org/wiki/XQuartz -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-ui-customization.jpg?ssl=1 -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-live-path-effects.jpg?ssl=1 -[7]: https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0 -[8]: https://inkscape.org/release/1.0/gnulinux/ -[9]: https://itsfoss.com/use-appimage-linux/ -[10]: https://itsfoss.com/install-snap-linux/ -[11]: https://itsfoss.com/pop-os-20-04-review/ diff --git a/translated/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md b/translated/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md new file mode 100644 index 0000000000..06c61b776b --- /dev/null +++ b/translated/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements) +[#]: via: (https://itsfoss.com/inkscape-1-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +经过了 3 年,Inkscape 1.0 终于发布了 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/06/094055fvnh9nnnbybwl4jn.jpg) + +虽然我不是这方面的专业人员,但可以肯定地说,Inkscape 是[最好的矢量图形编辑器][1]之一。 + +不仅仅因为它是自由开源软件,而且对于数字艺术家来说,它是一个非常有用的应用程序。 + +上一次发布(0.92 版本)是在 3 年前。现在,终于,[Inkscape 宣布了它的 1.0 版本][2] —— 增加了很多新的功能和改进。 + +### Inkscape 1.0 里的新东西 + +![Inkscape 1.0][3] + +在这里,让我重点介绍一下 Inkscape 1.0 版本中重要关键变化。 + +#### 首个原生 macOS 应用 + +对于像 Inkscape 这样的神奇工具来说,适当的跨平台支持总是好的。在这个最新的版本中,它推出了原生的 macOS 应用。 + +请注意,这个 macOS 应用仍然是一个**预览版**,还有很多改进的空间。不过,在无需 [XQuartz][4] 的情况下就做到了更好的系统集成,对于 macOS 用户来说,应该是一个值得期许的进步。 + +#### 性能提升 + +不管是什么应用程序/工具,都会从显著的性能提升中受益,而 Inkscape 也是如此。 + +随着其 1.0 版本的发布,他们提到,当你使用 Inkscape 进行各种创意工作时,你会发现性能更加流畅。 + +除了在 macOS 上(仍为“预览版”),Inkscape 在 Linux 和 Windows 上的运行都是很好的。 + +#### 改进的 UI 和 HiDPI 支持 + +![][5] + +他们在发布说明中提到: + +> ……达成了一个重要的里程碑,使 Inkscape 能够使用最新的软件(即 GTK+3)来构建编辑器的用户界面。拥有 HiDPI(高分辨率)屏幕的用户要感谢 2018 年波士顿黑客节期间的团队合作,让更新后的 GTK 轮子开始运转起来。 + +从 GTK+3 的用户界面到高分辨率屏幕的 HiDPI 支持,这都是一次精彩的升级。 + +更不要忘了,你还可以获得更多的自定义选项来调整外观和感受。 + +#### 新增功能 + +![][6] + +即便是从纸面上看,这些列出新功能都看起来不错。根据你的专业知识和你的喜好,这些新增功能应该会派上用场。 + +以下是新功能的概述: + + * 新改进过的实时路径效果(LPE)功能。 + * 新的可搜索的 LPE 选择对话框。 + * 自由式绘图用户现在可以对画布进行镜像和旋转。 + * 铅笔工具的新的 PowerPencil 模式提供了压感的宽度,并且终于可以创建封闭路径了。 + * 包括偏移、PowerClip 和 PowerMask LPE 在内的新路径效果会吸引艺术类用户。 + * 能够创建复制引导、将网格对齐到页面上、测量工具的路径长度指示器和反向 Y 轴。 + * 能够导出带有可点击链接和元数据的 PDF 文件。 + * 新的调色板和网状渐变,可在网页浏览器中使用。 + +虽然我已经尝试着整理了这个版本中添加的关键功能列表,但你可以在他们的[发布说明][7]中获得全部细节。 + +#### 其他重要变化 + +作为重大变化之一,Inkscape 1.0 现在支持 Python 3。而且,随着这一变化,你可能会注意到一些扩展程序无法在最新版本中工作。 + +所以,如果你的工作依赖于某个扩展程序的工作流程,我建议你仔细看看他们的[发布说明][7],了解所有的技术细节。 + +### 在 Linux 上下载和安装 Inkscape 1.0 + +Inkscape 1.0 有用于 Linux 的 AppImage 和 Snap 软件包,你可以从 Inkscape 的网站上下载。 + +- [下载 Inkscape 1.0 for Linux][8] + +如果你还不知道,可以查看[如何在 Linux 上使用 AppImage 文件][9]来入门。你也可以参考[这个 Snap 指南][10]。 + +Ubuntu 用户可以在 Ubuntu 软件中心找到 Inskcape 1.0 的 Snap 版本。 + +我在 [Pop!_OS 20.04][11] 上使用了 AppImage 文件,工作的很好。你可以详细体验所有的功能,看看它的效果如何。 + +你试过了吗?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/inkscape-1-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/vector-graphics-editors-linux/ +[2]: https://inkscape.org/news/2020/05/04/introducing-inkscape-10/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-1-0.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/XQuartz +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-ui-customization.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-live-path-effects.jpg?ssl=1 +[7]: https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0 +[8]: https://inkscape.org/release/1.0/gnulinux/ +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://itsfoss.com/install-snap-linux/ +[11]: https://itsfoss.com/pop-os-20-04-review/ From cf259313357b80fa60fc812766ac71fb373810c9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 May 2020 09:48:22 +0800 Subject: [PATCH 1978/3057] PUB @wxy https://linux.cn/article-12188-1.html --- ...e 1.0 is Finally Here With Tons of Feature Improvements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md (98%) diff --git a/translated/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md b/published/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md similarity index 98% rename from translated/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md rename to published/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md index 06c61b776b..fcf6c3b3ca 100644 --- a/translated/news/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md +++ b/published/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12188-1.html) [#]: subject: (After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements) [#]: via: (https://itsfoss.com/inkscape-1-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From a6da4f7e618643ce6beb0c799a33028d7b403c0f Mon Sep 17 00:00:00 2001 From: messon007 <306809057@qq.com> Date: Wed, 6 May 2020 21:38:22 +0800 Subject: [PATCH 1979/3057] Almost done --- ... Create a SDN on Linux with open source.md | 64 +++++++++++++------ 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/sources/tech/20200417 Create a SDN on Linux with open source.md b/sources/tech/20200417 Create a SDN on Linux with open source.md index 5e69bb4db6..fe22d47bbe 100644 --- a/sources/tech/20200417 Create a SDN on Linux with open source.md +++ b/sources/tech/20200417 Create a SDN on Linux with open source.md @@ -7,27 +7,33 @@ [#]: via: (https://opensource.com/article/20/4/quagga-linux) [#]: author: (M Umer https://opensource.com/users/noisybotnet) -Create a SDN on Linux with open source +Create a SDN on Linux with open source 在Linux上使用开源代码创建SDN ====== -Make your Linux system act like a router with the open source routing -stack Quagga. +Make your Linux system act like a router with the open source routing stack Quagga. +使用开源路由协议栈Quagga,使您的Linux系统成为一台路由器。 ![Coding on a computer][1] Network routing protocols fall into two main categories: interior gateway protocols and exterior gateway protocols. Interior gateway protocols are used by routers to share information within a single autonomous system. If you are running Linux, you can make your system behave as a router through the open source (GPLv2) routing stack [Quagga][2]. +网络路由协议分为两大类:内部网关协议和外部网关协议。路由器使用内部网关协议在单个自治系统内共享信息。如果您用的是Linux,则可以通过开源(GPLv2)路由协议栈[Quagga][2]使其表现得像一台路由器。 -### What is Quagga? +### What is Quagga? 什么是Quagga? Quagga is a [routing software suite][3] and a fork of [GNU Zebra][4]. It provides implementations of all major routing protocols such as Open Shortest Path First (OSPF), Routing Information Protocol (RIP), Border Gateway Protocol (BGP), and Intermediate System to Intermediate System (IS-IS) for Unix-like platforms. Although Quagga implements the routing protocols for both IPv4 and IPv6, it doesn't act as a complete router. A true router not only implements all the routing protocols but also has the ability to forward network traffic. Quagga only implements the routing stack, and the job of forwarding network traffic is handled by the Linux kernel. -### Architecture +Quagga是[路由软件包][3],并且是[GNU Zebra][4]的一个分支。它为类Unix平台提供了所有主流路由协议的实现,例如开放最短路径优先(OSPF),路由信息协议(RIP),边界网关协议(BGP)和中间系统到中间系统协议(IS-IS)。 + +尽管Quagga为IPv4和IPv6都实现了路由协议,但它却不是一个完整的路由器。真正的路由器不仅实现了所有路由协议,而且还有转发网络流量的能力。 Quagga仅仅实现了路由协议栈,而转发网络流量的工作由Linux内核处理。 + +### Architecture 架构 Quagga implements the different routing protocols through protocol-specific daemons. The daemon name is the same as the routing protocol followed by the letter "d." Zebra is the core and a protocol-independent daemon that provides an [abstraction layer][5] to the kernel and presents the Zserv API over TCP sockets to Quagga clients. Each protocol-specific daemon is responsible for running the relevant protocol and building the routing table based on the information exchanged. +Quagga通过协议特定的守护程序实现不同的路由协议。守护程序名称与路由协议相同,加了字母“d”作为后缀。Zebra是核心的协议无关的守护进程,它为内核提供了一个[抽象层][5],并通过TCP套接字向Quagga客户端提供Zserv API。每个协议特定的守护程序负责运行相关的协议并基于交换的信息来建立路由表。 ![Quagga architecture][6] -### Setup +### Setup 环境 This tutorial implements the OSPF protocol to configure dynamic routing using Quagga. The setup includes two CentOS 7.7 hosts, named Alpha and Beta. Both hosts share access to the **192.168.122.0/24** network. @@ -41,26 +47,38 @@ Gateway: 192.168.122.1 IP: 192.168.122.50/24 Gateway: 192.168.122.1 -### Install the package +本教程通过Quagga实现的OSPF协议来配置动态路由。该环境包括两个名为Alpha和Beta的CentOS 7.7主机。两台主机共享访问 **192.168.122.0/24** 网络。 + +**主机Alpha** + +IP:192.168.122.100/24 +网关:192.168.122.1 + +**主机Beta** + +IP:192.168.122.50/24 +网关:192.168.122.1 + +### Install the package 安装软件包 First, install the Quagga package on both hosts. It is available in the CentOS base repo: - +首先,在两台主机上安装Quagga软件包。它存在于CentOS基础仓库中: ``` `yum install quagga -y` ``` -### Enable IP forwarding +### Enable IP forwarding 使能IP转发 Next, enable IP forwarding on both hosts since that will performed by the Linux kernel: - +接下来,在两台主机上使能IP转发,因为它将由Linux内核来执行: ``` sysctl -w net.ipv4.ip_forward = 1 sysctl -p ``` -### Configuration +### Configuration 配置 Now, go into the **/etc/quagga** directory and create the configuration files for your setup. You need three files: @@ -71,7 +89,14 @@ Now, go into the **/etc/quagga** directory and create the configuration files fo On host Alpha, +现在,进入 **/etc/quagga** 目录并为您的设置创建配置文件。您需要三个文件: + * **zebra.conf**:Quagga的守护程序配置文件,您可以在其中定义接口及其IP地址和IP转发 + * **ospfd.conf**:协议配置文件,您可以在其中定义将通过OSPF协议提供的网络 + * **守护程序**:您将在其中指定需要运行的相关的协议守护程序 + + +在主机Alpha上, ```  [root@alpha]# cat /etc/quagga/zebra.conf @@ -100,7 +125,7 @@ ospfd=yes ``` On host Beta, - +在主机Beta上, ``` [root@beta quagga]# cat zebra.conf @@ -128,10 +153,10 @@ zebra=yes ospfd=yes ``` -### Configure the firewall +### Configure the firewall 配置防火墙 To use the OSPF protocol, you must allow it in the firewall: - +要使用OSPF协议,必须允许它通过防火墙: ``` firewall-cmd --add-protocol=ospf –permanent @@ -140,7 +165,7 @@ firewall-cmd –reload ``` Now, start the zebra and ospfd daemons. - +现在,启动zebra和ospfd守护程序。 ``` # systemctl start zebra @@ -148,7 +173,7 @@ Now, start the zebra and ospfd daemons. ``` Look at the route table on both hosts using: - +用下面命令在两个主机上查看路由表: ``` [root@alpha ~]# ip route show   @@ -159,7 +184,7 @@ default via 192.168.122.1 dev eth0 proto static metric 100 ``` You can see that the routing table on Alpha contains an entry of **10.10.10.0/24** via **192.168.122.50** offered through protocol **zebra**. Similarly, on host Beta, the table contains an entry of network **10.12.13.0/24** via **192.168.122.100**. - +您可以看到Alpha上的路由表包含通过 **192.168.122.50** 到达 **10.10.10.0/24** 的条目,它是通过协议 **zebra** 获取的。同样,在主机Beta上,该表包含通过 **192.168.122.100** 到达网络 **10.12.13.0/24** 的条目。 ``` [root@beta ~]# ip route show @@ -169,9 +194,10 @@ default via 192.168.122.1 dev eth0 proto static metric 100 192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.50 metric 100 ``` -### Conclusion +### Conclusion 结论 As you can see, the setup and configuration are relatively simple. To add complexity, you can add more network interfaces to the router to provide routing for more networks. You can also implement BGP and RIP protocols using the same method. +如您所见,环境和配置相对简单。要增加复杂性,您可以向路由器添加更多网络接口,以为更多网络提供路由。您也可以使用相同的方法来实现BGP和RIP协议。 -------------------------------------------------------------------------------- @@ -179,7 +205,7 @@ via: https://opensource.com/article/20/4/quagga-linux 作者:[M Umer][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[messon007](https://github.com/messon007) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a22332810e4218e601d4230ae509484e6b067768 Mon Sep 17 00:00:00 2001 From: messon007 <306809057@qq.com> Date: Wed, 6 May 2020 21:41:09 +0800 Subject: [PATCH 1980/3057] translated --- ... Create a SDN on Linux with open source.md | 54 ++++--------------- 1 file changed, 9 insertions(+), 45 deletions(-) rename {sources => translated}/tech/20200417 Create a SDN on Linux with open source.md (62%) diff --git a/sources/tech/20200417 Create a SDN on Linux with open source.md b/translated/tech/20200417 Create a SDN on Linux with open source.md similarity index 62% rename from sources/tech/20200417 Create a SDN on Linux with open source.md rename to translated/tech/20200417 Create a SDN on Linux with open source.md index fe22d47bbe..97272e9f2d 100644 --- a/sources/tech/20200417 Create a SDN on Linux with open source.md +++ b/translated/tech/20200417 Create a SDN on Linux with open source.md @@ -7,45 +7,26 @@ [#]: via: (https://opensource.com/article/20/4/quagga-linux) [#]: author: (M Umer https://opensource.com/users/noisybotnet) -Create a SDN on Linux with open source 在Linux上使用开源代码创建SDN +在Linux上使用开源代码创建SDN ====== -Make your Linux system act like a router with the open source routing stack Quagga. 使用开源路由协议栈Quagga,使您的Linux系统成为一台路由器。 ![Coding on a computer][1] -Network routing protocols fall into two main categories: interior gateway protocols and exterior gateway protocols. Interior gateway protocols are used by routers to share information within a single autonomous system. If you are running Linux, you can make your system behave as a router through the open source (GPLv2) routing stack [Quagga][2]. 网络路由协议分为两大类:内部网关协议和外部网关协议。路由器使用内部网关协议在单个自治系统内共享信息。如果您用的是Linux,则可以通过开源(GPLv2)路由协议栈[Quagga][2]使其表现得像一台路由器。 -### What is Quagga? 什么是Quagga? - -Quagga is a [routing software suite][3] and a fork of [GNU Zebra][4]. It provides implementations of all major routing protocols such as Open Shortest Path First (OSPF), Routing Information Protocol (RIP), Border Gateway Protocol (BGP), and Intermediate System to Intermediate System (IS-IS) for Unix-like platforms. - -Although Quagga implements the routing protocols for both IPv4 and IPv6, it doesn't act as a complete router. A true router not only implements all the routing protocols but also has the ability to forward network traffic. Quagga only implements the routing stack, and the job of forwarding network traffic is handled by the Linux kernel. +### Quagga是什么? Quagga是[路由软件包][3],并且是[GNU Zebra][4]的一个分支。它为类Unix平台提供了所有主流路由协议的实现,例如开放最短路径优先(OSPF),路由信息协议(RIP),边界网关协议(BGP)和中间系统到中间系统协议(IS-IS)。 尽管Quagga为IPv4和IPv6都实现了路由协议,但它却不是一个完整的路由器。真正的路由器不仅实现了所有路由协议,而且还有转发网络流量的能力。 Quagga仅仅实现了路由协议栈,而转发网络流量的工作由Linux内核处理。 -### Architecture 架构 +### 架构 -Quagga implements the different routing protocols through protocol-specific daemons. The daemon name is the same as the routing protocol followed by the letter "d." Zebra is the core and a protocol-independent daemon that provides an [abstraction layer][5] to the kernel and presents the Zserv API over TCP sockets to Quagga clients. Each protocol-specific daemon is responsible for running the relevant protocol and building the routing table based on the information exchanged. Quagga通过协议特定的守护程序实现不同的路由协议。守护程序名称与路由协议相同,加了字母“d”作为后缀。Zebra是核心的协议无关的守护进程,它为内核提供了一个[抽象层][5],并通过TCP套接字向Quagga客户端提供Zserv API。每个协议特定的守护程序负责运行相关的协议并基于交换的信息来建立路由表。 ![Quagga architecture][6] -### Setup 环境 - -This tutorial implements the OSPF protocol to configure dynamic routing using Quagga. The setup includes two CentOS 7.7 hosts, named Alpha and Beta. Both hosts share access to the **192.168.122.0/24** network. - -**Host Alpha:** - -IP: 192.168.122.100/24 -Gateway: 192.168.122.1 - -**Host Beta:** - -IP: 192.168.122.50/24 -Gateway: 192.168.122.1 +### 环境 本教程通过Quagga实现的OSPF协议来配置动态路由。该环境包括两个名为Alpha和Beta的CentOS 7.7主机。两台主机共享访问 **192.168.122.0/24** 网络。 @@ -59,18 +40,16 @@ IP:192.168.122.100/24 IP:192.168.122.50/24 网关:192.168.122.1 -### Install the package 安装软件包 +### 安装软件包 -First, install the Quagga package on both hosts. It is available in the CentOS base repo: 首先,在两台主机上安装Quagga软件包。它存在于CentOS基础仓库中: ``` `yum install quagga -y` ``` -### Enable IP forwarding 使能IP转发 +### 使能IP转发 -Next, enable IP forwarding on both hosts since that will performed by the Linux kernel: 接下来,在两台主机上使能IP转发,因为它将由Linux内核来执行: ``` @@ -78,17 +57,8 @@ sysctl -w net.ipv4.ip_forward = 1 sysctl -p ``` -### Configuration 配置 +### 配置 -Now, go into the **/etc/quagga** directory and create the configuration files for your setup. You need three files: - - * **zebra.conf**: Quagga's daemon configuration file, which is where you'll define the interfaces and their IP addresses and IP forwarding - * **ospfd.conf**: The protocol configuration file, which is where you'll define the networks that will be offered through the OSPF protocol - * **daemons**: Where you'll specify the relevant protocol daemons that are required to run - - - -On host Alpha, 现在,进入 **/etc/quagga** 目录并为您的设置创建配置文件。您需要三个文件: * **zebra.conf**:Quagga的守护程序配置文件,您可以在其中定义接口及其IP地址和IP转发 @@ -124,7 +94,6 @@ zebra=yes ospfd=yes ``` -On host Beta, 在主机Beta上, ``` @@ -153,9 +122,8 @@ zebra=yes ospfd=yes ``` -### Configure the firewall 配置防火墙 +### 配置防火墙 -To use the OSPF protocol, you must allow it in the firewall: 要使用OSPF协议,必须允许它通过防火墙: ``` @@ -164,7 +132,6 @@ firewall-cmd --add-protocol=ospf –permanent firewall-cmd –reload ``` -Now, start the zebra and ospfd daemons. 现在,启动zebra和ospfd守护程序。 ``` @@ -172,7 +139,6 @@ Now, start the zebra and ospfd daemons. # systemctl start ospfd ``` -Look at the route table on both hosts using: 用下面命令在两个主机上查看路由表: ``` @@ -183,7 +149,6 @@ default via 192.168.122.1 dev eth0 proto static metric 100 192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.100 metric 100 ``` -You can see that the routing table on Alpha contains an entry of **10.10.10.0/24** via **192.168.122.50** offered through protocol **zebra**. Similarly, on host Beta, the table contains an entry of network **10.12.13.0/24** via **192.168.122.100**. 您可以看到Alpha上的路由表包含通过 **192.168.122.50** 到达 **10.10.10.0/24** 的条目,它是通过协议 **zebra** 获取的。同样,在主机Beta上,该表包含通过 **192.168.122.100** 到达网络 **10.12.13.0/24** 的条目。 ``` @@ -194,9 +159,8 @@ default via 192.168.122.1 dev eth0 proto static metric 100 192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.50 metric 100 ``` -### Conclusion 结论 +### 结论 -As you can see, the setup and configuration are relatively simple. To add complexity, you can add more network interfaces to the router to provide routing for more networks. You can also implement BGP and RIP protocols using the same method. 如您所见,环境和配置相对简单。要增加复杂性,您可以向路由器添加更多网络接口,以为更多网络提供路由。您也可以使用相同的方法来实现BGP和RIP协议。 -------------------------------------------------------------------------------- From 139f7f0551537cd8d82a18e33d64a17d1ae4fc02 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 May 2020 23:16:10 +0800 Subject: [PATCH 1981/3057] PRF @robsean --- ...7 How to compress files on Linux 5 ways.md | 76 +++++++++---------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/translated/tech/20200417 How to compress files on Linux 5 ways.md b/translated/tech/20200417 How to compress files on Linux 5 ways.md index e9ef6af572..e10a0bd8a4 100644 --- a/translated/tech/20200417 How to compress files on Linux 5 ways.md +++ b/translated/tech/20200417 How to compress files on Linux 5 ways.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to compress files on Linux 5 ways) @@ -9,18 +9,20 @@ 在 Linux 上压缩文件的 5 种方法 ====== -在 Linux 系统上有很多可以用于压缩文件的工具,但是它们表现的行为或产生相同程度的压缩等级并不相同,在这篇文章中,我们比较其中的五个工具。 -Getty Images -在 Linux 上有不少用于压缩文件的命令。最新最有效的一个方法是 **xz** ,但是所有的方法都有节省磁盘空间和为后期使用维护备份文件的优点。在这篇文章中,我们将比较压缩命令并指出显著的不同 。 +> 在 Linux 系统上有很多可以用于压缩文件的工具,但它们的表现并不都是一样的,也不是所有的压缩效果都是一样的。在这篇文章中,我们比较其中的五个工具。 + +![](https://img.linux.net.cn/data/attachment/album/202005/06/231536tgxma941yb8dgl53.jpg) + +在 Linux 上有不少用于压缩文件的命令。最新最有效的一个方法是 `xz`,但是所有的方法都有节省磁盘空间和维护备份文件供以后使用的优点。在这篇文章中,我们将比较这些压缩命令并指出显著的不同。 ### tar -tar 命令不是专门的压缩命令。它通常用于将多个文件拉入一单个文件中,以便容易地传输到另一个系统,或者备份文件为一个相关的组。它也提供压缩作为一个功能,这是很明智的,附加的 **z** 压缩选项能够实现压缩文件。 +`tar` 命令不是专门的压缩命令。它通常用于将多个文件拉入一个单个的文件中,以便容易地传输到另一个系统,或者将文件作为一个相关的组进行备份。它也提供压缩的功能,这就很有意义了,附加一个 `z` 压缩选项能够实现压缩文件。 -当压缩过程被附加到一个使用 **z** 选项的 **tar** 命令时,tar 使用 **gzip** 来进行压缩。 +当使用 `z` 选项为 `tar` 命令附加压缩过程时,`tar` 使用 `gzip` 来进行压缩。 -你可以使用 **tar** 来压缩一个单个文件,就像压缩一个组一样容易,尽管这种操作与直接使用 **gzip** 相比没有特别的优势。为此,要使用 **tar** ,只需要使用一个 “tar cfz newtarfile filename” 命令来像你标识一个组一样标识文件,像这样: +就像压缩一组文件一样,你可以使用 `tar` 来压缩单个文件,尽管这种操作与直接使用 `gzip` 相比没有特别的优势。要使用 `tar` 这样做,只需要使用 `tar cfz newtarfile filename` 命令来标识要压缩的文件,就像标识一组文件一样,像这样: ``` $ tar cfz bigfile.tgz bigfile @@ -33,13 +35,11 @@ $ ls -l bigfile* -rw-rw-r-- 1 shs shs 21608325 Apr 16 16:08 bigfile.tgz ``` -注意,文件的大小显著减少。 +注意,文件的大小显著减少了。 -如果你喜欢,你可以使用 **tar.gz** 扩展名,这可能会使文件的特征更加明显,但是大多数的 Linux 用户将很可能会意识到与 **tgz** 的意思是相同的东西 – **tar** 和 **gz** 的组合来显示文件是一个压缩的 tar 文件。在压缩完成后,将留下原始文件和压缩文件。 +如果你愿意,你可以使用 `tar.gz` 扩展名,这可能会使文件的特征更加明显,但是大多数的 Linux 用户将很可能会意识到与 `tgz` 的意思是一样的 – `tar` 和 `gz` 的组合来显示文件是一个压缩的 tar 文件。在压缩完成后,你将同时得到原始文件和压缩文件。 -为收集很多文件在一起并在一个命令中压缩生成的 “tar ball” ,使用相同的语法,但是要指明将要被包含的文件来作为一个组,而不是单个文件。这里有一个示例: - -[][1] +要将很多文件收集在一起并在一个命令中压缩出 “tar ball”,使用相同的语法,但要指定要包含的文件为一组,而不是单个文件。这里有一个示例: ``` $ tar cfz bin.tgz bin/* @@ -50,7 +50,7 @@ $ tar cfz bin.tgz bin/* ### zip -**zip** 命令创建一个压缩文件,与此同时保留原始文件的完整性。语法像使用 **tar** 一样简单,只是你必需记住,你的原始文件名称应该是命令行上的最后一个参数。 +`zip` 命令创建一个压缩文件,与此同时保留原始文件的完整性。语法像使用 `tar` 一样简单,只是你必需记住,你的原始文件名称应该是命令行上的最后一个参数。 ``` $ zip ./bigfile.zip bigfile @@ -62,7 +62,7 @@ $ ls -l bigfile bigfile.zip ### gzip -**gzip** 命令非常容易使用。你只需要键入 "gzip" ,紧随其后的是你想要压缩的文件名称。不像上述描述的命令,**gzip** 将“就地”加密文件。换句话说,原始文件将被加密文件替换。 +`gzip` 命令非常容易使用。你只需要键入 `gzip`,紧随其后的是你想要压缩的文件名称。不像上述描述的命令,`gzip` 将“就地”加密文件。换句话说,原始文件将被加密文件替换。 ``` $ gzip bigfile @@ -72,7 +72,7 @@ $ ls -l bigfile* ### bzip2 -像使用 **gzip** 命令一样,**bzip2** 将在你选的“合适位置”压缩文件,只留下原始文件保持原样离开。 +像使用 `gzip` 命令一样,`bzip2` 将在你选择的文件“就地”压缩,不留下原始文件。 ``` $ bzip bigfile @@ -82,7 +82,7 @@ $ ls -l bigfile* ### xz -压缩命令组中的一个相对较新的成员,**xz** 就如何更好的压缩文件而言是领跑者。像先前的两个命令一样,你只需要将文件名称补给到命令中。再强调一次,原始文件被就地压缩。 +`xz` 是压缩命令团队中的一个相对较新的成员,在压缩文件的能力方面,它是一个领跑者。像先前的两个命令一样,你只需要将文件名称提供给命令。再强调一次,原始文件被就地压缩。 ``` $ xz bigfile @@ -90,17 +90,17 @@ $ ls -l bigfile* -rw-rw-r-- 1 shs shs 13427236 Apr 15 17:30 bigfile.xz ``` -对于大文件来说,你可能会注意到 **xz** 将比其它的压缩命令花费更多的运行时间,但是压缩的结果却是非常令人赞叹的。 +对于大文件来说,你可能会注意到 `xz` 将比其它的压缩命令花费更多的运行时间,但是压缩的结果却是非常令人赞叹的。 -### 考虑对比性 +### 对比 -大多数人都听说过 "文件大小不是万能的"。所以,让我们比较一下文件大小以及一些当你计划如何压缩文件时的问题。 +大多数人都听说过“大小不是一切”。所以,让我们比较一下文件大小以及一些当你计划如何压缩文件时的问题。 -下面显示的统计数据都与压缩单个文件相关,在上面显示的示例中使用 – bigfile – 。这个文件是一个大的且相当随机的文本文件。压缩率在一定程度上取决于文件的内容。 +下面显示的统计数据都与压缩单个文件相关,在上面显示的示例中使用 `bigfile`。这个文件是一个大的且相当随机的文本文件。压缩率在一定程度上取决于文件的内容。 #### 大小减缩率 -在比较期间,上面显示的各种压缩命产生下面的结果。百分比表示压缩文件对比原始文件。 +当比较时,上面显示的各种压缩命产生下面的结果。百分比表示压缩文件与原始文件的比较效果。 ``` -rw-rw-r-- 1 shs shs 103270400 Apr 16 14:01 bigfile @@ -112,15 +112,15 @@ $ ls -l bigfile* -rw-rw-r-- 1 shs shs 21606889 Apr 16 13:59 bigfile.zip ~21% ``` -**xz** 命令获胜,最终只有压缩文件大小的13%,但是这些所有的压缩命令都相当显著地减少原始文件的大小。 +`xz` 命令获胜,最终只有压缩文件 13% 的大小,但是所有这些压缩命令都相当显著地减少原始文件的大小。 #### 是否替换原始文件 -**bzip2**,**gzip** 和 **xz** 命令都将使用压缩文件替换原始文件。**tar** 和 **zip** 命令不替换。 +`bzip2`、`gzip` 和 `xz` 命令都用压缩文件替换原始文件。`tar` 和 `zip` 命令不替换。 #### 运行时间 -**xz** 命令似乎比其它命令需要花费更多的时间来加密文件。对于 bigfile 来说,近似时间是: +`xz` 命令似乎比其它命令需要花费更多的时间来加密文件。对于 `bigfile` 来说,大概的时间是: ``` 命令 运行时间 @@ -135,27 +135,25 @@ xz 50.4 秒 #### 文件权限 -不管你对压缩文件设置什么权限,压缩文件的权限将基于你的 **umask** 设置,除 **bzip2** 维持原始文件的权限外。 +不管你对压缩文件设置什么权限,压缩文件的权限将基于你的 `umask` 设置,但 `bzip2` 除外,它保留了原始文件的权限。 #### 与 Windows 的兼容性 -**zip** 命令将创建一个可被使用的文件(例如,解压缩),在 Windows 系统上以及 Linux 和其它 Unix 系统上,无需安装其它可能可用或不可用的工具。 +`zip` 命令创建的文件可以在 Windows 系统以及 Linux 和其他 Unix 系统上使用(即解压),而无需安装其他工具,无论这些工具可能是可用还是不可用的。 ### 解压缩文件 -解压缩文件的命令类似于这些压缩文件的命令。这些命令将在我们运行上述压缩命令后用于解压缩 bigfile 。 +解压文件的命令与压缩文件的命令类似。在我们运行上述压缩命令后,这些命令用于解压缩 `bigfile`: - * tar: **tar xf bigfile.tgz** - * zip: **unzip bigfile.zip** - * gzip: **gunzip bigfile.gz** - * bzip2: **bunzip2 bigfile.gz2** - * xz: **xz -d bigfile.xz** 或 **unxz bigfile.xz** + * tar: `tar xf bigfile.tgz` + * zip: `unzip bigfile.zip` + * gzip: `gunzip bigfile.gz` + * bzip2: `bunzip2 bigfile.gz2` + * xz: `xz -d bigfile.xz` 或 `unxz bigfile.xz` +### 自己运行压缩对比 - -### 对比你自己运行的压缩 - -如果你想自己运行一些测试,抓取一个大的且可以替换的文件,并使用上面显示的每个命令来压缩它 – 最好使用一个新的子目录。你可能必需先安装 **xz** ,如果你想在测试中包含它的话。这个脚本可能更容易地压缩,但是将可能花费几分钟来完成。 +如果你想自己运行一些测试,抓取一个大的且可以替换的文件,并使用上面显示的每个命令来压缩它 —— 最好使用一个新的子目录。你可能需要先安装 `xz`,如果你想在测试中包含它的话。这个脚本可能更容易地进行压缩,但是可能需要花费几分钟完成。 ``` #!/bin/bash @@ -187,16 +185,14 @@ ls -l $filename.* mv $filename-2 $filename ``` -加入 [Facebook][2] 和 [LinkedIn][3] 网络世界社区来评论那些最重要的话题。 - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3538471/how-to-compress-files-on-linux-5-ways.html 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 08728494a92d2f8e81d6106bee61679ec764b75a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 May 2020 23:16:42 +0800 Subject: [PATCH 1982/3057] PUB @robsean https://linux.cn/article-12190-1.html --- .../20200417 How to compress files on Linux 5 ways.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200417 How to compress files on Linux 5 ways.md (99%) diff --git a/translated/tech/20200417 How to compress files on Linux 5 ways.md b/published/20200417 How to compress files on Linux 5 ways.md similarity index 99% rename from translated/tech/20200417 How to compress files on Linux 5 ways.md rename to published/20200417 How to compress files on Linux 5 ways.md index e10a0bd8a4..d0cb239d11 100644 --- a/translated/tech/20200417 How to compress files on Linux 5 ways.md +++ b/published/20200417 How to compress files on Linux 5 ways.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12190-1.html) [#]: subject: (How to compress files on Linux 5 ways) [#]: via: (https://www.networkworld.com/article/3538471/how-to-compress-files-on-linux-5-ways.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 43d4e5ad70eac5daeb4d038a58b70c7ae1e58585 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Wed, 6 May 2020 23:41:46 +0800 Subject: [PATCH 1983/3057] TSL 20200505 Browse the Peer-to-peer Web With Beaker Browser --- ...he Peer-to-peer Web With Beaker Browser.md | 124 ------------------ ...he Peer-to-peer Web With Beaker Browser.md | 124 ++++++++++++++++++ 2 files changed, 124 insertions(+), 124 deletions(-) delete mode 100644 sources/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md create mode 100644 translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md diff --git a/sources/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md b/sources/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md deleted file mode 100644 index 319b8a18c5..0000000000 --- a/sources/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md +++ /dev/null @@ -1,124 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Browse the Peer-to-peer Web With Beaker Browser) -[#]: via: (https://itsfoss.com/beaker-browser/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Browse the Peer-to-peer Web With Beaker Browser -====== - -The Internet as we know it has existed unchanged (more or less) for the last 50 years. People across the globe use their devices to retrieve data from huge servers dotted around the world. - -A group of dedicated technologists wants to change that to make the internet a place where people can connect and share information directly instead of relying on a central server (decentralization). - -There are a bunch of such decentralized services that we have already covered on It’s FOSS. [LBRY as YouTube alternative][1], [Mastodon as Twitter alternative][2] are just a couple of such examples. - -And today I am going to cover another such product called [Beaker Browser][3] which is essentially for browsing the peer to peer web. - -![Beaker Browser][4] - -### What is the ‘peer-to-peer Web’? - -According to [one of the devs][5] behind the Beaker browser, “The P2P Web is an experimental set of technologies…to give users more control over the Web.” - -Further, they say that the peer-to-peer Web has three main principles: anybody can be a server; multiple computers can serve the same site; there is no back end. - -As you can see from those principles. the idea of the peer-to-peer Web is very similar to BitTorrent where files are seeded by multiple peers and those peers share the bandwidth load. This reduces the overall bandwidth that a person needs to provide for their site. - -![Beaker Browser Settings][6] - -The other major part of the peer-to-peer Web is creator control of their ideas. In this day and age, platforms being controlled by large corporations, who try to use your data for their benefit. Beaker returns control to the content creators. - -### Browsing the decentralized web with Beaker - -The [Beaker Browser][3] first came into existence in 2016. The project (and the technology that surrounds it) is created by a team of three at [Blue Link Labs][7]. The Beaker Browser uses the [Dat protocol][8] to share data between computers. All websites that use the Dat protocol start with `dat://` instead of `http://`. - -The strengths of the Dat protocol are: - - * Fast – Archives sync from multiple sources at once. - * Secure – All updates are signed and integrity-checked. - * Resilient – Archives can change hosts without changing their URLs. - * Versioned – Changes are written to an append-only version log. - * Decentralized – Any device can host any archive. - - - -![Beaker Browser Seeding][9] - -The Beaker Browser is essentially a cut down version of Chromium with built-in support for `dat://`addresses. It can still visit regular `http://` sites. - -Each time you visit a dat site, the content for that site is downloaded to your computer as you request it. For example, a picture of Linux Torvalds on the about page of a site is not downloaded until you navigate to that page. - -Also, once you visit a dat website, “[you temporarily][10] re-upload or seed whichever files you’ve downloaded from the website.” You can also choose to seed the website to help its creator. - -![Beaker Browser Menu][11] - -Since the whole idea of Beaker is to create a more open web, you can easily view the source of any website. Unlike most browsers where you just see the source code the current page, you are viewing, Beaker shows you the entire structure of the site in a GitHub-like view. You can even fork the site and host your version of it. - -Besides visiting dat-based websites, you can also create your own site. In the Beaker Browser menu, there is an option to create a new website or an empty project. If you select the option to create a new website, Beaker will build a little demo site that you can edit with the browser’s built-in editor. - -However, if you are like me and prefer to use Markdown, you can choose to create an empty project. Beaker will create the structure of a site and assign it a `dat://`address. Create an `index.md` file and you are good to go. There is a [short tutorial][12] with more info. You can also use the create empty project option to build a web app. - -![Beaker Browser Website Template][13] - -Since Beaker acts as a web server and site seeder, any time you close it or turn off your computer your site will become unavailable. Thankfully, you don’t have to run your computer or the browser constantly. You can also use a seeding service named [Hashbase][14] or you can set up a [`homebase`][15] seeding server. - -Though Beaker is [available][16] for Linux, Windows, and macOS. If you do start playing around Beaker, be sure to take a quick look at [their gui][17][d][17][es][17]. - -### Beaker Browser is not for everyone but it has a purpose - -When I first got this assignment, I had high hopes for the Beaker Browser. As it stands now, it’s still very experimental. A number of the dat sites that I tried to visit were unavailable because the user was not seeding their site. Beaker does have an option to notify you when that site is back online. - -![Beaker Browser No Peer][18] - -Another problem is that Beaker is a really stripped down version of Chromium. There is no option to install extensions or themes. Instead, you are stuck with a white theme and a very limited toolset. I would not use this as my main browser and having access to the world of dat websites is not enough of a reason to keep it installed on my system. - -I looked to see if there is an extension for Firefox that would add support for the `dat://` protocol. I did find such an extension, but it also required the installation of a couple of other pieces of software. It’s just easier to install Beaker. - -As it stands now, Beaker is not for me. Maybe in the future, more people will start using Beaker or the dat protocol will gain support by other browsers. Then it might be interesting. Right now, it’s kinda empty. - -As part of my time with Beaker, I created a [website][19] using the built-in tools. Don’t worry, I made sure that it’s seeded. - -![Beaker Bowser Site Source][20] - -What are your thoughts on the Beaker Brower? What are your thoughts on the peer-to-peer web? Please let us know in the comments below. - -If you found this article interesting, please take a minute to share it on social media, Hacker News, or [Reddit][21]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/beaker-browser/ - -作者:[John Paul][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/john/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/lbry/ -[2]: https://itsfoss.com/mastodon-open-source-alternative-twitter/ -[3]: https://beakerbrowser.com/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser.jpg?resize=800%2C426&ssl=1 -[5]: https://pfrazee.hashbase.io/blog/what-is-the-p2p-web -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-setting.jpg?resize=800%2C573&ssl=1 -[7]: https://bluelinklabs.com/ -[8]: https://www.datprotocol.com/ -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-seedding.jpg?resize=800%2C466&ssl=1 -[10]: https://beakerbrowser.com/docs/faq/ -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-menu.jpg?ssl=1 -[12]: https://beakerbrowser.com/docs/guides/create-a-markdown-site -[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-website-template.jpg?resize=800%2C459&ssl=1 -[14]: https://hashbase.io/ -[15]: https://github.com/beakerbrowser/homebase -[16]: https://beakerbrowser.com/install/ -[17]: https://beakerbrowser.com/docs/guides/ -[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-no-peer.jpg?resize=800%2C424&ssl=1 -[19]: https://41bfbd06731e8d9c5d5676e8145069c69b254e7a3b710ddda4f6e9804529690c/ -[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-source.jpg?resize=800%2C544&ssl=1 -[21]: https://reddit.com/r/linuxusersgroup diff --git a/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md b/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md new file mode 100644 index 0000000000..4a83f1435d --- /dev/null +++ b/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Browse the Peer-to-peer Web With Beaker Browser) +[#]: via: (https://itsfoss.com/beaker-browser/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +使用 Beaker 浏览器浏览 P2P Web +====== + +我们所认识的因特网在过去 50 年中变化不大。全球的网民使用它们的设备从遍布在世界各地的服务器上检索数据。 + +一群专业的技术专家想改变现状,使互联网变成人们可以连接和直接分享信息的地方,而不是依赖一个中心服务器(去中心化)。 + +我们已经在 It’s FOSS 讨论过很多这样的去中心化的服务。[YouTube 竞品:LBRY][1],[Twitter竞品:Mastodon][2] 是其中的两个例子。 + +今天我将要介绍另一个这样的产品,名为 [Beaker 浏览器][3],它的设计目标是浏览 P2P web 数据。 + +![Beaker Browser][4] + +### ’peer-to-peer Web‘ 是什么? + +根据 Beaker 浏览器的[开发者之一][5]的描述,”P2P Web 是一项实验性的技术...提高我们掌控 Web 的能力。“ + +还有,它们说 P2P Web 有三个主要原则:任何一点都可以成为服务器;多台计算机可以为同一个网站提供服务;没有后端。 + +从这些原则中你可以看出,P2P Web 的思想与 BitTorrent 很像,多个点把文件作为种子,这些点共享带宽负载。这减少了一个用户需要提供给他的网站的总带宽。 + +![Beaker Browser Settings][6] + +P2P Web 另一个重要的方面是创作者对于他们自己的想法的控制能力。当今年代,平台都是由庞大的组织控制的,往往拿你的数据为他们所用。Beaker 把数据的控制能力返还给了内容创造者。 + +### 使用 Beaker 浏览去中心化的 web + +[Beaker 浏览器][3] 是在 2016 年被创建的。该项目(及其周边技术)由[蓝链实验室][7]的三人团队创建。Beaker 浏览器使用 [Dat 协议][8]在计算机之间共享数据。使用 Dat 协议的网站以 `dat://` 而不是 `http://` 开头。 + +Dat 协议的优势如下: + + * 快速 – 档案能立即从多个源同步。 + * 安全 – 所有的更新都是有签名和被完整检查的。 + * 灵活 – 可以在不修改档案 URL 的情况下迁移主机。 + * 版本控制 – 每次修改都被写到只能追加的版本日志中。 + * 去中心化 – 任何设备都可以作为承载档案的主机。 + + + +![Beaker Browser Seeding][9] + +Beaker 浏览器本质上是阉割版的 Chromium,原生支持 `dat://` 地址,也可以访问普通的 `http://` 站点。 + +每次访问一个 dat 站点,在你请求时该站点的内容才会下载到你的计算机。例如,只有在你浏览到站点的 about 页面时,才会下载该页面上的 Linux Torvalds 的图片。 + +当你浏览一个 dat 网站时,”[你暂时][10]重新上传或种下你从网站上下载的所有文件。“你也可以选择为网站做种来帮助创造者。 + +![Beaker Browser Menu][11] + +由于 Beaker 的志向就是创建一个更开放的网络,因此你可以很容易地查看任何网站的源码。不像在大多数浏览器上你只能看到当前浏览的页面的源码那样,使用 Beaker 你能以类似 GitHub 的视图查看整个站点的结构。你甚至可以 fork 这个站点,自己维护。 + +除了浏览基于 dat 的网站外,你还可以创建自己的站点。在 Beaker 浏览器的菜单里,有创建新网站和创建空项目的选项。如果你选择了创建一个新网站,Beaker 会搭建一个小的 demo 站点,你可以使用浏览器里自带的编辑器来编辑。 + +然而,如果你像我一样更喜欢用 Markdown,你可以选择创建一个空项目。Beaker 会创建一个站点的结构,赋给它一个 `dat://` 地址。创建一个 `index.md` 文件后你就可以很好地工作了。里面有个[简短教程][12],你可以看到更多信息。你也可以用创建空项目的选项搭建一个 web app。 + +![Beaker Browser Website Template][13] + +由于 Beaker 的角色是个 web 服务器和站点播种者,当你关闭它或关机后你的站点就不可用了。幸运的是,你不必一直开着你的计算机或浏览器。你也可以使用名为 [Hashbase][14] 的播种服务或者你可以搭建一个 [`homebase`][15] 播种服务器。 + +虽然 Beaker [适用于][16] Linux,Windows 和 macOS,但是在搞 Beaker 之前,还是要查阅下[各平台的教程][17]。 + +### Beaker 浏览器不是每个人都能用,但它有这个意图 + +当第一次被分配到这个任务时,我对 Beaker 浏览器有极高的热情。(但是)像它现在的地位一样,Beaker 浏览器仍是实验性的。我尝试浏览过的很多 dat 站点还不可用,因为用户并没有为站点做种。当站点恢复可用时 Beaker 确实可以选择通知你。 + +![Beaker Browser No Peer][18] + +另一个问题是,Beaker 是真正阉割版的 Chromium。不能安装扩展或主题。你只能使用白色主题和极少的工具集。我不会把 Beaker 浏览器作为常用浏览器,而且能访问 dat 网站并不是把它留在系统上的充分条件。 + +我曾经寻找一个能支持 `dat://` 协议的 Firefox 扩展。我确实找到了这样一款扩展,但它需要安装一系列其他的软件。相比而言,安装 Beaker 比安装那些软件容易点。 + +就像它现在的地位,Beaker 不适合我。也许在将来更多的人使用 Beaker 或者其他浏览器支持 dat 协议。那时会很有趣。目前而言,聊胜于无。 + +在使用 Beaker 的时间里,我用内建的工具创建了一个[网站][19]。不要担心,我已经为它做种了。 + +![Beaker Bowser Site Source][20] + +你怎么看 Beaker 浏览器?你怎么看 P2P web?请尽情在下面评论。 + +如果你觉得本文有意思,请花点时间把它分享到社交媒体,Hacker News 或 [Reddit][21]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/beaker-browser/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/lbry/ +[2]: https://itsfoss.com/mastodon-open-source-alternative-twitter/ +[3]: https://beakerbrowser.com/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser.jpg?resize=800%2C426&ssl=1 +[5]: https://pfrazee.hashbase.io/blog/what-is-the-p2p-web +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-setting.jpg?resize=800%2C573&ssl=1 +[7]: https://bluelinklabs.com/ +[8]: https://www.datprotocol.com/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-seedding.jpg?resize=800%2C466&ssl=1 +[10]: https://beakerbrowser.com/docs/faq/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-menu.jpg?ssl=1 +[12]: https://beakerbrowser.com/docs/guides/create-a-markdown-site +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-website-template.jpg?resize=800%2C459&ssl=1 +[14]: https://hashbase.io/ +[15]: https://github.com/beakerbrowser/homebase +[16]: https://beakerbrowser.com/install/ +[17]: https://beakerbrowser.com/docs/guides/ +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-no-peer.jpg?resize=800%2C424&ssl=1 +[19]: https://41bfbd06731e8d9c5d5676e8145069c69b254e7a3b710ddda4f6e9804529690c/ +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-source.jpg?resize=800%2C544&ssl=1 +[21]: https://reddit.com/r/linuxusersgroup From f49b6bc5bed2a1aaf9aef634fc30512a89e011ea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 May 2020 01:07:02 +0800 Subject: [PATCH 1984/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200507=20Ubun?= =?UTF-8?q?tu=20Studio=20To=20Replace=20Xfce=20With=20KDE=20Plasma=20Deskt?= =?UTF-8?q?op=20Environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md --- ...fce With KDE Plasma Desktop Environment.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md diff --git a/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md b/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md new file mode 100644 index 0000000000..586232d723 --- /dev/null +++ b/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment) +[#]: via: (https://itsfoss.com/ubuntu-studio-opts-for-kde/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment +====== + +[Ubuntu Studio][1] is a popular [official flavour of Ubuntu][2] tailored for creative content creators involved in audio production, video, graphics, photography, and book publishing. It offers a lot of multimedia content creation applications out of the box with the best possible experience. + +After the recent 20.04 LTS release, the Ubuntu Studio team highlighted something very important in their [official announcement][3]. And, probably not everyone noticed the key information i.e Ubuntu Studio’s future. + +Ubuntu Studio 20.04 will be the last version to ship with the [Xfce desktop environment][4]. All the future releases will be using [KDE Plasma][5] instead. + +### Why is Ubuntu Studio ditching XFCE? + +![][6] + +As per their clarification, Ubuntu Studio isn’t focused on any particular look/feel but aims to provide the best user experience possible. And, KDE proves to be a better option. + +> Plasma has proven to have better tools for graphics artists and photographers, as can be seen in Gwenview, Krita, and even the file manager Dolphin. Additionally, it has Wacom tablet support better than any other desktop environment. + +> It has become so good that the majority of the Ubuntu Studio team is now using Kubuntu with Ubuntu Studio added-on via Ubuntu Studio Installer as their daily driver. With so many of us using Plasma, the timing just seems right to focus on a transition to Plasma with our next release. + +Of course every desktop environment has been tailored for something different. And, here, they think that KDE Plasma will be the most suitable desktop environment replacing XFCE to provide a better user experience to all the users. + +While I’m not sure how the users will react to this as every user has a different set of preferences. If the existing users won’t have a problem with KDE, it isn’t going to be a big deal. + +It is worth noting that Ubuntu Studio also mentioned why KDE is potentially a superior choice for them: + +> The Plasma desktop environment has, without Akonadi, become just as light in resource usage as Xfce, perhaps even lighter. Other audio-focused Linux distributions, such as Fedora Jam and KXStudio, have historically used the KDE Plasma desktop environment and done well with the audio. + +Also, they’ve highlighted [an article by Jason Evangelho at Forbes][7] where some benchmarks reveal that KDE is almost as light as Xfce. Even though that’s a good sign – we still have to wait for the users to test-drive the KDE-powered Ubuntu Studio. Only then we’ll be able to observe whether Ubuntu Studio’s decision to ditch XFCE desktop environment was the right thing to do. + +### What will change for Ubuntu Studio users after this change? + +The overall workflow may get affected (or improve) moving forward with KDE on Ubuntu Studio 20.10 and later. + +However, the upgrade process (from 20.04 to 20.10) will result in broken systems. So, a fresh install of Ubuntu Studio 20.10 or later versions will be the only way to go. + +They’ve also mentioned that they will be constantly evaluating for any duplication with the pre-installed apps. So, I believe more details will follow in the coming days. + +Ubuntu Studio is second distribution that has changed its main desktop environment in recent times. Earlier, [Lubuntu][8] switched to LXQt from LXDE. + +What do you think about this change? Feel free to share your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-studio-opts-for-kde/ + +作者:[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://ubuntustudio.org/ +[2]: https://itsfoss.com/which-ubuntu-install/ +[3]: https://ubuntustudio.org/2020/04/ubuntu-studio-20-04-lts-released/ +[4]: https://xfce.org +[5]: https://kde.org/plasma-desktop +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-studio-kde-xfce.jpg?ssl=1 +[7]: https://www.forbes.com/sites/jasonevangelho/2019/10/23/bold-prediction-kde-will-steal-the-lightweight-linux-desktop-crown-in-2020 +[8]: https://itsfoss.com/lubuntu-20-04-review/ From 8357ae31341fdc38a453af4aa36a1bd18f93eb19 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 May 2020 01:08:01 +0800 Subject: [PATCH 1985/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200507=20Ubun?= =?UTF-8?q?tu=20Cinnamon=20Remix=2020.04=20Review:=20The=20Perfect=20Blend?= =?UTF-8?q?=20of=20Ubuntu=20With=20Cinnamon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md --- ...e Perfect Blend of Ubuntu With Cinnamon.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md diff --git a/sources/tech/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md b/sources/tech/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md new file mode 100644 index 0000000000..952e2ea946 --- /dev/null +++ b/sources/tech/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ubuntu Cinnamon Remix 20.04 Review: The Perfect Blend of Ubuntu With Cinnamon) +[#]: via: (https://itsfoss.com/ubuntu-cinnamon-remix-review/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Ubuntu Cinnamon Remix 20.04 Review: The Perfect Blend of Ubuntu With Cinnamon +====== + +GNOME 3 was introduced in 2011, and the GNOME Shell immediately generated both positive and negative responses. Many users and developers liked the original GNOME interface enough that a few groups forked it and one of those, Linux Mint team, created the [Cinnamon desktop environment][1]. + +The Cinnamon desktop became the identity of Linux Mint. For years, Cinnamon has been synonymous to [Linux Mint][2]. It has changed slightly in the past few years as the popularity for Cinnamon grew. Now other distributions have also started offering Cinnamon desktop environment. [Manjaro][3] is one such example. + +A few months back, we introduced you to a [new Ubuntu flavor that provides an out of the box Cinnamon desktop experience][4]. let’s take a deeper look at [Ubuntu Cinnamon Remix][5] today. + +### Why Ubuntu Cinnamon Remix and not Linux Mint? + +It is true that Linux Mint is based on Ubuntu and Many Linux Mint users will have the question: Does it make any sense to switch over to Ubuntu as Linux Mint is such a mature project and the user experience will remain more or less the same? + +Ubuntu Cinnamon Remix has a number of small differences from Linux Mint, but has has one key difference that a Linux enthusiast can’t ignore. + +Linux Mint is based on “LTS” (Long-Term Support) versions of Ubuntu, meaning it stays behind the Canonical’s 6-month update cadence. Ubuntu Cinnamon Remix benefits from a newer kernel to other 6-month cycle feature upgrade and more recent software. + +Another key difference is that Ubuntu Cinnamon Remix will “inherit” [Snap support][6], and Linux Mint embraces [FlatPak][7]. Ubuntu Cinnamon Remix uses Ubuntu Software Center instead of Mint Software Manager. + +That said, I am a huge fan of Cinnamon. So I chose to review this mix of Ubuntu and Cinnamon and here I share my experience with it. + +### Experiencing Ubuntu Cinnamon Remix + +By any chance given, I will always mention how fast [Calamares installer][8] is and thanks to Ubuntu Cinnamon Remix Team for choosing so. + +![Calamares Installer][9] + +A fresh installation of Ubuntu Cinnamon Remix consumes approximately 750 MB of RAM. This is very similar to Linux Mint Cinnamon. + +![An idle Cinnamon takes 750 MB of RAM][10] + +I was also impressed by the beautiful [Kimmo theme][11] and the orange toned Ubuntu wallpaper which seems to be a result of a very meticulous effort. + +![Ubuntu Cinammon Remix 20.04 Desktop][12] + +#### Enough tools to get you started + +As with any other Ubuntu distribution, Ubuntu Cinnamon Remix is packed with the essential productivity tools, to name a few: + + * Firefox Web Browser + * Thunderbird – Email Client + * LibreOffice suite + * Celluloid – Multimedia player + * [GIMP][13] – Image processing software + * Synaptic Package Manager + * Gnome Software Center + * [Gparted][14] – Partition Manager + + + +Using Ubuntu Cinnamon Remix as my main runner for a few days, fulfilled my high expectations. Ubuntu is rock-solid stable, very fast and I didn’t face a single issue at my day to day tasks. + +#### Ubuntu for Linux Mint Lovers + +Are you enthusiastic about Ubuntu Cinnamon but got used to Linux Mint theme? Click below to see how you can get a full Linux Mint theme pack and how to configure it to keep the Ubuntu heritage. + +Give Ubuntu Cinnamon Remix the real Mint touch + +Firstly you have to download and unpack the following, easily done via terminal. + +**Get the Linux Mint-X icon pack** + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-x-icons/mint-x-icons_1.5.5_all.deb +``` + +**Get the Linux Mint-Y icon pack** + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-y-icons/mint-y-icons_1.3.9_all.deb +``` + +**Get the Linux Mint Themes** + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-themes/mint-themes_1.8.4_all.deb +``` + +**Install the downloaded content** + +``` +sudo dpkg -i ./mint-x-icons_1.5.5_all.deb ./mint-y-icons_1.3.9_all.deb ./mint-themes_1.8.4_all.deb +``` + +When done, click on the Menu button at the bottom left corner and type themes. You can also find themes in system settings. + +![Accessing Themes][15] + +Once opened replace the kimmo icons and theme as shown below. The Linux Mint default “Green” is the plain Mint-Y but the orange colour is a perfect selection for Ubuntu. + +![Linux Mint Theme Settings][16] + +#### A treat for Cinnamon fans + +Let’s accept it, aesthetics are important. Cinnamon has a clean and elegant look, easy to read fonts and nice colour contrast themes. Cinnamon offers an uncluttered desktop with easily configured desktop icons simply by accessing the Desktop menu under System Settings. You can also choose the desktop icons to be shown only on the primary monitor, only on secondary monitor, or on both. This also applies to a beyond two monitor setup. + +![Ubuntu Cinnamon Remix Desklets][17] + +Desklets and applets are small, single-purpose applications that can be added to your desktop or your panel respectively. The most commonly used among the many you can choose are CPU or resources monitor, a weather applet, sticky notes, and calendar. + +The Cinnamon Control Center provides centralized access to many of the desktop configuration options. By accessing the themes section you can choose the desktop basic scheme and icons, window borders, mouse pointers, and controls look. Fonts can have a great impact on the overall desktop look and cinnamon makes the change easier than ever. + +The Cinnamon Control Center makes the configuration simple enough for a new user, compared to KDE Plasma that can lead a new user to confusion, due to the massive number of configuration options. + +![][18] + +The Cinnamon Panel contains the menu used to launch programs, a basic system tray, and an application selector. The panel is easy to configure and adding new program launchers is simply done by locating the program you want to add in the main Menu, right click on the icon and select “Add to panel.” You can also add the launcher icon to the desktop, and to the Cinnamon “Favourites” launcher bar. If you don’t like the order of the icons at your panel, just right click at the panel bar, enter panel’s Edit mode and rearrange the icons. + +#### **Conclusions** + +Whether you decide to “spice” up your desktop or thinking to move from [Windows to Linux][19], the Cinnamon Community has made plenty of spices for you. + +Traditional yet elegant, customizable but simple, Ubuntu Cinnamon Remix is an interesting project with a promising future, and for existing fans of the Cinnamon Desktop who love Ubuntu, this is probably a no-brainer. + +What do you think of Ubuntu Cinnamon Remix? Have you used it already? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-cinnamon-remix-review/ + +作者:[Dimitrios Savvopoulos][a] +选题:[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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment) +[2]: https://www.linuxmint.com/ +[3]: https://manjaro.org/ +[4]: https://itsfoss.com/ubuntudde/ +[5]: https://ubuntucinnamon.org/ +[6]: https://snapcraft.io/ +[7]: https://flatpak.org/ +[8]: https://calamares.io/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/Calamares-Installer.png?resize=800%2C426&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/htop-running-on-Ubuntu-Cinnamon-Remix-20.04.png?ssl=1 +[11]: https://github.com/Ubuntu-Cinnamon-Remix/kimmo-gtk-theme +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Ubuntu-Cinammon-Remix-20.04-desktop.png?resize=800%2C450&ssl=1 +[13]: https://itsfoss.com/gimp-2-10-release/ +[14]: https://itsfoss.com/gparted/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/accessing-themes.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/Linux-Mint-theme-settings.png?ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-cinnamon-remix-desklets.jpg?fit=800%2C450&ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-cinnamon-control.jpg?fit=800%2C450&ssl=1 +[19]: https://itsfoss.com/windows-like-linux-distributions/ From 6b681ab52dea3daf62aa77906b9286bf12846c15 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 May 2020 01:12:15 +0800 Subject: [PATCH 1986/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200506=206=20?= =?UTF-8?q?open=20source=20alternatives=20to=20Wunderlist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200506 6 open source alternatives to Wunderlist.md --- ... open source alternatives to Wunderlist.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 sources/tech/20200506 6 open source alternatives to Wunderlist.md diff --git a/sources/tech/20200506 6 open source alternatives to Wunderlist.md b/sources/tech/20200506 6 open source alternatives to Wunderlist.md new file mode 100644 index 0000000000..84c5cc828b --- /dev/null +++ b/sources/tech/20200506 6 open source alternatives to Wunderlist.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 open source alternatives to Wunderlist) +[#]: via: (https://opensource.com/article/20/5/alternatives-list) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +6 open source alternatives to Wunderlist +====== +Love lists? Check out this handy list of open source apps for managing +all your lists! +![a checklist for a team][1] + +Wunderlist is an app for lists, loved by many, but gone for good as of May 6, 2020. The website encourages existing users to download and use Microsoft To Do in its place. That's tempting because it makes it easy to import all of those lists you've made over the years. Then again, maybe it's a chance to _Marie Kondo_ those lists and pare things down. Do you really need 30 lists? (Apparently, I've decided that I do, so I won't judge.) + +I have lists for all sorts of things, from "Plants for the garden 2020" to "Gifts for the husband." Some are checklists, some are To Do lists, and some are lists for list's sake. + +For my husband and me, the most useful list is our shared grocery list. We both have the app on our phones, we both add things to the list, we review it together but separately on our phones before he goes shopping (yes, you read that correctly), and he checks things off as he puts them in the cart. It makes the whole thing surprisingly efficient, and I think we save some money because we're into sticking to THE LIST. + +While its users loved it, Wunderlist isn't entirely unique. There are a gazillion list apps out there. With Wunderlist, I've specifically enjoyed its combination of simplicity and design, and that it managed to implement useful features like sharing and collaboration with others, dynamics checkboxes for lists, and a great user experience across both mobile and web interfaces. I've also enjoyed using it for a list that isn't an "active" document: a list I don't review weekly or make regular progress on—like my many lists I've used for brainstorming an idea (including that novel I've been meaning to write...). + +From the many wonderful articles we've published over the years, I've curated a list of open source alternatives to Wunderlist that may work for your needs, from simple task management and to-do lists to complex note-taking and process management. Or, if you are that person scribbling tasks and notes on paper scraps and post-it notes that are lying... er, around somewhere and everywhere... this might be a good time to try one of these digital options out. + +### Tasks—works with OwnCloud + +> Tasks is a free and open source app you can install from [F-droid][2]. Tasks is a mobile-only application, but it's extremely flexible in what it can sync to. You can save your lists to NextCloud or OwnCloud, Google Tasks, Apple Reminders, and just about any CalDAV server you have an account on. +> +> The default view of Tasks is a daily view, so any task you enter is assumed to be a task from today onward. If you're like me and you want to maintain several unique lists, you can do that with Tags. When you create a tag, you create a category for tasks. You can assign a colour and an icon so each list of tasks is unique. +> +> It takes a little getting used to, but tagging has many advantages. Because all tasks are tagged, you can view groups of tasks by clicking the tag you want to filter for, but you can also filter by day and even by place. That means that when you go grocery shopping, your grocery list becomes the active default list, and your everyday life list becomes active again when you return home. +> +> By syncing your data to one of your online accounts, you can share lists with loved ones, collaborators, and colleagues. +> +> Another great feature is that if you the same tasks every morning when you get to work, or the same 20 items in your weekly grocery list, you can create tasks that repeat on a regular basis. + +Reviewed by Seth Kenlon + +![Screenshot of Tasks interface][3] + +### OpenTasks—best for long lists + +> [OpenTasks][4] is an excellent task management tool for creating individual tasks with a wide variety of settings. It supports a wide range of fields when creating a task, ranging from basic things, such as name and description, to more complex items, such as choosing if the task is private, public, or confidential. The biggest thing that sets OpenTasks apart from the alternatives is its use of tabs on the app's main screen. These tabs quickly allow you to see the tasks due, tasks starting soon, tasks sorted by priority, and tasks sorted by current progress towards completion. Many of the other apps support doing things like these, but OpenTasks quickly easily accesses these lists. + +[Read the full OpenTasks review][5] by Joshua Allen Holm + +![OpenTasks in Google Play store][6] + +### Mirakel—great for nested lists + +> [Mirakel][7] is a task management app with a modern user interface and support for just about every format you might want in such a program. At Mirakel's basic level, it supports multiple lists, which are referred to as "meta lists." Creating an individual task has a plethora of options with deadlines, reminders, progress tracking, tags, notes, sub-tasks, and file attachments, all comprising a part of a task's entry. + +[Read the full Mirakel review][5] by Joshua Allen Holm + +![Screenshot from website of Mirakel app][8] + +### Todo—simple and effective, works anywhere + +> [Todo.txt][9] is one of the two to-do list and task management apps that I keep coming back to over and over again (the other is Org mode). And what keeps me coming back is that it is simple, portable, understandable, and has many great add-ons that don't break it if one machine has them and the others don't. And since it is a Bash shell script, I have never found a system that cannot support it. Read more about [how to install and use Todo.txt][10]. + +[Read the full todo.txt review][10] by Kevin Sonney + +![Drop-down menu for Todo.txt][11] + +Drop-down menu for Todo.txt + +### Joplin—best for private lists + +> [Joplin][12] is a NodeJS application that runs and stores information locally, allows you to encrypt your tasks 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 your notes with Markdown, HTML, or plain text. + +[Read the full Joplin review][13] by Kevin Sonney + +![Joplin graphical version ][14] + +### CherryTree—great alternative to Evernote / OneNote / Keep + +> [CherryTree][15] is a GPLv3-licensed application that organizes information in nodes. Each node can have child nodes, allowing you to easily organize your lists and thoughts. And, child nodes can have their own children with independent properties. + +[Read the full CherryTree review][16] by Ben Cotton + +![CherryTree's hierarchical note layout][17] + +### Bonus: Wekan—for fans of Kanban + +> Kanban boards are a mainstay of today's agile processes. And many of us (myself included) use them to organize not just our work but also our personal lives. I know several artists who use apps like Trello to keep track of their commission lists as well as what's in progress and what's complete. But these apps are often linked to a work account or a commercial service. Enter [Wekan][18], an open source kanban board you can run locally or on the service of your choice. Wekan offers much of the same functionality as other Kanban apps, such as creating boards, lists, swimlanes, and cards, dragging and dropping between lists, assigning to users, labeling cards, and doing pretty much everything else you'd expect in a modern kanban board. + +[Read the full Wekan review][19]* by Kevin Sonney* + +![Wekan kanban board][20] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/alternatives-list + +作者:[Jen Wike Huger][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://f-droid.org/en/packages/org.tasks/ +[3]: https://opensource.com/sites/default/files/uploads/screenshot_tasks_resized.jpg (Screenshot of Tasks interface) +[4]: https://play.google.com/store/apps/details?id=org.dmfs.tasks +[5]: https://opensource.com/article/17/1/task-management-time-tracking-android +[6]: https://opensource.com/sites/default/files/uploads/opentasks_rezied.jpg (OpenTasks in Google Play store) +[7]: https://mirakel.azapps.de/ +[8]: https://opensource.com/sites/default/files/uploads/mirakel_web_resized.jpg (Screenshot from website of Mirakel app) +[9]: http://todotxt.org/ +[10]: https://opensource.com/article/20/1/open-source-to-do-list +[11]: https://opensource.com/sites/default/files/uploads/todo.txtmenu_3.png (Drop-down menu for Todo.txt) +[12]: https://joplin.cozic.net/ +[13]: https://opensource.com/article/19/1/productivity-tool-joplin +[14]: https://opensource.com/sites/default/files/uploads/joplin-1.png (Joplin graphical version ) +[15]: https://www.giuspen.com/cherrytree/ +[16]: https://opensource.com/article/19/5/cherrytree-notetaking +[17]: https://opensource.com/sites/default/files/uploads/cherrytree.png (CherryTree's hierarchical note layout) +[18]: https://wekan.github.io/ +[19]: https://opensource.com/article/19/1/productivity-tool-wekan +[20]: https://opensource.com/sites/default/files/uploads/wekan-board.png (Wekan kanban board) From 290c3681d6c02ae1a9d4c7b25e907ec1338867d6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 May 2020 01:12:50 +0800 Subject: [PATCH 1987/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200506=20Spee?= =?UTF-8?q?d=20up=20administration=20of=20Kubernetes=20clusters=20with=20k?= =?UTF-8?q?9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md --- ...tration of Kubernetes clusters with k9s.md | 311 ++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md diff --git a/sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md b/sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md new file mode 100644 index 0000000000..03f563a952 --- /dev/null +++ b/sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md @@ -0,0 +1,311 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Speed up administration of Kubernetes clusters with k9s) +[#]: via: (https://opensource.com/article/20/5/kubernetes-administration) +[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) + +Speed up administration of Kubernetes clusters with k9s +====== +Check out this cool terminal UI for Kubernetes administration. +![Dogs playing chess][1] + +Usually, my articles about Kubernetes administration are full of kubectl commands for administration for your clusters. Recently, however, someone pointed me to the [k9s][2] project for a fast way to review and resolve day-to-day issues in Kubernetes. It's been a huge improvement to my workflow and I'll show you how to get started in this tutorial.  + +Installation can be done on a Mac, in Windows, and Linux. Instructions for each operating system can be found [here][2]. Be sure to complete installation to be able to follow along. + +I will be using Linux and Minikube, which is a lightweight way to run Kubernetes on a personal computer. Install it following [this tutorial][3] or by using the [documentation][4]. + +### Setting the k9s configuration file + +Once you've installed the k9s app, it's always good to start with the help command. + + +``` +$ k9s help +K9s is a CLI to view and manage your Kubernetes clusters. + +Usage: +  k9s [flags] +  k9s [command] + +Available Commands: +  help        Help about any command +  info        Print configuration info +  version     Print version/build info + +Flags: +  -A, --all-namespaces                 Launch K9s in all namespaces +      --as string                      Username to impersonate for the operation +      --as-group stringArray           Group to impersonate for the operation +      --certificate-authority string   Path to a cert file for the certificate authority +      --client-certificate string      Path to a client certificate file for TLS +      --client-key string              Path to a client key file for TLS +      --cluster string                 The name of the kubeconfig cluster to use +  -c, --command string                 Specify the default command to view when the application launches +      --context string                 The name of the kubeconfig context to use +      --demo                           Enable demo mode to show keyboard commands +      --headless                       Turn K9s header off +  -h, --help                           help for k9s +      --insecure-skip-tls-verify       If true, the server's caCertFile will not be checked for validity +      --kubeconfig string              Path to the kubeconfig file to use for CLI requests +  -l, --logLevel string                Specify a log level (info, warn, debug, error, fatal, panic, trace) (default "info") +  -n, --namespace string               If present, the namespace scope for this CLI request +      --readonly                       Disable all commands that modify the cluster +  -r, --refresh int                    Specify the default refresh rate as an integer (sec) (default 2) +      --request-timeout string         The length of time to wait before giving up on a single server request +      --token string                   Bearer token for authentication to the API server +      --user string                    The name of the kubeconfig user to use + +Use "k9s [command] --help" for more information about a command. +``` + +As you can see, there is a lot of functionality we can configure with k9s. The only step we need to take place to get off the ground is to write a configuration file. The **info** command will point us to where the application is looking for it. + + +``` +$ k9s info + ____  __.________ +|    |/ _/   __   \\______ +|      < \\____    /  ___/ +|    |  \   /    /\\___ \ +|____|__ \ /____//____  > +        \/            \/ + +Configuration:   /Users/jess/.k9s/config.yml +Logs:            /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log +Screen Dumps:    /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess +``` + + By default, k9s expects a configuration file and will fail to run without one. The command will return without any message, but if we look at the log file we see an error. + + +``` +$ tail -1 /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-mbbroberg.log +10:56AM FTL Unable to connect to api server error="Missing or incomplete configuration info.  Please point to an existing, complete config file:\n\n  1. Via the command-line flag --kubeconfig\n  2. Via the KUBECONFIG environment variable\n  3. In your home directory as ~/.kube/config\n\nTo view or setup config directly use the 'config' command." +``` + +To add a file, make the directory if it doesn't already exist and then add one. + + +``` +$ mkdir -p ~/.k9s/ +$ touch ~/.k9s/config.yml +``` + +For this introduction, we will use the default config.yml recommendations from the k9s repository. The maintainers note that this format is subject to change, so we can [check here][5] for the latest version. + + +``` +k9s: +  refreshRate: 2 +  headless: false +  readOnly: false +  noIcons: false +  logger: +    tail: 200 +    buffer: 500 +    sinceSeconds: 300 +    fullScreenLogs: false +    textWrap: false +    showTime: false +  currentContext: minikube +  currentCluster: minikube +  clusters: +    minikube: +      namespace: +        active: "" +        favorites: +       - all +        - kube-system +        - default +      view: +        active: dp +  thresholds: +    cpu: +      critical: 90 +      warn: 70 +    memory: +      critical: 90 +      warn: 70 +``` + +We set k9s to look for a local minikube configuration, so I'm going to confirm minikube is online and ready to go.  + + +``` +$ minikube status +host: Running +kubelet: Running +apiserver: Running +kubeconfig: Configured +``` + +### Running k9s to explore a Kubernetes cluster + +### With a configuration file set and pointing at our local cluster, we can now run the **k9s** command. + + +``` +`$ k9s` +``` + +Once you start it up, the k9s text-based user interface (UI) will pop up. With no flag for a namespace, it will show you the pods in the default namespace. + +![K9s screenshot][6] + +If you run in an environment with a lot of pods, the default view can be overwhelming. Alternatively, we can focus on a given namespace. Exit the application and run **k9s -n <namespace>** where _<namespace>_ is an existing namespace. In the picture below, I ran **k9s -n minecraft,** and it shows my broken pod + +![K9s screenshot][7] + +So once you have k9s up and running, there are a bunch of things you can do quickly.  + +Navigating k9s happens through shortcut keys. We can always use arrow keys and the enter key to choose items listed. There are quite a few other universal keystrokes to navigate to different views: + + * **0**—Show all pods in all namespaces + + + +![K9s screenshot][8] + + * **d**—Describe the selected pod + + + +![K9s screenshot][9] + + * **l**—Show logs for the selected pod pod + + + +![Using k9s to show Kubernetes pod logs][10] + +You may notice that k9s is set to use [Vim command keys][11], including moving up and down using **J** and **K** keys. Good luck exiting, emacs users :) + +### Viewing different Kubernetes resources quickly + +Need to get to something that's not a pod? Yea I do too. There are a number of shortcuts that are available when we enter a colon (":") key. From there, you can use the following commands to navigate around there. + + * **:svc**—Jump to a services view. + + + +![K9s screenshot][12] + + * **:deploy**—Jump to a deployment view. + + + +![K9s screenshot][13] + + * **:rb**—Jump to a Rolebindings view for [role-based access control (RBAC)][14] management. + + + +![K9s screenshot][15] + + * **:namespace**—Jump back to the namespaces view. + + + +![K9s screenshot][16] + + * **:cj**—Jump to the cronjobs view to see what jobs are scheduled in the cluster. + + + +![K9s screenshot][17] + +The most used tool for this application will be the keyboard; to go up or down on any page, use the arrow keys. If you need to quit, remember to use Vim keybindings. Type **:q** and hit enter to leave. + +### Example of troubleshooting Kubernetes with k9s + +How does k9s help when something goes wrong? To walk through an example, I let several pods die due to misconfiguration. Below you can see my terrible hello deployment that's crashing. Once we highlight it, we press **d** to run a _describe_ command to see what is causing the failure. + +![K9s screenshot][18] + +![K9s screenshot][19] + +Skimming the events does not tell us a reason for the failure. Next, I hit the **esc** key and go check the logs by highlighting the pod and entering **<shift-l>**. + +![K9s screenshot][20] + +Unfortunately, the logs don't offer anything helpful either (probably because the deployment was never correctly configured), and the pod will not come up. + +I then **esc** to step back out, and I will see if deleting the pod will take care of this issue. To do so, I highlight the pod and use **<ctrl-d>**. Thankfully, k9s prompts users before deletion.  + +![K9s screenshot][21] + +While I did delete the pod, the deployment resource still exists, so a new pod will come back up. It will also continue to restart and crash for whatever reason (we don't know yet). + +Here is the point where I would repeat reviewing logs, describing resources, and use the **e** shortcut to even edit a running pod to troubleshoot the behavior. In this particular case, the failing pod is not configured to run in this environment. So let's delete the deployment to stop crash-then-reboot loop we are in. + +We can get to deployments by typing **:deploy** and clicking enter. From there we highlight and press **<ctrl-d>** to delete. + +![K9s screenshot][22] + +![K9s screenshot][23] + +And poof the deployment is gone! It only took a few keystrokes to clean up this failed deployment. + +### k9s is incredibly customizable + +So this application has a ton of customization options, down to the color scheme of the UI. Here are a few editable options you may be interested in: + + * Adjust where you put the config.yml file (so you can store it in [version control][24]) + * Add [custom aliases][25] to an **alias.yml** file + * Create [custom hotkeys][26] in a **hotkey.yml** file + * Explore available [plugins][27] or write your own + + + +The entire application is configured in YAML files, so customization will feel familiar to any Kubernetes administrator. + +### Simplify your life with k9s + +I'm prone to administrating over my team's systems in a very manual way, more for brain training than anything else. When I first heard about k9s, I thought, "This is just lazy Kubernetes," so I dismissed it and went back to doing my manual intervention everywhere. I actually started using it daily while working through my backlog, and I was blown away at how much faster it was to use than kubectl alone. Now I'm a convert.  + +It's important to know your tools and master the "hard way" of doing something. It is also important to remember, as far as administration goes, it's important to work smarter, not harder. Using k9s is the way I live up to that objective. I guess we can call it lazy Kubernetes administration, and that's okay. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/kubernetes-administration + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cherrybomb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z (Dogs playing chess) +[2]: https://github.com/derailed/k9s +[3]: https://opensource.com/article/18/10/getting-started-minikube +[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/ +[5]: https://github.com/derailed/k9s#k9s-configuration +[6]: https://opensource.com/sites/default/files/uploads/k9s_1.png (K9s screenshot) +[7]: https://opensource.com/sites/default/files/uploads/k9s_2.png (K9s screenshot) +[8]: https://opensource.com/sites/default/files/uploads/k9s_3.png (K9s screenshot) +[9]: https://opensource.com/sites/default/files/uploads/k9s_5_0.png (K9s screenshot) +[10]: https://opensource.com/sites/default/files/uploads/k9s-show-logs-opensourcedotcom.png (Using k9s to show Kubernetes pod logs) +[11]: https://opensource.com/article/19/3/getting-started-vim +[12]: https://opensource.com/sites/default/files/uploads/k9s_5.png (K9s screenshot) +[13]: https://opensource.com/sites/default/files/uploads/k9s_6.png (K9s screenshot) +[14]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/ +[15]: https://opensource.com/sites/default/files/uploads/k9s_7.png (K9s screenshot) +[16]: https://opensource.com/sites/default/files/uploads/k9s_8.png (K9s screenshot) +[17]: https://opensource.com/sites/default/files/uploads/k9s_9.png (K9s screenshot) +[18]: https://opensource.com/sites/default/files/uploads/k9s_10.png (K9s screenshot) +[19]: https://opensource.com/sites/default/files/uploads/k9s_11.png (K9s screenshot) +[20]: https://opensource.com/sites/default/files/uploads/k9s_12.png (K9s screenshot) +[21]: https://opensource.com/sites/default/files/uploads/k9s_13.png (K9s screenshot) +[22]: https://opensource.com/sites/default/files/uploads/k9s_14.png (K9s screenshot) +[23]: https://opensource.com/sites/default/files/uploads/k9s_15.png (K9s screenshot) +[24]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[25]: https://k9scli.io/topics/aliases/ +[26]: https://k9scli.io/topics/hotkeys/ +[27]: https://github.com/derailed/k9s/tree/master/plugins From 36fe6fa73d662e98210850732e6239c52fc3d555 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 May 2020 01:13:33 +0800 Subject: [PATCH 1988/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200506=20Cust?= =?UTF-8?q?omizing=20my=20open=20source=20PHP=20framework=20for=20web=20de?= =?UTF-8?q?velopment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200506 Customizing my open source PHP framework for web development.md --- ...ource PHP framework for web development.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20200506 Customizing my open source PHP framework for web development.md diff --git a/sources/tech/20200506 Customizing my open source PHP framework for web development.md b/sources/tech/20200506 Customizing my open source PHP framework for web development.md new file mode 100644 index 0000000000..00b605148d --- /dev/null +++ b/sources/tech/20200506 Customizing my open source PHP framework for web development.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Customizing my open source PHP framework for web development) +[#]: via: (https://opensource.com/article/20/5/codeignitor) +[#]: author: (Wee Ben Sen https://opensource.com/users/bswee14) + +Customizing my open source PHP framework for web development +====== +Codeignitor is a PHP framework that empowers companies to develop +high-performance websites with flexibility and ease. +![Business woman on laptop sitting in front of window][1] + +PHP Codeignitor is an open source framework providing business applications with the easy-to-use PHP programming language and powerful tools for coding. It also provides business intelligence, server monitoring, development, and application integration facilities. It's a relatively quiet project that you don't hear much about, but it's got a lot going for it that many developers new to it find surprising and refreshing. + +I use [Codeignitor][2] at my job working for an online tuition service provider in Singapore. We offer services that aren't common enough to be the default feature set for templates or existing back-ends, so I need something that provides good, solid, raw materials I can build upon. Initially, I was considering other platforms such as Wordpress for our website; however, I arrived at Codeignitor due to its flexibility and integration of functions needed in the tuition-matching process. + +Here are the points that sold me on Codeignitor: + + * Database integration with MySQL—A major functionality is allowing clients to browse the tutor database and add tutors like a "shopping cart" similar to an e-commerce platform. + * Client interface system—Users can log in to manage preferences and edit their particulars, modify subject taught, areas traveled, mobile number, address, etc. + * Customized administrator panel—The administrator can access the client's submission with a customized admin panel, which is integrated with a customer service feature so the administrator can follow up individually. + * Payment system—The admin panel comes with an invoice and payments gateway, which is integrated with Paypal. + * CMS editor interface—The administrator is able to edit text and images in the blog and subject pages, as well as add new pages. + + + +The project took around six months to complete and another two months of debugging work. If I'd had to build all of it from scratch or try to rework an existing framework to suit our needs, it would have taken longer, and I probably wouldn't have ended up with what I needed for the demands of our customers. + +### Features and benefits + +There are many more features that draw developers to PHP Codeignitor, including error handling and code formatting, which are useful in every coding situation. It supports templates, which can be used to add functionality to an existing website or to generate new ones. There are many features available for a business that needs to use a web-based system, including the ability to use custom tags. Most can be used by even an average developer who does not have any prior experience in programming. + +The key features of Codeignitor are: + + * XML core services, + * HTTP/FTP core services + * AppData and PHP sandbox features + * XSLT and HTML templates + * Encrypted information transfer + * PCM Codeignitor server monitoring + * Application integration + * File Transfer Protocol (FTP) + * Help desk support + * Apache POI (content management infrastructure used for hosting a website) + + + +#### Compatibility + +Codeignitor is compatible with many leading software applications like PHP, MySQL, [MariaDB][3], [phpMyAdmin][4], [Apache][5], OpenBSD, XSLT, [SQLite][6], and more. A number of companies prefer to use Codeignitor products for their website requirements because they are easy to work with and integrate. If you're not comfortable creating your own website, you can find many developers and design agencies that provide custom web development services. + +#### Security + +Codeignitor also provides data security through SSL encryption. The encryption protects the data from external threats such as intruders and firewalls. The data storage facility also allows for security audits of the company's website. + +#### Other features + +A good PHP web development company uses several advanced and third-party technologies such as XML and PHP. It provides organizations with a complete platform to develop professional-looking, useful websites with a business application. Codeignitor makes it easy to use third party technology, and works with common web development software. This allows web agencies to easily create websites with their chosen modules. Most PHP developers offer support and training services for individuals, as well. + +### Using PHP framework Codeignitor + +Codeignitor allows businesses to have a complete package for PHP development that will offer the right combination of power, flexibility, and performance. So far, I am very pleased with our website and I have continuously upgraded and added new features along the way. I look forward to discovering what else I can do with our website using Codeignitor. Could it be right for you too? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/codeignitor + +作者:[Wee Ben Sen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bswee14 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://codeigniter.com/ +[3]: http://mariadb.org/ +[4]: https://www.phpmyadmin.net/ +[5]: http://apache.org/ +[6]: http://sqlite.org/ From d771233d1eef0243d1f53c0758065738cce95480 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 May 2020 01:14:26 +0800 Subject: [PATCH 1989/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200506=20Mana?= =?UTF-8?q?ging=20Git=20projects=20with=20submodules=20and=20subtrees?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200506 Managing Git projects with submodules and subtrees.md --- ...t projects with submodules and subtrees.md | 212 ++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 sources/tech/20200506 Managing Git projects with submodules and subtrees.md diff --git a/sources/tech/20200506 Managing Git projects with submodules and subtrees.md b/sources/tech/20200506 Managing Git projects with submodules and subtrees.md new file mode 100644 index 0000000000..f906f2a4e4 --- /dev/null +++ b/sources/tech/20200506 Managing Git projects with submodules and subtrees.md @@ -0,0 +1,212 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing Git projects with submodules and subtrees) +[#]: via: (https://opensource.com/article/20/5/git-submodules-subtrees) +[#]: author: (Manaswini Das https://opensource.com/users/manaswinidas) + +Managing Git projects with submodules and subtrees +====== +Submodules and subtrees help you manage child projects across multiple +repositories. +![Digital creative of a browser on the internet][1] + +If you are into open source development, you have probably worked with Git to manage source code. You might have come across projects with numerous dependencies and/or sub-projects. How do you manage them? + +For an open source organization, it can be tricky to achieve single-source documentation and dependency management for the community _and_ the product. The documentation and project often end up fragmented and redundant, which makes them difficult to maintain. + +### The need + +Suppose you want to use a single project as a child project inside a repository. The traditional method is just to copy the project to the parent repository. But, what if you want to use the same child project in many parent repositories? It wouldn't be feasible to copy the child project into every parent and have to make changes in all of them whenever you update it. This would create redundancy and inconsistency in the parent repositories and make it difficult to update and maintain the child project. + +### Git submodules and subtrees + +What if you could put one project within another using a single command? What if you could just add the project as a child to any number of projects and push changes on the go, whenever you want to? Git provides solutions for this: Git submodules and Git subtrees. These tools were created to support code-sharing development workflows on a more modular level, aspiring to bridge the gap between the Git repository's source-code management (SCM) and the sub-repos within it. + +![Cherry tree growing on a mulberry tree][2] + +Cherry tree growing on a mulberry tree + +This is a real-life scenario of the concepts this article will cover in detail. If you're already familiar with trees, here is what this model will look like: + +![Tree with subtrees][3] + +CC BY-SA opensource.com + +### What are Git submodules? + +Git provides submodules in its default package that enable Git repositories to be nested within other repositories. To be precise, the Git submodule points to a specific commit on the child repository. Here is what Git submodules look like in my [Docs-test][4] GitHub repo: + +![Git submodules screenshot][5] + +The format **[folder@commitId][6]** indicates that the repository is a submodule, and you can directly click on the folder to go to the child repository. The config file called **.gitmodules** contains all the submodule repository details. My repo's **.gitmodules** file looks like this: + +![Screenshot of .gitmodules file][7] + +You can use the following commands to use Git submodules in your repositories. + +#### Clone a repository and load submodules + +To clone a repository containing submodules: + + +``` +`$ git clone --recursive ` +``` + +If you have already cloned a repository and want to load its submodules: + + +``` +`$ git submodule update --init` +``` + +If there are nested submodules: + + +``` +`$ git submodule update --init --recursive` +``` + +#### Download submodules + +Downloading submodules sequentially can be a tedious task, so **clone** and **submodule update** will support the **\--jobs** or **-j** parameter. + +For example, to download eight submodules at once, use: + + +``` +$ git submodule update --init --recursive -j 8 +$ git clone --recursive --jobs 8 <URL to Git repo> +``` + +#### Pull submodules + +Before running or building the parent repository, you have to make sure that the child dependencies are up to date. + +To pull all changes in submodules: + + +``` +`$ git submodule update --remote` +``` + +#### Create repositories with submodules + +To add a child repository to a parent repository: + + +``` +`$ git submodule add ` +``` + +To initialize an existing Git submodule: + + +``` +`$ git submodule init` +``` + +You can also create branches and track commits in your submodules by adding **\--update** to your **submodule update** command: + + +``` +`$ git submodule update --remote` +``` + +#### Update submodule commits + +As explained above, a submodule is a link that points to a specific commit in the child repository. If you want to update the commit of the submodule, don't worry. You don't need to specify the latest commit explicitly. You can just use the general **submodule update** command: + + +``` +`$ git submodule update` +``` + +Just add and commit as you normally would to create and push the parent repository to GitHub. + +#### Delete a submodule from a parent repository + +Merely deleting a child project folder manually won't remove the child project from the parent repository. To delete a submodule named **childmodule**, use: + + +``` +`$ git rm -f childmodule` +``` + +Although Git submodules may appear easy to work with, it can be difficult for beginners to find their way around them. + +### What are Git subtrees? + +Git subtrees, introduced in Git 1.7.11, allow you to insert a copy of any repository as a subdirectory of another one. It is one of several ways Git projects can inject and manage project dependencies. It stores the external dependencies in regular commits. Git subtrees provide clean integration points, so they're easier to revert. + +If you use the [subtrees tutorial provided by GitHub][8] to use subtrees, you won't see a **.gittrees** config file in your local whenever you add a subtree. This makes it difficult to recognize subtrees because subtrees look like general folders, but they are copies of the child repository. The version of Git subtree with the **.gittrees** config file is not available with the default Git package, so to get the git-subtree with **.gittrees** config file, you must download git-subtree from the [**/contrib/subtree** folder][9] in the Git source repository. + +You can clone any repository containing subtrees, just like any other general repository, but it may take longer because entire copies of the child repository reside in the parent repository. + +You can use the following commands to use Git subtrees in your repositories. + +#### Add a subtree to a parent repository + +To add a new subtree to a parent repository, you first need to **remote add** it and then run the **subtree add** command, like: + + +``` +$ git remote add remote-name <URL to Git repo> +$ git subtree add --prefix=folder/ remote-name <URL to Git repo> subtree-branchname +``` + +This merges the whole child project's commit history to the parent repository. + +#### Push and pull changes to and from the subtree + + +``` +`$ git subtree push-all` +``` + +or + + +``` +`$ git subtree pull-all` +``` + +### Which should you use? + +Every tool has pros and cons. Here are some features that may help you decide which is best for your use case. + + * Git submodules have a smaller repository size since they are just links that point to a specific commit in the child project, whereas Git subtrees house the entire child project along with its history. + * Git submodules need to be accessible in a server, but subtrees are decentralized. + * Git submodules are mostly used in component-based development, whereas Git subtrees are used in system-based development. + + + +A Git subtree isn't a direct alternative to a Git submodule. There are certain caveats that guide where each can be used. If there is an external repository you own and are likely to push code back to, use Git submodule since it is easier to push. If you have third-party code that you are unlikely to push to, use Git subtree since it is easier to pull. + +Give Git subtrees and submodules a try and let me know how it goes in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/git-submodules-subtrees + +作者:[Manaswini 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://opensource.com/users/manaswinidas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://opensource.com/sites/default/files/uploads/640px-bialbero_di_casorzo.jpg (Cherry tree growing on a mulberry tree) +[3]: https://opensource.com/sites/default/files/subtree_0.png (Tree with subtrees) +[4]: https://github.com/manaswinidas/Docs-test/ +[5]: https://opensource.com/sites/default/files/uploads/git-submodules_github.png (Git submodules screenshot) +[6]: mailto:folder@commitId +[7]: https://opensource.com/sites/default/files/uploads/gitmodules.png (Screenshot of .gitmodules file) +[8]: https://help.github.com/en/github/using-git/about-git-subtree-merges +[9]: https://github.com/git/git/tree/master/contrib/subtree From b75fb525cba2f1e4b07042ad202a49b19c2d6384 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 May 2020 01:18:56 +0800 Subject: [PATCH 1990/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200506=20IBM?= =?UTF-8?q?=20rolls=20Red=20Hat=20into=20edge,=20AI,=20hybrid-cloud=20expa?= =?UTF-8?q?nsion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md --- ...t into edge, AI, hybrid-cloud expansion.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md diff --git a/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md b/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md new file mode 100644 index 0000000000..ef7d152e55 --- /dev/null +++ b/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IBM rolls Red Hat into edge, AI, hybrid-cloud expansion) +[#]: via: (https://www.networkworld.com/article/3542409/ibm-rolls-red-hat-into-edge-ai-hybrid-cloud-expansion.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +IBM rolls Red Hat into edge, AI, hybrid-cloud expansion +====== +Every company will be an AI company new IBM CEO Krishna tells Think! virtual gathering +Getty + +Deeply assimilating its Red Hat technology, IBM this week rolled out a set of new platforms and services designed to help customers manage edge-based application workloads and exploit artificial intelligence for infrastructure resiliency. + +The announcements came at IBM’s virtualized Think! 2020 event that also featured the first Big Blue keynote by [the company's new CEO Arvind Krishna][1], during which he told the online audience about challenges of COVID-19: "History will look back on this as the moment when the digital transformation of business and society suddenly accelerated,” but also that [hybrid cloud and AI][2] are the two dominant forces driving digital transformation. + +[Now see how AI can boost data-center availability and efficiency][3] + +“More than 20 years ago, experts predicted every company would become an internet company. I am predicting today that every company will become an AI company, not because they can, but because they must,” he said. + +With that idea in mind the company rolled out [IBM Watson AIOps][4], an application that uses AI to automate how enterprises detect, diagnose and respond to IT anomalies in real time. Watson AIOps works by grouping log anomalies and alerts based on spatial and temporal reasoning as well as similarity to past situations, IBM said. It uses IBM’s natural language processing technology to understand the content in trouble tickets to identify and extract resolution actions automatically. + +Then it provides a pointer to where the problem is and identifies other services that might be affected.  “It does this by showing details of the problem based on data from existing tools in the environment, all in the context of the application topology, distilling multiple signals into a succinct report” and eliminating the need for multiple dashboards, IBM stated. + +AI can automate tasks like shifting traffic from one router to another, freeing up space on a drive, or restarting an application. AI systems can also be trained to self-correct, IBM stated. + +“The problem is that many businesses are consumed with fixing problems after they occur, instead of preventing them before they happen. Watson AIOps relies on AI to solve and automate how enterprises self-detect, diagnose and respond to anomalies in real time,” Krishna said. + +AIOps is built on the latest release of Red Hat OpenShift, supports Slack and Box, and can be integrated with IT-monitoring packages from Mattermost and ServiceNow, IBM stated.  + +The Kubernetes-based OpenShift Container Platform lets enterprise customers deploy and manage containers on their infrastructure of choice, be it private or public clouds, including AWS, Microsoft Azure, Google Cloud Platform, Alibaba and IBM Cloud.  It also integrates with IBM prepackaged Cloud Paks, which include a secured Kubernetes container and containerized IBM middleware designed to let customers quickly spin-up enterprise-ready containers. + +OpenShift is also the underlying package for a new version of its [edge network][5] management application called IBM Edge Application Manager. Based on the open source project [Open Horizon][6], the Edge Application Manager can use AI and analytics to help deploy and manage up to 10,000 edge nodes simultaneously by a single administrator. With the platform customers can remotely add new capabilities to a single-purpose device or automatically direct a device to use a variety of cloud-based resources depending on what resources it needs.   + +Cisco said it was working with the IBM Edge Application Manager to deploy apps and analytics models that run on a broad range of Cisco products, such as servers, its industrial portfolio of gateways, routers, switches, SD-WAN, and wireless-connectivity offerings for edge computing.  + +“As an example, IBM Edge Application Manager leverages [Cisco HyperFlex Edge][7] and Cisco IC3000 Industrial Compute Gateway servers. The HyperFlex Edge and IC3K platforms are specifically designed to support a number of edge use cases, such as optimizing traffic management, increasing manufacturing productivity, and increasing the safety of oil and gas pipelines,” Cisco [stated][8]. + +In addition, Cisco said it has used the capabilities in IBM Edge Application Manager to build an “Edge in a Box proposal,” where customers can deploy remote edge applications that run entirely disconnected from public or private clouds but are also synchronized and managed remotely in controlled connectivity windows. For instance, client edge locations may need to operate in disconnected mode but have the ability to synch up for automated application updates and data exchanges, Cisco stated. + +Other edge-related announcements include: + + * IBM [Edge Ecosystem][9], a group of industry players who will target open technology developments to let customers move data and applications between private data centers, hybrid multicloud environments and the edge. The group includes Cisco, Juniper, Samsung and NVIDIA among others. IBM said a Telco Network Cloud Ecosystem will serve a similar function for their network cloud platforms. + * A preview of an upcoming service, called IBM Cloud Satellite. This will extend IBM’s public-cloud service to give customers the ability to use IBM Cloud anywhere – on-premises, in data centers or at the edge – delivered as a service that can be managed from a single pane of glass controlled through the public cloud. It lets customers run applications where it makes sense while utilizing cloud security and ops benefits, IBM stated. Satellite runs on Red Hat OpenShift. + * Telco Network Cloud Manager – a telco/service provider offering that runs  on Red Hat OpenShift to deliver intelligent automation capabilities to orchestrate virtual and container network functions in minutes. Service providers will have the ability to manage workloads on both Red Hat OpenShift and Red Hat OpenStack platforms, which will be critical as telcos increasingly look to modernize their networks for greater agility and efficiency, and to provide new services as 5G adoption expands, IBM stated. + * New capabilities for some of its Cloud Paks including extending the Cloud Pak for Data to include the ability to better automate planning, budgeting and forecasting in [hybrid-cloud][10] environments. IBM upgraded tools for business routing and data capture to the Cloud Pak for Automation as well. + + + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3542409/ibm-rolls-red-hat-into-edge-ai-hybrid-cloud-expansion.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3536654/ibm-taps-new-leaders-for-hybrid-cloud-battles-ahead.html +[2]: https://www.infoworld.com/article/3541825/ibms-new-ceo-lays-out-his-roadmap.html +[3]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html +[4]: https://www.ibm.com/watson/assets/duo/pdf/WDDE814_IBM_Watson_AIOps_Web.pdf +[5]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[6]: https://developer.ibm.com/blogs/open-horizon-joins-linux-foundation-grow-open-edge-computing-platform/ +[7]: https://www.cisco.com/c/en/us/products/hyperconverged-infrastructure/index.html?dtid=oblgzzz001087 +[8]: https://blogs.cisco.com/partner/cisco-and-ibm-teaming-at-the-edge +[9]: https://www.ibm.com/blogs/business-partners/join-the-edge-ecosystem/ +[10]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world From 3c1f6f4adaea0bc7680f2b2ba50c145ad80817bf Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 7 May 2020 08:41:17 +0800 Subject: [PATCH 1991/3057] translated --- ...200428 Upgrading Fedora 31 to Fedora 32.md | 99 ------------------- ...200428 Upgrading Fedora 31 to Fedora 32.md | 99 +++++++++++++++++++ 2 files changed, 99 insertions(+), 99 deletions(-) delete mode 100644 sources/tech/20200428 Upgrading Fedora 31 to Fedora 32.md create mode 100644 translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md diff --git a/sources/tech/20200428 Upgrading Fedora 31 to Fedora 32.md b/sources/tech/20200428 Upgrading Fedora 31 to Fedora 32.md deleted file mode 100644 index 5dd426ccfc..0000000000 --- a/sources/tech/20200428 Upgrading Fedora 31 to Fedora 32.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Upgrading Fedora 31 to Fedora 32) -[#]: via: (https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/) -[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) - -Upgrading Fedora 31 to Fedora 32 -====== - -![][1] - -Fedora 32 [is available now][2]. You’ll likely want to upgrade your system to get the latest features available in Fedora. Fedora Workstation has a graphical upgrade method. Alternatively, Fedora offers a command-line method for upgrading Fedora 30 to Fedora 31. - -Before upgrading, visit the [wiki page of common Fedora 32 bugs][3] to see if there’s an issue that might affect your upgrade. Although the Fedora community tries to ensure upgrades work well, there’s no way to guarantee this for every combination of hardware and software that users might have. - -### Upgrading Fedora 31 Workstation to Fedora 32 - -Soon after release time, a notification appears to tell you an upgrade is available. You can click the notification to launch the **GNOME Software** app. Or you can choose Software from GNOME Shell. - -Choose the _Updates_ tab in GNOME Software and you should see a screen informing you that Fedora 32 is Now Available. - -If you don’t see anything on this screen, try using the reload button at the top left. It may take some time after release for all systems to be able to see an upgrade available. - -Choose _Download_ to fetch the upgrade packages. You can continue working until you reach a stopping point, and the download is complete. Then use GNOME Software to restart your system and apply the upgrade. Upgrading takes time, so you may want to grab a coffee and come back to the system later. - -### Using the command line - -If you’ve upgraded from past Fedora releases, you are likely familiar with the _dnf upgrade_ plugin. This method is the recommended and supported way to upgrade from Fedora 31 to Fedora 32. Using this plugin will make your upgrade to Fedora 32 simple and easy. - -#### 1\. Update software and back up your system - -Before you do start the upgrade process, make sure you have the latest software for Fedora 31. This is particularly important if you have modular software installed; the latest versions of dnf and GNOME Software include improvements to the upgrade process for some modular streams. To update your software, use _GNOME Software_ or enter the following command in a terminal. - -``` -sudo dnf upgrade --refresh -``` - -Additionally, make sure you back up your system before proceeding. For help with taking a backup, see [the backup series][4] on the Fedora Magazine. - -#### 2\. Install the DNF plugin - -Next, open a terminal and type the following command to install the plugin: - -``` -sudo dnf install dnf-plugin-system-upgrade -``` - -#### 3\. Start the update with DNF - -Now that your system is up-to-date, backed up, and you have the DNF plugin installed, you can begin the upgrade by using the following command in a terminal: - -``` -sudo dnf system-upgrade download --releasever=32 -``` - -This command will begin downloading all of the upgrades for your machine locally to prepare for the upgrade. If you have issues when upgrading because of packages without updates, broken dependencies, or retired packages, add the _‐‐allowerasing_ flag when typing the above command. This will allow DNF to remove packages that may be blocking your system upgrade. - -#### 4\. Reboot and upgrade - -Once the previous command finishes downloading all of the upgrades, your system will be ready for rebooting. To boot your system into the upgrade process, type the following command in a terminal: - -``` -sudo dnf system-upgrade reboot -``` - -Your system will restart after this. Many releases ago, the _fedup_ tool would create a new option on the kernel selection / boot screen. With the _dnf-plugin-system-upgrade_ package, your system reboots into the current kernel installed for Fedora 31; this is normal. Shortly after the kernel selection screen, your system begins the upgrade process. - -Now might be a good time for a coffee break! Once it finishes, your system will restart and you’ll be able to log in to your newly upgraded Fedora 32 system. - -![][5] - -### Resolving upgrade problems - -On occasion, there may be unexpected issues when you upgrade your system. If you experience any issues, please visit the [DNF system upgrade quick docs][6] for more information on troubleshooting. - -If you are having issues upgrading and have third-party repositories installed on your system, you may need to disable these repositories while you are upgrading. For support with repositories not provided by Fedora, please contact the providers of the repositories. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/ - -作者:[Adam Šamalík][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/asamalik/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/31-32-816x345.png -[2]: https://fedoramagazine.org/announcing-fedora-32/ -[3]: https://fedoraproject.org/wiki/Common_F32_bugs -[4]: https://fedoramagazine.org/taking-smart-backups-duplicity/ -[5]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png -[6]: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/#Resolving_post-upgrade_issues diff --git a/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md b/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md new file mode 100644 index 0000000000..637bf41ce8 --- /dev/null +++ b/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Upgrading Fedora 31 to Fedora 32) +[#]: via: (https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/) +[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) + +将 Fedora 31 升级到 Fedora 32 +====== + +![][1] + +Fedora 32 [已经发布][2]。你可能想升级系统以获得 Fedora 中的最新功能。Fedora Workstation 有图形化的升级方法。另外,Fedora 提供了命令行方法,用于将 Fedora 30 升级到 Fedora 31。 + +升级前,请访问 [Fedora 32 个常见 bug 的维基页面] [3],查看是否存在可能影响升级的问题。尽管 Fedora 社区试图确保升级正常进行,但是无法为用户可能使用的每种软硬件组合提供保证。 + +### 将Fedora 31 Workstation 升级到 Fedora 32 + +发布不久之后就会出现通知,告诉你有可用的升级。你可以单击通知启动 **GNOME Software**。或者,你可以从 GNOME Shell 中选择“软件”。 + +在 GNOME Software中 选择 _Updates_ 选项卡,你会看到一个页面通知你 Fedora 32 现在可用。 + +如果你在此页面看不到任何内容,请尝试使用左上方的重新加载按钮。发布后,所有系统可能都需要一段时间才能看到可用的升级。 + +选择 _Download_ 获取升级包。你可以继续做事直到下载完成。然后使用 GNOME Software 重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再回来。 + +### 使用命令行 + +如果你是从 Fedora 的先前版本升级的,那么你可能对 _dnf upgrade_ 插件很熟悉。此方法是从 Fedora 31 升级到 Fedora 32 的推荐和受支持的方法。使用此插件将使你轻松地升级到 Fedora 32。 + +#### 1\. 更新软件并备份系统 + +在开始升级过程之前,请确保你有 Fedora 31 的最新软件。如果你安装了模块化软件,这尤为重要。dnf 和 GNOME Software 的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用_ GNOME Software_ 或在终端中输入以下命令。 + +``` +sudo dnf upgrade --refresh +``` + +此外,在继续操作之前,请确保备份系统。有关备份的帮助,请参阅 Fedora Magazine 上的[备份系列][4]。 + +#### 2\. 安装 DNF 插件 + +接下来,打开终端并输入以下命令安装插件: + +``` +sudo dnf install dnf-plugin-system-upgrade +``` + +#### 3\. 使用 DNF 开始更新 + +现在,你的系统已更新、已备份、并且已安装 DNF 插件,你可以在终端中使用以下命令开始升级: + +``` +sudo dnf system-upgrade download --releasever=32 +``` + +该命令将开始在本地下载计算机的所有升级,以准备升级。如果由于没有更新的软件包、损坏的依赖项或已淘汰的软件包而在升级时遇到问题,请在输入上述命令时添加 _‐allowerasing_ 标志。这将使 DNF 删除可能阻止系统升级的软件包。 + +#### 4\. 重启并升级 + +当上一个命令完成了所有升级的下载,你的系统就可以重新启动了。要将系统引导至升级过程,请在终端中输入以下命令: + +``` +sudo dnf system-upgrade reboot +``` + +此后,系统将重启。在许多版本之前,_fedup_ 工具会在内核选择/引导页上创建一个新选项。使用 _dnf-plugin-system-upgrade_ 包,你的系统将重启进入 Fedora 31 当前安装的内核;这个是正常的。在选择内核之后,你的系统会立即开始升级过程。 + +现在可能是喝杯咖啡休息的好时机!完成后,系统将重启,你将能够登录到新升级的 Fedora 32 系统。 + +![][5] + +### 解决升级问题 + +有时,升级系统时可能会出现意外问题。如果你遇到任何问题,请访问 [DNF 系统升级文档][6],以获取有关故障排除的更多信息。 + +如果升级时遇到问题,并且系统上安装了第三方仓库,那么在升级时可能需要禁用这些仓库。对于 Fedora 不提供的仓库的支持,请联系仓库的提供者。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/ + +作者:[Adam Šamalík][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/asamalik/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/31-32-816x345.png +[2]: https://fedoramagazine.org/announcing-fedora-32/ +[3]: https://fedoraproject.org/wiki/Common_F32_bugs +[4]: https://fedoramagazine.org/taking-smart-backups-duplicity/ +[5]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png +[6]: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/#Resolving_post-upgrade_issues From 9f2a56309ae5a977e41ccd004f8a06c8108c6dc1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 7 May 2020 08:48:05 +0800 Subject: [PATCH 1992/3057] translating --- sources/tech/20200428 What-s new in Fedora 32 Workstation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200428 What-s new in Fedora 32 Workstation.md b/sources/tech/20200428 What-s new in Fedora 32 Workstation.md index 402a8e63a7..7553d1bb99 100644 --- a/sources/tech/20200428 What-s new in Fedora 32 Workstation.md +++ b/sources/tech/20200428 What-s new in Fedora 32 Workstation.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 366f92cf3ad9cf9b17feb32c3c88a6a651c57713 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 May 2020 10:07:38 +0800 Subject: [PATCH 1993/3057] PRF @tinyeyeser --- ...o avoid man-in-the-middle cyber attacks.md | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/translated/tech/20200407 How to avoid man-in-the-middle cyber attacks.md b/translated/tech/20200407 How to avoid man-in-the-middle cyber attacks.md index 7ccce7c3bd..ca5b6b0aac 100644 --- a/translated/tech/20200407 How to avoid man-in-the-middle cyber attacks.md +++ b/translated/tech/20200407 How to avoid man-in-the-middle cyber attacks.md @@ -1,68 +1,64 @@ [#]: collector: "lujun9972" -[#]: translator: " " -[#]: reviewer: " " +[#]: translator: "tinyeyeser" +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "How to avoid man-in-the-middle cyber attacks" [#]: via: "https://opensource.com/article/20/4/mitm-attacks" [#]: author: "Jackie Lam https://opensource.com/users/beenverified" -如何避免中间人攻击 +如何避免中间人攻击(MITM) ====== -首先搞明白到底什么是中间人攻击,才能避免成为此类高科技窃听的受害者。 +> 首先搞明白到底什么是中间人攻击(MITM),才能避免成为此类高科技窃听的受害者。 -![Security monster][1] +![](https://img.linux.net.cn/data/attachment/album/202005/07/100655i7og1eqsw6o3ww81.jpg) 当你使用电脑发送数据或与某人在线通话的时候,你一定采取了某种程度的安全隐私手段。 但如果有第三方在你不知情的情况下窃听,甚至冒充某个你信任的商业伙伴窃取破坏性的信息呢?你的私人数据就这样被放在了危险分子的手中。 -这就是臭名昭著的中间人攻击。 +这就是臭名昭著的中间人攻击man-in-the-middle(MITM)。 ### 到底什么是中间人攻击? -黑客潜入到你与受害者或是某个设备间的通信过程中,窃取敏感信息——多数是身份信息——进而从事各种违法行为的过程,就是一次中间人攻击。Scamicide公司创始人Steve J. J. Weisman介绍说: +黑客潜入到你与受害者或是某个设备间的通信过程中,窃取敏感信息(多数是身份信息)进而从事各种违法行为的过程,就是一次中间人攻击。Scamicide 公司创始人 Steve J. J. Weisman 介绍说: -“中间人攻击也可以发生在受害者与某个合法app或网页中间。当受害者以为自己面对的是正常app或网页时,其实Ta 正在与一个仿冒的app或网页互动,将自己的敏感信息透露给不法分子。” +> “中间人攻击也可以发生在受害者与某个合法 app 或网页中间。当受害者以为自己面对的是正常 app 或网页时,其实 Ta 正在与一个仿冒的 app 或网页互动,将自己的敏感信息透露给了不法分子。” -中间人攻击诞生于1980年代,是最古老的网络攻击形式之一。但它却更为常见。Weisman解释道,发生中间人攻击的场景有很多种: +中间人攻击诞生于 1980 年代,是最古老的网络攻击形式之一。但它却更为常见。Weisman 解释道,发生中间人攻击的场景有很多种: - * **攻陷一个未有效加密的WiFi路由器**:该场景多见于人们使用公共WiFi的时候。“虽然家用路由器也很脆弱,但黑客攻击公共WiFi网络的情况更为常见。”Weisman说,“黑客的目标就是从毫无戒心的人们那里窃取在线银行账户这样的敏感信息。” - * **攻陷银行、金融顾问等机构的电子邮件账户**:“一旦黑客攻陷了这些电子邮件系统,他们就会冒充银行或此类公司给受害者发邮件”,Weisman说,”他们以紧急情况的名义索要个人信息,诸如用户名和密码。受害者很容易被诱骗交出这些信息。“ - * **发送钓鱼邮件**:窃贼们还可能冒充成与受害者有合作关系的公司,向其索要个人信息。”在多个案例中,钓鱼邮件会引导受害者访问一个伪造的网页,这个伪造的网页看起来就和受害者常常访问的合法公司网页一模一样。“Weisman说道。 - * **在合法网页中嵌入恶意代码**:攻击者还会把恶意代码——通常是JavaScript——嵌入到一个合法的网页中。”当受害者加载这个合法网页时,恶意代码首先按兵不动,直到用户输入账户登录或是信用卡信息时,恶意代码就会复制这些信息并将其发送至攻击者的服务器。“网络安全专家Nicholas McBride介绍说。 + * **攻陷一个未有效加密的 WiFi 路由器**:该场景多见于人们使用公共 WiFi 的时候。“虽然家用路由器也很脆弱,但黑客攻击公共 WiFi 网络的情况更为常见。”Weisman 说,“黑客的目标就是从毫无戒心的人们那里窃取在线银行账户这样的敏感信息。” + * **攻陷银行、金融顾问等机构的电子邮件账户**:“一旦黑客攻陷了这些电子邮件系统,他们就会冒充银行或此类公司给受害者发邮件”,Weisman 说,”他们以紧急情况的名义索要个人信息,诸如用户名和密码。受害者很容易被诱骗交出这些信息。” + * **发送钓鱼邮件**:窃贼们还可能冒充成与受害者有合作关系的公司,向其索要个人信息。“在多个案例中,钓鱼邮件会引导受害者访问一个伪造的网页,这个伪造的网页看起来就和受害者常常访问的合法公司网页一模一样。”Weisman 说道。 + * **在合法网页中嵌入恶意代码**:攻击者还会把恶意代码(通常是 JavaScript)嵌入到一个合法的网页中。“当受害者加载这个合法网页时,恶意代码首先按兵不动,直到用户输入账户登录或是信用卡信息时,恶意代码就会复制这些信息并将其发送至攻击者的服务器。”网络安全专家 Nicholas McBride 介绍说。 ### 有哪些中间人攻击的著名案例? -联想作为主流的计算机制造厂商,在2014到2015年售卖的消费级笔记本电脑中预装了一款叫做 VisualDiscovery 的软件,拦截用户的网页浏览行为。当用户的鼠标在某个产品页面经过时,这款软件就会弹出一个来自合作伙伴的类似产品的广告。 +联想作为主流的计算机制造厂商,在 2014 到 2015 年售卖的消费级笔记本电脑中预装了一款叫做 VisualDiscovery 的软件,拦截用户的网页浏览行为。当用户的鼠标在某个产品页面经过时,这款软件就会弹出一个来自合作伙伴的类似产品的广告。 -这起中间人攻击事件的关键在于:VisualDiscovery 拥有访问用户所有私人数据的权限,包括身份证号、金融交易信息、医疗信息、登录名和密码等等。所有这些访问行为都是在用户不知情和未获得授权的情况下进行的。联邦交易委员会(FTC)认定此次事件为欺诈与不公平竞争。2019年,联想同意为此支付8300万美元的集体诉讼罚款。 +这起中间人攻击事件的关键在于:VisualDiscovery 拥有访问用户所有私人数据的权限,包括身份证号、金融交易信息、医疗信息、登录名和密码等等。所有这些访问行为都是在用户不知情和未获得授权的情况下进行的。联邦交易委员会(FTC)认定此次事件为欺诈与不公平竞争。2019 年,联想同意为此支付 8300 万美元的集体诉讼罚款。 ### 我如何才能避免遭受中间人攻击? - * **避免使用公共WiFi:**Weisman建议,从来都不要使用公开的WiFi进行金融交易,除非你安装了可靠的VPN客户端并连接至可信任的VPN服务器。通过VPN连接,你的通信是加密的,信息也就不会失窃。 + * **避免使用公共 WiFi**:Weisman 建议,从来都不要使用公开的 WiFi 进行金融交易,除非你安装了可靠的 VPN 客户端并连接至可信任的 VPN 服务器。通过 VPN 连接,你的通信是加密的,信息也就不会失窃。 * **时刻注意:**对要求你更新密码或是提供用户名等私人信息的邮件或文本消息要时刻保持警惕。这些手段很可能被用来窃取你的身份信息。 -如果不确定收到的邮件来自于确切哪一方,你可以使用诸如电话反查或是邮件反查等工具。通过电话反查,你可以找出未知发件人的更多身份信息。通过邮件反查,你可以尝试确定谁给你发来了这条消息。 + 如果不确定收到的邮件来自于确切哪一方,你可以使用诸如电话反查或是邮件反查等工具。通过电话反查,你可以找出未知发件人的更多身份信息。通过邮件反查,你可以尝试确定谁给你发来了这条消息。 -通常来讲,如果发现某些方面确实有问题,你可以听从公司中某个你认识或是信任的人的意见。或者,你也可以去你的银行、学校或其他某个组织,当面寻求他们的帮助。总之,重要的账户信息绝对不要透露给不认识的“技术人员”。 + 通常来讲,如果发现某些方面确实有问题,你可以听从公司中某个你认识或是信任的人的意见。或者,你也可以去你的银行、学校或其他某个组织,当面寻求他们的帮助。总之,重要的账户信息绝对不要透露给不认识的“技术人员”。 - * **不要点击邮件中的链接:**如果有人给你发了一封邮件,说你需要登录某个账户,不要点击邮件中的链接。相反,要通过平常习惯的方式自行去访问,并留意是否有告警信息。如果在账户设置中没有看到告警信息,给客服打电话的时候也_不要_联系邮件中留的电话,而是站点页面中的联系人信息。 - * **安装可靠的安全软件:**如果你使用的是Windows操作系统,安装开源的杀毒软件,如[ClamAV][2]。如果使用的是其他平台,要保持你的软件安装有最新的安全补丁。 - * **认真对待告警信息:**如果你正在访问的页面以HTTPS开头,浏览器可能会出现一则告警信息。例如,站点证书的域名与你尝试访问的站点域名不相匹配。千万不要忽视此类告警信息。听从告警建议,迅速关掉页面。确认域名没有输入错误的情况下,如果情况依旧,要立刻联系站点所有者。 - * **使用广告屏蔽软件:**弹窗广告(也叫广告软件攻击)可被用于窃取个人信息,因此你还可以使用广告屏蔽类软件。对个人用户来说,中间人攻击其实是很难防范的,因为它被设计出来的时候,就是为了让受害者始终蒙在鼓里,意识不到任何异常。有一款不错的开源广告屏蔽软件叫 [uBlock origin][4]。可以同时支持Firefox和Chromium(以及所有基于Chromium的浏览器,例如Chrome、Brave、Vivaldi、Edge等),甚至还支持Safari。 + * **不要点击邮件中的链接**:如果有人给你发了一封邮件,说你需要登录某个账户,不要点击邮件中的链接。相反,要通过平常习惯的方式自行去访问,并留意是否有告警信息。如果在账户设置中没有看到告警信息,给客服打电话的时候也*不要*联系邮件中留的电话,而是联系站点页面中的联系人信息。 + * **安装可靠的安全软件**:如果你使用的是 Windows 操作系统,安装开源的杀毒软件,如 [ClamAV][2]。如果使用的是其他平台,要保持你的软件安装有最新的安全补丁。 + * **认真对待告警信息**:如果你正在访问的页面以 HTTPS 开头,浏览器可能会出现一则告警信息。例如,站点证书的域名与你尝试访问的站点域名不相匹配。千万不要忽视此类告警信息。听从告警建议,迅速关掉页面。确认域名没有输入错误的情况下,如果情况依旧,要立刻联系站点所有者。 + * **使用广告屏蔽软件**:弹窗广告(也叫广告软件攻击)可被用于窃取个人信息,因此你还可以使用广告屏蔽类软件。对个人用户来说,中间人攻击其实是很难防范的,因为它被设计出来的时候,就是为了让受害者始终蒙在鼓里,意识不到任何异常。有一款不错的开源广告屏蔽软件叫 [uBlock origin][4]。可以同时支持 Firefox 和 Chromium(以及所有基于 Chromium 的浏览器,例如 Chrome、Brave、Vivaldi、Edge 等),甚至还支持 Safari。 ### 保持警惕 -要时刻记住,你并不需要立刻就点击某些链接,你也并不需要跟随某个陌生人的建议,无论这些信息看起来有多么紧急。互联网始终都在。你大可以先离开电脑,去证实一下这些人的真实身份,看看这些”无比紧急“的页面到底是真是假。 +要时刻记住,你并不需要立刻就点击某些链接,你也并不需要听从某个陌生人的建议,无论这些信息看起来有多么紧急。互联网始终都在。你大可以先离开电脑,去证实一下这些人的真实身份,看看这些“无比紧急”的页面到底是真是假。 尽管任何人都可能遭遇中间人攻击,只要弄明白何为中间人攻击,理解中间人攻击如何发生,并采取有效的防范措施,就可以保护自己避免成为其受害者。 -* * * - -_This article was originally published on [BeenVerified.com][5] under a [CC BY-SA 2.0][6] license._ - -------------------------------------------------------------------------------- via: https://opensource.com/article/20/4/mitm-attacks @@ -70,7 +66,7 @@ via: https://opensource.com/article/20/4/mitm-attacks 作者:[Jackie Lam][a] 选题:[lujun9972][b] 译者:[tinyeyeser](https://github.com/tinyeyeser) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b525cbdf895c58609a8996f05a198f01ff4196e3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 May 2020 10:08:10 +0800 Subject: [PATCH 1994/3057] PUB @tinyeyeser https://linux.cn/article-12191-1.html --- .../20200407 How to avoid man-in-the-middle cyber attacks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200407 How to avoid man-in-the-middle cyber attacks.md (99%) diff --git a/translated/tech/20200407 How to avoid man-in-the-middle cyber attacks.md b/published/20200407 How to avoid man-in-the-middle cyber attacks.md similarity index 99% rename from translated/tech/20200407 How to avoid man-in-the-middle cyber attacks.md rename to published/20200407 How to avoid man-in-the-middle cyber attacks.md index ca5b6b0aac..8ae4bb8a6d 100644 --- a/translated/tech/20200407 How to avoid man-in-the-middle cyber attacks.md +++ b/published/20200407 How to avoid man-in-the-middle cyber attacks.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "tinyeyeser" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12191-1.html" [#]: subject: "How to avoid man-in-the-middle cyber attacks" [#]: via: "https://opensource.com/article/20/4/mitm-attacks" [#]: author: "Jackie Lam https://opensource.com/users/beenverified" From c9bea52ee1574bc76d95802cbd33a555c5aeb81c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 May 2020 14:40:15 +0800 Subject: [PATCH 1995/3057] PRF @lxbwolf --- ...nd JPG for your online images- Use WebP.md | 83 ++++++++++--------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md b/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md index 690f4c6c39..0450e63f23 100644 --- a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md +++ b/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md @@ -1,28 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Drop PNG and JPG for your online images: Use WebP) [#]: via: (https://opensource.com/article/20/4/webp-image-compression) [#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) -线上图片请抛弃 PNG 和 JPG 后缀:使用 WebP +线上图片请抛弃 PNG 和 JPG:使用 WebP ====== -了解一下这个开源的图片编辑工具来节省时间和空间。 -![Painting art on a computer screen][1] -WebP 是 2010 年 Google 开发的一种图片格式,能提供对网络图片的无损压缩和有损压缩。网络开发者们可以使用 WebP 来创建更小更丰富的图片,以此来提高网站的速度。更快的加载速度对于网站的用户体验和网站市场的效能是至关重要的。 +> 了解一下这个开源的图片编辑工具来节省时间和空间。 -为了提供领先于所有的设备和用户的图片加载能力,你网站上的图片文件大小不应该超过 500 KB。 +![](https://img.linux.net.cn/data/attachment/album/202005/07/143932l22hot7ebhbbqjmm.jpg) -WebP 无损图片通常比 PNG 图片文件小至少 25%。在相同的 SSIM(structural similarity,结构相似性)质量指标下,WebP 有损图片通常比 JPEG 图片小 25% 到 34%。 +WebP 是 2010 年 Google 开发的一种图片格式,它为网页上的图片提供了卓越的无损和有损压缩。网站开发者们可以使用 WebP 来创建尺寸更小、细节更丰富的图片,以此来提高网站的速度。更快的加载速度对于网站的用户体验和网站的营销效果是至关重要的。 -无损 WebP 也支持透明度。在有损 RGB 压缩可接受的情况下,有损 WebP 也支持透明度,PNG 文件的大小通常为 WebP 文件大小的四倍。 +为了在所有设备和用户中达到最佳加载效果,你网站上的图片文件大小不应该超过 500 KB。 -Google 报告把动图 GIF 文件转换为有损 WebP后文件大小减少了 64%,转换为无损 WebP 后文件大小减少了 19%。 +与 PNG 图片相比,WebP 无损图片通常至少要比 PNG 图片小 25%。在同等的 SSIM(结构相似度structural similarity)质量指标下,WebP 有损图片通常比 JPEG 图片小 25% 到 34%。 -WebP 文件格式是一种基于 RIFF(resource interchange file format,资源交换文件格式)的文档格式。你可以用 [hexdump][2] 看到文件的签名是 **52 49 46 46** (RIFF): +无损 WebP 也支持透明度。而在可接受有损 RGB 压缩的情况下,有损 WebP 也支持透明度,通常其大小比 PNG 文件小三倍。 + +Google 报告称,把动画 GIF 文件转换为有损 WebP 后文件大小减少了 64%,转换为无损 WebP 后文件大小减少了 19%。 + +WebP 文件格式是一种基于 RIFF(资源互换文件格式resource interchange file format)的文档格式。你可以用 [hexdump][2] 看到文件的签名是 `52 49 46 46`(RIFF): ``` @@ -33,31 +35,31 @@ $ hexdump --canonical pixel.webp 0000002e ``` -独立的 libwebp 库以 WebP 技术规范的引用实现的方式提供服务,可以从 Google 的 [Git 仓库][3] 或下载 tar 包获得。 +独立的 libwebp 库作为 WebP 技术规范的参考实现,可以从 Google 的 [Git 仓库][3] 或 tar 包中获得。 -全球在用的 80% 的 web 浏览器兼容 WebP 格式。本文撰写时,Apple 的 Safari 浏览器还不兼容。对于不兼容的情况,应变方法是在 WebP 图片旁边准备一张 JPG/PNG 图片,我们有很多种方法和 Wordpress 插件来实现。 +全球在用的 80% 的 web 浏览器兼容 WebP 格式。本文撰写时,Apple 的 Safari 浏览器还不兼容。解决这个问题的方法是将 JPG/PNG 图片与 WebP 图片一起提供,有一些方法和 Wordpress 插件可以做到这一点。 -### 为什么这很重要? +### 为什么要这样做? -我的部分工作是设计和维护我们组织的网站。由于网站是个市场工具并且网站速度是衡量用户体验的重要指标,我一直致力于提高网站速度,通过把图片转换为 WebP 来减少图片大小是一个有效的解决方案。 +我的部分工作是设计和维护我们组织的网站。由于网站是个营销工具,而网站的速度是衡量用户体验的重要指标,我一直致力于提高网站速度,通过把图片转换为 WebP 来减少图片大小是一个很好的解决方案。 -我使用了 **web.dev** 来检测其中一个网页,该工具是由 Lighthouse 提供服务的,遵循 Apache 2.0 证书,可以在 找到。 +我使用了 web.dev 来检测其中一个网页,该工具是由 Lighthouse 提供服务的,遵循 Apache 2.0 许可证,可以在 找到。 -根据官方描述,”LIghthouse 是一个开源的,旨在提升网页质量的自动化工具。你可以在任何网页上运行它 — 公共的或需要鉴权的。它有性能、可用性、积极的 web 应用、SEO和其他项目的审计。你可以使用命令行、作为一个 Node 模块或在 Chrome DevTools 里运行 Lighthouse。你输入一个 URL 给 Lighthouse,它对这个网页运行一系列的审计规则,之后生成这个网页的审计结果报告。从报告的失败审计条目中可以知道应该怎么优化网页。每条审计都有对应的文档解释为什么该项目是重要的,以及如何修复它。“ +据其官方描述,“LIghthouse 是一个开源的,旨在提升网页质量的自动化工具。你可以在任何公共的或需要鉴权的网页上运行它。它有性能、可用性、渐进式 web 应用、SEO 等方面的审计。你可以在 Chrome 浏览器的开发工具中运行 Lighthouse,也可以通过命令行或作为 Node 模块运行。你输入一个 URL 给 Lighthouse,它会对这个网页进行一系列的审计,然后生成这个网页的审计结果报告。从报告的失败审计条目中可以知道应该怎么优化网页。每条审计都有对应的文档解释为什么该项目是重要的,以及如何修复它。” ### 创建更小的 WebP 图片 -我测试的页面返回了三张图片。在它生成的报告中,它提供了推荐和目标格式。我选择了它报告有 650 KB 的 ”app-graphic“ 图片。通过把它转换为 WebP 格式,预计可以图片大小降到 61 KB,节省 589 KB。我在 Photoshop 中把它转换了,用默认的 WebP 设置参数保存它,它的文件大小为 44.9 KB。比预期的还要好!从下面的 Photoshop 截图中可以看出,两张图在视觉上完全一样。 +我测试的页面返回了三张图片。在它生成的报告中,它提供了推荐和目标。我选择了它报告有 650 KB 的 `app-graphic` 图片。通过把它转换为 WebP 格式,预计可以把图片大小降到 61 KB,节省 589 KB。我在 Photoshop 中把它转换了,用默认的 WebP 设置参数保存它,它的文件大小为 44.9 KB。比预期的还要好!从下面的 Photoshop 截图中可以看出,两张图在视觉质量上完全一样。 ![WebP vs JPG comparison][4] -左图:650 KB(实际大小)。右图: 589 KB(转换之后的目标大小)。 +*左图:650 KB(实际大小)。右图: 44.9 KB(转换之后的目标大小)。* 当然,也可以用开源图片编辑工具 [GIMP][5] 把图片导出为 WebP。它提供了几个质量和压缩的参数: ![GIMP dialog for exporting webp, as a webp][6] -另一张图拉近视野后: +另一张图放大后: ![WebP vs PNG comparison][7] @@ -67,55 +69,54 @@ PNG(左图)和 WebP(右图),都是从 JPG 转换而来,两图对比 你也可以用 Linux 的命令行工具把图片从 JPG/PNG 转换为 WebP: -在命令行使用 **cwebp** 把 PNG 或 JPG 图片文件转换为 WebP 格式。你可以用下面的命令把 PNG 图片文件转换为质量参数为 80 的 WebP 图片。 - +在命令行使用 `cwebp` 把 PNG 或 JPG 图片文件转换为 WebP 格式。你可以用下面的命令把 PNG 图片文件转换为质量参数为 80 的 WebP 图片。 ``` -`cwebp -q 80 image.png -o image.webp` +cwebp -q 80 image.png -o image.webp ``` -你还可以用 [Image Magick][8],这个工具可能在你的发行版本软件仓库中可以找到。转换的子命令是 **convert**,它需要的所有参数就是输入和输出文件: - +你还可以用 [Image Magick][8],这个工具可能在你的发行版本软件仓库中可以找到。转换的子命令是 `convert`,它需要的所有参数就是输入和输出文件: ``` -`convert pixel.png pixel.webp` +convert pixel.png pixel.webp ``` ### 使用编辑器把图片转换为 WebP -使用 [GIMP][9] 图片编辑器来把图片转换为 WebP。从 2.10 版本开始,它原生地支持 WebP。 +要在图片编辑器中来把图片转换为 WebP,可以使用 [GIMP][9]。从 2.10 版本开始,它原生地支持 WebP。 -如果你是 Photoshop 用户,由于 Photoshop 默认不包含 WebP,因此你需要一个转换插件。遵循 Apache License 2.0 证书发行的 WebPShop 0.2.1 是一个用户打开和保存包括动图在内的 WebP 图片的 Photoshop 模块,在 可以找到。 +如果你是 Photoshop 用户,由于 Photoshop 默认不包含 WebP 支持,因此你需要一个转换插件。遵循 Apache License 2.0 许可证发布的 WebPShop 0.2.1 是一个用于打开和保存包括动画图在内的 WebP 图片的 Photoshop 模块,在 可以找到。 -为了能正常使用它,你需要把它放进 Photoshop 插件目录下的 **bin** 文件夹: +为了能正常使用它,你需要把它放进 Photoshop 插件目录下的 `bin` 文件夹: -Windows x64—C:\Program Files\Adobe\Adobe Photoshop\Plug-ins\WebPShop.8bi +Windows x64 :`C:\Program Files\Adobe\Adobe Photoshop\Plug-ins\WebPShop.8bi` -Mac—Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin +Mac:`Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin` ### Wordpress 上的 WebP 很多网站是用 Wordpress 搭建的(我的网站就是)。因此,Wordpress 怎么上传 WebP 图片?本文撰写时,它还不支持。但是,当然已经有插件来满足这种需求,因此你可以在你的网站上同时准备 WebP 和 PNG/JPG 图片(为 Apple 用户)。 -在 [Marius Hosting][11] 有下面的指示: +在 [Marius Hosting][11] 有下面的[说明][10]: -”直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 functions.php 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你陈述怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入 Appearance/Theme Editor 找到 functions.php。拷贝下面的代码粘贴到文件最后并保存。 +> “直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 `functions.php` 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你介绍一下怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入‘外观/主题编辑器’找到 `functions.php`。复制下面的代码粘贴到该文件最后并保存: - -``` -`//** *Enable upload for webp image files.*/ function webp_upload_mimes($existing_mimes) { $existing_mimes['webp'] = 'image/webp'; return $existing_mimes; } add_filter('mime_types', 'webp_upload_mimes');` +> ``` +//** *Enable upload for webp image files.*/ function webp_upload_mimes($existing_mimes) { $existing_mimes['webp'] = 'image/webp'; return $existing_mimes; } add_filter('mime_types', 'webp_upload_mimes'); ``` -"如果你想在 Media/Library 看缩略图预览,那么你需要把下面的代码也添加到 functions.php 文件。为了找到 functions.php 文件,进入 Appearance/Theme Editor 并搜索 functions.php,然后拷贝下面的代码粘贴到文件最后并保存。“ +> 如果你想在‘媒体/媒体库’时看到缩略图预览,那么你需要把下面的代码也添加到 `functions.php` 文件。为了找到 `functions.php` 文件,进入‘外观/主题编辑器’并搜索 `functions.php`,然后复制下面的代码粘贴到文件最后并保存: +> ``` +//** * Enable preview / thumbnail for webp image files.*/ function webp_is_displayable($result, $path) { if ($result === false) { $displayable_image_types = array( IMAGETYPE_WEBP ); $info = @getimagesize( $path ); if (empty($info)) { $result = false; } elseif (!in_array($info[2], $displayable_image_types)) { $result = false; } else { $result = true; } } return $result; } add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2); ``` -`//** * Enable preview / thumbnail for webp image files.*/ function webp_is_displayable($result, $path) { if ($result === false) { $displayable_image_types = array( IMAGETYPE_WEBP ); $info = @getimagesize( $path ); if (empty($info)) { $result = false; } elseif (!in_array($info[2], $displayable_image_types)) { $result = false; } else { $result = true; } } return $result; } add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);` -``` + +> ” ### WebP 和未来 -WebP 是鲁棒的和最优的格式。它看起来更好,有更好的压缩率,它拥有其他大部分常见图片格式的所有特性。不必再等了,现在就使用它把。 +WebP 是一个健壮而优化的格式。它看起来更好,压缩率更高,并具有其他大部分常见图片格式的所有特性。不必再等了,现在就使用它吧。 -------------------------------------------------------------------------------- @@ -124,7 +125,7 @@ via: https://opensource.com/article/20/4/webp-image-compression 作者:[Jeff Macharyas][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -135,7 +136,7 @@ via: https://opensource.com/article/20/4/webp-image-compression [3]: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html [4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png (WebP vs JPG comparison) [5]: http://gimp.org -[6]: https://opensource.com/sites/default/files/webp-gimp.webp (GIMP dialog for exporting webp, as a webp) +[6]: https://img.linux.net.cn/data/attachment/album/202005/07/143538plu797s4wmhy9b1p.jpg (GIMP dialog for exporting webp, as a webp) [7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png (WebP vs PNG comparison) [8]: https://imagemagick.org [9]: https://en.wikipedia.org/wiki/GIMP From 20a7f216748da621361b1eb9144ac850c208df5f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 May 2020 14:52:53 +0800 Subject: [PATCH 1996/3057] PRF --- ...nd JPG for your online images- Use WebP.md | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md b/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md index 0450e63f23..7cf2cdd803 100644 --- a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md +++ b/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md @@ -99,20 +99,41 @@ Mac:`Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin` 在 [Marius Hosting][11] 有下面的[说明][10]: -> “直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 `functions.php` 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你介绍一下怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入‘外观/主题编辑器’找到 `functions.php`。复制下面的代码粘贴到该文件最后并保存: +“直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 `functions.php` 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你介绍一下怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入‘外观/主题编辑器’找到 `functions.php`。复制下面的代码粘贴到该文件最后并保存: -> ``` -//** *Enable upload for webp image files.*/ function webp_upload_mimes($existing_mimes) { $existing_mimes['webp'] = 'image/webp'; return $existing_mimes; } add_filter('mime_types', 'webp_upload_mimes'); +``` +//** *Enable upload for webp image files.*/ +function webp_upload_mimes($existing_mimes) { + $existing_mimes['webp'] = 'image/webp'; + return $existing_mimes; +} +add_filter('mime_types', 'webp_upload_mimes'); ``` -> 如果你想在‘媒体/媒体库’时看到缩略图预览,那么你需要把下面的代码也添加到 `functions.php` 文件。为了找到 `functions.php` 文件,进入‘外观/主题编辑器’并搜索 `functions.php`,然后复制下面的代码粘贴到文件最后并保存: +如果你想在‘媒体/媒体库’时看到缩略图预览,那么你需要把下面的代码也添加到 `functions.php` 文件。为了找到 `functions.php` 文件,进入‘外观/主题编辑器’并搜索 `functions.php`,然后复制下面的代码粘贴到文件最后并保存: +``` +//** * Enable preview / thumbnail for webp image files.*/ +function webp_is_displayable($result, $path) { + if ($result === false) { + $displayable_image_types = array( IMAGETYPE_WEBP ); + $info = @getimagesize( $path ); -> ``` -//** * Enable preview / thumbnail for webp image files.*/ function webp_is_displayable($result, $path) { if ($result === false) { $displayable_image_types = array( IMAGETYPE_WEBP ); $info = @getimagesize( $path ); if (empty($info)) { $result = false; } elseif (!in_array($info[2], $displayable_image_types)) { $result = false; } else { $result = true; } } return $result; } add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2); + if (empty($info)) { + $result = false; + } elseif (!in_array($info[2], $displayable_image_types)) { + $result = false; + } else { + $result = true; + } + } + + return $result; +} +add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2); ``` -> ” +” ### WebP 和未来 From 1baf20a87c0e4d7c0534a572361511c4280ef2bd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 May 2020 14:55:16 +0800 Subject: [PATCH 1997/3057] PUB @lxbwolf https://linux.cn/article-12193-1.html --- ...00429 Drop PNG and JPG for your online images- Use WebP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200429 Drop PNG and JPG for your online images- Use WebP.md (99%) diff --git a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md b/published/20200429 Drop PNG and JPG for your online images- Use WebP.md similarity index 99% rename from translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md rename to published/20200429 Drop PNG and JPG for your online images- Use WebP.md index 7cf2cdd803..7f581e778f 100644 --- a/translated/tech/20200429 Drop PNG and JPG for your online images- Use WebP.md +++ b/published/20200429 Drop PNG and JPG for your online images- Use WebP.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12193-1.html) [#]: subject: (Drop PNG and JPG for your online images: Use WebP) [#]: via: (https://opensource.com/article/20/4/webp-image-compression) [#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) From a537b46c0f00cdc990c4ebb716e1511d4060ae09 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 May 2020 00:57:13 +0800 Subject: [PATCH 1998/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200508=20Good?= =?UTF-8?q?=20News!=20You=20Can=20Now=20Buy=20the=20De-Googled=20/e/OS=20S?= =?UTF-8?q?martphone=20from=20Fairphone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md --- ...Googled -e-OS Smartphone from Fairphone.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md diff --git a/sources/tech/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md b/sources/tech/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md new file mode 100644 index 0000000000..19d0bb67c2 --- /dev/null +++ b/sources/tech/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Good News! You Can Now Buy the De-Googled /e/OS Smartphone from Fairphone) +[#]: via: (https://itsfoss.com/fairphone-with-e-os/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Good News! You Can Now Buy the De-Googled /e/OS Smartphone from Fairphone +====== + +Fairphone is known for its ethical (or fair) approach of making a smartphone. + +Normally, the ethical approach involves that the workers get paid well, the smartphone build materials are safer for the planet, and the phone is durable/sustainable. And, they’ve already done a good job with their [Fairphone 1][1] , [Fairphone 2][2], and [Fairphone 3][3] smartphones. + +Now, to take things up a notch, Fairphone has teamed up with [/e/OS][4] which is a de-googled Android fork, to launch a separate edition of [Fairphone 3][3] (its latest smartphone) that comes with **/e/OS** out of the box. + +In case you didn’t know about the mobile operating system, you can read our [interview with Gael Duval (Founder of /e/OS)][5] to know more about it. + +While we already have some privacy-focused smartphones like [Librem 5][6], Fairphone 3 with /e/OS is something different to its core. In this article, I’ll try highlighting the key things that you need to know before ordering a Fairphone 3 with /e/OS loaded. + +### The First Privacy Conscious & Sustainable Phone + +You may have noticed a privacy-focused smartphone manufactured in some corner of the world, like [Librem 5][7]. + +But for the most part, it looks like the Fairphone 3 is the first privacy-conscious sustainable phone to get the spotlight. + +![][8] + +The de-googled operating system /e/OS ensures that the smartphone does not rely on Google services to function among other things. Hence, /e/OS should be a great choice for Fairphone 3 for privacy-focused users. + +Also, to support /e/OS out of the box wasn’t just the decision of the manufacturer – but its community. + +As per their announcement, they’ve mentioned: + +> For many, fairer technology isn’t just about the device and its components, it is also about the software that powers the product; and when Fairphone community members were asked what their preferred alternative operating system (OS) was for the next Fairphone, the Fairphone 3, they voted for /e/OS. + +So, it looks like the users do prefer to have /e/OS on their smartphones. + +### Fairphone 3: Overview + +![][9] + +To tell you what I think about it, let me first share the technical specifications of the phone: + + * Dual Nano-SIM (4G LTE/3G/2G support) + * **Display:** 5.65-inch LCD (IPS) with Corning Gorilla Glass 5 protection + * **Screen Resolution**: 2160 x 1080 + * **RAM:** 4 GB + * **Chipset**: Qualcomm Snapdragon 632 + * **Internal Storage:** 64 GB + * **Rear Camera:** 12 MP (IMX363 sensor) + * **Front Camera:** 8 MP + * Bluetooth 5.0 + * WiFi 802.11a/b/g/n/ac + * NFC Supported + * USB-C + * Expandable Storage supported + + + +So, on paper, it sounds like a decent budget smartphone. But, the pricing and availability will be an important factor keeping in mind that it’s a one-of-a-kind smartphone and we don’t really have alternatives to compare to. + +Not just how it’s unique for privacy-focused users, but it is potentially the easiest phone to fix (as suggested by [iFixit’s teardown][10]). + +### Fairphone 3 with /e/OS: Pre-Order, Price & Availability + +![][11] + +As for its availability – the Fairphone 3 with /e/OS is available to pre-order through the [online shop of /e/OS][12] for **€479.90** across Europe.  + +If you are an existing Fairphone 3 user, you can also install /e/OS from the [available build here][13]. + +You get 2 years of warranty along with a 14-day return policy. + +[Pre-Order Fairphone 3 With /e/OS][12] + +### My Thoughts On Fairphone 3 with /e/OS + +It’s important to consider that the smartphone is targeting a particular group of consumers. So, it’s quite obvious that it isn’t meant for everyone. The specifications on paper may look good – but not necessarily the best bang for the buck. + +Also, looking at the smartphone market right now – the specifications and its value for money matter more than what we privacy-focused users want. + +But it’s definitely something impressive and I believe it’s going to get good attention specially among the privacy-aware people who don’t want their smartphone spying on them. + +With Fairphone 3’s launch with /e/OS, the lesser tech savvy people can now get an out of the box privacy-focused smartphone experience. + +What do you think about the Fairphone 3 with /e/OS? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/fairphone-with-e-os/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Fairphone_1 +[2]: https://en.wikipedia.org/wiki/Fairphone_2 +[3]: https://shop.fairphone.com/en/?ref=header +[4]: https://e.foundation/ +[5]: https://itsfoss.com/gael-duval-interview/ +[6]: https://itsfoss.com/librem-5-available/ +[7]: https://itsfoss.com/librem-linux-phone/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Fairphone-3-battery.png?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/fairphone-3.png?ssl=1 +[10]: https://www.ifixit.com/Teardown/Fairphone+3+Teardown/125573 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/fairphone-e-os.png?ssl=1 +[12]: https://e.foundation/product/e-os-fairphone-3/ +[13]: https://doc.e.foundation/devices/FP3/ From e7bb7616b6e076d6699bc1c91f6c0ebaf4995699 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 May 2020 00:57:46 +0800 Subject: [PATCH 1999/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200508=20Fixi?= =?UTF-8?q?ng=20=E2=80=9CUnable=20to=20parse=20package=20file=20/var/lib/a?= =?UTF-8?q?pt/lists=E2=80=9D=20Error=20in=20Ubuntu=20and=20Other=20Linux?= =?UTF-8?q?=20Distributions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md --- ...in Ubuntu and Other Linux Distributions.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md b/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..6ef4f2b55a --- /dev/null +++ b/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/unable-to-parse-package-file/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions +====== + +I have discussed a number of [Ubuntu update errors][1] in the past. If you [use the command line to update Ubuntu][2], you might run into some ‘errors’. + +Some of these ‘errors’ are basically built-in features to prevent unwarranted changes to your system. I am not going into those details in this quick tutorial. + +In this quick tip, I’ll show you how to tackle the following error that you could encounter while updating your system or installing new software: + +**Reading package lists… Error! +E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease +E: The package lists or status file could not be parsed or opened.** + +A similar error can be encountered in Debian: + +**E: Unable to parse package file /var/lib/apt/extended_states (1)** + +There is absolutely no need to panic even thought it says ‘**The package cache file is corrupted**‘. This is really easy to ‘fix’. + +### Handling “Unable to parse package file” error in Ubuntu and Debian-based Linux distributions + +![][3] + +Here’s what you need to do. Take a closer look at the name and path of the file the [Ubuntu][4] is complaining about. + +Reading package lists… Error! +**E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease** +E: The package lists or status file could not be parsed or opened. + +For example, in the above error, it was complaining about /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease + +This gives you the idea that something is not right with this file. Now all you need to do is to remove this file and regenerate the cache. + +``` +sudo rm +``` + +So in my case, I could use this command: **sudo rm /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease** and then rebuild the cache with sudo apt update command. + +#### Step by step for beginners + +If you are familiar with Linux commands, you may know how to do delete the file with its absolute path. For novice users, let me guide you to safely delete the file. + +First, you should go to the directory where the file is stored: + +``` +cd /var/lib/apt/lists/ +``` + +Now delete the file which is not being parsed: + +``` +sudo rm archive.ubuntu.com_ubuntu_dists_bionic_InRelease +``` + +Now if you run the update again, the apt cache will be regenerated. + +``` +sudo apt update +``` + +#### Too many files cannot be parsed? + +This is fine if you have one or two files that are not being parsed while updating the system. But if the system complains about ten or twenty such files, removing them one by one is too tiring. + +What you can do in such a case to remove the entire cache and then generate it again: + +``` +sudo rm -r /var/lib/apt/lists/* +sudo apt update +``` + +#### Explanation of how it fixed your problem + +The /var/lib/apt is the directory where files and data related to the apt package manager are stored. The /var/lib/apt/lists is the directory which is used for storing information for each package resource specified in your system’s sources.list. + +In slightly non complicated terms, this /var/lib/apt/lists stores the package information cache. When you want to install or update a program, your system checks in this directory for the information on the said package. If it finds the detail on the package, then it goes to remote repository and actually download the program or its update. + +When you run the “sudo apt update”, it builds the cache. This is why even when you remove everything in the /var/lib/apt/lists directory, running the update will build a fresh cache. + +This is how it handles the issue of file not being parsed. Your system complained about a particular package or repository information that somehow got corrupted (either a failed download or manual change to sources.list). Removing that file (or everything) and rebuilding the cache solves the issue. + +#### Still facing error? + +This should fix the issue for you. But if the problem still persists or if you have some other related issue, let me know in the comment section and I’ll try to help you out. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/unable-to-parse-package-file/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-update-error/ +[2]: https://itsfoss.com/update-ubuntu/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Unable-to-parse-package-file.png?ssl=1 +[4]: https://ubuntu.com/ From 52b62af73c729813313bbf83fce220728aaeb9ad Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 May 2020 01:02:30 +0800 Subject: [PATCH 2000/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200507=20Usin?= =?UTF-8?q?g=20the=20systemctl=20command=20to=20manage=20systemd=20units?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200507 Using the systemctl command to manage systemd units.md --- ...stemctl command to manage systemd units.md | 618 ++++++++++++++++++ 1 file changed, 618 insertions(+) create mode 100644 sources/tech/20200507 Using the systemctl command to manage systemd units.md diff --git a/sources/tech/20200507 Using the systemctl command to manage systemd units.md b/sources/tech/20200507 Using the systemctl command to manage systemd units.md new file mode 100644 index 0000000000..e305cee36c --- /dev/null +++ b/sources/tech/20200507 Using the systemctl command to manage systemd units.md @@ -0,0 +1,618 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using the systemctl command to manage systemd units) +[#]: via: (https://opensource.com/article/20/5/systemd-units) +[#]: author: (David Both https://opensource.com/users/dboth) + +Using the systemctl command to manage systemd units +====== +Units are the basis of everything in systemd. +![woman on laptop sitting at the window][1] + +In the first two articles in this series, I explored the Linux systemd startup sequence. In the [first article][2], I looked at systemd's functions and architecture and the controversy around its role as a replacement for the old SystemV init program and startup scripts. And in the [second article][3], I examined two important systemd tools, systemctl and journalctl, and explained how to switch from one target to another and to change the default target. + +In this third article, I'll look at systemd units in more detail and how to use the systemctl command to explore and manage units. I'll also explain how to stop and disable units and how to create a new systemd mount unit to mount a new filesystem and enable it to initiate during startup. + +### Preparation + +All of the experiments in this article should be done as the root user (unless otherwise specified). Some of the commands that simply list various systemd units can be performed by non-root users, but the commands that make changes cannot. Make sure to do all of these experiments only on non-production hosts or virtual machines (VMs). + +One of these experiments requires the sysstat package, so install it before you move on. For Fedora and other Red Hat-based distributions you can install sysstat with: + + +``` +`dnf -y install sysstat` +``` + +The sysstat RPM installs several statistical tools that can be used for problem determination. One is [System Activity Report][4] (SAR), which records many system performance data points at regular intervals (every 10 minutes by default). Rather than run as a daemon in the background, the sysstat package installs two systemd timers. One timer runs every 10 minutes to collect data, and the other runs once a day to aggregate the daily data. In this article, I will look briefly at these timers but wait to explain how to create a timer in a future article. + +### systemd suite + +The fact is, systemd is more than just one program. It is a large suite of programs all designed to work together to manage nearly every aspect of a running Linux system. A full exposition of systemd would take a book on its own. Most of us do not need to understand all of the details about how all of systemd's components fit together, so I will focus on the programs and components that enable you to manage various Linux services and deal with log files and journals. + +### Practical structure + +The structure of systemd—outside of its executable files—is contained in its many configuration files. Although these files have different names and identifier extensions, they are all called "unit" files. Units are the basis of everything systemd. + +Unit files are ASCII plain-text files that are accessible to and can be created or modified by a sysadmin. There are a number of unit file types, and each has its own man page. Figure 1 lists some of these unit file types by their filename extensions and a short description of each. + +systemd unit | Description +---|--- +.automount | The **.automount** units are used to implement on-demand (i.e., plug and play) and mounting of filesystem units in parallel during startup. +.device | The **.device** unit files define hardware and virtual devices that are exposed to the sysadmin in the **/dev/directory**. Not all devices have unit files; typically, block devices such as hard drives, network devices, and some others have unit files. +.mount | The **.mount** unit defines a mount point on the Linux filesystem directory structure. +.scope | The **.scope** unit defines and manages a set of system processes. This unit is not configured using unit files, rather it is created programmatically. Per the **systemd.scope** man page, “The main purpose of scope units is grouping worker processes of a system service for organization and for managing resources.” +.service | The **.service** unit files define processes that are managed by systemd. These include services such as crond cups (Common Unix Printing System), iptables, multiple logical volume management (LVM) services, NetworkManager, and more. +.slice | The **.slice** unit defines a “slice,” which is a conceptual division of system resources that are related to a group of processes. You can think of all system resources as a pie and this subset of resources as a “slice” out of that pie. +.socket | The **.socket** units define interprocess communication sockets, such as network sockets. +.swap | The **.swap** units define swap devices or files. +.target | The **.target** units define groups of unit files that define startup synchronization points, runlevels, and services. Target units define the services and other units that must be active in order to start successfully. +.timer | The **.timer** unit defines timers that can initiate program execution at specified times. + +### systemctl + +I looked at systemd's startup functions in the [second article][3], and here I'll explore its service management functions a bit further. systemd provides the **systemctl** command that is used to start and stop services, configure them to launch (or not) at system startup, and monitor the current status of running services. + +In a terminal session as the root user, ensure that root's home directory ( **~** ) is the [PWD][5]. To begin looking at units in various ways, list all of the loaded and active systemd units. systemctl automatically pipes its [stdout][6] data stream through the **less** pager, so you don't have to: + + +``` +[root@testvm1 ~]# systemctl +UNIT                                       LOAD   ACTIVE SUB       DESCRIPTION               +proc-sys-fs-binfmt_misc.automount          loaded active running   Arbitrary Executable File> +sys-devices-pci0000:00-0000:00:01.1-ata7-host6-target6:0:0-6:0:0:0-block-sr0.device loaded a> +sys-devices-pci0000:00-0000:00:03.0-net-enp0s3.device loaded active plugged   82540EM Gigabi> +sys-devices-pci0000:00-0000:00:05.0-sound-card0.device loaded active plugged   82801AA AC'97> +sys-devices-pci0000:00-0000:00:08.0-net-enp0s8.device loaded active plugged   82540EM Gigabi> +sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loa> +sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loa> +<snip – removed lots of lines of data from here> + +LOAD   = Reflects whether the unit definition was properly loaded. +ACTIVE = The high-level unit activation state, i.e. generalization of SUB. +SUB    = The low-level unit activation state, values depend on unit type. + +206 loaded units listed. Pass --all to see loaded but inactive units, too. +To show all installed unit files use 'systemctl list-unit-files'. +``` + +As you scroll through the data in your terminal session, look for some specific things. The first section lists devices such as hard drives, sound cards, network interface cards, and TTY devices. Another section shows the filesystem mount points. Other sections include various services and a list of all loaded and active targets. + +The sysstat timers at the bottom of the output are used to collect and generate daily system activity summaries for SAR. SAR is a very useful problem-solving tool. (You can learn more about it in Chapter 13 of my book [_Using and Administering Linux: Volume 1, Zero to SysAdmin: Getting Started_][7].) + +Near the very bottom, three lines describe the meanings of the statuses (loaded, active, and sub). Press **q** to exit the pager. + +Use the following command (as suggested in the last line of the output above) to see all the units that are installed, whether or not they are loaded. I won't reproduce the output here, because you can scroll through it on your own. The systemctl program has an excellent tab-completion facility that makes it easy to enter complex commands without needing to memorize all the options: + + +``` +`[root@testvm1 ~]# systemctl list-unit-files` +``` + +You can see that some units are disabled. Table 1 in the man page for systemctl lists and provides short descriptions of the entries you might see in this listing. Use the **-t** (type) option to view just the timer units: + + +``` +[root@testvm1 ~]# systemctl list-unit-files -t timer +UNIT FILE                    STATE   +[chrony-dnssrv@.timer][8]         disabled +dnf-makecache.timer          enabled +fstrim.timer                 disabled +logrotate.timer              disabled +logwatch.timer               disabled +[mdadm-last-resort@.timer][9]     static   +mlocate-updatedb.timer       enabled +sysstat-collect.timer        enabled +sysstat-summary.timer        enabled +systemd-tmpfiles-clean.timer static   +unbound-anchor.timer         enabled +``` + +You could do the same thing with this alternative, which provides considerably more detail: + + +``` +[root@testvm1 ~]# systemctl list-timers +Thu 2020-04-16 09:06:20 EDT  3min 59s left n/a                          n/a           systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service +Thu 2020-04-16 10:02:01 EDT  59min left    Thu 2020-04-16 09:01:32 EDT  49s ago       dnf-makecache.timer          dnf-makecache.service +Thu 2020-04-16 13:00:00 EDT  3h 57min left n/a                          n/a           sysstat-collect.timer        sysstat-collect.service +Fri 2020-04-17 00:00:00 EDT  14h left      Thu 2020-04-16 12:51:37 EDT  3h 49min left mlocate-updatedb.timer       mlocate-updatedb.service +Fri 2020-04-17 00:00:00 EDT  14h left      Thu 2020-04-16 12:51:37 EDT  3h 49min left unbound-anchor.timer         unbound-anchor.service +Fri 2020-04-17 00:07:00 EDT  15h left      n/a                          n/a           sysstat-summary.timer        sysstat-summary.service + +6 timers listed. +Pass --all to see loaded but inactive timers, too. +[root@testvm1 ~]# +``` + +Although there is no option to do systemctl list-mounts, you can list the mount point unit files: + + +``` +[root@testvm1 ~]# systemctl list-unit-files -t mount +UNIT FILE                     STATE     +-.mount                       generated +boot.mount                    generated +dev-hugepages.mount           static   +dev-mqueue.mount              static   +home.mount                    generated +proc-fs-nfsd.mount            static   +proc-sys-fs-binfmt_misc.mount disabled +run-vmblock\x2dfuse.mount     disabled +sys-fs-fuse-connections.mount static   +sys-kernel-config.mount       static   +sys-kernel-debug.mount        static   +tmp.mount                     generated +usr.mount                     generated +var-lib-nfs-rpc_pipefs.mount  static   +var.mount                     generated + +15 unit files listed. +[root@testvm1 ~]# +``` + +The STATE column in this data stream is interesting and requires a bit of explanation. The "generated" states indicate that the mount unit was generated on the fly during startup using the information in **/etc/fstab**. The program that generates these mount units is **/lib/systemd/system-generators/systemd-fstab-generator,** along with other tools that generate a number of other unit types. The "static" mount units are for filesystems like **/proc** and **/sys**, and the files for these are located in the **/usr/lib/systemd/system** directory. + +Now, look at the service units. This command will show all services installed on the host, whether or not they are active: + + +``` +`[root@testvm1 ~]# systemctl --all -t service` +``` + +The bottom of this listing of service units displays 166 as the total number of loaded units on my host. Your number will probably differ. + +Unit files do not have a filename extension (such as **.unit**) to help identify them, so you can generalize that most configuration files that belong to systemd are unit files of one type or another. The few remaining files are mostly **.conf** files located in **/etc/systemd**. + +Unit files are stored in the **/usr/lib/systemd** directory and its subdirectories, while the **/etc/systemd/** directory and its subdirectories contain symbolic links to the unit files necessary to the local configuration of this host. + +To explore this, make **/etc/systemd** the PWD and list its contents. Then make **/etc/systemd/system** the PWD and list its contents, and list the contents of at least a couple of the current PWD's subdirectories. + +Take a look at the **default.target** file, which determines which runlevel target the system will boot to. In the second article in this series, I explained how to change the default target from the GUI (**graphical.target**) to the command-line only (**multi-user.target**) target. The **default.target** file on my test VM is simply a symlink to **/usr/lib/systemd/system/graphical.target**. + +Take a few minutes to examine the contents of the **/etc/systemd/system/default.target** file: + + +``` +[root@testvm1 system]# cat default.target +#  SPDX-License-Identifier: LGPL-2.1+ +# +#  This file is part of systemd. +# +#  systemd is free software; you can redistribute it and/or modify it +#  under the terms of the GNU Lesser General Public License as published by +#  the Free Software Foundation; either version 2.1 of the License, or +#  (at your option) any later version. + +[Unit] +Description=Graphical Interface +Documentation=man:systemd.special(7) +Requires=multi-user.target +Wants=display-manager.service +Conflicts=rescue.service rescue.target +After=multi-user.target rescue.service rescue.target display-manager.service +AllowIsolate=yes +``` + +Note that this requires the **multi-user.target**; the **graphical.target** cannot start if the **multi-user.target** is not already up and running. It also says it "wants" the **display-manager.service** unit. A "want" does not need to be fulfilled in order for the unit to start successfully. If the "want" cannot be fulfilled, it will be ignored by systemd, and the rest of the target will start regardless. + +The subdirectories in **/etc/systemd/system** are lists of wants for various targets. Take a few minutes to explore the files and their contents in the **/etc/systemd/system/graphical.target.wants** directory. + +The **systemd.unit** man page contains a lot of good information about unit files, their structure, the sections they can be divided into, and the options that can be used. It also lists many of the unit types, all of which have their own man pages. If you want to interpret a unit file, this would be a good place to start. + +### Service units + +A Fedora installation usually installs and enables services that particular hosts do not need for normal operation. Conversely, sometimes it doesn't include services that need to be installed, enabled, and started. Services that are not needed for the Linux host to function as desired, but which are installed and possibly running, represent a security risk and should—at minimum—be stopped and disabled and—at best—should be uninstalled. + +The systemctl command is used to manage systemd units, including services, targets, mounts, and more. Take a closer look at the list of services to identify services that will never be used: + + +``` +[root@testvm1 ~]# systemctl --all -t service +UNIT                           LOAD      ACTIVE SUB        DESCRIPTION                             +<snip> +chronyd.service                loaded    active running    NTP client/server                       +crond.service                  loaded    active running    Command Scheduler                       +cups.service                   loaded    active running    CUPS Scheduler                           +dbus-daemon.service            loaded    active running    D-Bus System Message Bus                 +<snip> +● ip6tables.service           not-found inactive dead     ip6tables.service                   +● ipset.service               not-found inactive dead     ipset.service                       +● iptables.service            not-found inactive dead     iptables.service                     +<snip> +firewalld.service              loaded    active   running  firewalld - dynamic firewall daemon +<snip> +● ntpd.service                not-found inactive dead     ntpd.service                         +● ntpdate.service             not-found inactive dead     ntpdate.service                     +pcscd.service                  loaded    active   running  PC/SC Smart Card Daemon +``` + +I have pruned out most of the output from the command to save space. The services that show "loaded active running" are obvious. The "not-found" services are ones that systemd is aware of but are not installed on the Linux host. If you want to run those services, you must install the packages that contain them. + +Note the **pcscd.service** unit. This is the PC/SC smart-card daemon. Its function is to communicate with smart-card readers. Many Linux hosts—including VMs—have no need for this reader nor the service that is loaded and taking up memory and CPU resources. You can stop this service and disable it, so it will not restart on the next boot. First, check its status: + + +``` +[root@testvm1 ~]# systemctl status pcscd.service +● pcscd.service - PC/SC Smart Card Daemon +   Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled) +   Active: active (running) since Fri 2019-05-10 11:28:42 EDT; 3 days ago +     Docs: man:pcscd(8) + Main PID: 24706 (pcscd) +    Tasks: 6 (limit: 4694) +   Memory: 1.6M +   CGroup: /system.slice/pcscd.service +           └─24706 /usr/sbin/pcscd --foreground --auto-exit + +May 10 11:28:42 testvm1 systemd[1]: Started PC/SC Smart Card Daemon. +``` + +This data illustrates the additional information systemd provides versus SystemV, which only reports whether or not the service is running. Note that specifying the **.service** unit type is optional. Now stop and disable the service, then re-check its status: + + +``` +[root@testvm1 ~]# systemctl stop pcscd ; systemctl disable pcscd +Warning: Stopping pcscd.service, but it can still be activated by: +  pcscd.socket +Removed /etc/systemd/system/sockets.target.wants/pcscd.socket. +[root@testvm1 ~]# systemctl status pcscd +● pcscd.service - PC/SC Smart Card Daemon +   Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled) +   Active: failed (Result: exit-code) since Mon 2019-05-13 15:23:15 EDT; 48s ago +     Docs: man:pcscd(8) + Main PID: 24706 (code=exited, status=1/FAILURE) + +May 10 11:28:42 testvm1 systemd[1]: Started PC/SC Smart Card Daemon. +May 13 15:23:15 testvm1 systemd[1]: Stopping PC/SC Smart Card Daemon... +May 13 15:23:15 testvm1 systemd[1]: pcscd.service: Main process exited, code=exited, status=1/FAIL> +May 13 15:23:15 testvm1 systemd[1]: pcscd.service: Failed with result 'exit-code'. +May 13 15:23:15 testvm1 systemd[1]: Stopped PC/SC Smart Card Daemon. +``` + +The short log entry display for most services prevents having to search through various log files to locate this type of information. Check the status of the system runlevel targets—specifying the "target" unit type is required: + + +``` +[root@testvm1 ~]# systemctl status multi-user.target +● multi-user.target - Multi-User System +   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Multi-User System. +[root@testvm1 ~]# systemctl status graphical.target +● graphical.target - Graphical Interface +   Loaded: loaded (/usr/lib/systemd/system/graphical.target; indirect; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Graphical Interface. +[root@testvm1 ~]# systemctl status default.target +● graphical.target - Graphical Interface +   Loaded: loaded (/usr/lib/systemd/system/graphical.target; indirect; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Graphical Interface. +``` + +The default target is the graphical target. The status of any unit can be checked in this way. + +### Mounts the old way + +A mount unit defines all of the parameters required to mount a filesystem on a designated mount point. systemd can manage mount units with more flexibility than those using the **/etc/fstab** filesystem configuration file. Despite this, systemd still uses the **/etc/fstab** file for filesystem configuration and mounting purposes. systemd uses the **systemd-fstab-generator** tool to create transient mount units from the data in the **fstab** file. + +I will create a new filesystem and a systemd mount unit to mount it. If you have some available disk space on your test system, you can do it along with me. + +_Note that the volume group and logical volume names may be different on your test system. Be sure to use the names that are pertinent to your system._ + +You will need to create a partition or logical volume, then make an EXT4 filesystem on it. Add a label to the filesystem, **TestFS**, and create a directory for a mount point **/TestFS**. + +To try this on your own, first, verify that you have free space on the volume group. Here is what that looks like on my VM where I have some space available on the volume group to create a new logical volume: + + +``` +[root@testvm1 ~]# lsblk +NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +sda             8:0    0  120G  0 disk +├─sda1          8:1    0    4G  0 part /boot +└─sda2          8:2    0  116G  0 part +  ├─VG01-root 253:0    0    5G  0 lvm  / +  ├─VG01-swap 253:1    0    8G  0 lvm  [SWAP] +  ├─VG01-usr  253:2    0   30G  0 lvm  /usr +  ├─VG01-home 253:3    0   20G  0 lvm  /home +  ├─VG01-var  253:4    0   20G  0 lvm  /var +  └─VG01-tmp  253:5    0   10G  0 lvm  /tmp +sr0            11:0    1 1024M  0 rom   +[root@testvm1 ~]# vgs +  VG   #PV #LV #SN Attr   VSize    VFree   +  VG01   1   6   0 wz--n- <116.00g <23.00g +``` + +Then create a new volume on **VG01** named **TestFS**. It does not need to be large; 1GB is fine. Then create a filesystem, add the filesystem label, and create the mount point: + + +``` +[root@testvm1 ~]# lvcreate -L 1G -n TestFS VG01 +  Logical volume "TestFS" created. +[root@testvm1 ~]# mkfs -t ext4 /dev/mapper/VG01-TestFS +mke2fs 1.45.3 (14-Jul-2019) +Creating filesystem with 262144 4k blocks and 65536 inodes +Filesystem UUID: 8718fba9-419f-4915-ab2d-8edf811b5d23 +Superblock backups stored on blocks: +        32768, 98304, 163840, 229376 + +Allocating group tables: done                             +Writing inode tables: done                             +Creating journal (8192 blocks): done +Writing superblocks and filesystem accounting information: done + +[root@testvm1 ~]# e2label /dev/mapper/VG01-TestFS TestFS +[root@testvm1 ~]# mkdir /TestFS +``` + +Now, mount the new filesystem: + + +``` +[root@testvm1 ~]# mount /TestFS/ +mount: /TestFS/: can't find in /etc/fstab. +``` + +This will not work because you do not have an entry in **/etc/fstab**. You can mount the new filesystem even without the entry in **/etc/fstab** using both the device name (as it appears in **/dev**) and the mount point. Mounting in this manner is simpler than it used to be—it used to require the filesystem type as an argument. The mount command is now smart enough to detect the filesystem type and mount it accordingly. + +Try it again: + + +``` +[root@testvm1 ~]# mount /dev/mapper/VG01-TestFS /TestFS/ +[root@testvm1 ~]# lsblk +NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +sda               8:0    0  120G  0 disk +├─sda1            8:1    0    4G  0 part /boot +└─sda2            8:2    0  116G  0 part +  ├─VG01-root   253:0    0    5G  0 lvm  / +  ├─VG01-swap   253:1    0    8G  0 lvm  [SWAP] +  ├─VG01-usr    253:2    0   30G  0 lvm  /usr +  ├─VG01-home   253:3    0   20G  0 lvm  /home +  ├─VG01-var    253:4    0   20G  0 lvm  /var +  ├─VG01-tmp    253:5    0   10G  0 lvm  /tmp +  └─VG01-TestFS 253:6    0    1G  0 lvm  /TestFS +sr0              11:0    1 1024M  0 rom   +[root@testvm1 ~]# +``` + +Now the new filesystem is mounted in the proper location. List the mount unit files: + + +``` +`[root@testvm1 ~]# systemctl list-unit-files -t mount` +``` + +This command does not show a file for the **/TestFS** filesystem because no file exists for it. The command **systemctl status TestFS.mount** does not display any information about the new filesystem either. You can try it using wildcards with the **systemctl status** command: + + +``` +[root@testvm1 ~]# systemctl status *mount +● usr.mount - /usr +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) +    Where: /usr +     What: /dev/mapper/VG01-usr +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) + +<SNIP> +● TestFS.mount - /TestFS +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Fri 2020-04-17 16:02:26 EDT; 1min 18s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS + +● run-user-0.mount - /run/user/0 +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Thu 2020-04-16 08:52:29 EDT; 1 day 5h ago +    Where: /run/user/0 +     What: tmpfs + +● var.mount - /var +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) since Thu 2020-04-16 12:51:34 EDT; 1 day 1h ago +    Where: /var +     What: /dev/mapper/VG01-var +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) +    Tasks: 0 (limit: 19166) +   Memory: 212.0K +      CPU: 5ms +   CGroup: /system.slice/var.mount +``` + +This command provides some very interesting information about your system's mounts, and your new filesystem shows up. The **/var** and **/usr** filesystems are identified as being generated from **/etc/fstab**, while your new filesystem simply shows that it is loaded and provides the location of the info file in the **/proc/self/mountinfo** file. + +Next, automate this mount. First, do it the old-fashioned way by adding an entry in **/etc/fstab**. Later, I'll show you how to do it the new way, which will teach you about creating units and integrating them into the startup sequence. + +Unmount **/TestFS** and add the following line to the **/etc/fstab** file: + + +``` +`/dev/mapper/VG01-TestFS  /TestFS       ext4    defaults        1 2` +``` + +Now, mount the filesystem with the simpler **mount** command and list the mount units again: + + +``` +[root@testvm1 ~]# mount /TestFS +[root@testvm1 ~]# systemctl status *mount +<SNIP> +● TestFS.mount - /TestFS +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Fri 2020-04-17 16:26:44 EDT; 1min 14s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +<SNIP> +``` + +This did not change the information for this mount because the filesystem was manually mounted. Reboot and run the command again, and this time specify **TestFS.mount** rather than using the wildcard. The results for this mount are now consistent with it being mounted at startup: + + +``` +[root@testvm1 ~]# systemctl status TestFS.mount +● TestFS.mount - /TestFS +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) since Fri 2020-04-17 16:30:21 EDT; 1min 38s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) +    Tasks: 0 (limit: 19166) +   Memory: 72.0K +      CPU: 6ms +   CGroup: /system.slice/TestFS.mount + +Apr 17 16:30:21 testvm1 systemd[1]: Mounting /TestFS... +Apr 17 16:30:21 testvm1 systemd[1]: Mounted /TestFS. +``` + +### Creating a mount unit + +Mount units may be configured either with the traditional **/etc/fstab** file or with systemd units. Fedora uses the **fstab** file as it is created during the installation. However, systemd uses the **systemd-fstab-generator** program to translate the **fstab** file into systemd units for each entry in the **fstab** file. Now that you know you can use systemd **.mount** unit files for filesystem mounting, try it out by creating a mount unit for this filesystem. + +First, unmount **/TestFS**. Edit the **/etc/fstab** file and delete or comment out the **TestFS** line. Now, create a new file with the name **TestFS.mount** in the **/etc/systemd/system** directory. Edit it to contain the configuration data below. The unit file name and the name of the mount point _must_ be identical, or the mount will fail: + + +``` +# This mount unit is for the TestFS filesystem +# By David Both +# Licensed under GPL V2 +# This file should be located in the /etc/systemd/system directory + +[Unit] +Description=TestFS Mount + +[Mount] +What=/dev/mapper/VG01-TestFS +Where=/TestFS +Type=ext4 +Options=defaults + +[Install] +WantedBy=multi-user.target +``` + +The **Description** line in the **[Unit]** section is for us humans, and it provides the name that's shown when you list mount units with **systemctl -t mount**. The data in the **[Mount]** section of this file contains essentially the same data that would be found in the **fstab** file. + +Now enable the mount unit: + + +``` +[root@testvm1 etc]# systemctl enable TestFS.mount +Created symlink /etc/systemd/system/multi-user.target.wants/TestFS.mount → /etc/systemd/system/TestFS.mount. +``` + +This creates the symlink in the **/etc/systemd/system** directory, which will cause this mount unit to be mounted on all subsequent boots. The filesystem has not yet been mounted, so you must "start" it: + + +``` +`[root@testvm1 ~]# systemctl start TestFS.mount` +``` + +Verify that the filesystem has been mounted: + + +``` +[root@testvm1 ~]# systemctl status TestFS.mount +● TestFS.mount - TestFS Mount +   Loaded: loaded (/etc/systemd/system/TestFS.mount; enabled; vendor preset: disabled) +   Active: active (mounted) since Sat 2020-04-18 09:59:53 EDT; 14s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +    Tasks: 0 (limit: 19166) +   Memory: 76.0K +      CPU: 3ms +   CGroup: /system.slice/TestFS.mount + +Apr 18 09:59:53 testvm1 systemd[1]: Mounting TestFS Mount... +Apr 18 09:59:53 testvm1 systemd[1]: Mounted TestFS Mount. +``` + +This experiment has been specifically about creating a unit file for a mount, but it can be applied to other types of unit files as well. The details will be different, but the concepts are the same. Yes, I know it is still easier to add a line to the **/etc/fstab** file than it is to create a mount unit. But this is a good example of how to create a unit file because systemd does not have generators for every type of unit. + +### In summary + +This article looked at systemd units in more detail and how to use the systemctl command to explore and manage units. It also showed how to stop and disable units and create a new systemd mount unit to mount a new filesystem and enable it to initiate during startup. + +In the next article in this series, I will take you through a recent problem I had during startup and show you how I circumvented it using systemd. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. + + * The Fedora Project has a good, practical [guide][10] [to systemd][10]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][11] that cross-references the old SystemV commands to comparable systemd ones. + * For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][12]'s [description of systemd][13]. + * [Linux.com][14]'s "More systemd fun" offers more advanced systemd [information and tips][15]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][16] + * [systemd for Administrators, Part I][17] + * [systemd for Administrators, Part II][18] + * [systemd for Administrators, Part III][19] + * [systemd for Administrators, Part IV][20] + * [systemd for Administrators, Part V][21] + * [systemd for Administrators, Part VI][22] + * [systemd for Administrators, Part VII][23] + * [systemd for Administrators, Part VIII][24] + * [systemd for Administrators, Part IX][25] + * [systemd for Administrators, Part X][26] + * [systemd for Administrators, Part XI][27] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/systemd-units + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/article/20/4/systemd +[3]: https://opensource.com/article/20/4/systemd-startup +[4]: https://en.wikipedia.org/wiki/Sar_%28Unix%29 +[5]: https://en.wikipedia.org/wiki/Pwd +[6]: https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout) +[7]: http://www.both.org/?page_id=1183 +[8]: mailto:chrony-dnssrv@.timer +[9]: mailto:mdadm-last-resort@.timer +[10]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[11]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[12]: http://Freedesktop.org +[13]: http://www.freedesktop.org/wiki/Software/systemd +[14]: http://Linux.com +[15]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[16]: http://0pointer.de/blog/projects/systemd.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[18]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[19]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[20]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[21]: http://0pointer.de/blog/projects/three-levels-of-off.html +[22]: http://0pointer.de/blog/projects/changing-roots +[23]: http://0pointer.de/blog/projects/blame-game.html +[24]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[25]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[26]: http://0pointer.de/blog/projects/instances.html +[27]: http://0pointer.de/blog/projects/inetd.html From 866f79c53dcdaf1cc6d114f2e333c63be2ca3e0a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 May 2020 01:04:05 +0800 Subject: [PATCH 2001/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200506=20Cust?= =?UTF-8?q?omizing=20my=20open=20source=20PHP=20framework=20for=20web=20de?= =?UTF-8?q?velopment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200506 Customizing my open source PHP framework for web development.md --- ...ource PHP framework for web development.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sources/tech/20200506 Customizing my open source PHP framework for web development.md b/sources/tech/20200506 Customizing my open source PHP framework for web development.md index 00b605148d..8247a6ad49 100644 --- a/sources/tech/20200506 Customizing my open source PHP framework for web development.md +++ b/sources/tech/20200506 Customizing my open source PHP framework for web development.md @@ -4,20 +4,20 @@ [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Customizing my open source PHP framework for web development) -[#]: via: (https://opensource.com/article/20/5/codeignitor) +[#]: via: (https://opensource.com/article/20/5/codeigniter) [#]: author: (Wee Ben Sen https://opensource.com/users/bswee14) Customizing my open source PHP framework for web development ====== -Codeignitor is a PHP framework that empowers companies to develop +Codeigniter is a PHP framework that empowers companies to develop high-performance websites with flexibility and ease. ![Business woman on laptop sitting in front of window][1] -PHP Codeignitor is an open source framework providing business applications with the easy-to-use PHP programming language and powerful tools for coding. It also provides business intelligence, server monitoring, development, and application integration facilities. It's a relatively quiet project that you don't hear much about, but it's got a lot going for it that many developers new to it find surprising and refreshing. +PHP Codeigniter is an open source framework providing business applications with the easy-to-use PHP programming language and powerful tools for coding. It also provides business intelligence, server monitoring, development, and application integration facilities. It's a relatively quiet project that you don't hear much about, but it's got a lot going for it that many developers new to it find surprising and refreshing. -I use [Codeignitor][2] at my job working for an online tuition service provider in Singapore. We offer services that aren't common enough to be the default feature set for templates or existing back-ends, so I need something that provides good, solid, raw materials I can build upon. Initially, I was considering other platforms such as Wordpress for our website; however, I arrived at Codeignitor due to its flexibility and integration of functions needed in the tuition-matching process. +I use [Codeigniter][2] at my job working for an online tuition service provider in Singapore. We offer services that aren't common enough to be the default feature set for templates or existing back-ends, so I need something that provides good, solid, raw materials I can build upon. Initially, I was considering other platforms such as Wordpress for our website; however, I arrived at Codeigniter due to its flexibility and integration of functions needed in the tuition-matching process. -Here are the points that sold me on Codeignitor: +Here are the points that sold me on Codeigniter: * Database integration with MySQL—A major functionality is allowing clients to browse the tutor database and add tutors like a "shopping cart" similar to an e-commerce platform. * Client interface system—Users can log in to manage preferences and edit their particulars, modify subject taught, areas traveled, mobile number, address, etc. @@ -31,16 +31,16 @@ The project took around six months to complete and another two months of debuggi ### Features and benefits -There are many more features that draw developers to PHP Codeignitor, including error handling and code formatting, which are useful in every coding situation. It supports templates, which can be used to add functionality to an existing website or to generate new ones. There are many features available for a business that needs to use a web-based system, including the ability to use custom tags. Most can be used by even an average developer who does not have any prior experience in programming. +There are many more features that draw developers to PHP Codeigniter, including error handling and code formatting, which are useful in every coding situation. It supports templates, which can be used to add functionality to an existing website or to generate new ones. There are many features available for a business that needs to use a web-based system, including the ability to use custom tags. Most can be used by even an average developer who does not have any prior experience in programming. -The key features of Codeignitor are: +The key features of Codeigniter are: * XML core services, * HTTP/FTP core services * AppData and PHP sandbox features * XSLT and HTML templates * Encrypted information transfer - * PCM Codeignitor server monitoring + * PCM Codeigniter server monitoring * Application integration * File Transfer Protocol (FTP) * Help desk support @@ -50,23 +50,23 @@ The key features of Codeignitor are: #### Compatibility -Codeignitor is compatible with many leading software applications like PHP, MySQL, [MariaDB][3], [phpMyAdmin][4], [Apache][5], OpenBSD, XSLT, [SQLite][6], and more. A number of companies prefer to use Codeignitor products for their website requirements because they are easy to work with and integrate. If you're not comfortable creating your own website, you can find many developers and design agencies that provide custom web development services. +Codeigniter is compatible with many leading software applications like PHP, MySQL, [MariaDB][3], [phpMyAdmin][4], [Apache][5], OpenBSD, XSLT, [SQLite][6], and more. A number of companies prefer to use Codeigniter products for their website requirements because they are easy to work with and integrate. If you're not comfortable creating your own website, you can find many developers and design agencies that provide custom web development services. #### Security -Codeignitor also provides data security through SSL encryption. The encryption protects the data from external threats such as intruders and firewalls. The data storage facility also allows for security audits of the company's website. +Codeigniter also provides data security through SSL encryption. The encryption protects the data from external threats such as intruders and firewalls. The data storage facility also allows for security audits of the company's website. #### Other features -A good PHP web development company uses several advanced and third-party technologies such as XML and PHP. It provides organizations with a complete platform to develop professional-looking, useful websites with a business application. Codeignitor makes it easy to use third party technology, and works with common web development software. This allows web agencies to easily create websites with their chosen modules. Most PHP developers offer support and training services for individuals, as well. +A good PHP web development company uses several advanced and third-party technologies such as XML and PHP. It provides organizations with a complete platform to develop professional-looking, useful websites with a business application. Codeigniter makes it easy to use third party technology, and works with common web development software. This allows web agencies to easily create websites with their chosen modules. Most PHP developers offer support and training services for individuals, as well. -### Using PHP framework Codeignitor +### Using PHP framework Codeigniter -Codeignitor allows businesses to have a complete package for PHP development that will offer the right combination of power, flexibility, and performance. So far, I am very pleased with our website and I have continuously upgraded and added new features along the way. I look forward to discovering what else I can do with our website using Codeignitor. Could it be right for you too? +Codeigniter allows businesses to have a complete package for PHP development that will offer the right combination of power, flexibility, and performance. So far, I am very pleased with our website and I have continuously upgraded and added new features along the way. I look forward to discovering what else I can do with our website using Codeigniter. Could it be right for you too? -------------------------------------------------------------------------------- -via: https://opensource.com/article/20/5/codeignitor +via: https://opensource.com/article/20/5/codeigniter 作者:[Wee Ben Sen][a] 选题:[lujun9972][b] From 473726103224793847e84829d310e7fcbaf8f427 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 8 May 2020 08:39:09 +0800 Subject: [PATCH 2002/3057] translating --- ...rgerfs to increase your virtual storage.md | 147 ------------------ ...rgerfs to increase your virtual storage.md | 147 ++++++++++++++++++ 2 files changed, 147 insertions(+), 147 deletions(-) delete mode 100644 sources/tech/20200501 Using mergerfs to increase your virtual storage.md create mode 100644 translated/tech/20200501 Using mergerfs to increase your virtual storage.md diff --git a/sources/tech/20200501 Using mergerfs to increase your virtual storage.md b/sources/tech/20200501 Using mergerfs to increase your virtual storage.md deleted file mode 100644 index 734af93148..0000000000 --- a/sources/tech/20200501 Using mergerfs to increase your virtual storage.md +++ /dev/null @@ -1,147 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using mergerfs to increase your virtual storage) -[#]: via: (https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/) -[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) - -Using mergerfs to increase your virtual storage -====== - -![][1] - -What happens if you have multiple disks or partitions that you’d like to use for a media project and you don’t want to lose any of your existing data, but you’d like to have everything located or mounted under one drive. That’s where mergerfs can come to your rescue! - -[mergerfs][2] is a union filesystem geared towards simplifying storage and management of files across numerous commodity storage devices. - -You will need to grab the latest RPM from their github page [here][3]. The releases for Fedora have _**fc**_ and the version number in the name. For example here is the version for Fedora 31: - -[mergerfs-2.29.0-1.fc31.x86_64.rpm][4] - -### Installing and configuring mergerfs - -Install the mergerfs package that you’ve downloaded using sudo: - -``` -$ sudo dnf install mergerfs-2.29.0-1.fc31.x86_64.rpm -``` - -You will now be able to mount multiple disks as one drive. This comes in handy if you have a media server and you’d like all of your media files to show up under one location. If you upload new files to your system, you can copy them to your mergerfs directory and mergerfs will automatically copy them to which ever drive has enough free space available. - -Here is an example to make it easier to understand: - -``` -$ df -hT | grep disk -/dev/sdb1 ext4 23M 386K 21M 2% /disk1 -/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2 - -$ ls -l /disk1/Videos/ -total 1 --rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv - -$ ls -l /disk2/Videos/ -total 2 --rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv --rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv -``` - -In this example there are two disks mounted as _disk1_ and _disk2_. Both drives have a _**Videos**_ directory with existing files. - -Now we’re going to mount those drives using mergerfs to make them appear as one larger drive. - -``` -$ sudo mergerfs -o defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=1M /disk1:/disk2 /media -``` - -The mergerfs man page is quite extensive and complex so we’ll break down the options that were specified. - - * _defaults_: This will use the default settings unless specified. - * _allow_other_: allows users besides sudo or root to see the filesystem. - * _use_ino_: Causes mergerfs to supply file/directory inodes rather than libfuse. While not a default it is recommended it be enabled so that linked files share the same inode value. - * _category.create=mfs_: Spreads files out across your drives based on available space. - * _moveonenospc=true_: If enabled, if writing fails, a scan will be done looking for the drive with the most free space. - * _minfreespace=1M_: The minimum space value used. - * _disk1_: First hard drive. - * _disk2_: Second hard drive. - * _/media_: The directory folder where the drives are mounted. - - - -Here is what it looks like: - -``` -$ df -hT | grep disk -/dev/sdb1 ext4 23M 386K 21M 2% /disk1 -/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2 - -$ df -hT | grep media -1:2 fuse.mergerfs 66M 1.4M 60M 3% /media -``` - -You can see that the mergerfs mount now shows a total capacity of 66M which is the combined total of the two hard drives. - -Continuing with the example: - -There is a 30Mb video called _Baby’s second Xmas.mkv_. Let’s copy it to the _/media_ folder which is the mergerfs mount. - -``` -$ ls -lh "Baby's second Xmas.mkv" --rw-rw-r--. 1 curt curt 30M Apr 20 08:45 Baby's second Xmas.mkv -$ cp "Baby's second Xmas.mkv" /media/Videos/ -``` - -Here is the end result: - -``` -$ df -hT | grep disk -/dev/sdb1 ext4 23M 386K 21M 2% /disk1 -/dev/sdc1 ext4 44M 31M 9.8M 76% /disk2 - -$ df -hT | grep media -1:2 fuse.mergerfs 66M 31M 30M 51% /media -``` - -You can see from the disk space utilization that mergerfs automatically copied the file to disk2 because disk1 did not have enough free space. - -Here is a breakdown of all of the files: - -``` -$ ls -l /disk1/Videos/ -total 1 --rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv - -$ ls -l /disk2/Videos/ -total 30003 --rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv --rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv --rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv - -$ ls -l /media/Videos/ -total 30004 --rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv --rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv --rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv --rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv -``` - -When you copy files to your mergerfs mount, it will always copy the files to the hard disk that has enough free space. If none of the drives in the pool have enough free space, then you won’t be able to copy them. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/ - -作者:[Curt Warfield][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/rcurtiswarfield/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/mergerfs-816x346.png -[2]: https://github.com/trapexit/mergerfs -[3]: https://github.com/trapexit/mergerfs/releases -[4]: https://github.com/trapexit/mergerfs/releases/download/2.29.0/mergerfs-2.29.0-1.fc31.x86_64.rpm diff --git a/translated/tech/20200501 Using mergerfs to increase your virtual storage.md b/translated/tech/20200501 Using mergerfs to increase your virtual storage.md new file mode 100644 index 0000000000..936ed454d9 --- /dev/null +++ b/translated/tech/20200501 Using mergerfs to increase your virtual storage.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using mergerfs to increase your virtual storage) +[#]: via: (https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +使用 mergefs 增加虚拟存储 +====== + +![][1] + +如果你想在一个媒体项目中用上多个磁盘或分区,而又不想丢失任何现有数据,但又想将所有文件都存放在一个驱动器下,该怎么办?这就是 mergefs 派上用场的地方! + +[mergerfs][2] 是旨在简化跨多个商业存储设备文件的存储和管理的联合文件系统。 + +你需要从[这个][3] github 页面获取最新的 RPM。Fedora 的版本名称中带有 _**fc**_ 和版本号。例如,以下是 Fedora 31 的版本: + +[mergerfs-2.29.0-1.fc31.x86_64.rpm][4] + +### 安装和配置 mergefs + +使用 sudo 安装已下载的 mergefs 软件包: + +``` +$ sudo dnf install mergerfs-2.29.0-1.fc31.x86_64.rpm +``` + +现在,你可以将多个磁盘挂载为一个驱动器。如果你有一台媒体服务器,并且希望所有媒体文件都显示在一个地方,这将很方便。如果将新文件上传到系统,那么可以将它们复制到 mergefs 目录,mergefs 会自动将它们复制具有足够可用空间的磁盘上。 + +这是使你更容易理解的例子: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2 + +$ ls -l /disk1/Videos/ +total 1 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv + +$ ls -l /disk2/Videos/ +total 2 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv +``` + +在此例中挂载了两块磁盘,分别为 _disk1_ 和 _disk2_。两个驱动器都有一个包含文件的 _**Videos**_ 目录。 + +现在,我们将使用 mergefs 挂载这些驱动器,使它们看起来像一个更大的驱动器。 + +``` +$ sudo mergerfs -o defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=1M /disk1:/disk2 /media +``` + +mergefs 手册页非常广泛且复杂,因此我们将说明上面提到的选项。 + + * _defaults_:除非指定,否则将使用默认设置。 + * _allow_other_:允许 sudo 或 root 以外的用户查看文件系统。 + * _use_ino_:让 mergefs 提供文件/目录 inode 而不是 libfuse。虽然不是默认值,但建议你启用它,以便链接的文件共享相同的 inode 值。 + * _category.create=mfs_:根据可用空间在驱动器间传播文件。 + * _moveonenospc=true_:如果启用,那么如果写入失败,将进行扫描以查找具有最大可用空间的驱动器。 + * _minfreespace=1M_:最小使用空间值。 + * _disk1_:第一块硬盘。 + * _disk2_:第二块硬盘。 + * _/media_:挂载驱动器的目录。 + + + +看起来是这样的: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2 + +$ df -hT | grep media +1:2 fuse.mergerfs 66M 1.4M 60M 3% /media +``` + +你可以看到现在 mergefs 挂载显示的总容量为 66M,这是两块硬盘的总容量。 + +继续示例: + +有一个叫 _Baby’s second Xmas.mkv_ 的 30M 视频。让我们将其复制到用 mergerfs 挂载的 _/media_ 文件夹中。 + +``` +$ ls -lh "Baby's second Xmas.mkv" +-rw-rw-r--. 1 curt curt 30M Apr 20 08:45 Baby's second Xmas.mkv +$ cp "Baby's second Xmas.mkv" /media/Videos/ +``` + +这是最终结果: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 31M 9.8M 76% /disk2 + +$ df -hT | grep media +1:2 fuse.mergerfs 66M 31M 30M 51% /media +``` + +从磁盘空间利用率中可以看到,因为 disk1 没有足够的可用空间,所以 mergefs 自动将文件复制到 disk2。 + +这是所有文件详情: + +``` +$ ls -l /disk1/Videos/ +total 1 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv + +$ ls -l /disk2/Videos/ +total 30003 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv + +$ ls -l /media/Videos/ +total 30004 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv +``` + +当你将文件复制到 mergefs 挂载点时,它将始终将文件复制到有足够可用空间的硬盘上。如果池中的所有驱动器都没有足够的可用空间,那么你将无法复制它们。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/ + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/mergerfs-816x346.png +[2]: https://github.com/trapexit/mergerfs +[3]: https://github.com/trapexit/mergerfs/releases +[4]: https://github.com/trapexit/mergerfs/releases/download/2.29.0/mergerfs-2.29.0-1.fc31.x86_64.rpm From c6aea43b045b063f0e9a7d072b89a26abcd93efd Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 8 May 2020 08:43:51 +0800 Subject: [PATCH 2003/3057] translating --- ...tudio To Replace Xfce With KDE Plasma Desktop Environment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md b/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md index 586232d723..61c2007784 100644 --- a/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md +++ b/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0f1c6aa3bbbcf726d40eb12f1a14a931ffab9807 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 May 2020 09:40:39 +0800 Subject: [PATCH 2004/3057] PRF @geekpi --- ...200428 Upgrading Fedora 31 to Fedora 32.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md b/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md index 637bf41ce8..a5f6cc9ce0 100644 --- a/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md +++ b/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Upgrading Fedora 31 to Fedora 32) @@ -12,27 +12,27 @@ ![][1] -Fedora 32 [已经发布][2]。你可能想升级系统以获得 Fedora 中的最新功能。Fedora Workstation 有图形化的升级方法。另外,Fedora 提供了命令行方法,用于将 Fedora 30 升级到 Fedora 31。 +Fedora 32 [已经发布][2]。你可能想升级系统以获得 Fedora 中的最新功能。Fedora Workstation 有图形化的升级方法。另外,Fedora 提供了命令行方法,用于将 Fedora 31 升级到 Fedora 32。 -升级前,请访问 [Fedora 32 个常见 bug 的维基页面] [3],查看是否存在可能影响升级的问题。尽管 Fedora 社区试图确保升级正常进行,但是无法为用户可能使用的每种软硬件组合提供保证。 +升级前,请访问 [Fedora 32 个常见 bug 的维基页面][3],查看是否存在可能影响升级的问题。尽管 Fedora 社区试图确保升级正常进行,但是无法为用户可能使用的每种软硬件组合提供保证。 -### 将Fedora 31 Workstation 升级到 Fedora 32 +### 将 Fedora 31 Workstation 升级到 Fedora 32 -发布不久之后就会出现通知,告诉你有可用的升级。你可以单击通知启动 **GNOME Software**。或者,你可以从 GNOME Shell 中选择“软件”。 +在新版本发布不久之后就会出现通知,告诉你有可用的升级。你可以单击该通知启动 “GNOME 软件”。或者,你可以从 GNOME Shell 中选择“软件”。 -在 GNOME Software中 选择 _Updates_ 选项卡,你会看到一个页面通知你 Fedora 32 现在可用。 +在 “GNOME 软件”中选择更新Updates选项卡,你会看到一个页面通知你 Fedora 32 现在可用。 如果你在此页面看不到任何内容,请尝试使用左上方的重新加载按钮。发布后,所有系统可能都需要一段时间才能看到可用的升级。 -选择 _Download_ 获取升级包。你可以继续做事直到下载完成。然后使用 GNOME Software 重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再回来。 +选择下载Download获取升级包。你可以继续做事直到下载完成。然后使用 “GNOME 软件”重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再回来。 ### 使用命令行 -如果你是从 Fedora 的先前版本升级的,那么你可能对 _dnf upgrade_ 插件很熟悉。此方法是从 Fedora 31 升级到 Fedora 32 的推荐和受支持的方法。使用此插件将使你轻松地升级到 Fedora 32。 +如果你是从 Fedora 的先前版本升级的,那么你可能对 `dnf upgrade` 插件很熟悉。这个方法是推荐和受支持的从 Fedora 31 升级到 Fedora 32 的方法。使用此插件将使你轻松地升级到 Fedora 32。 -#### 1\. 更新软件并备份系统 +#### 1、更新软件并备份系统 -在开始升级过程之前,请确保你有 Fedora 31 的最新软件。如果你安装了模块化软件,这尤为重要。dnf 和 GNOME Software 的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用_ GNOME Software_ 或在终端中输入以下命令。 +在开始升级过程之前,请确保你有 Fedora 31 的最新软件。如果你安装了模块化软件modular software,这尤为重要。`dnf` 和 “GNOME 软件”的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用 “GNOME 软件” 或在终端中输入以下命令。 ``` sudo dnf upgrade --refresh @@ -40,7 +40,7 @@ sudo dnf upgrade --refresh 此外,在继续操作之前,请确保备份系统。有关备份的帮助,请参阅 Fedora Magazine 上的[备份系列][4]。 -#### 2\. 安装 DNF 插件 +#### 2、安装 DNF 插件 接下来,打开终端并输入以下命令安装插件: @@ -48,7 +48,7 @@ sudo dnf upgrade --refresh sudo dnf install dnf-plugin-system-upgrade ``` -#### 3\. 使用 DNF 开始更新 +#### 3、使用 DNF 开始更新 现在,你的系统已更新、已备份、并且已安装 DNF 插件,你可以在终端中使用以下命令开始升级: @@ -56,17 +56,17 @@ sudo dnf install dnf-plugin-system-upgrade sudo dnf system-upgrade download --releasever=32 ``` -该命令将开始在本地下载计算机的所有升级,以准备升级。如果由于没有更新的软件包、损坏的依赖项或已淘汰的软件包而在升级时遇到问题,请在输入上述命令时添加 _‐allowerasing_ 标志。这将使 DNF 删除可能阻止系统升级的软件包。 +这个命令将开始在本地下载所有的升级包,为升级做准备。如果你在升级的时候因为没有更新的包、依赖关系破损或退役的包而出现问题,请在输入上述命令时添加 `--allowerasing` 标志。这将允许 DNF 移除可能阻碍系统升级的软件包。 -#### 4\. 重启并升级 +#### 4、重启并升级 -当上一个命令完成了所有升级的下载,你的系统就可以重新启动了。要将系统引导至升级过程,请在终端中输入以下命令: +当上一个命令完成了所有升级包的下载,你的系统就可以重新启动了。要将系统引导至升级过程,请在终端中输入以下命令: ``` sudo dnf system-upgrade reboot ``` -此后,系统将重启。在许多版本之前,_fedup_ 工具会在内核选择/引导页上创建一个新选项。使用 _dnf-plugin-system-upgrade_ 包,你的系统将重启进入 Fedora 31 当前安装的内核;这个是正常的。在选择内核之后,你的系统会立即开始升级过程。 +此后,系统将重启。在许多版本之前,`fedup` 工具会在内核选择/启动页上创建一个新选项。使用 `dnf-plugin-system-upgrade` 包,你的系统会重启进入 Fedora 31 当前安装的内核;这个是正常的。在选择内核之后,你的系统会立即开始升级过程。 现在可能是喝杯咖啡休息的好时机!完成后,系统将重启,你将能够登录到新升级的 Fedora 32 系统。 @@ -85,14 +85,14 @@ via: https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/ 作者:[Adam Šamalík][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://fedoramagazine.org/author/asamalik/ [b]: https://github.com/lujun9972 [1]: https://fedoramagazine.org/wp-content/uploads/2020/04/31-32-816x345.png -[2]: https://fedoramagazine.org/announcing-fedora-32/ +[2]: https://linux.cn/article-12164-1.html [3]: https://fedoraproject.org/wiki/Common_F32_bugs [4]: https://fedoramagazine.org/taking-smart-backups-duplicity/ [5]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png From ed260ec05ed019b957efea8774ede77278f690d1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 May 2020 09:41:06 +0800 Subject: [PATCH 2005/3057] PUB @geekpi https://linux.cn/article-12195-1.html --- .../20200428 Upgrading Fedora 31 to Fedora 32.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200428 Upgrading Fedora 31 to Fedora 32.md (98%) diff --git a/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md b/published/20200428 Upgrading Fedora 31 to Fedora 32.md similarity index 98% rename from translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md rename to published/20200428 Upgrading Fedora 31 to Fedora 32.md index a5f6cc9ce0..c2c4bc0301 100644 --- a/translated/tech/20200428 Upgrading Fedora 31 to Fedora 32.md +++ b/published/20200428 Upgrading Fedora 31 to Fedora 32.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12195-1.html) [#]: subject: (Upgrading Fedora 31 to Fedora 32) [#]: via: (https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/) [#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) From 26adc8d62d551e8bcf00e27f43dae24e412a9669 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 May 2020 09:58:48 +0800 Subject: [PATCH 2006/3057] Rename sources/tech/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md to sources/news/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md --- ... Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md (100%) diff --git a/sources/tech/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md b/sources/news/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md similarity index 100% rename from sources/tech/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md rename to sources/news/20200508 Good News- You Can Now Buy the De-Googled -e-OS Smartphone from Fairphone.md From 2924cda5869786e5d6cebd523107a9b8d0a9917e Mon Sep 17 00:00:00 2001 From: luzw3 Date: Fri, 8 May 2020 14:32:25 +0800 Subject: [PATCH 2007/3057] =?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 --- .../20200410 How Kubernetes saved my desktop application.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200410 How Kubernetes saved my desktop application.md b/sources/tech/20200410 How Kubernetes saved my desktop application.md index ecbd6ee273..8e2cf34da6 100644 --- a/sources/tech/20200410 How Kubernetes saved my desktop application.md +++ b/sources/tech/20200410 How Kubernetes saved my desktop application.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (CrazyShipOne) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c1435a2539bd6cfc203ebb2012fec2193b6dfa34 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 May 2020 22:48:44 +0800 Subject: [PATCH 2008/3057] PRF @geekpi --- ...and Folders on Desktop Screen in Ubuntu.md | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md b/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md index 984bb4dedb..562862520e 100644 --- a/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md +++ b/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using Files and Folders on Desktop Screen in Ubuntu) @@ -10,7 +10,9 @@ 在 Ubuntu 桌面中使用文件和文件夹 ====== -_**此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可能遇到的一些困难。**_ +![](https://img.linux.net.cn/data/attachment/album/202005/08/224609chff5qn5ccah56af.jpg) + +> 此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可能遇到的一些困难。 我认识一些习惯将所有重要/常用文件放在桌面上以便快速访问的人。 @@ -20,9 +22,9 @@ _**此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可 在过去的几个版本中,很难在 Ubuntu 的默认 GNOME 桌面上添加文件。这并不是 Ubuntu 的错。 -[GNOME][2] 的开发者认为,桌面上没有图标和文件的位置。当你可以在菜单中轻松搜索文件时,无需将文件放在桌面上。这部分是事实。 +[GNOME][2] 的开发者认为,桌面上没有图标和文件的存身之地。当你可以在菜单中轻松搜索文件时,无需将文件放在桌面上。这在部分情况下是事实。 -这就是为什么 [GNOME 的文件管理器 Nautilus][3]的较新版本不能很好地支持桌面上的图标和文件的原因。 +这就是为什么 [GNOME 的文件管理器 Nautilus][3] 的较新版本不能很好地支持桌面上的图标和文件的原因。 也就是说,在桌面上添加文件和文件夹并非没有可能。让我告诉你如何做。 @@ -38,7 +40,7 @@ _**此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可 ![Desktop folder can be used to add files to the desktop screen][5] -你添加到此文件夹的所有内容都会反应在桌面上。 +你添加到此文件夹的所有内容都会反映在桌面上。 ![Anything added to the Desktop folder will be reflected on the desktop screen][6] @@ -46,7 +48,7 @@ _**此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可 #### 将文件拖放到桌面不起作用 -现在,如果你尝试在桌面上从文件管理器拖放文件,它会不起使用。这不是一个 bug,它是一个使很多人恼火的功能。 +现在,如果你尝试从文件管理器往桌面上拖放文件,它会不起使用。这不是一个 bug,它是一个使很多人恼火的功能。 一种临时方案是打开两个文件管理器。在其中一个打开“桌面”文件夹,然后将文件拖放到该文件夹​​中,它们将被添加到桌面上。 @@ -54,7 +56,7 @@ _**此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可 #### 你不能使用 Ctrl+C 和 Ctrl+V 在桌面上复制粘贴,请使用右键单击菜单 -更恼人的是,你不能使用 Ctrl+V(著名的键盘快捷键)将文件粘贴到桌面上。 +更恼人的是,你不能使用 `Ctrl+V`(著名的键盘快捷键)将文件粘贴到桌面上。 但是,你仍然可以使用右键单击,然后选择“粘贴”,将文件复制到桌面上。你甚至可以通过这种方式创建新文件夹。 @@ -64,13 +66,13 @@ _**此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可 #### 你无法使用 Delete 键删除文件和文件夹,请再次使用右键菜单 -更糟糕的是,你无法使用 Delete 键或 Shift+Delete 键从桌面上删除文件。但是你仍然可以右键单击文件或文件夹,然后选择“移至回收站”来删除文件。 +更糟糕的是,你无法使用 `Delete` 键或 `Shift+Delete` 键从桌面上删除文件。但是你仍然可以右键单击文件或文件夹,然后选择“移至回收站”来删除文件。 ![Delete files from desktop using right click][8] 好了,你现在知道至少有一种方法可以在桌面上添加文件,但有一些限制。不幸的是,这还没有结束。 -你无法在桌面上用名称搜索文件。通常,如果你开始输入 “abc”,那么以 “abc” 开头的文件会高亮显示。你并不明白。 +你无法在桌面上用名称搜索文件。通常,如果你开始输入 “abc”,那么以 “abc” 开头的文件会高亮显示。但是在这里不行。 我不知道为什么在桌面上添加文件受到了如此多的限制。值得庆幸的是,我不会经常使用它,否则我会感到非常沮丧。 @@ -83,7 +85,7 @@ via: https://itsfoss.com/add-files-on-desktop-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d24a2d5eef4fb1babb454f784829a578b4f65ba1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 May 2020 22:49:16 +0800 Subject: [PATCH 2009/3057] PUB @geekpi https://linux.cn/article-12198-1.html --- ...428 Using Files and Folders on Desktop Screen in Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md (98%) diff --git a/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md b/published/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md similarity index 98% rename from translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md rename to published/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md index 562862520e..a58f9a7895 100644 --- a/translated/tech/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md +++ b/published/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12198-1.html) [#]: subject: (Using Files and Folders on Desktop Screen in Ubuntu) [#]: via: (https://itsfoss.com/add-files-on-desktop-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From e2551e28f4169713f1a3c7eecd515fa790feac61 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Fri, 8 May 2020 23:06:19 +0800 Subject: [PATCH 2010/3057] APL --- ...200506 Managing Git projects with submodules and subtrees.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200506 Managing Git projects with submodules and subtrees.md b/sources/tech/20200506 Managing Git projects with submodules and subtrees.md index f906f2a4e4..66f89ca545 100644 --- a/sources/tech/20200506 Managing Git projects with submodules and subtrees.md +++ b/sources/tech/20200506 Managing Git projects with submodules and subtrees.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 04be984af861c64adf5ab4de7b4e2bad92d9065f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 9 May 2020 00:54:38 +0800 Subject: [PATCH 2011/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200507=20How?= =?UTF-8?q?=20to=20repeat=20a=20Linux=20command=20until=20it=20succeeds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200507 How to repeat a Linux command until it succeeds.md --- ...epeat a Linux command until it succeeds.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 sources/tech/20200507 How to repeat a Linux command until it succeeds.md diff --git a/sources/tech/20200507 How to repeat a Linux command until it succeeds.md b/sources/tech/20200507 How to repeat a Linux command until it succeeds.md new file mode 100644 index 0000000000..1eb586b267 --- /dev/null +++ b/sources/tech/20200507 How to repeat a Linux command until it succeeds.md @@ -0,0 +1,30 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to repeat a Linux command until it succeeds) +[#]: via: (https://www.linux.com/news/how-to-repeat-a-linux-command-until-it-succeeds/) +[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/) + +How to repeat a Linux command until it succeeds +====== + +If you want to run a command on a Linux system until it succeeds, there are some really easy ways to do it that don’t require you to retype the command repeatedly or sit in front of your screen pressing !! Let’s look at the two options available with bash. + +Read More at [Network World][1] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/how-to-repeat-a-linux-command-until-it-succeeds/ + +作者:[Linux.com Editorial Staff][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/linuxdotcom/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3541298/how-to-repeat-a-linux-command-until-it-succeeds.html From e2c3b95ce71aeff916ddb6d63ab9d07ac42b65d9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 9 May 2020 01:04:48 +0800 Subject: [PATCH 2012/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200508=205=20?= =?UTF-8?q?ways=20to=20split=20your=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200508 5 ways to split your Linux terminal.md --- ...508 5 ways to split your Linux terminal.md | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 sources/tech/20200508 5 ways to split your Linux terminal.md diff --git a/sources/tech/20200508 5 ways to split your Linux terminal.md b/sources/tech/20200508 5 ways to split your Linux terminal.md new file mode 100644 index 0000000000..b1115fbfcb --- /dev/null +++ b/sources/tech/20200508 5 ways to split your Linux terminal.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to split your Linux terminal) +[#]: via: (https://opensource.com/article/20/5/split-terminal) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 ways to split your Linux terminal +====== +What's your favorite terminal multiplexer? Take our poll. Then read +about how Linux offers plenty of ways for you to split your terminal so +you can multitask. +![4 different color terminal windows with code][1] + +Is there anything better than a warmly flickering Linux terminal? + +Sure there is: two warmly flickering Linux terminals. In fact, the more, the better. + +Long ago, [terminals were physical devices][2], but of course, today, they're just emulated as an application on your computer. If you prefer the terminal as your interface, you probably know that one terminal is rarely enough. Inevitably, you're going to open a new terminal or a new tab so you can work in it while your first is busy compiling or converting or otherwise processing data. + +If you're a sysadmin, then you know you're going to need at least four open windows while you work on several systems at the same time. + +Terminal applications with tabs have existed on Linux for a long time, and luckily, that trend seems to have caught on such that it's an expected feature of a modern terminal. And yet, sometimes it's distracting or inconvenient to flip back and forth between tabs. + +The only answer is a split screen so that two or more terminals can exist at the same time within just one application window. There are many tools in your Linux kit to help you slice and dice your consoles. + +### Shells, terminals, and consoles + +Before you slice and dice screens, you should know the difference between a terminal, a shell, and a "console." To get the full picture, read my article on the subject over on the [Enable Sysadmin][2] blog. + +The short version: + + * A shell is an input and output screen with a prompt. There's technically a shell running somewhere underneath your [POSIX][3] desktop, even when it's not visible (because it's a shell that launched your user session). + * A terminal is an application running within a graphics server (such as X11 or Wayland) with a shell loaded into it. A terminal is only running when you have a terminal window launched. It's more or less a "portal" into your shell. + * "Console" or "virtual console" is a term usually used to imply a shell running outside of your desktop. You can get to a virtual console by pressing **Alt-Ctrl-F2** (more are usually available from **F3** up to **F7**, with **F1** or **F7** representing your desktop, depending on your distribution). + + + +Some applications let you split your shell or console, while others let you split your terminal. + +### tmux + +![tmux terminal][4] + +Arguably the most flexible and capable of screen splitters, [tmux][5] is a keyboard-centric terminal multiplexer, meaning that you can "layer" one console on top of another and then switch between the two. You can also split a console view in half (or thirds or fourths, and so on) so you can see other consoles next to it. + +All controls center around the keyboard, which means you never have to take your hand off the keys in search of a mouse, but also that you must learn some new keyboard combos. + +If you're using tmux primarily for screen splitting, then the only commands you really need are these: + + * **Ctrl-B %** for a vertical split (one shell on the left, one shell on the right) + * **Ctrl-B"** for a horizontal split (one shell at the top, one shell at the bottom) + * **Ctrl-B O** to make the other shell active + * **Ctrl-B ?** for help + * **Ctrl-B d** detach from Tmux, leaving it running in the background (use **tmux attach** to reenter) + + + +There are many benefits to tmux, including the ability to start a tmux session on one computer, and then join that same session from another computer remotely. It essentially daemonizes your shell. + +It's with tmux running on a Pi, for example, that I can stay logged into IRC on a permanent basis—I start tmux on the Pi, and then log in from whatever computer I happen to be on. When I log out, tmux continues to run, patiently waiting for me to reattach to the session from a different computer. + +### GNU Screen + +![GNU Screen terminal][6] + +Similar to tmux, [GNU Screen][7] is a shell multiplexer. You can detach and reattach from a running session, and you can split the screen both horizontally and vertically. + +Screen is a little clunkier than tmux. Its default key binding is **Ctrl-A**, which also happens to be Bash's keyboard shortcut to go to the beginning of a line. This means that if you have Screen running, you must press **Ctrl-A** twice instead of just once to go to the beginning of the line. Personally, I redefine the trigger key to **Ctrl-J** with this line in **$HOME/.screenrc**: + + +``` +`escape ^jJ` +``` + +Screen's split function works well, but it leaves out a few pleasantries that tmux lacks. For instance, when you split your shell, a new shell does not start in the other panel. You have to navigate to the other space with **Ctrl-A Tab** (or **Ctrl-J** if you redefine your keyboard shortcut as I do) and create a new shell manually with **Ctrl-A C**. + +Unlike tmux, a split doesn't go away when you exit a shell, which is a design feature that's quite nice in some instances but can also sometimes be cumbersome because it forces you to manage your splits manually. + +Still, Screen is a reliable and flexible application that you can run should you find that **tmux** is unavailable to you. + +Here are the basic split commands, using the default keyboard shortcuts: + + * **Ctrl-A |** for a vertical split (one shell on the left, one shell on the right) + * **Ctrl-A S** for a horizontal split (one shell at the top, one shell at the bottom) + * **Ctrl-A Tab** to make the other shell active + * **Ctrl-A ?** for help + * **Ctrl-A d** detach from Screen, leaving it running in the background (use **screen -r** to reenter) + + + +### Konsole + +![Konsole screen][8] + +[Konsole][9] is the terminal bundled along with the KDE Plasma desktop. Like KDE itself, Konsole is famous for being highly customizable and powerful. + +Among its many features is the ability to split its window, similar to both tmux and GNU Screen. Because Konsole is a graphical terminal, you can control its split-screen feature with your mouse instead of your keyboard. + +Splitting is found in the **View** menu of Konsole. You can split your window horizontally or vertically. To change which panel is active, just click on it. Each panel is a unique terminal, so it can have its own theme and tabs. + +Unlike tmux and GNU Screen, you can't detach and reattach from Konsole. Like most graphical applications, you use Konsole while you're physically in front of it, and you lose access to it when you're away (unless you use remote desktop software). + +### Emacs + +![Emacs rpg][10] + +Emacs isn't exactly a terminal multiplexer, but its interface supports splitting and resizing, and it has a built-in terminal. + +If you're in Emacs on a daily basis anyway, the ability to split your window between essentially different applications means you never have to leave the familiarity and comfort of your favorite text editor. Furthermore, because the Emacs **eshell** module is implemented in eLISP, you can interact with it using the same commands you use in Emacs itself, making it trivial to copy and yank long file paths or command output. + +If you're using Emacs in a graphical window, you can perform some actions with your mouse. It's faster to use keyboard shortcuts, and some are more or less required. For instance, you can change which panel is the active one by clicking into it, and you can resize the proportions of your split screen with your mouse. + +These are the important keyboard shortcuts: + + * **Ctrl-X 3** for a vertical split (one shell on the left, one shell on the right) + * **Ctrl-X 2** for a horizontal split (one shell at the top, one shell at the bottom) + * **Ctrl-X O** to make the other shell active (you can also do this with the mouse) + * **Ctrl-X 0** (that’s a zero) close the current panel + + + +Similar to tmux and GNU Screen, you can detach and reattach from Emacs as long as you run **emacs-client**. + +### Window manager + +![Ratpoison split screen][11] + +Should you think a text editor that can split its screen and load a terminal is amazing, imagine your desktop serving the same purpose. There are Linux desktops, like [Ratpoison][12], [Herbsluftwm][13], i3, Awesome, and even the KDE Plasma desktop with specific settings enabled, that present each application window to you as a fixed tile in a desktop grid. + +Instead of windows floating "above" your desktop, they remain in a predictable place so you can change from one to the other. You can open any number of terminals within your grid, emulating a terminal multiplexer. In fact, you could even load a terminal multiplexer in your desktop multiplexer. + +And there's nothing stopping you from loading Emacs with split buffers inside of that. No one knows what happens if you take it further than that, and most Linux users agree it's best not to find out. + +Unlike tmux and GNU Screen, you can't detach and reattach from your desktop unless you count using remote desktop software. + +### Other options + +Believe it or not, these aren't the only options you have to split your screen on Linux. There are other terminal emulators, like [Tilix][14] and Terminator before it, that can split into sections, and applications with embedded terminal components, and much more. Tell us your favorite way of splitting up your workspace in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/split-terminal + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/freedos.png?itok=aOBLy7Ky (4 different color terminal windows with code) +[2]: https://www.redhat.com/sysadmin/terminals-shells-consoles +[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[4]: https://opensource.com/sites/default/files/uploads/terminal-split-tmux2.png (tmux terminal) +[5]: https://github.com/tmux/tmux +[6]: https://opensource.com/sites/default/files/uploads/terminal-split-screen.png (GNU Screen terminal) +[7]: https://www.gnu.org/software/screen/ +[8]: https://opensource.com/sites/default/files/uploads/konsole.jpg (Konsole screen) +[9]: https://konsole.kde.org +[10]: https://opensource.com/sites/default/files/uploads/emacs-rpg_0.jpg (Emacs rpg) +[11]: https://opensource.com/sites/default/files/uploads/advent-ratpoison-split_0.jpg (Ratpoison split screen) +[12]: https://opensource.com/article/19/12/ratpoison-linux-desktop +[13]: https://opensource.com/article/19/12/herbstluftwm-linux-desktop +[14]: https://gnunn1.github.io/tilix-web/ From 467fafcaf77526fe15d1bdb93be779d5ed8ceab6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 9 May 2020 01:05:28 +0800 Subject: [PATCH 2013/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200508=20Gett?= =?UTF-8?q?ing=20started=20with=20FreeBSD=20as=20a=20desktop=20operating?= =?UTF-8?q?=20system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md --- ...h FreeBSD as a desktop operating system.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md diff --git a/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md b/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md new file mode 100644 index 0000000000..0ce2dc4e32 --- /dev/null +++ b/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with FreeBSD as a desktop operating system) +[#]: via: (https://opensource.com/article/20/5/furybsd-linux) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +Getting started with FreeBSD as a desktop operating system +====== +FuryBSD's live desktop environment lets you try it before committing to +it. +![web development and design, desktop and browser][1] + +[FreeBSD][2] is a great operating system, but, by design, it does not come with a desktop environment. Without installing additional software from FreeBSD's [ports and packages collection][3], FreeBSD is a command-line only experience. The screenshot below shows what logging into FreeBSD 12.1 looks like when every one of the "optional system components" is selected during installation. + +![FreeBSD][4] + +FreeBSD can be turned into a desktop operating system with any of a wide selection of desktop environments, but it takes time, effort, and [following a lot of written instructions][5]. Using the **desktop-installer** package, which provides the user with options in a text-based menu and helps automate much of the process, is still time-consuming. The biggest problem with either of these methods is that users might find out that their system is not fully compatible with FreeBSD after they have taken all the time to set things up. + +[FuryBSD][6] solves that problem by providing a live desktop image that users can evaluate before installing. Currently, FuryBSD provides an Xfce image and a KDE image. Each of these images provides an installation of FreeBSD that has a desktop environment pre-installed. If users try out the image and find that their hardware works, they can install FuryBSD and have a ready-to-go desktop operating system powered by FreeBSD. For the purposes of this article, I will be using the Xfce image, but the KDE image works the exact same way. + +Getting started with FuryBSD should be a familiar process to anyone who has installed a Linux distribution, any of the BSDs, or any other Unix-like open source operating system. Download the ISO from the FuryBSD website, copy it to a flash drive, and boot a computer from the flash drive. If booting from the flash drive fails, make sure Secure Boot is disabled. + +![FuryBSD Live XFCE Desktop][7] + +After booting from the flash drive, the desktop environment loads automatically. In addition to the Home, File System, and Trash icons, the live desktop has icons for a tool to configure Xorg, getting started instructions, the FuryBSD installer, and a system information utility. Other than these extras and some custom Xfce settings and wallpaper, the desktop environment does not come with much beyond the basic Xfce applications and Firefox. + +![FuryBSD Xorg Tool][8] + +Only basic graphics drivers are loaded at this point, but it is enough to check to see if the system's wired and wireless network interfaces are supported by FuryBSD. If none of the network interfaces is working automatically, the **Getting Started.txt** file contains instructions for attempting to configure network interfaces and other configuration tasks. If at least one of the network interfaces works, the **Configure Xorg** application can be used to install Intel, NVidia, or VirtualBox graphics drivers. The drivers will be downloaded and installed, and Xorg will need to be restarted. If the system does not automatically re-login to the live image user, the password is **furybsd**. Once they are configured, the graphics drivers will carry over to an installed system. + +![FuryBSD Installer - ZFS Configuration][9] + +If everything works well in the live environment, the FuryBSD installer can configure and install FuryBSD onto the computer. This installer runs in a terminal, but it provides the same options found in most other BSD and Linux installers. The user will be asked to set the system's hostname, configure ZFS storage, set the root password, add at least one non-root user, and configure the time and date settings. Once the process is complete, the system can be rebooted into a pre-configured FreeBSD with an Xfce (or KDE) desktop. FuryBSD did all the hard work and even took the extra effort to make the desktop look nice. + +![FuryBSD Post-Install XFCE Desktop][10] + +As noted above, the desktop environment does not come with a lot of pre-installed software, so installing additional packages is almost certainly necessary. The quickest way to do this is by using the **pkg** command in the terminal. This command behaves much like **dnf** and **apt**, so users coming from a Linux distribution that uses one of those should feel right at home when it comes to finding and installing packages. FreeBSD's package collection is large, so most of the big-name open source software packages are available. + +Users trying out FuryBSD without having much FreeBSD experience should consult the [FreeBSD Handbook][11] to learn more about how to do things the FreeBSD way. Users with experience using any Linux distribution or one of the other BSDs should be able to figure out a lot of things, but there are differences that the handbook can help clarify. Another great resource for learning more about the FreeBSD way of doing things is _[Absolute FreeBSD, 3rd Edition][12],_ by Michael W. Lucas. + +A brief overview of PC-BSD and thoughts about the distribution. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/furybsd-linux + +作者:[Joshua Allen Holm][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) +[2]: https://www.freebsd.org +[3]: https://www.freebsd.org/ports/ +[4]: https://opensource.com/sites/default/files/uploads/freebsd.png (FreeBSD) +[5]: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/ +[6]: https://www.furybsd.org +[7]: https://opensource.com/sites/default/files/uploads/furybsd_live_xfce_desktop.png (FuryBSD Live XFCE Desktop) +[8]: https://opensource.com/sites/default/files/uploads/furybsd_xorg_tool.png (FuryBSD Xorg Tool) +[9]: https://opensource.com/sites/default/files/uploads/furybsd_installer_-_zfs_configuration.png (FuryBSD Installer - ZFS Configuration) +[10]: https://opensource.com/sites/default/files/uploads/furybsd_post-install_xfce_desktop.png (FuryBSD Post-Install XFCE Desktop) +[11]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ +[12]: https://nostarch.com/absfreebsd3 From 1b952189f0437987229ddca3634ad76244ee2415 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 9 May 2020 01:06:03 +0800 Subject: [PATCH 2014/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200508=20A=20?= =?UTF-8?q?guide=20to=20setting=20up=20your=20Open=20Source=20Program=20Of?= =?UTF-8?q?fice=20(OSPO)=20for=20success?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md --- ...ource Program Office (OSPO) for success.md | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md diff --git a/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md b/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md new file mode 100644 index 0000000000..ea3aa01866 --- /dev/null +++ b/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md @@ -0,0 +1,193 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A guide to setting up your Open Source Program Office (OSPO) for success) +[#]: via: (https://opensource.com/article/20/5/open-source-program-office) +[#]: author: (J. Manrique Lopez de la Fuente https://opensource.com/users/jsmanrique) + +A guide to setting up your Open Source Program Office (OSPO) for success +====== +Learn how to best grow and maintain your open source communities and +allies. +![community team brainstorming ideas][1] + +Companies create Open Source Program Offices (OSPO) to manage their relationship with the open source ecosystems they depend on. By understanding the company's open source ecosystem, an OSPO is able to maximize the company's return on investment and reduce the risks of consuming, contributing to, and releasing open source software. Additionally, since the company depends on its open source ecosystem, ensuring its health and sustainability shall ensure the company's health, sustainable growth, and evolution. + +### How has OSPO become vital to companies and their open source ecosystem? + +Marc Andreessen has said that "software is eating the world," and more recently, it could be said that open source is eating the software world. But how is that process happening? + +Companies get involved with open source projects in several ways. These projects comprise the company's open source ecosystem, and their relationships and interactions can be seen through Open Source Software's (OSS) inbound and outbound processes. + +From the OSS inbound point of view, companies use it to build their own solutions and their own infrastructure. OSS gets introduced because it's part of the code their technology providers use, or because their own developers add open source components to the company's information technology (IT) infrastructure. + +From the OSS outbound point of view, some companies contribute to OSS projects. That contribution could be part of the company's requirements for their solutions that need certain fixes in upstream projects. For example, Samsung contributes to certain graphics-related projects to ensure its hardware has software support once it gets into the market. In some other cases, contributing to OSS is a mechanism to retain talent by allowing the people to contribute to projects different from their daily work. + +Some companies release their own open source projects as an outbound OSS process. For companies like Red Hat or GitLab, it would be expected. But, there are increasingly more non-software companies releasing a lot of OSS, like Lyft. + +![OSS inbound and outbound processes][2] + +OSS inbound and outbound processes + +Ultimately, all of these projects involved in the inbound and outbound OSS flow are the company's OSS ecosystem. And like any living being, the company's health and sustainability depend on the ecosystem that surrounds it. + +### OSPO responsibilities + +Following the species and their ecosystem, people working in the OSPO team could be seen as the rangers in the organization's OSS ecosystem. They take care of the ecosystem and its relationship with the company, to keep everything healthy and sustainable. + +When the company consumes open source software projects, they need to be aware of licenses and compliance, to check the project's health, to ensure there are no security flaws, and, in some cases, to identify talented community members for potential hiring processes. + +When the company contributes to open source software projects, they need to be sure there are no Intellectual Property (IP) issues, to ensure the company contributions' footprint and its leadership in the projects, and sometimes, also to help talented people stay engaged with the company through their contributions. + +And when the company releases and maintains open source projects, they are responsible for ensuring community engagement and growth, for checking there are no IP issues, that the company maintains its footprint and leadership, and perhaps, to attract new talent to the company. + +Have you realized the whole set of skills required in an OSPO team? When I've asked people working in OSPO about the size of their teams, the number is around 1 to 5 people per 1,000 developers in the company. That's a small team to monitor a lot of people and their potential OSS related activity. + +### How to manage an OSPO + +With all these activities in OSPO people's minds and all the resources they need to worry about, how are they able to manage all of this? + +There are at least a couple of open source communities with valuable knowledge and resources available for them: + + * The [TODO Group][3] is "an open group of companies who want to collaborate on practices, tools, and other ways to run successful and effective open source projects and programs." For example, they have a complete set of [guides][4] with best practices for and from companies running OSPOS. + * The [CHAOSS (Community Health Analytics for Open Source Software)][5] community develops metrics, methodologies, and software for managing open source project health and sustainability. (See more on CHAOSS' active communities and working groups below). + + + +OSPO managers need to report a lot of information to the rest of the company to answer many questions related to their OSS inbound and outbound processes, i.e., Which projects are we using in our organization? What's the health of those projects? Who are the key people in those projects? Which projects are we contributing to? Which projects are we releasing? How are we dealing with community contributions? Who are the key contributors? + +### Data-driven OSPO + +As William Edwards Deming said, "Without data, you are just a person with an opinion." + +Having opinions is not a bad thing, but having opinions based on data certainly makes it easier to understand, discuss, and determine the processes best suited to your company and its goals. CHAOSS is the recommended community to look to for guidance about metrics strategies and tools. + +Recently, the CHAOSS community has released [a new set of metric definitions][6]. These metrics are only subsets of all the ones being discussed in the focus areas of each working group (WG): + + * [Common WG][7]: Defines the metrics that are used by both working groups or are important for community health, but that do not cleanly fit into one of the other existing working groups. Areas of interest include organizational affiliation, responsiveness, and geographic coverage. + * [Diversity and Inclusion WG][8]: Gathers experiences regarding diversity and inclusion in open source projects with the goal of understanding, from a qualitative and quantitative point of view, how diversity and inclusion can be measured. + * [Evolution WG][9]: Refines the metrics that inform evolution and works with software implementations. + * [Risk WG][10]: Refines the metrics that inform risk and works with software implementations. + * [Value WG][11]: Focuses on industry-standard metrics for economic value in open source. Their main goal is to publish trusted industry-standard value metrics—a kind of S&P for software development and an authoritative source for metrics significance and industry norms. + + + +On the tooling side, projects like [Augur][12], [Cregit][13], and [GrimoireLab][14] are the reference tools that report these metrics, but also many others related to OSPO activities. They are also the seed for new tools and solutions provided by the OSS community like [Cauldron.io][15], a SaaS open source solution to ease OSS ecosystem analysis. + +![CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io][16] + +CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io + +All these metrics and data are useless without a metrics strategy. Usually, the first approach is to try to measure as much as possible, producing overwhelming reports and dashboards full of charts and data. What is the value of that? + +Experience has shown that a very valid approach is the [Goal, Questions, Metrics (GQM)][17] strategy. But how do we put that in practice in an OSPO? + +First of all, we need to understand the company's goals when using, consuming, contributing to, or releasing and maintaining OSS projects. The usual goals are related to market positioning, required upstream features development, and talent attraction or retention. Based on these goals, we should write down related questions that can be answered with numbers, like the following: + +#### Who/how many are the core maintainers of my OSS ecosystem projects? + +![Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io][18] + +Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io + +People contribute through different mechanisms or tools (code, issues, comments, tests, etc.). Measuring the core contributors (those that have done 80% of the contributions), the regular ones (those that have done 15% of the contributions), and the casual ones (those have made 5% of the contributions) can answer questions related to participation over time, but also how people move between the different buckets. Adding affiliation information helps to identify external core contributors. + +#### Where are the contributions happening? + +![Uber OSS activity based on location. Source: uber.biterg.io][19] + +Uber OSS activity based on location. Source: uber.biterg.io + +The growth of OSS ecosystems is also related to OSS projects spread across the world. Understanding that spread helps OSPO, and the company, to manage actions that improve support for people from different countries and regions. + +#### What is the company's OSS network? + +![Uber OSS network. Source: uber.biterg.io][20] + +Uber OSS network. Source: uber.biterg.io + +The company's OSS ecosystem includes those projects that the company's people contribute to. Understanding which projects they contribute to offers insight into which technologies or OSS components are interesting to people, and which companies or organizations the company collaborates with. + +#### How is the company dealing with contributions? + +![Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io][21] + +Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io + +One of the goals when releasing OSS projects is to grow the community around them. Measuring how the company handles contributions to its projects from outside its boundaries helps to understand how "welcoming" it is and identifies mentors (or bottlenecks) and opportunities to lower the barrier to contribute. + +#### Consumers vs. maintainers + +Over the last months, we have been hearing that corporations are taking OSS for free without contributing back. The typical arguments are that these corporations are making millions of dollars thanks to free work, plus the issue of OSS project maintainer burnout due to users' complaints and requests for free support. + +The system is unbalanced; usually, the number of users exceeds the number of maintainers. Is that good or bad? Having users for our software is (or should be) good. But we need to manage expectations on both sides. + +From the corporation's point of view, consuming OSS without care is very, very risky. + +OSPO can play an important role in educating the company about the risks they are facing, and how to reduce them by contributing back to their OSS ecosystem. Remember, a company's overall sustainability could rely heavily on its ecosystem sustainability. + +A good strategy is to start shifting your company from being pure OSS consumers to becoming contributors to their OSS inbound projects. From just submitting issues and asking questions to help solve issues, answering questions, and even sending patches, contributing helps grow and maintain the project while giving back to the community. It doesn't happen immediately, but over time, the company will be perceived as an OSS ecosystem citizen. Eventually, some people from the company could end up helping to maintain those projects too. + +And what about money? There are plenty of ways to support the OSS ecosystem financially. Some examples: + + * Business initiatives like [Tidelift][22], or [OpenCollective][23] + * Foundations and their supporting mechanisms, like [Software Freedom Conservancy][24], or [CommunityBridge][25] from the Linux Foundation + * Self-funding programs (like [Indeed][26] and [Salesforce][27] have done) + * Emerging gig development approaches like [Github Sponsors][28] or [Patreon][29] + + + +Last but not least, companies need to avoid the "not invented here" syndrome. For some OSS projects, there might be companies providing consulting, customization, maintenance, and/or support services. Instead of taking OSS and spending time and people to self-host, self-customize, or try to bring those kinds of services in-house, it might be smarter and more efficient to hire some of those companies to do the thought work. + +As a final remark, I would like to emphasize the importance of an OSPO for a company to succeed and grow in the current market. As shepherds of the company's OSS ecosystem, they are the best people in the organization to understand how the ecosystem works and flows, and they should be empowered to manage, monitor, and make recommendations and decisions to ensure sustainability and growth. + +Does your organization have an OSPO yet? + +Six common traits of successful open source programs, and a look back at how the open source... + +Why would a company not in the business of software development create an open source program... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/open-source-program-office + +作者:[J. Manrique Lopez de la Fuente][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jsmanrique +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/meeting_discussion_brainstorm.png?itok=7_m4CC8S (community team brainstorming ideas) +[2]: https://opensource.com/sites/default/files/uploads/ospo_1.png (OSS inbound and outbound processes) +[3]: https://todogroup.org/ +[4]: https://todogroup.org/guides/ +[5]: https://chaoss.community/ +[6]: https://chaoss.community/metrics/ +[7]: https://github.com/chaoss/wg-common +[8]: https://github.com/chaoss/wg-diversity-inclusion +[9]: https://github.com/chaoss/wg-evolution +[10]: https://github.com/chaoss/wg-risk +[11]: https://github.com/chaoss/wg-value +[12]: https://github.com/chaoss/augur +[13]: https://github.com/cregit +[14]: https://chaoss.github.io/grimoirelab/ +[15]: https://cauldron.io/ +[16]: https://opensource.com/sites/default/files/uploads/ospo_2.png (CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io) +[17]: https://en.wikipedia.org/wiki/GQM +[18]: https://opensource.com/sites/default/files/uploads/ospo_3.png (Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io) +[19]: https://opensource.com/sites/default/files/uploads/ospo_4.png (Uber OSS activity based on location. Source: uber.biterg.io) +[20]: https://opensource.com/sites/default/files/uploads/ospo_5_0.png (Uber OSS network. Source: uber.biterg.io) +[21]: https://opensource.com/sites/default/files/uploads/ospo_6.png (Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io) +[22]: https://tidelift.com/ +[23]: https://opencollective.com/ +[24]: https://sfconservancy.org/ +[25]: https://funding.communitybridge.org/ +[26]: https://engineering.indeedblog.com/blog/2019/02/sponsoring-osi/ +[27]: https://sustain.codefund.fm/23 +[28]: https://help.github.com/en/github/supporting-the-open-source-community-with-github-sponsors +[29]: https://www.patreon.com/ From fbbbc4c7ca206c03746dc65e9d41081395666ee1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 9 May 2020 08:49:34 +0800 Subject: [PATCH 2015/3057] translated --- ...428 What-s new in Fedora 32 Workstation.md | 89 ------------------- ...428 What-s new in Fedora 32 Workstation.md | 89 +++++++++++++++++++ 2 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 sources/tech/20200428 What-s new in Fedora 32 Workstation.md create mode 100644 translated/tech/20200428 What-s new in Fedora 32 Workstation.md diff --git a/sources/tech/20200428 What-s new in Fedora 32 Workstation.md b/sources/tech/20200428 What-s new in Fedora 32 Workstation.md deleted file mode 100644 index 7553d1bb99..0000000000 --- a/sources/tech/20200428 What-s new in Fedora 32 Workstation.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What’s new in Fedora 32 Workstation) -[#]: via: (https://fedoramagazine.org/whats-new-fedora-32-workstation/) -[#]: author: (Ryan Lerch https://fedoramagazine.org/author/ryanlerch/) - -What’s new in Fedora 32 Workstation -====== - -![][1] - -Fedora 32 Workstation is the [latest release][2] of our free, leading-edge operating system. You can download it from [the official website here][3] right now. There are several new and noteworthy changes in Fedora 32 Workstation. Read more details below. - -### GNOME 3.36 - -Fedora 32 Workstation includes the latest release of GNOME Desktop Environment for users of all types. GNOME 3.36 in Fedora 32 Workstation includes many updates and improvements, including: - -#### Redesigned Lock Screen - -The lock screen in Fedora 32 is a totally new experience. The new design removes the “window shade” metaphor used in previous releases, and focuses on ease and speed of use. - -![Unlock screen in Fedora 32][4] - -#### New Extensions Application - -Fedora 32 features the new Extensions application, to easily manage your GNOME Extensions. In the past, extensions were installed, configured, and enabled using either the Software application and / or the Tweak Tool. - -![The new Extensions application in Fedora 32][5] - -Note that the Extensions application is not installed by default on Fedora 32. To either use the Software application to search and install, or use the following command in the terminal: - -``` -sudo dnf install gnome-extensions-app -``` - -#### Reorganized Settings - -Eagle-eyed Fedora users will notice that the Settings application has been re-organized. The structure of the settings categories is a lot flatter, resulting in more settings being visible at a glance. - -Additionally, the **About** category now has a more information about your system, including which windowing system you are running (e.g. Wayland) - -![The reorganized settings application in Fedora 32][6] - -#### Redesigned Notifications / Calendar popover - -The Notifications / Calendar popover — toggled by clicking on the Date and Time at the top of your desktop — has had numerous small style tweaks. Additionally, the popover now has a **Do Not Disturb** switch to quickly disable all notifications. This quick access is useful when presenting your screen, and not wanting your personal notifications appearing. - -![The new Notification / Calendar popover in Fedora 32 ][7] - -#### Redesigned Clocks Application - -The Clocks application is totally redesigned in Fedora 32. It features a design that works better on smaller windows. - -![The Clocks application in Fedora 32][8] - -GNOME 3.36 also provides many additional features and enhancements. Check out the [GNOME 3.36 Release Notes][9] for further information - -* * * - -### Improved Out of Memory handling - -Previously, if a system encountered a low-memory situation, it may have encountered heavy swap usage (aka [swap thrashing][10])– sometimes resulting in the Workstation UI slowing down, or becoming unresponsive for periods of time. Fedora 32 Workstation now ships and enables EarlyOOM by default. EarlyOOM enables users to more quickly recover and regain control over their system in low-memory situations with heavy swap usage. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/whats-new-fedora-32-workstation/ - -作者:[Ryan Lerch][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/ryanlerch/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/fedora32workstation-816x345.jpg -[2]: https://fedoramagazine.org/announcing-fedora-32/ -[3]: https://getfedora.org/workstation -[4]: https://fedoramagazine.org/wp-content/uploads/2020/04/unlock.gif -[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/extensions.png -[6]: https://fedoramagazine.org/wp-content/uploads/2020/04/settings.png -[7]: https://fedoramagazine.org/wp-content/uploads/2020/04/donotdisturb.png -[8]: https://fedoramagazine.org/wp-content/uploads/2020/04/clocks.png -[9]: https://help.gnome.org/misc/release-notes/3.36/ -[10]: https://en.wikipedia.org/wiki/Thrashing_(computer_science) diff --git a/translated/tech/20200428 What-s new in Fedora 32 Workstation.md b/translated/tech/20200428 What-s new in Fedora 32 Workstation.md new file mode 100644 index 0000000000..383da73a32 --- /dev/null +++ b/translated/tech/20200428 What-s new in Fedora 32 Workstation.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What’s new in Fedora 32 Workstation) +[#]: via: (https://fedoramagazine.org/whats-new-fedora-32-workstation/) +[#]: author: (Ryan Lerch https://fedoramagazine.org/author/ryanlerch/) + +Fedora 32 Workstation 的新功能 +====== + +![][1] + +Fedora 32 Workstation 是我们免费的领先操作系统的[最新版本][2]。你现在可以从[官方网站][3]下载它。Fedora 32 Workstation 中有几个新的且值得注意的更改。请阅读下面的详情。 + +### GNOME 3.36 + +Fedora 32 Workstation 包含了适合所有用户的 GNOME 桌面环境的最新版本。Fedora 32 Workstation 中的 GNOME 3.36 包含了许多更新和改进,包括: + +#### 重新设计的锁屏界面 + +Fedora 32 中的锁屏是一种全新的体验。新设计消除了以前版本中使用的“窗口阴影”,并着重于易用性和速度。 + +![Unlock screen in Fedora 32][4] + +#### 新的扩展程序 + +Fedora 32 有新的“扩展”应用,它可轻松管理你的 GNOME 扩展。过去,扩展是使用“软件”和/或“调整工具”来安装、配置和启用的。 + +![The new Extensions application in Fedora 32][5] + +请注意,默认情况下,Fedora 32 上未安装“扩展”应用。需要使用“软件”进行搜索和安装,或在终端中使用以下命令: + +``` +sudo dnf install gnome-extensions-app +``` + +#### 重新组织的设置 + +敏锐的 Fedora 用户会注意到“设置”应用已重新组织。设置类别的结构更加平坦,因此可以一次看到更多设置。 + +此外,“关于”中现在有有关系统的更多信息,包括正在运行的窗口系统(例如 Wayland) + +![The reorganized settings application in Fedora 32][6] + +#### 重新设计的通知/日历弹出框 + +单击桌面顶部的“日期和时间”可切换“通知/日历”弹出窗口,其中有许多小的样式调整项。此外,弹出窗口现在有“请勿打扰”开关,可快速禁用所有通知。这在希望只显示屏幕不显示个人通知时很有用。 + +![The new Notification / Calendar popover in Fedora 32 ][7] + +#### 重新设计的时钟应用 + +Fedora 32 完全重新设计了时钟。该设计在较小的窗口中效果更好。 + +![The Clocks application in Fedora 32][8] + +GNOME 3.36 还提供了许多其他功能和增强。有关更多信息,请查看 [GNOME 3.36 的发布说明][9]。 + +* * * + +### 改进的内存不足处理 + +以前,如果系统内存不足,那么可能会遇到大量 swap 使用(也称为 [swap thrashing][10])–有时会导致 Workstation UI 变慢或在一段时间内无响应。Fedora 32 Workstation 现在默认启用 EarlyOOM。EarlyOOM 使用户可以在低内存情况下通过大量 swap 使用来更快地恢复并重新获得对系统的控制。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/whats-new-fedora-32-workstation/ + +作者:[Ryan Lerch][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/ryanlerch/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/fedora32workstation-816x345.jpg +[2]: https://fedoramagazine.org/announcing-fedora-32/ +[3]: https://getfedora.org/workstation +[4]: https://fedoramagazine.org/wp-content/uploads/2020/04/unlock.gif +[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/extensions.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/04/settings.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/04/donotdisturb.png +[8]: https://fedoramagazine.org/wp-content/uploads/2020/04/clocks.png +[9]: https://help.gnome.org/misc/release-notes/3.36/ +[10]: https://en.wikipedia.org/wiki/Thrashing_(computer_science) From baf9d42292372004ce21335583c72399f622b1ab Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 9 May 2020 09:16:04 +0800 Subject: [PATCH 2016/3057] translating --- ...-apt-lists- Error in Ubuntu and Other Linux Distributions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md b/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md index 6ef4f2b55a..637f438ed8 100644 --- a/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md +++ b/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 03445180fdfbaf58b55c1cadd74b5d8f383d7272 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 May 2020 09:38:36 +0800 Subject: [PATCH 2017/3057] PRF @messon007 --- ... Create a SDN on Linux with open source.md | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/translated/tech/20200417 Create a SDN on Linux with open source.md b/translated/tech/20200417 Create a SDN on Linux with open source.md index 97272e9f2d..b8370a8e62 100644 --- a/translated/tech/20200417 Create a SDN on Linux with open source.md +++ b/translated/tech/20200417 Create a SDN on Linux with open source.md @@ -1,56 +1,58 @@ [#]: collector: (lujun9972) [#]: translator: (messon007) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Create a SDN on Linux with open source) [#]: via: (https://opensource.com/article/20/4/quagga-linux) [#]: author: (M Umer https://opensource.com/users/noisybotnet) -在Linux上使用开源代码创建SDN +在 Linux 上使用开源软件创建 SDN ====== -使用开源路由协议栈Quagga,使您的Linux系统成为一台路由器。 -![Coding on a computer][1] -网络路由协议分为两大类:内部网关协议和外部网关协议。路由器使用内部网关协议在单个自治系统内共享信息。如果您用的是Linux,则可以通过开源(GPLv2)路由协议栈[Quagga][2]使其表现得像一台路由器。 +> 使用开源路由协议栈 Quagga,使你的 Linux 系统成为一台路由器。 -### Quagga是什么? +![](https://img.linux.net.cn/data/attachment/album/202005/09/093541rqx3zr5dxn3yvnq6.jpg) -Quagga是[路由软件包][3],并且是[GNU Zebra][4]的一个分支。它为类Unix平台提供了所有主流路由协议的实现,例如开放最短路径优先(OSPF),路由信息协议(RIP),边界网关协议(BGP)和中间系统到中间系统协议(IS-IS)。 +网络路由协议分为两大类:内部网关协议和外部网关协议。路由器使用内部网关协议在单个自治系统内共享信息。如果你用的是 Linux,则可以通过开源(GPLv2)路由协议栈 [Quagga][2] 使其表现得像一台路由器。 -尽管Quagga为IPv4和IPv6都实现了路由协议,但它却不是一个完整的路由器。真正的路由器不仅实现了所有路由协议,而且还有转发网络流量的能力。 Quagga仅仅实现了路由协议栈,而转发网络流量的工作由Linux内核处理。 +### Quagga 是什么? + +Quagga 是一个[路由软件包][3],并且是 [GNU Zebra][4] 的一个分支。它为类 Unix 平台提供了所有主流路由协议的实现,例如开放最短路径优先(OSPF),路由信息协议(RIP),边界网关协议(BGP)和中间系统到中间系统协议(IS-IS)。 + +尽管 Quagga 实现了 IPv4 和 IPv6 的路由协议,但它并不是一个完整的路由器。一个真正的路由器不仅实现了所有路由协议,而且还有转发网络流量的能力。 Quagga 仅仅实现了路由协议栈,而转发网络流量的工作由 Linux 内核处理。 ### 架构 -Quagga通过协议特定的守护程序实现不同的路由协议。守护程序名称与路由协议相同,加了字母“d”作为后缀。Zebra是核心的协议无关的守护进程,它为内核提供了一个[抽象层][5],并通过TCP套接字向Quagga客户端提供Zserv API。每个协议特定的守护程序负责运行相关的协议并基于交换的信息来建立路由表。 +Quagga 通过特定协议的守护程序实现不同的路由协议。守护程序名称与路由协议相同,加了字母“d”作为后缀。Zebra 是核心,也是与协议无关的守护进程,它为内核提供了一个[抽象层][5],并通过 TCP 套接字向 Quagga 客户端提供 Zserv API。每个特定协议的守护程序负责运行相关的协议,并基于交换的信息来建立路由表。 ![Quagga architecture][6] ### 环境 -本教程通过Quagga实现的OSPF协议来配置动态路由。该环境包括两个名为Alpha和Beta的CentOS 7.7主机。两台主机共享访问 **192.168.122.0/24** 网络。 +本教程通过 Quagga 实现的 OSPF 协议来配置动态路由。该环境包括两个名为 Alpha 和 Beta 的 CentOS 7.7 主机。两台主机共享访问 **192.168.122.0/24** 网络。 -**主机Alpha** +**主机 Alpha:** IP:192.168.122.100/24 网关:192.168.122.1 -**主机Beta** +**主机 Beta:** IP:192.168.122.50/24 网关:192.168.122.1 ### 安装软件包 -首先,在两台主机上安装Quagga软件包。它存在于CentOS基础仓库中: +首先,在两台主机上安装 Quagga 软件包。它存在于 CentOS 基础仓库中: ``` -`yum install quagga -y` +yum install quagga -y ``` -### 使能IP转发 +### 启用 IP 转发 -接下来,在两台主机上使能IP转发,因为它将由Linux内核来执行: +接下来,在两台主机上启用 IP 转发,因为它将由 Linux 内核来执行: ``` sysctl -w net.ipv4.ip_forward = 1 @@ -59,14 +61,13 @@ sysctl -p ### 配置 -现在,进入 **/etc/quagga** 目录并为您的设置创建配置文件。您需要三个文件: +现在,进入 `/etc/quagga` 目录并为你的设置创建配置文件。你需要三个文件: - * **zebra.conf**:Quagga的守护程序配置文件,您可以在其中定义接口及其IP地址和IP转发 - * **ospfd.conf**:协议配置文件,您可以在其中定义将通过OSPF协议提供的网络 - * **守护程序**:您将在其中指定需要运行的相关的协议守护程序 +* `zebra.conf`:Quagga 守护程序的配置文件,你可以在其中定义接口及其 IP 地址和 IP 转发 +* `ospfd.conf`:协议配置文件,你可以在其中定义将通过 OSPF 协议提供的网络 +* `daemons`:你将在其中指定需要运行的相关的协议守护程序 - -在主机Alpha上, +在主机 Alpha 上, ```  [root@alpha]# cat /etc/quagga/zebra.conf @@ -94,7 +95,7 @@ zebra=yes ospfd=yes ``` -在主机Beta上, +在主机 Beta 上, ``` [root@beta quagga]# cat zebra.conf @@ -124,7 +125,7 @@ ospfd=yes ### 配置防火墙 -要使用OSPF协议,必须允许它通过防火墙: +要使用 OSPF 协议,必须允许它通过防火墙: ``` firewall-cmd --add-protocol=ospf –permanent @@ -132,7 +133,7 @@ firewall-cmd --add-protocol=ospf –permanent firewall-cmd –reload ``` -现在,启动zebra和ospfd守护程序。 +现在,启动 `zebra` 和 `ospfd` 守护程序。 ``` # systemctl start zebra @@ -149,7 +150,7 @@ default via 192.168.122.1 dev eth0 proto static metric 100 192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.100 metric 100 ``` -您可以看到Alpha上的路由表包含通过 **192.168.122.50** 到达 **10.10.10.0/24** 的条目,它是通过协议 **zebra** 获取的。同样,在主机Beta上,该表包含通过 **192.168.122.100** 到达网络 **10.12.13.0/24** 的条目。 +你可以看到 Alpha 上的路由表包含通过 **192.168.122.50** 到达 **10.10.10.0/24** 的路由项,它是通过协议 zebra 获取的。同样,在主机 Beta 上,该表包含通过 **192.168.122.100** 到达网络 **10.12.13.0/24** 的路由项。 ``` [root@beta ~]# ip route show @@ -161,7 +162,7 @@ default via 192.168.122.1 dev eth0 proto static metric 100 ### 结论 -如您所见,环境和配置相对简单。要增加复杂性,您可以向路由器添加更多网络接口,以为更多网络提供路由。您也可以使用相同的方法来实现BGP和RIP协议。 +如你所见,环境和配置相对简单。要增加复杂性,你可以向路由器添加更多网络接口,以为更多网络提供路由。你也可以使用相同的方法来实现 BGP 和 RIP 协议。 -------------------------------------------------------------------------------- @@ -170,7 +171,7 @@ via: https://opensource.com/article/20/4/quagga-linux 作者:[M Umer][a] 选题:[lujun9972][b] 译者:[messon007](https://github.com/messon007) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b0610b989b6eff8a94e6886097c7725710b1bfa9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 May 2020 09:39:13 +0800 Subject: [PATCH 2018/3057] PUB @messon007 https://linux.cn/article-12199-1.html --- .../20200417 Create a SDN on Linux with open source.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200417 Create a SDN on Linux with open source.md (98%) diff --git a/translated/tech/20200417 Create a SDN on Linux with open source.md b/published/20200417 Create a SDN on Linux with open source.md similarity index 98% rename from translated/tech/20200417 Create a SDN on Linux with open source.md rename to published/20200417 Create a SDN on Linux with open source.md index b8370a8e62..e05b649ee1 100644 --- a/translated/tech/20200417 Create a SDN on Linux with open source.md +++ b/published/20200417 Create a SDN on Linux with open source.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (messon007) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12199-1.html) [#]: subject: (Create a SDN on Linux with open source) [#]: via: (https://opensource.com/article/20/4/quagga-linux) [#]: author: (M Umer https://opensource.com/users/noisybotnet) From 6dfa609674d949f2c709f4514af2c22490872f16 Mon Sep 17 00:00:00 2001 From: Hank Chow <280630620@qq.com> Date: Sat, 9 May 2020 19:30:35 +0800 Subject: [PATCH 2019/3057] hankchow translating --- sources/tech/20200508 5 ways to split your Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200508 5 ways to split your Linux terminal.md b/sources/tech/20200508 5 ways to split your Linux terminal.md index b1115fbfcb..1809296e6a 100644 --- a/sources/tech/20200508 5 ways to split your Linux terminal.md +++ b/sources/tech/20200508 5 ways to split your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 323f3a9dba50bede8e8208cd87cb74bdd64c2da5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 May 2020 20:37:19 +0800 Subject: [PATCH 2020/3057] PRF @geekpi --- ...428 What-s new in Fedora 32 Workstation.md | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/translated/tech/20200428 What-s new in Fedora 32 Workstation.md b/translated/tech/20200428 What-s new in Fedora 32 Workstation.md index 383da73a32..629267aa9a 100644 --- a/translated/tech/20200428 What-s new in Fedora 32 Workstation.md +++ b/translated/tech/20200428 What-s new in Fedora 32 Workstation.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What’s new in Fedora 32 Workstation) @@ -12,7 +12,7 @@ Fedora 32 Workstation 的新功能 ![][1] -Fedora 32 Workstation 是我们免费的领先操作系统的[最新版本][2]。你现在可以从[官方网站][3]下载它。Fedora 32 Workstation 中有几个新的且值得注意的更改。请阅读下面的详情。 +Fedora 32 Workstation 是我们免费的领先操作系统的[最新版本][2]。你现在可以从[官方网站][3]下载它。Fedora 32 Workstation 中有几个新的且值得注意的变化。请阅读下面的详情。 ### GNOME 3.36 @@ -30,23 +30,23 @@ Fedora 32 有新的“扩展”应用,它可轻松管理你的 GNOME 扩展。 ![The new Extensions application in Fedora 32][5] -请注意,默认情况下,Fedora 32 上未安装“扩展”应用。需要使用“软件”进行搜索和安装,或在终端中使用以下命令: +请注意,默认情况下,Fedora 32 上未安装这个“扩展”应用。需要使用“软件”进行搜索和安装,或在终端中使用以下命令: ``` sudo dnf install gnome-extensions-app ``` -#### 重新组织的设置 +#### 重新组织的设置应用 -敏锐的 Fedora 用户会注意到“设置”应用已重新组织。设置类别的结构更加平坦,因此可以一次看到更多设置。 +敏锐的 Fedora 用户会注意到“设置”应用已重新组织。设置类别的结构更加扁平,因此可以一次看到更多设置。 -此外,“关于”中现在有有关系统的更多信息,包括正在运行的窗口系统(例如 Wayland) +此外,“关于”中现在有有关系统的更多信息,包括正在运行的窗口系统(例如 Wayland)。 ![The reorganized settings application in Fedora 32][6] #### 重新设计的通知/日历弹出框 -单击桌面顶部的“日期和时间”可切换“通知/日历”弹出窗口,其中有许多小的样式调整项。此外,弹出窗口现在有“请勿打扰”开关,可快速禁用所有通知。这在希望只显示屏幕不显示个人通知时很有用。 +单击桌面顶部的“日期和时间”可切换“通知/日历”弹出窗口,其中有许多小的样式调整项。此外,弹出窗口现在有“请勿打扰”开关,可快速禁用所有通知。这在希望只显示屏幕而不显示个人通知时很有用。 ![The new Notification / Calendar popover in Fedora 32 ][7] @@ -58,11 +58,9 @@ Fedora 32 完全重新设计了时钟。该设计在较小的窗口中效果更 GNOME 3.36 还提供了许多其他功能和增强。有关更多信息,请查看 [GNOME 3.36 的发布说明][9]。 -* * * - ### 改进的内存不足处理 -以前,如果系统内存不足,那么可能会遇到大量 swap 使用(也称为 [swap thrashing][10])–有时会导致 Workstation UI 变慢或在一段时间内无响应。Fedora 32 Workstation 现在默认启用 EarlyOOM。EarlyOOM 使用户可以在低内存情况下通过大量 swap 使用来更快地恢复并重新获得对系统的控制。 +以前,如果系统内存不足,那么可能会遇到大量使用交换(也称为 [交换抖动][10])–有时会导致 Workstation UI 变慢或在一段时间内无响应。Fedora 32 Workstation 现在默认启用 EarlyOOM。EarlyOOM 可以让用户在低内存的情况下,存在大量使用交换的情况下,更快速地恢复和恢复对系统的控制。 -------------------------------------------------------------------------------- @@ -71,7 +69,7 @@ via: https://fedoramagazine.org/whats-new-fedora-32-workstation/ 作者:[Ryan Lerch][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cfe1ff164eea4bd5f75ed23613f8ee905c0317fa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 May 2020 20:38:47 +0800 Subject: [PATCH 2021/3057] PUB @geekpi https://linux.cn/article-12201-1.html --- .../20200428 What-s new in Fedora 32 Workstation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200428 What-s new in Fedora 32 Workstation.md (97%) diff --git a/translated/tech/20200428 What-s new in Fedora 32 Workstation.md b/published/20200428 What-s new in Fedora 32 Workstation.md similarity index 97% rename from translated/tech/20200428 What-s new in Fedora 32 Workstation.md rename to published/20200428 What-s new in Fedora 32 Workstation.md index 629267aa9a..17050794d2 100644 --- a/translated/tech/20200428 What-s new in Fedora 32 Workstation.md +++ b/published/20200428 What-s new in Fedora 32 Workstation.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12201-1.html) [#]: subject: (What’s new in Fedora 32 Workstation) [#]: via: (https://fedoramagazine.org/whats-new-fedora-32-workstation/) [#]: author: (Ryan Lerch https://fedoramagazine.org/author/ryanlerch/) @@ -76,7 +76,7 @@ via: https://fedoramagazine.org/whats-new-fedora-32-workstation/ [a]: https://fedoramagazine.org/author/ryanlerch/ [b]: https://github.com/lujun9972 [1]: https://fedoramagazine.org/wp-content/uploads/2020/04/fedora32workstation-816x345.jpg -[2]: https://fedoramagazine.org/announcing-fedora-32/ +[2]: https://linux.cn/article-12164-1.html [3]: https://getfedora.org/workstation [4]: https://fedoramagazine.org/wp-content/uploads/2020/04/unlock.gif [5]: https://fedoramagazine.org/wp-content/uploads/2020/04/extensions.png From bd59f554ca437110171b163a431c7f7eeea43bd4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 May 2020 22:39:02 +0800 Subject: [PATCH 2022/3057] PRF @messon007 --- ...high-performance computing as a service.md | 79 +++++++++---------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/translated/talk/20200401 The ins and outs of high-performance computing as a service.md b/translated/talk/20200401 The ins and outs of high-performance computing as a service.md index 948d985765..40d9fd292e 100644 --- a/translated/talk/20200401 The ins and outs of high-performance computing as a service.md +++ b/translated/talk/20200401 The ins and outs of high-performance computing as a service.md @@ -1,87 +1,82 @@ [#]: collector: (lujun9972) [#]: translator: (messon007) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The ins and outs of high-performance computing as a service) [#]: via: (https://www.networkworld.com/article/3534725/the-ins-and-outs-of-high-performance-computing-as-a-service.html) [#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/) -高性能计算即服务的来龙去脉 +超算即服务:超级计算机如何上云 ====== -高性能计算(HPC)服务可能是一种满足不断增长的超级计算需求的方式,但依赖于使用场景,它们不一定比使用本地超级计算机好。 -戴尔EMC -导弹和军用直升机上的电子设备需要工作在极端条件下。国防承包商麦考密克·史蒂文森公司(McCormick Stevenson Corp.)在部署任何物理设备之前都会事先模拟它所能承受的真实条件。模拟依赖于像Ansys这样的有限元素分析软件,该软件需要强大的算力。 +> 高性能计算(HPC)服务可能是一种满足不断增长的超级计算需求的方式,但依赖于使用场景,它们不一定比使用本地超级计算机好。 + +![](https://img.linux.net.cn/data/attachment/album/202005/09/223805mrjfjzecr3hceais.jpg) + +导弹和军用直升机上的电子设备需要工作在极端条件下。美国国防承包商麦考密克·史蒂文森公司McCormick Stevenson Corp.在部署任何物理设备之前都会事先模拟它所能承受的真实条件。模拟依赖于像 Ansys 这样的有限元素分析软件,该软件需要强大的算力。 几年前的一天,它出乎意料地超出了计算极限。 -[世界上最快的10个超级计算机][1] -麦考密克·史蒂文森(McCormick Stevenson)的首席工程师迈克·克劳奇奇(Mike Krawczyk)说:“我们的一些工作会使办公室的计算机不堪重负。购买机器并安装软件在经济上或计划上都不划算。” 相反,该公司与Rescale签约,从其购买在超级计算机系统上运行的周期(cycles),而这只花费了他们购买新硬件上所需的一小部分。 +麦考密克·史蒂文森公司的首席工程师 Mike Krawczyk 说:“我们的一些工作会使办公室的计算机不堪重负。购买机器并安装软件在经济上或计划上都不划算。”相反,他们与 Rescale 签约,该公司销售其超级计算机系统上的处理能力,而这只花费了他们购买新硬件上所需的一小部分。 -麦考密克·史蒂文森(McCormick Stevenson)已成为被称为超级计算即服务或高性能计算(HPC)即服务(两个紧密相关的术语)市场的早期采用者之一。根据国家计算科学研究所(的定义),HPC是超级计算机在计算复杂问题上的应用,而超级计算机是处理能力最先进的那些计算机。 +麦考密克·史蒂文森公司已成为被称为超级计算即服务或高性能计算即服务(两个紧密相关的术语)市场的早期采用者之一。根据国家计算科学研究所的定义,HPC 是超级计算机在计算复杂问题上的应用,而超级计算机是处理能力最先进的那些计算机。 -无论叫它什么,这些服务都在颠覆传统的超级计算市场,并将HPC能力带给以前买不起的客户。但这不是万能的,而且绝对不是即插即用的,至少现在还不是。 +无论叫它什么,这些服务都在颠覆传统的超级计算市场,并将 HPC 能力带给以前负担不起的客户。但这不是万能的,而且绝对不是即插即用的,至少现在还不是。 -### HPC服务实践 +### HPC 服务实践 -从最终用户的角度来看,HPC即服务类似于早期大型机时代的批处理模型。 “我们创建一个Ansys批处理文件并将其发送过去,运行它,然后将结果文件取下来并在本地导入它们,” Krawczyk说。 +从最终用户的角度来看,HPC 即服务类似于早期大型机时代的批处理模型。 “我们创建一个 Ansys 批处理文件并将其发送过去,运行它,然后将结果文件取下来,然后导入到本地,” Krawczyk 说。 -在HPC服务背后,云提供商在其自己的数据中心中运行超级计算基础设施,尽管这不一定意味着当您听到“超级计算机”时你就会看到最先进的硬件。正如IBM OpenPOWER计算技术副总裁Dave Turek解释的那样,HPC服务的核心是“相互互连的服务器集合。您可以调用该虚拟计算基础设施,它能够在您提出问题时,使得许多不同的服务器并行工作来解决问题。” -[][2] +在 HPC 服务背后,云提供商在其自己的数据中心中运行超级计算基础设施,尽管这不一定意味着当你听到“超级计算机”时你就会看到最先进的硬件。正如 IBM OpenPOWER 计算技术副总裁 Dave Turek 解释的那样,HPC 服务的核心是“相互互连的服务器集合。你可以调用该虚拟计算基础设施,它能够在你提出问题时,使得许多不同的服务器并行工作来解决问题。” -理论听起来很简单。但都柏林城市大学数字业务教授西奥·林恩(Theo Lynn)表示,要使其在实践中可行,需要解决一些技术问题。普通计算与HPC的区别在于那些互连-高速的,低延时的而且昂贵的-因此需要将这些互连引入云基础设施领域。在HPC服务可行之前,至少需要将存储性能和数据传输也提升到与本地HPC相同的水平。 +理论听起来很简单。但都柏林城市大学数字商业教授 Theo Lynn 表示,要使其在实践中可行,需要解决一些技术问题。普通计算与 HPC 的区别在于那些互联互通 —— 高速的、低延时的而且昂贵的 —— 因此需要将这些互连引入云基础设施领域。在 HPC 服务可行之前,至少需要将存储性能和数据传输也提升到与本地 HPC 相同的水平。 -但是林恩说,一些制度创新相比技术更好的帮助了HPC服务的起飞。特别是,“我们现在看到越来越多的传统HPC应用采用云友好的许可模式-过去是采用这种模式的障碍。” +但是 Lynn 说,一些制度创新相比技术更好的帮助了 HPC 服务的起飞。特别是,“我们现在看到越来越多的传统 HPC 应用采用云友好的许可模式 —— 这在过去是阻碍采用的障碍。” -他说,经济也改变了潜在的客户群。 “云服务提供商通过向那些负担不起传统HPC所需的投资成本的低端HPC买家开放,进一步开放了市场。随着市场的开放,超大规模经济模型变得越来越多,更可行,成本开始下降。” +他说,经济也改变了潜在的客户群。“云服务提供商通过向那些负担不起传统 HPC 所需的投资成本的低端 HPC 买家开放,进一步开放了市场。随着市场的开放,超大规模经济模型变得越来越多,更可行,成本开始下降。” -避免本地资本支出** -** +### 避免本地资本支出 -HPC服务对有志于传统超级计算长期把持的领域的私营行业客户具有吸引力。这些客户包括严重依赖复杂数学模型的行业,包括麦考密克·史蒂文森(McCormick Stevenson)等国防承包商,以及油气公司,金融服务公司和生物技术公司。都柏林城市大学的Lynn补充说,松耦合的工作负载是一个特别好的用例,这意味着许多早期采用者将其用于3D图像渲染和相关应用。 +HPC 服务对传统超级计算长期以来一直占据主导地位的私营部门客户具有吸引力。这些客户包括严重依赖复杂数学模型的行业,包括麦考密克·史蒂文森公司等国防承包商,以及石油和天然气公司、金融服务公司和生物技术公司。都柏林城市大学的 Lynn 补充说,松耦合的工作负载是一个特别好的用例,这意味着许多早期采用者将其用于 3D 图像渲染和相关应用。 -但是,何时考虑HPC服务而不是本地HPC才有意义?对于德国的模拟烟雾在建筑物中的蔓延和火灾对建筑物结构部件的破坏的hhpberlin公司来说,答案是在它超出了其现有资源时。 +但是,何时考虑 HPC 服务而不是本地 HPC 才有意义?对于德国的模拟烟雾在建筑物中的蔓延和火灾对建筑物结构部件的破坏的 hhpberlin 公司来说,答案是在它超出了其现有资源时。 -Hpberlin公司数值模拟的科学负责人Susanne Kilian说:“几年来,我们一直在运行自己的小型集群,该集群具有多达80个处理器核。” “但是,随着应用复杂性的提高,这种架构(constellation)已经越来越不足以支撑;可用容量并不总是够快速地处理项目。” +Hpberlin 公司数值模拟的科学负责人 Susanne Kilian 说:“几年来,我们一直在运行自己的小型集群,该集群具有多达 80 个处理器核。……但是,随着应用复杂性的提高,这种架构已经越来越不足以支撑;可用容量并不总是够快速地处理项目。” -她说:“但是,仅仅花钱买一个新的集群并不是一个理想的解决方案:鉴于我们公司的规模和管理环境,强制持续维护该集群(定期进行软件和硬件升级)是不现实的。另外,需要模拟的项目数量会出现很大的波动,因此集群的利用率并不是真正可预测的。通常,使用率很高的阶段与很少使用或不使用的阶段交替出现。”通过转换为HPC服务模式,hhpberlin释放了过剩的容量,并无需支付升级费用。 +她说:“但是,仅仅花钱买一个新的集群并不是一个理想的解决方案:鉴于我们公司的规模和管理环境,不断地维护这个集群(定期进行软件和硬件升级)是不现实的。另外,需要模拟的项目数量会出现很大的波动,因此集群的利用率并不是真正可预测的。通常,使用率很高的阶段与很少使用或不使用的阶段交替出现。”通过转换为 HPC 服务模式,hhpberlin 释放了过剩的产能,并无需支付升级费用。 -IBM的Turek解释了不同公司在评估其需求时所经历的计算过程。对于拥有30名员工的生物科学初创公司来说,“您需要计算,但您实在负担不起15%的员工专门从事它。这就像您可能也说过,您不想拥有在职法律代表,因此您也可以通过服务获得它。”但是,对于一家较大的公司而言,最终归结为权衡HPC服务的运营费用与购买内部超级计算机或HPC集群的费用。 +IBM 的 Turek 解释了不同公司在评估其需求时所经历的计算过程。对于拥有 30 名员工的生物科学初创公司来说,“你需要计算,但你真的不可能让 15% 的员工专门负责计算。这就像你可能也会说你不希望有专职的法律代表,所以你也会把它作为一项服务来做。”不过,对于一家较大的公司而言,最终归结为权衡 HPC 服务的运营费用与购买内部超级计算机或 HPC 集群的费用。 -到目前为止,这些都是您采用任何云服务时都会遇到的类似的争论。但是,可以HPC市场的某些特点将使得衡量运营支出与资本支出时选择前者。超级计算机不是诸如存储或x86服务器之类的商用硬件;它们非常昂贵,技术进步很快会使其过时。正如麦考密克·史蒂文森(McCormick Stevenson)的克拉维奇(Krawczyk)所说,“这就像买车:只要车一开走,它就会开始贬值。”对于许多公司,尤其是规模较大,灵活性较差的公司,购买超级计算机的过程可能会陷入无望的泥潭。 IBM的Turek说:“您陷入了计划问题,建筑问题,施工问题,培训问题,然后必须执行RFP。您必须得到CIO的支持。您必须与内部客户合作以确保服务的连续性。这是一个非常非常复杂的过程,并没有很多机构有非常出色的执行力。” +到目前为止,这些都是你采用任何云服务时都会遇到的类似的争论。但是,可以 HPC 市场的某些特殊性将使得衡量运营支出(OPEX)与资本支出(CAPEX)时选择前者。超级计算机不是诸如存储或 x86 服务器之类的商用硬件;它们非常昂贵,技术进步很快会使其过时。正如麦考密克·史蒂文森公司的 Krawczyk 所说,“这就像买车:只要车一开走,它就会开始贬值。”对于许多公司,尤其是规模较大,灵活性较差的公司,购买超级计算机的过程可能会陷入无望的泥潭。IBM 的 Turek 说:“你会被规划问题、建筑问题、施工问题、培训问题所困扰,然后必须执行 RFP。你必须得到 CIO 的支持。你必须与内部客户合作以确保服务的连续性。这是一个非常、非常复杂的过程,并没有很多机构有非常出色的执行力。” -一旦您选择了HPC服务的路线后,您会发现您会得到您期望从云服务中得到的许多好处,特别是仅在业务需要时才需付费的能力,从而可以带来资源的高效利用。 Gartner高级总监兼分析师Chirag Dekate表示,当您对高性能计算有短期需求时的突发性负载是推动选择HPC服务的关键用例。 +一旦你选择走 HPC 服务的路线,你会发现你会得到你期望从云服务中得到的许多好处,特别是仅在业务需要时才需付费的能力,从而可以带来资源的高效利用。Gartner 高级总监兼分析师 Chirag Dekate 表示,当你对高性能计算有短期需求时,突发性负载是推动选择 HPC 服务的关键用例。 -他说:“在制造业中,在产品设计阶段,HPC活动往往会达到很高的峰值。但是,一旦产品设计完成,在其余产品开发周期中,HPC资源的利用率就会降低。” 相比之下,他说:“当您拥有大量长期运行的工作时,云的经济性就会逐渐减弱。” +他说:“在制造业中,在产品设计阶段前后,HPC 活动往往会达到很高的峰值。但是,一旦产品设计完成,在其余产品开发周期中,HPC 资源的利用率就会降低。” 相比之下,他说:“当你拥有大型的、长期运行的工作时,云计算的经济性才会逐渐减弱。” -通过巧妙的系统设计,您可以将这些HPC服务突发活动与您自己的内部常规计算集成在一起。 埃森哲(Accenture)实验室常务董事Teresa Tung举了一个例子:“通过API访问HPC可以无缝地与传统计算混合。在模型构建阶段,传统的AI流水线可能会在高端超级计算机上进行训练,但是最终经过反复按预期运行的训练好的模型将部署在云中的其他服务上,甚至部署在边缘设备上。” +通过巧妙的系统设计,你可以将这些 HPC 服务突发活动与你自己的内部常规计算集成在一起。埃森哲Accenture实验室常务董事 Teresa Tung 举了一个例子:“通过 API 访问 HPC 可以与传统计算无缝融合。在模型构建阶段,传统的 AI 流水线可能会在高端超级计算机上进行训练,但是最终经过反复按预期运行的训练好的模型将部署在云端的其他服务上,甚至部署在边缘设备上。” -### 它并不适合所有的应用场景 ** +### 它并不适合所有的应用场景 -** +HPC 服务适合批处理和松耦合的场景。这与一个常见的 HPC 缺点有关:数据传输问题。高性能计算本身通常涉及庞大的数据集,而将所有这些信息通过互联网发送到云服务提供商并不容易。IBM 的 Turek 说:“我们与生物技术行业的客户交流,他们每月仅在数据费用上就花费 1000 万美元。” -HPC服务适合批处理和松耦合的场景。这与HPC的普遍缺点有关:数据传输问题。高性能计算本身通常涉及庞大的数据集,而将所有这些信息通过Internet发送到云服务提供商并不容易。IBM的Turek说:“我们与生物技术行业的客户交流,他们每月仅在数据费用上就花费1000万美元。” +而钱并不是唯一的潜在问题。构建一个利用数据的工作流程,可能会对你的工作流程提出挑战,让你绕过数据传输所需的漫长时间。hhpberlin 的 Kilian 说:“当我们拥有自己的 HPC 集群时,当然可以随时访问已经产生的仿真结果,从而进行交互式的临时评估。我们目前正努力达到在仿真的任意时刻都可以更高效地、交互地访问和评估云端生成的数据,而无需下载大量的模拟数据。” -钱并不是唯一的潜在问题。已制定的需要使用数据的工作流可能会使您在数据传输所需的时间内无法工作。hhpberlin的Kilian说:“当我们拥有自己的HPC集群时,当然可以随时访问已经产生的仿真结果,从而进行交互式的临时评估。我们目前正努力达到在仿真的任意时刻都可以更高效地,交互地访问和评估云中生成的数据,而无需下载大量的模拟数据。” +Mike Krawczyk 提到了另一个绊脚石:合规性问题。国防承包商使用的任何服务都需要遵从《国际武器交易条例》(ITAR),麦考密克·史蒂文森公司之所以选择 Rescale,部分原因是因为这是他们发现的唯一符合的供应商。如今,尽管有更多的公司使用云服务,但任何希望使用云服务的公司都应该意识到使用其他人的基础设施时所涉及的法律和数据保护问题,而且许多 HPC 场景的敏感性使得 HPC 即服务的这个问题更加突出。 -Mike Krawczyk提到了另一个绊脚石:合规性问题。国防承包商使用的任何服务都需要遵从(原文是complaint, 应该是笔误)《国际武器交易条例》(ITAR),麦考密克·史蒂文森(McCormick Stevenson)之所以选择Rescale,部分原因是因为这是他们发现的唯一符合的供应商。如今,尽管有更多的公司(使用云服务),但任何希望使用云服务的公司都应该意识到使用其他人的基础设施时所涉及的法律和数据保护问题,而且许多HPC场景的敏感性使得更HPC即服务的这个问题更加突出。 +此外,HPC 服务所需的 IT 治理超出了目前的监管范围。例如,你需要跟踪你的软件许可证是否允许云使用­ —— 尤其是专门为本地 HPC 群集上运行而编写的软件包。通常,你需要跟踪 HPC 服务的使用方式,它可能是一个诱人的资源,尤其是当你从员工习惯的内部系统过渡到有可用的空闲的 HPC 能力时。例如,Avanade 全球平台高级主管兼 Azure 平台服务全球负责人 Ron Gilpin 建议,将你使用的处理核心的数量回拨给那些对时间不敏感的任务。他说:“如果一项工作只需要用一小时来完成而不需要在十分钟内就完成,那么它可以使用 165 个处理器而不是 1,000 个,从而节省了数千美元。” -此外,HPC服务所需的IT治理超出了目前的监管范围。例如,您需要跟踪您的软件许可证是否允许云使用­ –尤其是专门为本地HPC群集上运行而编写的软件包。通常,您需要跟踪HPC服务的使用方式,它可能是一个诱人的资源,尤其是当您从员工习惯的内部系统过渡到有可用的空闲的HPC能力时。例如,Avanade全球平台高级主管兼Azure平台服务全球负责人Ron Gilpin建议,回调您用于时间不敏感任务的处理核心数量。他说:“如果一项工作只需要用一小时来完成而不需要在十分钟内就完成,那么它可以使用165个处理器而不是1,000个,从而节省了数千美元。” +### 对 HPC 技能的要求很高 -### 独特的HPC技能** +一直以来,采用 HPC 的最大障碍之一就是其所需的独特的内部技能,而 HPC 服务并不能神奇使这种障碍消失。Gartner 的 Dekate 表示:“许多 CIO 将许多工作负载迁移到了云上,他们看到了成本的节约、敏捷性和效率的提升,因此相信在 HPC 生态中也可以达成类似的效果。一个普遍的误解是,他们可以通过彻底地免去系统管理员,并聘用能解决其 HPC 工作负载的新的云专家,从而以某种方式优化人力成本。”对于 HPC 即服务来说更是如此。 -** +“但是 HPC 并不是一个主流的企业环境。” 他说。“你正在处理通过高带宽、低延迟的网络互联的高端计算节点,以及相当复杂的应用和中间件技术栈。许多情况下,甚至连文件系统层也是 HPC 环境所独有的。没有对应的技能可能会破坏稳定性。” -一直以来,采用HPC的最大障碍之一就是其所需的独特的内部技能,而HPC服务并不能使这种障碍消失。Gartner的Dekate表示:“许多CIO将许多工作负载迁移到了云上,他们看到了成本的节约,敏捷性和效率的提升,因此相信在HPC生态中也可以达成类似的效果。一个普遍的误解是,他们可以通过彻底地免去系统管理员,并聘用能解决其HPC工作负载的新的云专家,从而以某种方式优化人力成本。” +但是超级计算技能的供给却在减少,Dekate 将其称为劳动力“老龄化”,这是因为这一代开发人员将目光投向了新兴的初创公司,而不是学术界或使用 HPC 的更老套的公司。因此,HPC 服务供应商正在尽其所能地弥补差距。IBM 的 Turek 表示,许多 HPC 老手将总是想运行他们自己精心调整过的代码,并需要专门的调试器和其他工具来帮助他们在云端实现这一目标。但是,即使是 HPC 新手也可以调用供应商构建的代码库,以利用超级计算的并行处理能力。第三方软件提供商出售的交钥匙软件包可以减少 HPC 的许多复杂性。 -“但是HPC并不是一个主流的企业环境。” 他说。“您正在处理通过高带宽,低延迟的网络互联的高端计算节点,以及相当复杂的应用和中间件技术栈。许多情况下,甚至连文件系统层也是HPC环境所独有的。没有对应的技能可能会破坏稳定性。” +埃森哲的 Tung 表示,该行业需要进一步加大投入才能真正繁荣。她说:“HPCaaS 已经创建了具有重大影响力的新功能,但还需要做的是使它易于被数据科学家、企业架构师或软件开发人员使用。这包括易用的 API、文档和示例代码。它包括解答问题的用户支持。仅仅提供 API 是不够的,API 需要适合特定的用途。对于数据科学家而言,这可能是以 Python 形式提供,并容易更换她已经在使用的框架。价值来自于使这些用户能够通过新的效率和性能最终使他们的工作得到改善,只要他们能够访问新的功能就可以了。” 如果供应商能够做到这一点,那么 HPC 服务才能真正将超级计算带给大众。 -但是超级计算技能的供给却在减少,Dekate将其称为劳动力“灰化”,这是因为一代开发人员将目光投向了新兴的初创公司,而不是学术界或使用HPC的更老套的公司。因此,HPC服务供应商正在尽其所能地弥补差距。 IBM的Turek表示,许多HPC老手将总是想运行他们自己精心调整过的代码,将需要专门的调试器和其他工具来帮助他们在云上实现这一目标。但是,即使是HPC新手也可以调用供应商构建的代码库,以利用超级计算的并行处理能力。第三方软件提供商出售的交钥匙软件包可以减少HPC的许多复杂性。 -埃森哲的Tung表示,该行业需要进一步加大投入才能真正繁荣。她说:“HPCaaS已经创建了具有重大影响力的新功能,但还需要做的是使它易于被数据科学家,企业架构师或软件开发人员使用。这包括易用的API,文档和示例代码。它包括用户支持来解答问题。仅仅提供API是不够的,API需要适合特定的用途。对于数据科学家而言,这可能是以python形式提供,并容易更换她已经在使用的框架。其价值来自使这些用户最综只有在使用新功能时才能够改进效率和性能。” 如果供应商能够做到这一点,那么HPC服务才能真正将超级计算带给大众。 - -加入[Facebook][3]和[LinkedIn][4]上的Network World社区,探讨最前沿的话题。 -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3534725/the-ins-and-outs-of-high-performance-computing-as-a-service.html @@ -89,7 +84,7 @@ via: https://www.networkworld.com/article/3534725/the-ins-and-outs-of-high-perfo 作者:[Josh Fruhlinger][a] 选题:[lujun9972][b] 译者:[messon007](https://github.com/messon007) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f359853d721f21859f65f83415a799af9ab125a1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 May 2020 22:39:37 +0800 Subject: [PATCH 2023/3057] PUB @messon007 https://linux.cn/article-12202-1.html --- ...ins and outs of high-performance computing as a service.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20200401 The ins and outs of high-performance computing as a service.md (99%) diff --git a/translated/talk/20200401 The ins and outs of high-performance computing as a service.md b/published/20200401 The ins and outs of high-performance computing as a service.md similarity index 99% rename from translated/talk/20200401 The ins and outs of high-performance computing as a service.md rename to published/20200401 The ins and outs of high-performance computing as a service.md index 40d9fd292e..ef96b09ffe 100644 --- a/translated/talk/20200401 The ins and outs of high-performance computing as a service.md +++ b/published/20200401 The ins and outs of high-performance computing as a service.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (messon007) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12202-1.html) [#]: subject: (The ins and outs of high-performance computing as a service) [#]: via: (https://www.networkworld.com/article/3534725/the-ins-and-outs-of-high-performance-computing-as-a-service.html) [#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/) From 655214810f39e827932526b4f3d8eef8e58d394f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 10 May 2020 01:06:03 +0800 Subject: [PATCH 2024/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200509=20The?= =?UTF-8?q?=20success=20of=20virtual=20conferences,=20Retropie=20comes=20t?= =?UTF-8?q?o=20Raspberry=20Pi=204,=20and=20other=20open=20source=20news?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md --- ...pberry Pi 4, and other open source news.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md diff --git a/sources/tech/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md b/sources/tech/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md new file mode 100644 index 0000000000..76a6def4a1 --- /dev/null +++ b/sources/tech/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news) +[#]: via: (https://opensource.com/article/20/5/news-may-9) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![][1] + +In this week’s edition of our open source news roundup, we see the success of virtual conferences, continued impact of open source on COVID-19, Retropie adds support for Raspberry Pi 4, and more open source news. + +### Virtual conferences report record attendance + +The technology industry, and non-profits supporting open source software, greatly [depend on conferences][2] to connect their community together. There has been an open question of whether moving to an online alternative would be effective or not. The last two weeks have given us reason to say virtual conferences are a huge success, and there are multiple paths to getting there. + +The first success goes to [Red Hat Summit][3], a conference put on by Red Hat to showcase their technology and interact with the open source community each year. Last year it held at Boston Convention and Exhibition Center in Boston, MA with a record-breaking  8,900 people in attendence. This year, due to COVID-19, Red Hat took it virtual with what they called [Red Hat Summit 2020 Virtual Experience][3]. The final attendance numbers, as [reported by IT World Canada][4], was 80,000 people. + +The explosive growth of online events continued this week with GitHub Satelite [reporting][5] over 40,000 attendees for its multiday event. + +![Example streaming for #DIDevOps][6] + +*Streaming example of [Desert Island DevOps][7] * + +Another success with a different twist came in the shape of 3-D avatars in the popular Animal Crossing game. Desert Island DevOps [reported][8] over 8,500 attendees in a simulated space and received [a lot of praise][9] from attendees and speakers alike.  + +### Open source continues to speed COVID-19 response + +Emergency response requires speed and safety to be a top concern, which makes open source licensing and designs even more valuable. In our current battle with COVID-19, there is a need for increasing inventory of medical equipment such as ventilators and PPE as well as the development of treatments and medications. An open source approach is showing to have a major response. + +A recent victory comes in the form of a [ventilator design][10] announced by Nvidia Corporation. Described as "low-cost and easy-to-assemble," the ventilators are expected to cost much less to build than other models on the market, making them a great option for medical professionals who have been working so hard to protect their patients. + +Developing [open source medications][11] may also provide vast benefits. Research and development of vaccines are taking practices perfected in the open source world of the Linux kernel and applying them to how medications are developed. The focus may help merit be more central to the process than profitability. The absence of patent and copyright restrictions are also noted to speed the process of discovery. + +### Retropie announces support for Raspberry Pi 4 + +Many of us are passing the time by playing games while we stay at home. If you’re into console gaming and nostalgia, [Retropie][12] gives Raspberry Pi enthusiasts a set of classic games to dig through. Last week the team behind the project is happy to announce [support for the latest Raspberry Pi 4][13] hardware [released 24 June 2019][14].   + +#### In other news + + * [Fedora 32 Linux Official Release][15] + * [Jitsi open source conferencing gaining interest][16] + * [Free Wayland Book Available][17] + * [Inkscape 1.0 Released][18] + + + +Thanks, as always, to Opensource.com staff members and [Correspondents][19] for their help this week. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/news-may-9 + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/weekly_news_roundup_tv.png?itok=tibLvjBd +[2]: https://opensource.com/article/20/5/pycon-covid-19 +[3]: https://www.redhat.com/en/summit +[4]: https://www.itworldcanada.com/article/over-80000-people-tune-into-virtual-red-hat-summit-crushing-last-years-record/430090?sc_cid=701f2000000u72aAAA +[5]: https://twitter.com/MishManners/status/1258232215814586369 +[6]: https://opensource.com/sites/default/files/uploads/stream_example.jpg (Example streaming for #DIDevOps) +[7]: https://desertedisland.club/about/ +[8]: https://desertedislanddevops.com/ +[9]: https://www.vice.com/en_us/article/z3bjga/this-tech-conference-is-being-held-on-an-animal-crossing-island +[10]: https://blogs.nvidia.com/blog/2020/05/01/low-cost-open-source-ventilator-nvidia-chief-scientist/ +[11]: https://www.fastcompany.com/90498448/how-open-source-medicine-could-prepare-us-for-the-next-pandemic +[12]: https://opensource.com/article/19/1/retropie +[13]: https://retropie.org.uk/2020/04/retropie-4-6-released-with-raspberry-pi-4-support/ +[14]: https://opensource.com/article/19/6/raspberry-pi-4 +[15]: https://fedoramagazine.org/announcing-fedora-32/ +[16]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/open-source-videoconferences +[17]: https://www.phoronix.com/scan.php?page=news_item&px=Wayland-Book-Free +[18]: https://inkscape.org/news/2020/05/04/introducing-inkscape-10/ +[19]: https://opensource.com/correspondent-program From 83601b12602323d27cdb7b858cd26e85b9d1eeb7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 May 2020 07:56:14 +0800 Subject: [PATCH 2025/3057] Rename sources/tech/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md to sources/news/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md --- ...etropie comes to Raspberry Pi 4, and other open source news.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md (100%) diff --git a/sources/tech/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md b/sources/news/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md similarity index 100% rename from sources/tech/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md rename to sources/news/20200509 The success of virtual conferences, Retropie comes to Raspberry Pi 4, and other open source news.md From 50f15bd0323ed00e9b0fc4443ff81534668cee57 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 May 2020 08:28:23 +0800 Subject: [PATCH 2026/3057] PRF @lxbwolf --- ...he Peer-to-peer Web With Beaker Browser.md | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md b/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md index 4a83f1435d..ef75d543f2 100644 --- a/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md +++ b/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md @@ -1,36 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Browse the Peer-to-peer Web With Beaker Browser) [#]: via: (https://itsfoss.com/beaker-browser/) [#]: author: (John Paul https://itsfoss.com/author/john/) -使用 Beaker 浏览器浏览 P2P Web +使用 Beaker 浏览器浏览对等 Web ====== -我们所认识的因特网在过去 50 年中变化不大。全球的网民使用它们的设备从遍布在世界各地的服务器上检索数据。 +![](https://img.linux.net.cn/data/attachment/album/202005/10/082745ztmi4kqh4iq449ll.jpg) + +在过去 50 年中,我们所了解的互联网没有什么变化,全球的网民使用他们的设备从遍布在世界各地的服务器上检索数据。 一群专业的技术专家想改变现状,使互联网变成人们可以连接和直接分享信息的地方,而不是依赖一个中心服务器(去中心化)。 -我们已经在 It’s FOSS 讨论过很多这样的去中心化的服务。[YouTube 竞品:LBRY][1],[Twitter竞品:Mastodon][2] 是其中的两个例子。 +我们已经在 It’s FOSS 讨论过很多这样的去中心化的服务。[YouTube 竞品:LBRY][1]、[Twitter 竞品:Mastodon][2] 是其中的两个例子。 -今天我将要介绍另一个这样的产品,名为 [Beaker 浏览器][3],它的设计目标是浏览 P2P web 数据。 +今天我将要介绍另一个这样的产品,名为 [Beaker 浏览器][3],它的设计目标是浏览对等 Web。 ![Beaker Browser][4] -### ’peer-to-peer Web‘ 是什么? +### “对等 Web” 是什么? -根据 Beaker 浏览器的[开发者之一][5]的描述,”P2P Web 是一项实验性的技术...提高我们掌控 Web 的能力。“ +根据 Beaker 浏览器的[开发者之一][5]的描述,“对等 Web 是一项实验性的技术 ……旨在提高我们掌控 Web 的能力。” -还有,它们说 P2P Web 有三个主要原则:任何一点都可以成为服务器;多台计算机可以为同一个网站提供服务;没有后端。 +还有,他们说对等 Web 有三个主要原则:任何一点都可以成为服务器;多台计算机可以为同一个网站提供服务;没有后端。 -从这些原则中你可以看出,P2P Web 的思想与 BitTorrent 很像,多个点把文件作为种子,这些点共享带宽负载。这减少了一个用户需要提供给他的网站的总带宽。 +从这些原则中你可以看出,对等 Web 的思想与 BitTorrent 很像,文件由多个对端做种,这些对端共同承担带宽负载。这减少了一个用户需要提供给他们的网站的总带宽。 ![Beaker Browser Settings][6] -P2P Web 另一个重要的方面是创作者对于他们自己的想法的控制能力。当今年代,平台都是由庞大的组织控制的,往往拿你的数据为他们所用。Beaker 把数据的控制能力返还给了内容创造者。 +对等 Web 另一个重要的方面是创作者对于他们自己的想法的控制能力。当今年代,平台都是由庞大的组织控制的,往往拿你的数据为他们所用。Beaker 把数据的控制能力返还给了内容创造者。 ### 使用 Beaker 浏览去中心化的 web @@ -39,52 +41,50 @@ P2P Web 另一个重要的方面是创作者对于他们自己的想法的控制 Dat 协议的优势如下: * 快速 – 档案能立即从多个源同步。 - * 安全 – 所有的更新都是有签名和被完整检查的。 + * 安全 – 所有的更新都是有签名和经过完整性检查的。 * 灵活 – 可以在不修改档案 URL 的情况下迁移主机。 * 版本控制 – 每次修改都被写到只能追加的版本日志中。 * 去中心化 – 任何设备都可以作为承载档案的主机。 - - ![Beaker Browser Seeding][9] Beaker 浏览器本质上是阉割版的 Chromium,原生支持 `dat://` 地址,也可以访问普通的 `http://` 站点。 -每次访问一个 dat 站点,在你请求时该站点的内容才会下载到你的计算机。例如,只有在你浏览到站点的 about 页面时,才会下载该页面上的 Linux Torvalds 的图片。 +每次访问一个 dat 站点,在你请求时该站点的内容才会下载到你的计算机。例如,在一个站点上的 about 页面中有一张 Linux Torvalds 的图片,只有在你浏览到该站点的这个页面时,才会下载这张图片。 -当你浏览一个 dat 网站时,”[你暂时][10]重新上传或种下你从网站上下载的所有文件。“你也可以选择为网站做种来帮助创造者。 +此外,当你浏览一个 dat 网站时,“[你会短暂性的][10]重新上传或做种你从该网站上下载的所有文件。”你也可以选择为网站(主动)做种来帮助创造者。 ![Beaker Browser Menu][11] -由于 Beaker 的志向就是创建一个更开放的网络,因此你可以很容易地查看任何网站的源码。不像在大多数浏览器上你只能看到当前浏览的页面的源码那样,使用 Beaker 你能以类似 GitHub 的视图查看整个站点的结构。你甚至可以 fork 这个站点,自己维护。 +由于 Beaker 的志向就是创建一个更开放的网络,因此你可以很容易地查看任何网站的源码。不像在大多数浏览器上你只能看到当前浏览的页面的源码那样,使用 Beaker 你能以类似 GitHub 的视图查看整个站点的结构。你甚至可以复刻这个站点,并托管你自己的版本。 -除了浏览基于 dat 的网站外,你还可以创建自己的站点。在 Beaker 浏览器的菜单里,有创建新网站和创建空项目的选项。如果你选择了创建一个新网站,Beaker 会搭建一个小的 demo 站点,你可以使用浏览器里自带的编辑器来编辑。 +除了浏览基于 dat 的网站外,你还可以创建自己的站点。在 Beaker 浏览器的菜单里,有创建新网站或空项目的选项。如果你选择了创建一个新网站,Beaker 会搭建一个小的演示站点,你可以使用浏览器里自带的编辑器来编辑。 -然而,如果你像我一样更喜欢用 Markdown,你可以选择创建一个空项目。Beaker 会创建一个站点的结构,赋给它一个 `dat://` 地址。创建一个 `index.md` 文件后你就可以很好地工作了。里面有个[简短教程][12],你可以看到更多信息。你也可以用创建空项目的选项搭建一个 web app。 +然而,如果你像我一样更喜欢用 Markdown,你可以选择创建一个空项目。Beaker 会创建一个站点的结构,赋给它一个 `dat://` 地址。你只需要创建一个 `index.md` 文件后就行了。这有个[简短教程][12],你可以看到更多信息。你也可以用创建空项目的方式搭建一个 web 应用。 ![Beaker Browser Website Template][13] -由于 Beaker 的角色是个 web 服务器和站点播种者,当你关闭它或关机后你的站点就不可用了。幸运的是,你不必一直开着你的计算机或浏览器。你也可以使用名为 [Hashbase][14] 的播种服务或者你可以搭建一个 [`homebase`][15] 播种服务器。 +由于 Beaker 的角色是个 Web 服务器和站点做种者,当你关闭它或关机后你的站点就不可用了。幸运的是,你不必一直开着你的计算机或浏览器。你也可以使用名为 [Hashbase][14] 的做种服务或者你可以搭建一个 [homebase][15] 做种服务器。 -虽然 Beaker [适用于][16] Linux,Windows 和 macOS,但是在搞 Beaker 之前,还是要查阅下[各平台的教程][17]。 +虽然 Beaker [适用于][16] Linux、Windows 和 macOS,但是在使用 Beaker 之前,还是要查阅下[各平台的教程][17]。 -### Beaker 浏览器不是每个人都能用,但它有这个意图 +### Beaker 浏览器不是大众可用的,但它有这个意图 -当第一次被分配到这个任务时,我对 Beaker 浏览器有极高的热情。(但是)像它现在的地位一样,Beaker 浏览器仍是实验性的。我尝试浏览过的很多 dat 站点还不可用,因为用户并没有为站点做种。当站点恢复可用时 Beaker 确实可以选择通知你。 +当第一次接触到时,我对 Beaker 浏览器有极高的热情。(但是)如它现在的名字一样(烧杯),Beaker 浏览器仍是非常实验性的。我尝试浏览过的很多 dat 站点还不可用,因为用户并没有为站点做种。当站点恢复可用时 Beaker 确实可以选择通知你。 ![Beaker Browser No Peer][18] -另一个问题是,Beaker 是真正阉割版的 Chromium。不能安装扩展或主题。你只能使用白色主题和极少的工具集。我不会把 Beaker 浏览器作为常用浏览器,而且能访问 dat 网站并不是把它留在系统上的充分条件。 +另一个问题是,Beaker 是真正阉割版的 Chromium。它不能安装扩展或主题。你只能使用白色主题和极少的工具集。我不会把 Beaker 浏览器作为常用浏览器,而且能访问 dat 网站并不是把它留在系统上的充分条件。 我曾经寻找一个能支持 `dat://` 协议的 Firefox 扩展。我确实找到了这样一款扩展,但它需要安装一系列其他的软件。相比而言,安装 Beaker 比安装那些软件容易点。 -就像它现在的地位,Beaker 不适合我。也许在将来更多的人使用 Beaker 或者其他浏览器支持 dat 协议。那时会很有趣。目前而言,聊胜于无。 +就如它现在的名字一样,Beaker 不适合我。也许在将来更多的人使用 Beaker 或者其他浏览器支持 dat 协议。那时会很有趣。目前而言,聊胜于无。 在使用 Beaker 的时间里,我用内建的工具创建了一个[网站][19]。不要担心,我已经为它做种了。 ![Beaker Bowser Site Source][20] -你怎么看 Beaker 浏览器?你怎么看 P2P web?请尽情在下面评论。 +你怎么看 Beaker 浏览器?你怎么看对等 Web?请尽情在下面评论。 如果你觉得本文有意思,请花点时间把它分享到社交媒体,Hacker News 或 [Reddit][21]。 @@ -95,7 +95,7 @@ via: https://itsfoss.com/beaker-browser/ 作者:[John Paul][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 355b269580ae342dae6d8689da592614f34d4884 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 May 2020 08:31:14 +0800 Subject: [PATCH 2027/3057] PUB @lxbwolf https://linux.cn/article-12203-1.html --- ...0200505 Browse the Peer-to-peer Web With Beaker Browser.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200505 Browse the Peer-to-peer Web With Beaker Browser.md (99%) diff --git a/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md b/published/20200505 Browse the Peer-to-peer Web With Beaker Browser.md similarity index 99% rename from translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md rename to published/20200505 Browse the Peer-to-peer Web With Beaker Browser.md index ef75d543f2..701d66156e 100644 --- a/translated/tech/20200505 Browse the Peer-to-peer Web With Beaker Browser.md +++ b/published/20200505 Browse the Peer-to-peer Web With Beaker Browser.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12203-1.html) [#]: subject: (Browse the Peer-to-peer Web With Beaker Browser) [#]: via: (https://itsfoss.com/beaker-browser/) [#]: author: (John Paul https://itsfoss.com/author/john/) From 3318f6f9e67755f311335a4aa1ea69f53ee47088 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 May 2020 16:14:54 +0800 Subject: [PATCH 2028/3057] APL --- ... introduction to the GNU Core Utilities - Opensource.com.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md b/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md index aaa5a6ca00..5b4159d8c8 100644 --- a/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md +++ b/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md @@ -1,3 +1,4 @@ +wxy An introduction to the GNU Core Utilities ====== @@ -117,7 +118,7 @@ David Both \- David Both is a Linux and Open Source advocate who resides in Rale via: [https://opensource.com/article/18/4/gnu-core-utilities][17] -作者: [David Both][18] 选题者: [@lujun9972][19] 译者: [译者ID][20] 校对: [校对者ID][21] +作者: [David Both][18] 选题者: [lujun9972][19] 译者: [译者ID][20] 校对: [校对者ID][21] 本文由 [LCTT][22] 原创编译,[Linux中国][23] 荣誉推出 From a667d15e9a3493c9a6f29ea1e0dcd5642c0c7d6c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 May 2020 17:23:54 +0800 Subject: [PATCH 2029/3057] TSL&PRF --- ...the GNU Core Utilities - Opensource.com.md | 147 ------------------ ...the GNU Core Utilities - Opensource.com.md | 127 +++++++++++++++ 2 files changed, 127 insertions(+), 147 deletions(-) delete mode 100644 sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md create mode 100644 translated/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md diff --git a/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md b/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md deleted file mode 100644 index 5b4159d8c8..0000000000 --- a/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md +++ /dev/null @@ -1,147 +0,0 @@ -wxy -An introduction to the GNU Core Utilities -====== - -![Introduction to the GNU Core Utilities](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/core-utils.jpg?itok=YTkmsnyy "Introduction to the GNU Core Utilities") - -Image credits :  - -[Bella67][1] via Pixabay. [CC0][2]. - -Two sets of utilities—the [GNU Core Utilities][3] and util-linux—comprise many of the Linux system administrator's most basic and regularly used tools. Their basic functions allow sysadmins to perform many of the tasks required to administer a Linux computer, including management and manipulation of text files, directories, data streams, storage media, process controls, filesystems, and much more. - -These tools are indispensable because, without them, it is impossible to accomplish any useful work on a Unix or Linux computer. Given their importance, let's examine them. - -### GNU coreutils - -The Linux Terminal - -* [Top 7 terminal emulators for Linux][4] -* [10 command-line tools for data analysis in Linux][5] -* [Download Now: SSH cheat sheet][6] -* [Advanced Linux commands cheat sheet][7] - -To understand the origins of the GNU Core Utilities, we need to take a short trip in the Wayback machine to the early days of Unix at Bell Labs. [Unix was written][8] so Ken Thompson, Dennis Ritchie, Doug McIlroy, and Joe Ossanna could continue with something they had started while working on a large multi-tasking and multi-user computer project called [Multics][9]. That little something was a game called Space Travel. As remains true today, it always seems to be the gamers who drive forward the technology of computing. This new operating system was much more limited than Multics, as only two users could log in at a time, so it was called Unics. This name was later changed to Unix. - -Over time, Unix turned out to be such a success that Bell Labs began essentially giving it away it to universities and later to companies for the cost of the media and shipping. Back in those days, system-level software was shared between organizations and programmers as they worked to achieve common goals within the context of system administration. - -Eventually, the [PHBs][10] at AT&T decided they should make money on Unix and started using more restrictive—and expensive—licensing. This was taking place at a time when software was becoming more proprietary, restricted, and closed. It was becoming impossible to share software with other users and organizations. - -Some people did not like this and fought it with free software. Richard M. Stallman, aka RMS, led a group of rebels who were trying to write an open and freely available operating system they called the GNU Operating System. This group created the GNU Utilities but didn't produce a viable kernel. - -When Linus Torvalds first wrote and compiled the Linux kernel, he needed a set of very basic system utilities to even begin to perform marginally useful work. The kernel does not provide commands or any type of command shell such as Bash. It is useless by itself. So, Linus used the freely available GNU Core Utilities and recompiled them for Linux. This gave him a complete, if quite basic, operating system. - -You can learn about all the individual programs that comprise the GNU Utilities by entering the command info coreutils at a terminal command line. The following list of the core utilities is part of that info page. The utilities are grouped by function to make specific ones easier to find; in the terminal, highlight the group you want more information on and press the Enter key. - -``` -* Output of entire files::       cat tac nl od base32 base64 -* Formatting file contents::     fmt pr fold -* Output of parts of files::     head tail split csplit -* Summarizing files::            wc sum cksum b2sum md5sum sha1sum sha2 -* Operating on sorted files::    sort shuf uniq comm ptx tsort -* Operating on fields::          cut paste join -* Operating on characters::      tr expand unexpand -* Directory listing::            ls dir vdir dircolors -* Basic operations::             cp dd install mv rm shred -* Special file types::           mkdir rmdir unlink mkfifo mknod ln link readlink -* Changing file attributes::     chgrp chmod chown touch -* Disk usage::                   df du stat sync truncate -* Printing text::                echo printf yes -* Conditions::                   false true test expr -* Redirection::                  tee -* File name manipulation::       dirname basename pathchk mktemp realpath -* Working context::              pwd stty printenv tty -* User information::             id logname whoami groups users who -* System context::               date arch nproc uname hostname hostid uptime -* SELinux context::              chcon runcon -* Modified command invocation::  chroot env nice nohup stdbuf timeout -* Process control::              kill -* Delaying::                     sleep -* Numeric operations::           factor numfmt seq -``` - -There are 102 utilities on this list. It covers many of the functions necessary to perform basic tasks on a Unix or Linux host. However, many basic utilities are missing. For example, the mount and umount commands are not in this list. Those and many of the other commands that are not in the GNU coreutils can be found in the util-linux collection. - -### util-linux - -The util-linix package of utilities contains many of the other common commands that sysadmins use. These utilities are distributed by the Linux Kernel Organization, and virtually every one of these 107 commands were originally three separate collections—fileutils, shellutils, and textutils—which were [combined into the single package][11] util-linux in 2003. - -``` -agetty          fsck.minix      mkfs.bfs        setpriv -blkdiscard      fsfreeze        mkfs.cramfs     setsid -blkid           fstab           mkfs.minix      setterm -blockdev        fstrim          mkswap          sfdisk -cal             getopt          more            su -cfdisk          hexdump         mount           sulogin -chcpu           hwclock         mountpoint      swaplabel -chfn            ionice          namei           swapoff -chrt            ipcmk           newgrp          swapon -chsh            ipcrm           nologin         switch_root -colcrt          ipcs            nsenter         tailf -col             isosize         partx           taskset -colrm           kill            pg              tunelp -column          last            pivot_root      ul -ctrlaltdel      ldattach        prlimit         umount -ddpart          line            raw             unshare -delpart         logger          readprofile     utmpdump -dmesg           login           rename          uuidd -eject           look            renice          uuidgen -fallocate       losetup         reset           vipw -fdformat        lsblk           resizepart      wall -fdisk           lscpu           rev             wdctl -findfs          lslocks         RTC Alarm       whereis -findmnt         lslogins        runuser         wipefs -flock           mcookie         script          write -fsck            mesg            scriptreplay    zramctl -fsck.cramfs     mkfs            setarch -``` - -Some of these utilities have been deprecated and will likely fall out of the collection at some point in the future. You should check [Wikipedia's util-linux page][12] for information on many of the utilities, and the man pages also provide details on the commands. - -### Summary - -These two collections of Linux utilities, the GNU Core Utilities and util-linux, together provide the basic utilities required to administer a Linux system. As I researched this article, I found several interesting utilities I never knew about. Many of these commands are seldom needed, but when you need them, they are indispensable. - -Between these two collections, there are over 200 Linux utilities. While Linux has many more commands, these are the ones needed to manage the basic functions of a typical Linux host. - -### About the author - -[![](https://opensource.com/sites/default/files/styles/profile_pictures/public/david-crop.jpg?itok=oePpOpyV)][13] - -David Both \- David Both is a Linux and Open Source advocate who resides in Raleigh, North Carolina. He has been in the IT industry for over forty years and taught OS/2 for IBM where he worked for over 20 years. While at IBM, he wrote the first training course for the original IBM PC in 1981. He has taught RHCE classes for Red Hat and has worked at MCI Worldcom, Cisco, and the State of North Carolina. He has been working with Linux and Open Source Software for almost 20 years. David has written articles for... [more about David Both][14] - -[More about me][15] - -* [Learn how you can contribute][16] - ---- - -via: [https://opensource.com/article/18/4/gnu-core-utilities][17] - -作者: [David Both][18] 选题者: [lujun9972][19] 译者: [译者ID][20] 校对: [校对者ID][21] - -本文由 [LCTT][22] 原创编译,[Linux中国][23] 荣誉推出 - -[1]: https://pixabay.com/en/tiny-people-core-apple-apple-half-700921/ -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.gnu.org/software/coreutils/coreutils.html -[4]: https://opensource.com/life/17/10/top-terminal-emulators?intcmp=7016000000127cYAAQ -[5]: https://opensource.com/article/17/2/command-line-tools-data-analysis-linux?intcmp=7016000000127cYAAQ -[6]: https://opensource.com/downloads/advanced-ssh-cheat-sheet?intcmp=7016000000127cYAAQ -[7]: https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?intcmp=7016000000127cYAAQ -[8]: https://en.wikipedia.org/wiki/History_of_Unix -[9]: https://en.wikipedia.org/wiki/Multics -[10]: https://en.wikipedia.org/wiki/Pointy-haired_Boss -[11]: https://en.wikipedia.org/wiki/GNU_Core_Utilities -[12]: https://en.wikipedia.org/wiki/Util-linux -[13]: https://opensource.com/users/dboth -[14]: https://opensource.com/users/dboth -[15]: https://opensource.com/users/dboth -[16]: https://opensource.com/participate -[17]: https://opensource.com/article/18/4/gnu-core-utilities -[18]: https://opensource.com/users/dboth -[19]: https://github.com/lujun9972 -[20]: https://github.com/译者ID -[21]: https://github.com/校对者ID -[22]: https://github.com/LCTT/TranslateProject -[23]: https://linux.cn/ diff --git a/translated/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md b/translated/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md new file mode 100644 index 0000000000..fe61c265f0 --- /dev/null +++ b/translated/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md @@ -0,0 +1,127 @@ +GNU 核心实用程序简介 +====== + +> 大多数 Linux 系统管理员需要做的事情都可以在 GNU coreutils 或 util-linux 中找到。 + +![](https://img.linux.net.cn/data/attachment/album/202005/10/172312hofgh88i3g6jajfj.jpg) + +许多 Linux 系统管理员最基本和常用的工具主要包括在两套实用程序中:[GNU 核心实用程序(coreutils)][3]和 util-linux。它们的基本功能允许系统管理员执行许多管理 Linux 系统的任务,包括管理和操作文本文件、目录、数据流、存储介质、进程控制、文件系统等等。 + +这些工具是不可缺少的,因为没有它们,就不可能在 Unix 或 Linux 计算机上完成任何有用的工作。鉴于它们的重要性,让我们来研究一下它们。 + +### GNU coreutils + +要了解 GNU 核心实用程序的起源,我们需要乘坐时光机进行一次短暂的旅行,回到贝尔实验室的 Unix 早期。[编写 Unix][8] 是为了让 Ken Thompson、Dennis Ritchie、Doug McIlroy 和 Joe Ossanna 可以继续他们在大型多任务和多用户计算机项目 [Multics][9] 上的工作:开发一个叫做《太空旅行》游戏的小东西。正如今天一样,推动计算技术发展的似乎总是游戏玩家。这个新的操作系统比 Multics(LCTT 译注:multi- 字头的意思是多数的)的局限性更大,因为一次只能有两个用户登录,所以被称为 Unics(LCTT 译注:uni- 字头的意思是单独的)。后来这个名字被改成了 Unix。 + +随着时间的推移,Unix 取得了如此巨大的成功,开始贝尔实验室基本上是将其赠送给大学,后来送给公司也只是收取介质和运输的费用。在那个年代,系统级的软件是在组织和程序员之间共享的,因为在系统管理这个层面,他们努力实现的是共同的目标。 + +最终,AT&T 公司的[老板们][10]决定,他们应该在 Unix 上赚钱,并开始使用限制更多的、昂贵的许可证。这发生在软件变得更加专有、受限和封闭的时期,从那时起,与其他用户和组织共享软件变得不可能。 + +有些人不喜欢这种情况,于是用自由软件来对抗。Richard M. Stallman(RMS),他带领着一群“反叛者”试图编写一个开放的、自由的可用操作系统,他们称之为 GNU 操作系统。这群人创建了 GNU 实用程序,但并没有产生一个可行的内核。 + +当 Linus Torvalds 开始编写和编译 Linux 内核时,他需要一套非常基本的系统实用程序来开始执行一些稍微有用的工作。内核并不提供命令或任何类型的命令 shell,比如 Bash,它本身是没有任何用处的,因此,Linus 使用了免费提供的 GNU 核心实用程序,并为 Linux 重新编译了它们。这让他拥有了一个完整的、即便是相当基本的操作系统。 + +你可以通过在终端命令行中输入命令 `info coreutils` 来了解 GNU 核心实用程序的全部内容。下面的核心实用程序列表就是这个信息页面的一部分。这些实用程序按功能进行了分组,以方便查找;在终端中,选择你想了解更多信息的组,然后按回车键。 + +``` +* Output of entire files::       cat tac nl od base32 base64 +* Formatting file contents::     fmt pr fold +* Output of parts of files::     head tail split csplit +* Summarizing files::            wc sum cksum b2sum md5sum sha1sum sha2 +* Operating on sorted files::    sort shuf uniq comm ptx tsort +* Operating on fields::          cut paste join +* Operating on characters::      tr expand unexpand +* Directory listing::            ls dir vdir dircolors +* Basic operations::             cp dd install mv rm shred +* Special file types::           mkdir rmdir unlink mkfifo mknod ln link readlink +* Changing file attributes::     chgrp chmod chown touch +* Disk usage::                   df du stat sync truncate +* Printing text::                echo printf yes +* Conditions::                   false true test expr +* Redirection::                  tee +* File name manipulation::       dirname basename pathchk mktemp realpath +* Working context::              pwd stty printenv tty +* User information::             id logname whoami groups users who +* System context::               date arch nproc uname hostname hostid uptime +* SELinux context::              chcon runcon +* Modified command invocation::  chroot env nice nohup stdbuf timeout +* Process control::              kill +* Delaying::                     sleep +* Numeric operations::           factor numfmt seq +``` + +这个列表里有 102 个实用程序。它涵盖了在 Unix 或 Linux 主机上执行基本任务所需的许多功能。但是,很多基本的实用程序都缺失了,例如,`mount` 和 `umount` 命令不在这个列表中。这些命令和其他许多不在 GNU 核心实用程序中的命令可以在 util-linux 中找到。 + +### util-linux + +util-linix 实用程序包中包含了许多系统管理员常用的其它命令。这些实用程序是由 Linux 内核组织发布的,这 107 条命令中几乎每一个都来自原本是三个单独的集合 —— fileutils、shellutils 和 textutils,2003 年它们被[合并成一个包][11]:util-linux。 + +``` +agetty          fsck.minix      mkfs.bfs        setpriv +blkdiscard      fsfreeze        mkfs.cramfs     setsid +blkid           fstab           mkfs.minix      setterm +blockdev        fstrim          mkswap          sfdisk +cal             getopt          more            su +cfdisk          hexdump         mount           sulogin +chcpu           hwclock         mountpoint      swaplabel +chfn            ionice          namei           swapoff +chrt            ipcmk           newgrp          swapon +chsh            ipcrm           nologin         switch_root +colcrt          ipcs            nsenter         tailf +col             isosize         partx           taskset +colrm           kill            pg              tunelp +column          last            pivot_root      ul +ctrlaltdel      ldattach        prlimit         umount +ddpart          line            raw             unshare +delpart         logger          readprofile     utmpdump +dmesg           login           rename          uuidd +eject           look            renice          uuidgen +fallocate       losetup         reset           vipw +fdformat        lsblk           resizepart      wall +fdisk           lscpu           rev             wdctl +findfs          lslocks         RTC Alarm       whereis +findmnt         lslogins        runuser         wipefs +flock           mcookie         script          write +fsck            mesg            scriptreplay    zramctl +fsck.cramfs     mkfs            setarch +``` + +这些实用程序中的一些已经被淘汰了,很可能在未来的某个时候会从集合中被踢出去。你应该看看[维基百科的 util-linux 页面][12]来了解其中许多实用程序的信息,而 man 页面也提供了关于这些命令的详细信息。 + +### 总结 + +这两个 Linux 实用程序的集合,GNU 核心实用程序和 util-linux,共同提供了管理 Linux 系统所需的基本实用程序。在研究这篇文章的过程中,我发现了几个有趣的实用程序,这些实用程序是我从不知道的。这些命令中的很多都是很少需要的,但当你需要的时候,它们是不可缺少的。 + +在这两个集合里,有 200 多个 Linux 实用工具。虽然 Linux 的命令还有很多,但这些都是管理一个典型的 Linux 主机的基本功能所需要的。 + +--- + +via: [https://opensource.com/article/18/4/gnu-core-utilities][17] + +作者: [David Both][18] 选题者: [lujun9972][19] 译者: [wxy][20] 校对: [wxy][21] + +本文由 [LCTT][22] 原创编译,[Linux中国][23] 荣誉推出 + +[1]: https://pixabay.com/en/tiny-people-core-apple-apple-half-700921/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.gnu.org/software/coreutils/coreutils.html +[4]: https://opensource.com/life/17/10/top-terminal-emulators?intcmp=7016000000127cYAAQ +[5]: https://opensource.com/article/17/2/command-line-tools-data-analysis-linux?intcmp=7016000000127cYAAQ +[6]: https://opensource.com/downloads/advanced-ssh-cheat-sheet?intcmp=7016000000127cYAAQ +[7]: https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?intcmp=7016000000127cYAAQ +[8]: https://en.wikipedia.org/wiki/History_of_Unix +[9]: https://en.wikipedia.org/wiki/Multics +[10]: https://en.wikipedia.org/wiki/Pointy-haired_Boss +[11]: https://en.wikipedia.org/wiki/GNU_Core_Utilities +[12]: https://en.wikipedia.org/wiki/Util-linux +[13]: https://opensource.com/users/dboth +[14]: https://opensource.com/users/dboth +[15]: https://opensource.com/users/dboth +[16]: https://opensource.com/participate +[17]: https://opensource.com/article/18/4/gnu-core-utilities +[18]: https://opensource.com/users/dboth +[19]: https://github.com/lujun9972 +[20]: https://github.com/译者ID +[21]: https://github.com/校对者ID +[22]: https://github.com/LCTT/TranslateProject +[23]: https://linux.cn/ From 232bdb69c873cd5e88c493e267374fdbd8439102 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 May 2020 17:29:28 +0800 Subject: [PATCH 2030/3057] PUB @wxy https://linux.cn/article-12205-1.html --- ... An introduction to the GNU Core Utilities - Opensource.com.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180425 An introduction to the GNU Core Utilities - Opensource.com.md (100%) diff --git a/translated/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md b/published/20180425 An introduction to the GNU Core Utilities - Opensource.com.md similarity index 100% rename from translated/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md rename to published/20180425 An introduction to the GNU Core Utilities - Opensource.com.md From 791e6d91e0f4c22901d91bd9d6ba3b23f48618af Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Sun, 10 May 2020 21:30:24 +0800 Subject: [PATCH 2031/3057] Translated. (#18405) * Translating. * Translating. * Translating. * Translating. * Translating. * Translating. * Translating. * Translating. * Checking. * Translated. --- ...00414 How I containerize a build system.md | 166 ------------------ ...00414 How I containerize a build system.md | 163 +++++++++++++++++ 2 files changed, 163 insertions(+), 166 deletions(-) delete mode 100644 sources/tech/20200414 How I containerize a build system.md create mode 100644 translated/tech/20200414 How I containerize a build system.md diff --git a/sources/tech/20200414 How I containerize a build system.md b/sources/tech/20200414 How I containerize a build system.md deleted file mode 100644 index 1271aa27af..0000000000 --- a/sources/tech/20200414 How I containerize a build system.md +++ /dev/null @@ -1,166 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How I containerize a build system) -[#]: via: (https://opensource.com/article/20/4/how-containerize-build-system) -[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) - -How I containerize a build system -====== -Building a repeatable structure to deliver applications as containers -can be complicated. Here is one way to do it effectively. -![Containers on a ship on the ocean][1] - -A build system is comprised of the tools and processes used to transition from source code to a running application. This transition also involves changing the code's audience from the software developer to the end user, whether the end user is a colleague in operations or a deployment system. - -After creating a few build systems using containers, I think I have a decent, repeatable approach that's worth sharing. These build systems were used for generating loadable software images for embedded hardware and compiling machine learning algorithms, but the approach is abstract enough to be used in any container-based build system. - -This approach is about creating or organizing the build system in a way that makes it easy to use and maintain. It's not about the tricks needed to deal with containerizing any particular software compilers or tools. It applies to the common use case of software developers building software to hand off a maintainable image to other technical users (whether they are sysadmins, DevOps engineers, or some other title). The build system is abstracted away from the end users so that they can focus on the software. - -### Why containerize a build system? - -Creating a repeatable, container-based build system can provide a number of benefits to a software team: - - * **Focus:** I want to focus on writing my application. When I call a tool to "build," I want the toolset to deliver a ready-to-use binary. I don't want to spend time troubleshooting the build system. In fact, I'd rather not know or care about the build system. - * **Identical build behavior:** Whatever the use case, I want to ensure that the entire team uses the same versions of the toolset and gets the same results when building. Otherwise, I am constantly dealing with the case of "it works on my PC but not yours." Using the same toolset version and getting identical output for a given input source file set is critical in a team project. - * **Easy setup and future migration:** Even if a detailed set of instructions is given to everyone to install a toolset for a project, chances are someone will get it wrong. Or there could be issues due to how each person has customized their Linux environment. This can be further compounded by the use of different Linux distributions across the team (or other operating systems). The issues can get uglier quickly when it comes time for moving to the next version of the toolset. Using containers and the guidelines in this article will make migration to newer versions much easier. - - - -Containerizing the build systems that I use on my projects has certainly been valuable in my experience, as it has alleviated the problems above. I tend to use Docker for my container tooling, but there can still be issues due to the installation and network configuration being unique environment to environment, especially if you work in a corporate environment involving some complex proxy settings. But at least now I have fewer build system problems to deal with. - -### Walking through a containerized build system - -I created a [tutorial repository][2] you can clone and examine at a later time or follow along through this article. I'll be walking through all the files in the repository. The build system is deliberately trivial (it runs **gcc**) to keep the focus on the build system architecture. - -### Build system requirements - -Two key aspects that I think are desirable in a build system are: - - * **Standard build invocation:** I want to be able to build code by pointing to some work directory whose path is **/path/to/workdir**. I want to invoke the build as: [code]`./build.sh /path/to/workdir`[/code] To keep the example architecture simple (for the sake of explanation), I'll assume that the output is also generated somewhere within **/path/to/workdir**. (Otherwise, it would increase the number of volumes exposed to the container, which is not difficult, but more cumbersome to explain.) - * **Custom build invocation via shell:** Sometimes, the toolset needs to be used in unforeseen ways. In addition to the standard **build.sh** to invoke the toolset, some of these could be added as options to **build.sh**, if needed. But I always want to be able to get to a shell where I can invoke toolset commands directly. In this trivial example, say I sometimes want to try out different **gcc** optimization options to see the effects. To achieve this, I want to invoke: [code]`./shell.sh /path/to/workdir`[/code] This should get me to a Bash shell inside the container with access to the toolset and to my **workdir**, so I can experiment as I please with the toolset. - - - -### Build system architecture - -To comply with the basic requirements above, here is how I architect the build system: - -![Container build system architecture][3] - -At the bottom, the **workdir** represents any software source code that needs to be built by the software developer end users. Typically, this **workdir** will be a source-code repository. The end users can manipulate this source code repository in any way they want before invoking a build. For example, if they're using **git** for version control, they could **git checkout** the feature branch they are working on and add or modify files. This keeps the build system independent of the **workdir**. - -The three blocks at the top collectively represent the containerized build system. The left-most (yellow) block at the top represents the scripts (**build.sh** and **shell.sh**) that the end user will use to interact with the build system. - -In the middle (the red block) is the Dockerfile and the associated script **build_docker_image.sh**. The development operations people (me, in this case) will typically execute this script and generate the container image. (In fact, I'll execute this many, many times until I get everything working right, but that's another story.) And then I would distribute the image to the end users, such as through a container trusted registry. The end users will need this image. In addition, they will clone the build system repository (i.e., one that is equivalent to the [tutorial repository][2]). - -The **run_build.sh** script on the right is executed inside the container when the end user invokes either **build.sh** or **shell.sh**. I'll explain these scripts in detail next. The key here is that the end user does not need to know anything about the red or blue blocks or how a container works in order to use any of this. - -### Build system details - -The tutorial repository's file structure maps to this architecture. I've used this prototype structure for relatively complex build systems, so its simplicity is not a limitation in any way. Below, I've listed the tree structure of the relevant files from the repository. The **dockerize-tutorial** folder could be replaced with any other name corresponding to a build system. From within this folder, I invoke either **build.sh** or **shell.sh** with the one argument that is the path to the **workdir**. - - -``` -dockerize-tutorial/ -├── build.sh -├── shell.sh -└── swbuilder -    ├── build_docker_image.sh -    ├── install_swbuilder.dockerfile -    └── scripts -        └── run_build.sh -``` - -Note that I've deliberately excluded the **example_workdir** above, which you'll find in the tutorial repository. Actual source code would typically reside in a separate repository and not be part of the build tool repository; I included it in this repository, so I didn't have to deal with two repositories in the tutorial. - -Doing the tutorial is not necessary if you're only interested in the concepts, as I'll explain all the files. But if you want to follow along (and have Docker installed), first build the container image **swbuilder:v1** with: - - -``` -cd dockerize-tutorial/swbuilder/ -./build_docker_image.sh -docker image ls  # resulting image will be swbuilder:v1 -``` - -Then invoke **build.sh** as: - - -``` -cd dockerize-tutorial -./build.sh ~/repos/dockerize-tutorial/example_workdir -``` - -The code for [build.sh][4] is below. This script instantiates a container from the container image **swbuilder:v1**. It performs two volume mappings: one from the **example_workdir** folder to a volume inside the container at path **/workdir**, and the second from **dockerize-tutorial/swbuilder/scripts** outside the container to **/scripts** inside the container. - - -``` -docker container run                              \ -    --volume $(pwd)/swbuilder/scripts:/scripts    \ -    --volume $1:/workdir                          \ -    --user $(id -u ${USER}):$(id -g ${USER})      \ -    --rm -it --name build_swbuilder swbuilder:v1  \ -    build -``` - -In addition, the **build.sh** also invokes the container to run with your username (and group, which the tutorial assumes to be the same) so that you will not have issues with file permissions when accessing the generated build output. - -Note that [**shell.sh**][5] is identical except for two things: **build.sh** creates a container named **build_swbuilder** while **shell.sh** creates one named **shell_swbuilder**. This is so that there are no conflicts if either script is invoked while the other one is running. - -The other key difference between the two scripts is the last argument: **build.sh** passes in the argument **build** while **shell.sh** passes in the argument **shell**. If you look at the [Dockerfile][6] that is used to create the container image, the last line contains the following **ENTRYPOINT**. This means that the **docker container run** invocation above will result in executing the **run_build.sh** script with either **build** or **shell** as the sole input argument. - - -``` -# run bash script and process the input command -ENTRYPOINT [ "/bin/bash", "/scripts/run_build.sh"] -``` - -[**run_build.sh**][7] uses this input argument to either start the Bash shell or invoke **gcc** to perform the build of the trivial **helloworld.c** project. A real build system would typically invoke a Makefile and not run **gcc** directly. - - -``` -cd /workdir - -if [ $1 = "shell" ]; then     -    echo "Starting Bash Shell" -    /bin/bash -elif [ $1 = "build" ]; then -    echo "Performing SW Build" -    gcc helloworld.c -o helloworld -Wall -fi -``` - -You could certainly pass more than one argument if your use case demands it. For the build systems I've dealt with, the build is usually for a given project with a specific **make** invocation. In the case of a build system where the build invocation is complex, you can have **run_build.sh** call a specific script inside **workdir** that the end user has to write. - -### A note about the scripts folder - -You may be wondering why the **scripts** folder is located deep in the tree structure rather than at the top level of the repository. Either approach would work, but I didn't want to encourage the end user to poke around and change things there. Placing it deeper is a way to make it more difficult to poke around. Also, I could have added a **.dockerignore** file to ignore the **scripts** folder, as it doesn't need to be part of the container context. But since it's tiny, I didn't bother. - -### Simple yet flexible - -While the approach is simple, I've used it for a few rather different build systems and found it to be quite flexible. The aspects that are going to be relatively stable (e.g., a given toolset that changes only a few times a year) are fixed inside the container image. The aspects that are more fluid are kept outside the container image as scripts. This allows me to easily modify how the toolset is invoked by updating the script and pushing the changes to the build system repository. All the user needs to do is to pull the changes to their local build system repository, which is typically quite fast (unlike updating a Docker image). The structure lends itself to having as many volumes and scripts as are needed while abstracting the complexity away from the end user. - -How will you need to modify your application to optimize it for a containerized environment? - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/4/how-containerize-build-system - -作者:[Ravi Chandran][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ravichandran -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_2015-3-osdc-lead.png?itok=O6aivM_W (Containers on a ship on the ocean) -[2]: https://github.com/ravi-chandran/dockerize-tutorial -[3]: https://opensource.com/sites/default/files/uploads/build_sys_arch.jpg (Container build system architecture) -[4]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/build.sh -[5]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/shell.sh -[6]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/swbuilder/install_swbuilder.dockerfile -[7]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/swbuilder/scripts/run_build.sh diff --git a/translated/tech/20200414 How I containerize a build system.md b/translated/tech/20200414 How I containerize a build system.md new file mode 100644 index 0000000000..b7bc3f252c --- /dev/null +++ b/translated/tech/20200414 How I containerize a build system.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I containerize a build system) +[#]: via: (https://opensource.com/article/20/4/how-containerize-build-system) +[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) + +构建系统容器化指南 +====== +搭建一个通过容器分发应用的可复用系统可能很复杂,但这儿有个好方法。 +![Containers on a ship on the ocean][1] + +一个用于将源代码编译成可运行的应用的构建系统是由工具和流程共同组成。在编译过程中还涉及到代码从软件开发者流转到最终用户,无论最终用户是运维的同事还是部署的同事。 + +在使用容器搭建了一些构建系统后,我觉得有一个不错的可复用的方法值得分享。虽然这些构建系统被用于编译机器学习算法和为嵌入式硬件生成可加载的软件镜像上,但这个方法足够抽象,可用于任何基于容器的构建系统。 + +这个方法是关于通过简单和可维护的方式搭建或组织构建系统,但并不涉及处理特定编译器或工具容器化的技巧。它适用于软件开发人员构建软件并将可维护镜像交给其他技术人员(无论是系统管理员,运维工程师或者其他头衔)的常见情况。由于构建系统对于最终用户是透明的,因此他们能够专注于软件本身。 + +### 为什么要容器化构建系统? + +搭建基于容器的可复用构建系统可以为软件团队带来诸多好处: + + * **专注**:我希望专注于应用的开发。当我调用一个名为“build”的工具时,我希望这个工具集能生成一个随时可用的二进制文件。我不想浪费时间在构建系统的查错上。实际上,我宁愿不了解也不关心构建系统。 + * **一致的构建行为**:无论在哪种使用情况下,我都想确保整个团队使用相同版本的工具集并在构建时得到相同的结果。否则,我就得不断地处理“我这咋就是好的”的麻烦。在团队项目中,使用相同版本的工具集并对给定的输入源文件集产生一致的输出是非常重要。 + * **易于部署和升级**:即使向每个人都提供一套详细说明来为项目安装工具集,也可能会有人翻车。问题可能是由于每个人对自己的 Linux 环境的个性化修改导致的。在团队中使用不同的 Linux 发行版(或者其他操作系统),情况可能还会变得更复杂。当需要将工具集升级到下一版本时,问题很快就会变得更糟糕。使用容器和本指南将使得新版本升级非常简单。 + +我在项目中容器化构建系统的经验显然很有价值,因为它可以缓解上述问题。我倾向于使用 Docker 作为容器工具,虽然在相对特殊的环境中安装和网络配置仍可能出现问题,尤其是当你在一个使用复杂代理的企业环境中工作时。但至少现在我需要解决的构建系统问题已经很少了。 + +### 漫步容器化的构建系统 + +我创建了一个[教程存储库][2],随后你可以 clone 并检查它,或者按照本文内容进行操作。我将逐个介绍存储库中的文件。这个构建系统非常简单(它使用**gcc**)从而可以专注于构建系统结构上。 + +### 构建系统需求 + +我认为构建系统中有两个关键点: + + * **标准化构建调用**:我希望能够指定一些形如 **/path/to/workdir** 的工作目录来构建代码。我希望以如下形式调用构建: + + ./build.sh /path/to/workdir + + 为了使得示例的结构足够简单(以便说明),我将假定输出也在 **/path/to/workdir** 路径下的某处生成。(否则,将增加容器中显示的卷的数量,虽然这并不困难,但解释起来比较麻烦。) + * **通过 shell 自定义构建调用**:有时,工具集会以出乎意料的方式被调用。除了标准的工具集调用 **build.sh** 之外,如果需要还可以为 **build.sh** 添加一些选项。但我一直希望能够有一个可以直接调用工具集命令的 shell。在这个简单的示例中,有时我想尝试不同的 **gcc** 优化选项并查看效果。为此,我希望调用: + + ./shell.sh /path/to/workdir + + 这将让我得到一个容器内部的 Bash shell,并且可以调用工具集和访问我的**工作目录 workdir**,从而我可以根据需要尝试使用这个工具集。 + +### 构建系统架构 + +为了满足上述基本需求,这是我的构架系统架构: + +![Container build system architecture][3] + +在底部的 **workdir** 代表软件开发者用于构建的任意软件源码。通常,这个 **workdir** 是一个源代码的存储库。在构建之前,最终用户可以通过任何方式来操纵这个存储库。例如,如果他们使用 **git** 作为版本控制工具的话,可以使用 **git checkout** 切换到他们正在工作的功能分支上并添加或修改文件。这样可以使得构建系统独立于 **workdir** 之外。 + +顶部的三个模块共同代表了容器化的构建系统。最左边的黄色模块代表最终用户与构建系统交互的脚本(**build.sh** 和 **shell.sh**)。 + +在中间的红色模块是 Dockerfile 和相关的脚本 **build_docker_image.sh**。开发者(在这个例子中指我)通常将执行这个脚本并生成容器镜像(事实上我多次执行它直到一切正常为止,但这是另一个故事)。然后我将镜像分发给最终用户,例如通过 container trusted registry 进行分发。最终用户将需要这个镜像。另外,他们将 clone 构建系统存储库(即一个与[教程存储库][2]等效的存储库)。 + +当最终用户调用 **build.sh** 或者 **shell.sh** 时,容器内将执行右边的 **run_build.sh** 脚本。接下来我将详细解释这些脚本。这里的关键是最终用户不需要为了使用而去了解任何关于红色或者蓝色模块或者容器工作原理的知识。 + +### 构建系统细节 + +把教程存储库的文件结构映射到这个系统结构上。我曾将这个原型结构用于相对复杂构建系统,因此它的简单并不会造成任何限制。下面我列出存储库中相关文件的树结构。文件夹 **dockerize-tutorial** 能用构建系统的其他任何名称代替。在这个文件夹下,我用 **workdir** 的路径作参数调用 **build.sh** 或 **shell.sh**。 + +``` +dockerize-tutorial/ +├── build.sh +├── shell.sh +└── swbuilder +    ├── build_docker_image.sh +    ├── install_swbuilder.dockerfile +    └── scripts +        └── run_build.sh +``` + +请注意,我上面特意没列出 **example_workdir**,你能在教程存储库中找到。实际的源码通常存放在单独的存储库中,而不是构建工具库中的一部分;本教程为了不必处理两个存储库,所以我将它包含在这个存储库中。 + +如果你只对概念感兴趣,本教程并非必须的,因为我将解释所有文件。但是如果你继续本教程(并且已经安装 Docker),首先使用以下命令来构建容器镜像 **swbuilder:v1**: + +``` +cd dockerize-tutorial/swbuilder/ +./build_docker_image.sh +docker image ls  # resulting image will be swbuilder:v1 +``` + +然后调用 **build.sh**: + +``` +cd dockerize-tutorial +./build.sh ~/repos/dockerize-tutorial/example_workdir +``` + +下面是 [build.sh][4] 的代码。这个脚本从容器镜像 **swbuilder:v1** 实例化一个容器。而这个容器实例映射了两个卷:一个将文件夹 **example_workdir** 挂载到容器内部路径 **/workdir** 上,第二个则将容器外的文件夹 **dockerize-tutorial/swbuilder/scripts** 挂载到容器内部路径 **/scripts** 上。 + +``` +docker container run                              \ +    --volume $(pwd)/swbuilder/scripts:/scripts    \ +    --volume $1:/workdir                          \ +    --user $(id -u ${USER}):$(id -g ${USER})      \ +    --rm -it --name build_swbuilder swbuilder:v1  \ +    build +``` + +另外,**build.sh** 还会用你的用户名(以及组,本教程假设两者一致)去运行容器,以便在访问构建输出时不出现文件权限问题。 + +请注意,[**shell.sh**][5] 和 **build.sh** 大体上是一致的,除了两点不同:**build.sh** 会创建一个名为 **build_swbuilder** 的容器,而 **shell.sh** 则会创建一个名为 **shell_swbuilder** 的容器。这样一来,当其中一个脚本运行时另一个脚本被调用也不会产生冲突。 + +两个脚本之间的另一处关键不同则在于最后一个参数:**build.sh** 传入参数 **build** 而 **shell.sh** 则传入 **shell**。如果你看了用于构建容器镜像的 [Dockerfile][6],就会发现最后一行包含了下面的 **ENTRYPOINT** 语句。这意味着上面的 **docker container run** 调用将使用 **build** 或 **shell** 作为唯一的输入参数来执行 **run_build.sh** 脚本。 + +``` +# run bash script and process the input command +ENTRYPOINT [ "/bin/bash", "/scripts/run_build.sh"] +``` + +[**run_build.sh**][7] 使用这个输入参数来选择启动 Bash shell 还是调用 **gcc** 来构建 **helloworld.c** 项目。一个真正的构建系统通常会使用 Makefile 而非直接运行 **gcc**。 + +``` +cd /workdir + +if [ $1 = "shell" ]; then     +    echo "Starting Bash Shell" +    /bin/bash +elif [ $1 = "build" ]; then +    echo "Performing SW Build" +    gcc helloworld.c -o helloworld -Wall +fi +``` + +在使用时,如果你需要传入多个参数,当然也是可以的。我处理过的构建系统,构建通常是对给定的项目调用 **make**。如果一个构建系统有非常复杂的构建调用,则你可以让 **run_build.sh** 调用 **workdir** 下最终用户编写的特定脚本。 + +### 关于 scripts 文件夹的说明 + +你可能想知道为什么 **scripts** 文件夹位于目录树深处而不是位于存储库的顶层。两种方法都是可行的,但我不想鼓励最终用户到处乱翻并修改里面的脚本。将它放到更深的地方是一个让他们更难乱翻的方法。另外,我也可以添加一个 **.dockerignore** 文件去忽略 **scripts** 文件夹,因为它不是容器必需的部分。但因为它很小,所以我没有这样做。 + +### 简单而灵活 + +尽管这一方法很简单,但我将其用于某些非常特殊的构建系统时,发现它其实非常灵活。相对稳定的部分(例如,一年仅修改数次的给定工具集)被固定在容器镜像内。较为灵活的部分则以脚本的形式放在镜像外。这使我能够简单地通过修改脚本并将更改推送到构建系统存储库来修改调用工具集的方式。用户所需要做的是将更改拉到本地的构建系统存储库中,这通常是非常快的(与更新 Docker 镜像不同)。这种结构使其能够拥有尽可能多的卷和脚本,同时使最终用户摆脱复杂性。 + +你将如何修改你的应用来针对容器化环境进行优化呢? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/how-containerize-build-system + +作者:[Ravi Chandran][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/LazyWolfLin) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ravichandran +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_2015-3-osdc-lead.png?itok=O6aivM_W (Containers on a ship on the ocean) +[2]: https://github.com/ravi-chandran/dockerize-tutorial +[3]: https://opensource.com/sites/default/files/uploads/build_sys_arch.jpg (Container build system architecture) +[4]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/build.sh +[5]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/shell.sh +[6]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/swbuilder/install_swbuilder.dockerfile +[7]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/swbuilder/scripts/run_build.sh From 1e697f03270ae697cb3d3ddf55fd462d936825bd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 May 2020 22:07:54 +0800 Subject: [PATCH 2032/3057] PRF @geekpi --- ...rgerfs to increase your virtual storage.md | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/translated/tech/20200501 Using mergerfs to increase your virtual storage.md b/translated/tech/20200501 Using mergerfs to increase your virtual storage.md index 936ed454d9..24b851eca7 100644 --- a/translated/tech/20200501 Using mergerfs to increase your virtual storage.md +++ b/translated/tech/20200501 Using mergerfs to increase your virtual storage.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using mergerfs to increase your virtual storage) @@ -12,17 +12,15 @@ ![][1] -如果你想在一个媒体项目中用上多个磁盘或分区,而又不想丢失任何现有数据,但又想将所有文件都存放在一个驱动器下,该怎么办?这就是 mergefs 派上用场的地方! +如果你想在一个媒体项目中用到了多个磁盘或分区,不想丢失任何现有数据,但又想将所有文件都存放在一个驱动器下,该怎么办?这时,mergefs 就能派上用场! -[mergerfs][2] 是旨在简化跨多个商业存储设备文件的存储和管理的联合文件系统。 +[mergerfs][2] 是一个联合文件系统,旨在简化存储和管理众多商业存储设备上的文件。 -你需要从[这个][3] github 页面获取最新的 RPM。Fedora 的版本名称中带有 _**fc**_ 和版本号。例如,以下是 Fedora 31 的版本: - -[mergerfs-2.29.0-1.fc31.x86_64.rpm][4] +你需要从他们的 [GitHub][3] 页面获取最新的 RPM。Fedora 的版本名称中带有 “fc” 和版本号。例如,这是 Fedora 31 的版本: [mergerfs-2.29.0-1.fc31.x86_64.rpm][4]。 ### 安装和配置 mergefs -使用 sudo 安装已下载的 mergefs 软件包: +使用 `sudo` 安装已下载的 mergefs 软件包: ``` $ sudo dnf install mergerfs-2.29.0-1.fc31.x86_64.rpm @@ -47,7 +45,7 @@ total 2 -rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv ``` -在此例中挂载了两块磁盘,分别为 _disk1_ 和 _disk2_。两个驱动器都有一个包含文件的 _**Videos**_ 目录。 +在此例中挂载了两块磁盘,分别为 `disk1` 和 `disk2`。两个驱动器都有一个包含文件的 `Videos` 目录。 现在,我们将使用 mergefs 挂载这些驱动器,使它们看起来像一个更大的驱动器。 @@ -55,19 +53,17 @@ total 2 $ sudo mergerfs -o defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=1M /disk1:/disk2 /media ``` -mergefs 手册页非常广泛且复杂,因此我们将说明上面提到的选项。 - - * _defaults_:除非指定,否则将使用默认设置。 - * _allow_other_:允许 sudo 或 root 以外的用户查看文件系统。 - * _use_ino_:让 mergefs 提供文件/目录 inode 而不是 libfuse。虽然不是默认值,但建议你启用它,以便链接的文件共享相同的 inode 值。 - * _category.create=mfs_:根据可用空间在驱动器间传播文件。 - * _moveonenospc=true_:如果启用,那么如果写入失败,将进行扫描以查找具有最大可用空间的驱动器。 - * _minfreespace=1M_:最小使用空间值。 - * _disk1_:第一块硬盘。 - * _disk2_:第二块硬盘。 - * _/media_:挂载驱动器的目录。 - +mergefs 手册页非常庞杂,因此我们将说明上面提到的选项。 + * `defaults`:除非指定,否则将使用默认设置。 + * `allow_other`:允许 `sudo` 或 `root` 以外的用户查看文件系统。 + * `use_ino`:让 mergefs 提供文件/目录 inode 而不是 libfuse。虽然不是默认值,但建议你启用它,以便链接的文件共享相同的 inode 值。 + * `category.create=mfs`:根据可用空间在驱动器间传播文件。 + * `moveonenospc=true`:如果启用,那么如果写入失败,将进行扫描以查找具有最大可用空间的驱动器。 + * `minfreespace=1M`:最小使用空间值。 + * `disk1`:第一块硬盘。 + * `disk2`:第二块硬盘。 + * `/media`:挂载驱动器的目录。 看起来是这样的: @@ -84,7 +80,7 @@ $ df -hT | grep media 继续示例: -有一个叫 _Baby’s second Xmas.mkv_ 的 30M 视频。让我们将其复制到用 mergerfs 挂载的 _/media_ 文件夹中。 +有一个叫 `Baby's second Xmas.mkv` 的 30M 视频。让我们将其复制到用 mergerfs 挂载的 `/media` 文件夹中。 ``` $ ls -lh "Baby's second Xmas.mkv" @@ -103,7 +99,7 @@ $ df -hT | grep media 1:2 fuse.mergerfs 66M 31M 30M 51% /media ``` -从磁盘空间利用率中可以看到,因为 disk1 没有足够的可用空间,所以 mergefs 自动将文件复制到 disk2。 +从磁盘空间利用率中可以看到,因为 `disk1` 没有足够的可用空间,所以 mergefs 自动将文件复制到 `disk2`。 这是所有文件详情: @@ -135,7 +131,7 @@ via: https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/ 作者:[Curt Warfield][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8ac77ea7f607be019e64d68afefb3b9ca9c4498e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 May 2020 22:08:20 +0800 Subject: [PATCH 2033/3057] PUB @geekpi https://linux.cn/article-12207-1.html --- ...0200501 Using mergerfs to increase your virtual storage.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200501 Using mergerfs to increase your virtual storage.md (98%) diff --git a/translated/tech/20200501 Using mergerfs to increase your virtual storage.md b/published/20200501 Using mergerfs to increase your virtual storage.md similarity index 98% rename from translated/tech/20200501 Using mergerfs to increase your virtual storage.md rename to published/20200501 Using mergerfs to increase your virtual storage.md index 24b851eca7..de9b8af2c7 100644 --- a/translated/tech/20200501 Using mergerfs to increase your virtual storage.md +++ b/published/20200501 Using mergerfs to increase your virtual storage.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12207-1.html) [#]: subject: (Using mergerfs to increase your virtual storage) [#]: via: (https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/) [#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) From 69366c195264f0bcdc9b13f5cfaa3d1a6d2f9e25 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Mon, 11 May 2020 00:11:45 +0800 Subject: [PATCH 2034/3057] TSL 20200506 Managing Git projects with submodules and subtrees --- ...t projects with submodules and subtrees.md | 212 ------------------ ...t projects with submodules and subtrees.md | 211 +++++++++++++++++ 2 files changed, 211 insertions(+), 212 deletions(-) delete mode 100644 sources/tech/20200506 Managing Git projects with submodules and subtrees.md create mode 100644 translated/tech/20200506 Managing Git projects with submodules and subtrees.md diff --git a/sources/tech/20200506 Managing Git projects with submodules and subtrees.md b/sources/tech/20200506 Managing Git projects with submodules and subtrees.md deleted file mode 100644 index 66f89ca545..0000000000 --- a/sources/tech/20200506 Managing Git projects with submodules and subtrees.md +++ /dev/null @@ -1,212 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Managing Git projects with submodules and subtrees) -[#]: via: (https://opensource.com/article/20/5/git-submodules-subtrees) -[#]: author: (Manaswini Das https://opensource.com/users/manaswinidas) - -Managing Git projects with submodules and subtrees -====== -Submodules and subtrees help you manage child projects across multiple -repositories. -![Digital creative of a browser on the internet][1] - -If you are into open source development, you have probably worked with Git to manage source code. You might have come across projects with numerous dependencies and/or sub-projects. How do you manage them? - -For an open source organization, it can be tricky to achieve single-source documentation and dependency management for the community _and_ the product. The documentation and project often end up fragmented and redundant, which makes them difficult to maintain. - -### The need - -Suppose you want to use a single project as a child project inside a repository. The traditional method is just to copy the project to the parent repository. But, what if you want to use the same child project in many parent repositories? It wouldn't be feasible to copy the child project into every parent and have to make changes in all of them whenever you update it. This would create redundancy and inconsistency in the parent repositories and make it difficult to update and maintain the child project. - -### Git submodules and subtrees - -What if you could put one project within another using a single command? What if you could just add the project as a child to any number of projects and push changes on the go, whenever you want to? Git provides solutions for this: Git submodules and Git subtrees. These tools were created to support code-sharing development workflows on a more modular level, aspiring to bridge the gap between the Git repository's source-code management (SCM) and the sub-repos within it. - -![Cherry tree growing on a mulberry tree][2] - -Cherry tree growing on a mulberry tree - -This is a real-life scenario of the concepts this article will cover in detail. If you're already familiar with trees, here is what this model will look like: - -![Tree with subtrees][3] - -CC BY-SA opensource.com - -### What are Git submodules? - -Git provides submodules in its default package that enable Git repositories to be nested within other repositories. To be precise, the Git submodule points to a specific commit on the child repository. Here is what Git submodules look like in my [Docs-test][4] GitHub repo: - -![Git submodules screenshot][5] - -The format **[folder@commitId][6]** indicates that the repository is a submodule, and you can directly click on the folder to go to the child repository. The config file called **.gitmodules** contains all the submodule repository details. My repo's **.gitmodules** file looks like this: - -![Screenshot of .gitmodules file][7] - -You can use the following commands to use Git submodules in your repositories. - -#### Clone a repository and load submodules - -To clone a repository containing submodules: - - -``` -`$ git clone --recursive ` -``` - -If you have already cloned a repository and want to load its submodules: - - -``` -`$ git submodule update --init` -``` - -If there are nested submodules: - - -``` -`$ git submodule update --init --recursive` -``` - -#### Download submodules - -Downloading submodules sequentially can be a tedious task, so **clone** and **submodule update** will support the **\--jobs** or **-j** parameter. - -For example, to download eight submodules at once, use: - - -``` -$ git submodule update --init --recursive -j 8 -$ git clone --recursive --jobs 8 <URL to Git repo> -``` - -#### Pull submodules - -Before running or building the parent repository, you have to make sure that the child dependencies are up to date. - -To pull all changes in submodules: - - -``` -`$ git submodule update --remote` -``` - -#### Create repositories with submodules - -To add a child repository to a parent repository: - - -``` -`$ git submodule add ` -``` - -To initialize an existing Git submodule: - - -``` -`$ git submodule init` -``` - -You can also create branches and track commits in your submodules by adding **\--update** to your **submodule update** command: - - -``` -`$ git submodule update --remote` -``` - -#### Update submodule commits - -As explained above, a submodule is a link that points to a specific commit in the child repository. If you want to update the commit of the submodule, don't worry. You don't need to specify the latest commit explicitly. You can just use the general **submodule update** command: - - -``` -`$ git submodule update` -``` - -Just add and commit as you normally would to create and push the parent repository to GitHub. - -#### Delete a submodule from a parent repository - -Merely deleting a child project folder manually won't remove the child project from the parent repository. To delete a submodule named **childmodule**, use: - - -``` -`$ git rm -f childmodule` -``` - -Although Git submodules may appear easy to work with, it can be difficult for beginners to find their way around them. - -### What are Git subtrees? - -Git subtrees, introduced in Git 1.7.11, allow you to insert a copy of any repository as a subdirectory of another one. It is one of several ways Git projects can inject and manage project dependencies. It stores the external dependencies in regular commits. Git subtrees provide clean integration points, so they're easier to revert. - -If you use the [subtrees tutorial provided by GitHub][8] to use subtrees, you won't see a **.gittrees** config file in your local whenever you add a subtree. This makes it difficult to recognize subtrees because subtrees look like general folders, but they are copies of the child repository. The version of Git subtree with the **.gittrees** config file is not available with the default Git package, so to get the git-subtree with **.gittrees** config file, you must download git-subtree from the [**/contrib/subtree** folder][9] in the Git source repository. - -You can clone any repository containing subtrees, just like any other general repository, but it may take longer because entire copies of the child repository reside in the parent repository. - -You can use the following commands to use Git subtrees in your repositories. - -#### Add a subtree to a parent repository - -To add a new subtree to a parent repository, you first need to **remote add** it and then run the **subtree add** command, like: - - -``` -$ git remote add remote-name <URL to Git repo> -$ git subtree add --prefix=folder/ remote-name <URL to Git repo> subtree-branchname -``` - -This merges the whole child project's commit history to the parent repository. - -#### Push and pull changes to and from the subtree - - -``` -`$ git subtree push-all` -``` - -or - - -``` -`$ git subtree pull-all` -``` - -### Which should you use? - -Every tool has pros and cons. Here are some features that may help you decide which is best for your use case. - - * Git submodules have a smaller repository size since they are just links that point to a specific commit in the child project, whereas Git subtrees house the entire child project along with its history. - * Git submodules need to be accessible in a server, but subtrees are decentralized. - * Git submodules are mostly used in component-based development, whereas Git subtrees are used in system-based development. - - - -A Git subtree isn't a direct alternative to a Git submodule. There are certain caveats that guide where each can be used. If there is an external repository you own and are likely to push code back to, use Git submodule since it is easier to push. If you have third-party code that you are unlikely to push to, use Git subtree since it is easier to pull. - -Give Git subtrees and submodules a try and let me know how it goes in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/5/git-submodules-subtrees - -作者:[Manaswini 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://opensource.com/users/manaswinidas -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) -[2]: https://opensource.com/sites/default/files/uploads/640px-bialbero_di_casorzo.jpg (Cherry tree growing on a mulberry tree) -[3]: https://opensource.com/sites/default/files/subtree_0.png (Tree with subtrees) -[4]: https://github.com/manaswinidas/Docs-test/ -[5]: https://opensource.com/sites/default/files/uploads/git-submodules_github.png (Git submodules screenshot) -[6]: mailto:folder@commitId -[7]: https://opensource.com/sites/default/files/uploads/gitmodules.png (Screenshot of .gitmodules file) -[8]: https://help.github.com/en/github/using-git/about-git-subtree-merges -[9]: https://github.com/git/git/tree/master/contrib/subtree diff --git a/translated/tech/20200506 Managing Git projects with submodules and subtrees.md b/translated/tech/20200506 Managing Git projects with submodules and subtrees.md new file mode 100644 index 0000000000..a6902ac3b8 --- /dev/null +++ b/translated/tech/20200506 Managing Git projects with submodules and subtrees.md @@ -0,0 +1,211 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing Git projects with submodules and subtrees) +[#]: via: (https://opensource.com/article/20/5/git-submodules-subtrees) +[#]: author: (Manaswini Das https://opensource.com/users/manaswinidas) + +使用子模块和子仓库管理 Git 项目 +====== +使用子模块和子仓库来帮助你管理多个仓库中共有的子项目。 +![Digital creative of a browser on the internet][1] + +如果你参与了开源项目的开发,那么你可能会用 Git 来管理你的源码。你可能遇到过有很多依赖和/或子项目的项目。你怎么管理它们? + +对于一个开源组织,社区*和*产品想要实现单一来源文档和依赖管理比较棘手。文档和项目往往会碎片化和变得冗余,这致使它们很难维护。 + +### 必要性 + +假设你想要在一个仓库中把一个项目作为子项目来用。传统的方法是把该项目复制到父仓库中。但是,如果你想要在多个父项目中用同一个子项目呢?(如果)把子项目复制到所有父项目中,当有更新时,你不得不在每个父项目中都做修改,这是不太可行的。(因为)这会导致父项目中的冗余和数据不一致,也会使更新和维护子项目变得很困难。 + +### Git 子模块和子仓库 + +如果你可以用一条命令把一个项目放进另一个项目中,会怎样呢?如果你随时可以把一个项目作为子项目添加到任意数目的项目中,并可以同步更新修改呢?Git 提供了这类问题的解决方案:Git 子模块和 Git 子仓库。创建这些工具的目的是以更加模块化的水平来支持共用代码的开发工作流,(创建者)意在消除 Git 仓库源码管理source-code management与它下面的子仓库间的障碍。 + +![Cherry tree growing on a mulberry tree][2] + +生长在桑树上的樱桃树 + +下面是本文要详细介绍的概念的一个真实应用场景。如果你已经很熟悉 tree,这个模型看起来是下面这样: + +![Tree with subtrees][3] + +CC BY-SA opensource.com + +### Git 子模块是什么? + +Git 在它默认的包中提供了子模块,子模块可以把 Git 仓库嵌入到其他仓库中。确切地说,Git 子模块是指向子仓库中的某次提交。下面是我 [Docs-test][4] GitHub 仓库中的 Git 子模块: + +![Git submodules screenshot][5] + +**[文件夹@提交 Id][6]** 格式表明这个仓库是一个子模块,你可以直接点击文件夹进入该子仓库。名为 **.gitmodules** 的配置文件包含所有子模块仓库的详细信息。我的仓库的 **.gitmodules** 文件如下: + +![Screenshot of .gitmodules file][7] + +你可以用下面的命令在你的仓库中使用 Git 子模块: + +#### 克隆一个仓库并加载子模块 + +克隆一个含有子模块的仓库: + + +``` +`$ git clone --recursive ` +``` + +如果你之前已经克隆了仓库,现在想加载它的子模块: + + +``` +`$ git submodule update --init` +``` + +如果有嵌套的子模块: + + +``` +`$ git submodule update --init --recursive` +``` + +#### 下载子模块 + +串行地连续下载多个子模块是很枯燥的工作,所以 **clone** 和 **submodule update** 会支持 **\--jobs** 或 **-j** 参数: + +例如,想一次下载 8 个子模块,使用: + + +``` +$ git submodule update --init --recursive -j 8 +$ git clone --recursive --jobs 8 <URL to Git repo> +``` + +#### 拉取子模块 + +在运行或构建父项目之前,你需要确保依赖的子项目都是最新的。 + +拉取子模块的所有修改: + + +``` +`$ git submodule update --remote` +``` + +#### 使用 submodule 创建仓库: + +向一个父仓库添加子仓库: + + +``` +`$ git submodule add ` +``` + +初始化一个已存在的 Git 子模块: + + +``` +`$ git submodule init` +``` + +你也可以通过为 **submodule update** 命令添加 **\--update** 参数在子模块中创建分支和追踪提交: + + +``` +`$ git submodule update --remote` +``` + +#### 更新子模块提交 + +上面提到过,一个子模块就是一个指向子仓库中某次提交的链接。如果你想更新子模块的提交,不要担心。你不需要显式地指定最新的提交。你只需要使用通用的 **submodule update** 命令: + + +``` +`$ git submodule update` +``` + +就像你平时创建父仓库和把父仓库推送到 GitHub 那样添加和提交就可以了。 + +#### 从一个父仓库中删除一个子模块 + +仅仅手动删除一个子项目文件夹不会从父项目中移除这个子项目。想要删除名为 **childmodule** 的子模块,使用: + + +``` +`$ git rm -f childmodule` +``` + +虽然 Git 子模块看起来很容易上手,但是对于初学者来说,有一定的使用门槛。 + +### Git 子仓库是什么? + +Git 子仓库,是在 Git 1.7.11 引入的,让你可以把任何仓库的副本作为子目录嵌入另一个仓库中。它是 Git 项目可以注入和管理项目依赖的几种方法之一。它在常规的提交中保存了外部依赖信息。Git 子仓库提供了整洁的集成点,因此很容易复原它们。 + +如果你参考 [GitHub 提供的子仓库教程][8] 来使用子仓库,那么无论你什么时候添加子仓库,在本地都不会看到 **.gittrees** 配置文件。这让我们很难分辨哪个是子仓库,因为它们看起来很像普通的文件夹,但是它们却是子仓库的副本。默认的 Git 包中不提供带 **.gittrees** 配置文件的 Git 子仓库版本,因此如果你想要带 **.gittrees** 配置文件的 git-subtree,必须从 Git 源码仓库的 [**/contrib/subtree** 文件夹][9] 下载 git-subtree。 + +你可以像克隆其他常规的仓库那样克隆任何含有子仓库的仓库,但由于在父仓库中有整个子仓库的副本,因此克隆过程可能会持续很长时间。 + +你可以用下面的命令在你的仓库中使用 Git 子仓库。 + +#### 向父仓库中添加一个子仓库 + +想要向父仓库中添加一个子仓库,首先你需要执行 **remote add**,之后执行 **subtree add** 命令: + + +``` +$ git remote add remote-name <URL to Git repo> +$ git subtree add --prefix=folder/ remote-name <URL to Git repo> subtree-branchname +``` + +上面的命令会把整个子项目的提交历史合并到父仓库。 + +#### 向子仓库推送修改以及从子仓库拉取修改 + + +``` +`$ git subtree push-all` +``` + +或者 + + +``` +`$ git subtree pull-all` +``` + +### 你应该使用哪个? + +任何工具都有优缺点。下面是一些可能会帮助你决定哪种最适合你的特性: + + * Git 子模块的仓库占用空间更小,因为它们只是指向子项目的某次提交的链接,而 Git 子仓库保存了整个子项目及其提交历史。 + * Git 子模块需要在服务器中可访问,但子仓库是去中心化的。 + * Git 子模块大量用于基于组件的开发,而 Git 子仓库多用于基于系统的开发。 + + + +Git 子仓库并不是 Git 子模块的直接可替代项。有明确的说明来指导我们该使用哪种。如果有一个归属于你的外部仓库,使用场景是向它回推代码,那么就使用 Git 子模块,因为推送代码更容易。如果你有第三方代码,且不会向它推送代码,那么使用 Git 子仓库,因为拉取代码更容易。 + +自己尝试使用 Git 子仓库和子模块,然后在评论中留下你的使用感想。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/git-submodules-subtrees + +作者:[Manaswini Das][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/manaswinidas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://opensource.com/sites/default/files/uploads/640px-bialbero_di_casorzo.jpg (Cherry tree growing on a mulberry tree) +[3]: https://opensource.com/sites/default/files/subtree_0.png (Tree with subtrees) +[4]: https://github.com/manaswinidas/Docs-test/ +[5]: https://opensource.com/sites/default/files/uploads/git-submodules_github.png (Git submodules screenshot) +[6]: mailto:folder@commitId +[7]: https://opensource.com/sites/default/files/uploads/gitmodules.png (Screenshot of .gitmodules file) +[8]: https://help.github.com/en/github/using-git/about-git-subtree-merges +[9]: https://github.com/git/git/tree/master/contrib/subtree From 147eb6e5bb175c45ffb5c852982b1cbe57211a6f Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Mon, 11 May 2020 00:14:43 +0800 Subject: [PATCH 2035/3057] update --- ...200506 Managing Git projects with submodules and subtrees.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/translated/tech/20200506 Managing Git projects with submodules and subtrees.md b/translated/tech/20200506 Managing Git projects with submodules and subtrees.md index a6902ac3b8..a67f328d0c 100644 --- a/translated/tech/20200506 Managing Git projects with submodules and subtrees.md +++ b/translated/tech/20200506 Managing Git projects with submodules and subtrees.md @@ -181,8 +181,6 @@ $ git subtree add --prefix=folder/ remote-name <URL to Git repo> subtree-b * Git 子模块需要在服务器中可访问,但子仓库是去中心化的。 * Git 子模块大量用于基于组件的开发,而 Git 子仓库多用于基于系统的开发。 - - Git 子仓库并不是 Git 子模块的直接可替代项。有明确的说明来指导我们该使用哪种。如果有一个归属于你的外部仓库,使用场景是向它回推代码,那么就使用 Git 子模块,因为推送代码更容易。如果你有第三方代码,且不会向它推送代码,那么使用 Git 子仓库,因为拉取代码更容易。 自己尝试使用 Git 子仓库和子模块,然后在评论中留下你的使用感想。 From 6a4e47c17044d85f5f0b80b3c99da44da316ce4b Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Mon, 11 May 2020 00:36:01 +0800 Subject: [PATCH 2036/3057] APL --- ... Best Raspberry Pi Operating Systems for Various Purposes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md b/sources/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md index f4b09c9dbc..55c80a882a 100644 --- a/sources/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md +++ b/sources/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 15b9d60e87af0a7324d43143c28cb12d1ede4f3e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 May 2020 00:55:06 +0800 Subject: [PATCH 2037/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200511=20Can?= =?UTF-8?q?=E2=80=99t=20Install=20Deb=20File=20on=20Ubuntu=2020.04=3F=20He?= =?UTF-8?q?re=E2=80=99s=20What=20You=20Need=20to=20do!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md --- ...buntu 20.04- Here-s What You Need to do.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md diff --git a/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md b/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md new file mode 100644 index 0000000000..d5b106895b --- /dev/null +++ b/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do!) +[#]: via: (https://itsfoss.com/cant-install-deb-file-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do! +====== + +_**Brief: Double clicking on the deb file doesn’t install it via the software center in Ubuntu 20.04? You are not the only one facing this issue. This tutorial shows how to fix it.**_ + +On the “[things to do after installing Ubuntu 20.04][1]” article, a few readers mentioned that they had trouble [installing software from the Deb file][2]. + +I found that strange because installing a program using the deb file is one of the simplest methods. All you have to do is to double click the downloaded file and it opens (by default) with the Software Center program. You click on install, it asks for your password and within a few seconds/minute, the software is installed. + +I had [upgraded to Ubuntu 20.04 from 19.10][3] and hadn’t faced this issue with it until today. + +I downloaded the .deb file for installing [Rocket Chat messenger][4] and when I double clicked on it to install this software, the file was opened with the archive manager. This is not what I expected. + +![DEB files opened with Archive Manager instead of Software Center][5] + +The “fix” is simple and I am going to show it to you in this quick tutorial. + +### Installing deb files in Ubuntu 20.04 + +For some reasons, the default software to open the deb file has been set to Archive Manager tool in Ubuntu 20.04. The Archive Manager tool is used for [extract zip][6] and other compressed files. + +The solution for this problem is pretty simple. You [change the default application in Ubuntu][7] for opening DEB files from Archive Manager to Software Install. Let me show you the steps. + +**Step 1:** Right click on the downloaded DEB file and select **Properties**: + +![][8] + +**Step 2:** Go to “**Open With**” tab, select “**Software Install**” app and click on “**Set as default**“. + +![][9] + +This way, all the deb files in the future will be opened with Software Install i.e. the software center applications. + +Confirm it by double clicking the DEB file and see if it open with the software center application or not. + +#### Ignorant bug or stupid feature? + +Why is deb files are supposed to be opened with Archive Manager is beyond comprehension. I do hope that this is a bug, not a weird feature like [not allowing drag and drop files on the desktop in Ubuntu 20.04][10]. + +Since we are discussing deb file installation, let me tell you about a nifty tool [gdebi][11]. It’s a lightweight application with the sole purpose of installing DEB file. Not always but some times, it can also handle the dependencies. + +You can learn more about [using gdebi and making it default for installing deb files here][12]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cant-install-deb-file-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/ +[2]: https://itsfoss.com/install-deb-files-ubuntu/ +[3]: https://itsfoss.com/upgrade-ubuntu-version/ +[4]: https://rocket.chat/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/error-opening-deb-file.png?ssl=1 +[6]: https://itsfoss.com/unzip-linux/ +[7]: https://itsfoss.com/change-default-applications-ubuntu/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/open-deb-files.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/deb-file-install-fix-ubuntu.png?fit=800%2C454&ssl=1 +[10]: https://itsfoss.com/add-files-on-desktop-ubuntu/ +[11]: https://launchpad.net/gdebi +[12]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ From 217ea30828738e7dd5e297416f1e7f4f4c2ca49e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 May 2020 00:56:26 +0800 Subject: [PATCH 2038/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200509=20Ensm?= =?UTF-8?q?allening=20Go=20binaries=20by=20prohibiting=20comparisons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md --- ... Go binaries by prohibiting comparisons.md | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md diff --git a/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md b/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md new file mode 100644 index 0000000000..61ad40c73e --- /dev/null +++ b/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ensmallening Go binaries by prohibiting comparisons) +[#]: via: (https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Ensmallening Go binaries by prohibiting comparisons +====== + +Conventional wisdom dictates that the larger the number of types declared in a Go program, the larger the resulting binary. Intuitively this makes sense, after all, what’s the point in defining a bunch of types if you’re not going to write code that operates on them. However, part of the job of a linker is to detect functions which are not referenced by a program–say they are part of a library of which only a subset of functionality is used–and remove them from the final output. Yet, the adage mo’ types, mo’ binary holds true for the majority of Go programs. + +In this post I’ll dig into what equality, in the context of a Go program, means and why changes [like this][1] have a measurable impact on the size of a Go program. + +### Defining equality between two values + +The Go spec defines the concepts of assignability and equality. Assignabiity is the act of assigning a value to an identifier. Not everything which is declared can be assigned, for example constants and functions. Equality is the act of comparing two identifies by asking _are their contents the same?_ + +Being a strongly typed language, the notion of sameness is fundamentally rooted in the identifier’s type. Two things can only be the same if they are of the same type. Beyond that, the type of the values defines how they are compared. + +For example, integers are compared arithmetically. For pointer types, equality is determining if the addresses they point too are the same. Reference types like maps and channels, like pointers, are considered to be the same if they have the same address. + +These are all examples of bitwise equality, that is, if the bit patterns of the memory that value occupies are the same, those values are equal. This is known as memcmp, short for memory comparison, as equality is defined by comparing the contents of two areas of memory. + +Hold on to this idea, I’ll come back to in a second. + +### Struct equality + +Beyond scalar types like integers, floats, and pointers is the realm of compound types; structs. All structs are laid out in memory in program order, thus this declaration: + +``` +type S struct { + a, b, c, d int64 +} +``` + +will consume 32 bytes of memory; 8 bytes for `a`, then 8 bytes for `b`, and so on. The spec says that _struct values are comparable if all their fields are comparable_. Thus two structs are equal iff each of their fields are equal. + +``` +a := S{1, 2, 3, 4} +b := S{1, 2, 3, 4} +fmt.Println(a == b) // prints true +``` + +Under the hood the compiler uses memcmp to compare the 32 bytes of `a` and `b`. + +### Padding and alignment + +However the simplistic bitwise comparison strategy will fail in situations like this: + +``` +type S struct { + a byte + b uint64 + c int16 + d uint32 +} + +func main() + a := S{1, 2, 3, 4} + b := S{1, 2, 3, 4} + fmt.Println(a == b) // prints true +} +``` + +The code compiles, the comparison is still true, but under the hood the compiler cannot rely on comparing the bit patterns of `a` and `b` because the structure contains _padding_. + +Go requires each field in a struct to be naturally aligned. 2 byte values must start on an even address, four byte values on an address divisible by 4, and so on[1][2]. The compiler inserts padding to ensure the fields are _aligned_ to according to their type and the underlying platform. In effect, after padding, this is what the compiler sees[2][3]: + +``` +type S struct { + a byte + _ [7]byte // padding + b uint64 + c int16 + _ [2]int16 // padding + d uint32 +} +``` + +Padding exists to ensure the correct field alignments, and while it does take up space in memory, the contents of those padding bytes are unknown. You might assume that, being Go, the padding bytes are always zero, but it turns out that’s not the case–the contents of padding bytes are simply not defined. Because they’re not defined to always be a certain value, doing a bitwise comparison may return false because the nine bytes of padding spread throughout the 24 bytes of `S` are may not be the same. + +The Go compiler solves this problem by generating what is known as an equality function. In this case `S`‘s equality function knows how to compare two values of type `S` by comparing only the fields in the function while skipping over the padding. + +### Type algorithms + +Phew, that was a lot of setup to illustrate why, for each type defined in a Go program, the compiler may generate several supporting functions, known inside the compiler as the type’s algorithms. In addition to the equality function the compiler will generate a hash function if the type is used as a map key. Like the equality function, the hash function must consider factors like padding when computing its result to ensure it remains stable. + +It turns out that it can be hard, and sometimes non obvious, to intuit when the compiler will generate these functions–it’s more than you’d expect–and it can be hard for the linker to eliminate the ones that are not needed as reflection often causes the linker to be more conservative when trimming types. + +### Reducing binary size by prohibiting comparisons + +Now we’re at a point to explain Brad’s change. By adding an incomparable field [3][4] to the type, the resulting struct is by extension incomparable, thus forcing the compiler to elide the generation of eq and hash algorithms, short circuiting the linkers elimination of those types and, in practice, reducing the size of the final binary. As an example of this technique, this program: + +``` +package main + +import "fmt" + +func main() { + type t struct { + // _ [0][]byte uncomment to prevent comparison + a byte + b uint16 + c int32 + d uint64 + } + var a t + fmt.Println(a) +} +``` + +when compiled with Go 1.14.2 (darwin/amd64), decreased from 2174088 to 2174056, a saving of 32 bytes. In isolation this 32 byte saving may seem like small beer, but consider that equality and hash functions can be generated for every type in the transitive closure of your program and all its dependencies, and the size of these functions varies depending on the size of the type and its complexity, prohibiting them can have a sizeable impact on the final binary over and above the old saw of `-ldflags="-s -w"`. + +The bottom line, if you don’t wish to make your types comparable, a hack like this enforces it at the source level while contributing to a small reduction in the size of your binary. + +* * * + +Addendum: thanks to Brad’s prodding, Go 1.15 already has a bunch of improvements by [Cherry Zhang][5] and [Keith Randall][6] that fix the most egregious of the failures to eliminate unnecessary equality and hash functions (although I suspect it was also to avoid the proliferation of this class of CLs). + + 1. On 32bit platforms `int64` and `uint64` values may not be 8 byte aligned as the natural alignment of the platform is 4 bytes. See [issue 599][7] for the gory details.[][8] + 2. 32 bit platforms would see `_ [3]byte` padding between the declaration of `a` and `b`. See previous.[][9] + 3. Brad used `[0]func()`, but any type that the spec limits or prohibits comparisons on will do. By declaring the array has zero elements the type has no impact on the size or alignment of the struct.[][10] + + + +#### Related posts: + + 1. [How the Go runtime implements maps efficiently (without generics)][11] + 2. [The empty struct][12] + 3. [Padding is hard][13] + 4. [Typed nils in Go 2][14] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/net/commit/e0ff5e5a1de5b859e2d48a2830d7933b3ab5b75f +[2]: tmp.uBLyaVR1Hm#easy-footnote-bottom-1-4116 (On 32bit platforms int64 and uint64 values may not be 8 byte aligned as the natural alignment of the platform is 4 bytes. See issue 599 for the gory details.) +[3]: tmp.uBLyaVR1Hm#easy-footnote-bottom-2-4116 (32 bit platforms would see _ [3]byte padding between the declaration of a and b. See previous.) +[4]: tmp.uBLyaVR1Hm#easy-footnote-bottom-3-4116 (Brad used [0]func(), but any type that the spec limits or prohibits comparisons on will do. By declaring the array has zero elements the type has no impact on the size or alignment of the struct.) +[5]: https://go-review.googlesource.com/c/go/+/231397 +[6]: https://go-review.googlesource.com/c/go/+/191198 +[7]: https://github.com/golang/go/issues/599 +[8]: tmp.uBLyaVR1Hm#easy-footnote-1-4116 +[9]: tmp.uBLyaVR1Hm#easy-footnote-2-4116 +[10]: tmp.uBLyaVR1Hm#easy-footnote-3-4116 +[11]: https://dave.cheney.net/2018/05/29/how-the-go-runtime-implements-maps-efficiently-without-generics (How the Go runtime implements maps efficiently (without generics)) +[12]: https://dave.cheney.net/2014/03/25/the-empty-struct (The empty struct) +[13]: https://dave.cheney.net/2015/10/09/padding-is-hard (Padding is hard) +[14]: https://dave.cheney.net/2017/08/09/typed-nils-in-go-2 (Typed nils in Go 2) From 74791ac8448d0bfe74d68dc43f9b3409e280c10b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 May 2020 00:57:08 +0800 Subject: [PATCH 2039/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200510=20Open?= =?UTF-8?q?=20source=20underpins=20coronavirus=20IoT=20and=20robotics=20so?= =?UTF-8?q?lutions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md --- ... coronavirus IoT and robotics solutions.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md diff --git a/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md b/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md new file mode 100644 index 0000000000..5ce9ce0a1f --- /dev/null +++ b/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source underpins coronavirus IoT and robotics solutions) +[#]: via: (https://opensource.com/article/20/5/robotics-covid19) +[#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) + +Open source underpins coronavirus IoT and robotics solutions +====== +From sanitization of equipment and facilities to plotting the spread of +the virus, robots are playing an active role in combating COVID-19. +![Three giant robots and a person][1] + +The tech sector is quietly having a boom during the COVID-19 pandemic. Open source developers are getting involved with many aspects of the fight against the coronavirus, [using Python to visualize its spread][2] and helping to repurpose data acquisition systems to perform contact tracing. + +However, one of the most exciting areas of current research is the use of robotics to contain the spread of the coronavirus. In the last few weeks, robots have been deployed in critical environments—particularly in hospitals and on airplanes—to help staff sterilize surfaces and objects. + +Most of these robots are produced by tech startups, who have seen an opportunity to prove the worth of their proprietary systems. Many of them, however, rely on [open source cloud and IoT tools][3] that have been developed by the open source community. + +In this article, we'll take a look at how robotics are being used to fight the disease, the IoT infrastructure that underpins these systems, and finally, the security and privacy concerns that their increased use is highlighting. + +### Robots and COVID-19 + +Around the world, robots are being deployed to help the fight against COVID-19. The most direct use of robots has been in healthcare facilities, and China has taken the lead when it comes to deploying robots in hospitals. + +For example, a field hospital that recently opened in Wuhan—where the virus originated—is [making extensive use of robots][4] to help healthcare workers care for patients. Some of these robots provide food, drink, and medicine to patients, and others are used to clean parts of the hospital. + +Other companies, such as the Texas startup Xenex Disinfection Services, are using robots and UV light to deactivate viruses, bacteria, and spores on surfaces in airports. Still others, like Dimer UVC Innovations, are focusing on making robots that can [improve aircraft hygiene][5]. + +Not all of the "robots" deployed against the disease are anthropomorphic, though. The same field hospital in Wuhan that is using human-like robots is also making extensive use of less obviously "robotic" IoT devices. + +Patients entering the hospital are screened by networked 5G thermometers to alert staff for anyone showing a high fever, and patients wear smart bracelets and rings equipped with sensors. These are synced with CloudMinds' AI platform, and patients' vital signs, including temperature, heart rate, and blood oxygen levels, can be monitored. + +### Robots and the IoT + +Even when these robots appear to be independent entities, they make [extensive use of the IoT][6]. In other words, although patients may feel that they are being cared for by a robot that can make its own decisions, in reality, these robots are controlled by large, distributed sensing and data processing systems. + +Although many of the robots being deployed are the proprietary property of the tech firms who produce their hardware, their functioning is based on an ecosystem of software that is largely open source. + +This observation is an important one because it overturns one of the primary misconceptions about the [way that AI is used today][7][,][7] whether in a healthcare setting or elsewhere. Most research into robotics today does not seek to embed fully intelligent AI systems into robots themselves but, instead, uses centralized AI systems to control a wide variety of far less "smart" IoT devices. + +This observation, in turn, highlights two key points about the robots currently being developed and used to fight COVID-19. One is that they rely on a software ecosystem—much of it open source—that has been developed in a truly collaborative process involving thousands of engineers. The second is that the networked nature of these robots makes them vulnerable to exploitation. + +### Security and privacy + +This vulnerability to cybersecurity threats has led some analysts to raise questions about the wisdom of widespread deployment of IoT-driven robotics, whether in the healthcare system or anywhere else. Spyware in the IoT [remains a huge problem][8], and some fear that by integrating IoT systems into healthcare, we may be exposing more data—and more sensitive data—to intruders. + +Even where developers are careful to build security into these devices, the sheer number of components they rely on makes DevSecOps processes difficult to implement. Especially in this current time of crisis, many software engineers have been forced to accelerate the release of new components, and this could lead to them being vulnerable. If a company is rushing to bring a healthcare robot onto the market in response to COVID-19, it's unlikely that the open source code that these devices run on will be [properly audited][9]. + +And even if companies are able to maintain the integrity of their DevSecOps processes while still accelerating development, it's far from certain that patients themselves understand the privacy implications of delegating their care to IoT devices. Many lack the open source privacy tools [necessary to keep their data private][10] when browsing the internet, let alone those that should be deployed to protect sensitive healthcare data. + +### The future + +In short, the deployment of robots in the fight against COVID-19 is highlighting long-standing concerns about the integrity, security, and privacy of IoT systems more generally. Professionals in this field have long argued that [IoT audits][11] and [embedded Linux systems][12] should be the standard for IoT development, but in the current crisis, their warnings are likely to be ignored. + +This is worrying because it's likely that IoT systems will be increasingly used in healthcare in the coming decade. So whilst the COVID-19 pandemic will provide a proof of their utility in this sector, it should also not be used as an excuse to roll out poorly secured, poorly audited IoT software in highly sensitive environments. + +Open source isn’t just changing the way we interact with the world, it’s changing the way the world... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/robotics-covid19 + +作者:[Sam Bocetta][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_robots.png?itok=TOZgajrd (Three giant robots and a person) +[2]: https://opensource.com/article/20/4/python-data-covid-19 +[3]: https://opensource.com/article/18/7/digital-transformation-strategy-think-cloud +[4]: https://www.cnbc.com/2020/03/18/how-china-is-using-robots-and-telemedicine-to-combat-the-coronavirus.html +[5]: https://www.therobotreport.com/company-offers-germ-killing-robot-to-airports-to-address-coronavirus-outbreak/ +[6]: https://www.cloudwards.net/what-is-the-internet-of-things/ +[7]: https://opensource.com/article/17/3/5-big-ways-ai-rapidly-invading-our-lives +[8]: https://blog.eccouncil.org/spyware-in-the-iot-what-does-it-mean-for-your-online-privacy/ +[9]: https://opensource.com/article/17/10/doc-audits +[10]: https://privacyaustralia.net/privacy-tools/ +[11]: https://opensource.com/article/19/11/how-many-iot-devices +[12]: https://opensource.com/article/17/3/embedded-linux-iot-ecosystem From 6c086fa8afdd2c955587eaf47c2d14eeba5ac6a7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 11 May 2020 08:42:30 +0800 Subject: [PATCH 2040/3057] translated --- ...fce With KDE Plasma Desktop Environment.md | 71 ------------------- ...fce With KDE Plasma Desktop Environment.md | 71 +++++++++++++++++++ 2 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md create mode 100644 translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md diff --git a/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md b/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md deleted file mode 100644 index 61c2007784..0000000000 --- a/sources/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment) -[#]: via: (https://itsfoss.com/ubuntu-studio-opts-for-kde/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment -====== - -[Ubuntu Studio][1] is a popular [official flavour of Ubuntu][2] tailored for creative content creators involved in audio production, video, graphics, photography, and book publishing. It offers a lot of multimedia content creation applications out of the box with the best possible experience. - -After the recent 20.04 LTS release, the Ubuntu Studio team highlighted something very important in their [official announcement][3]. And, probably not everyone noticed the key information i.e Ubuntu Studio’s future. - -Ubuntu Studio 20.04 will be the last version to ship with the [Xfce desktop environment][4]. All the future releases will be using [KDE Plasma][5] instead. - -### Why is Ubuntu Studio ditching XFCE? - -![][6] - -As per their clarification, Ubuntu Studio isn’t focused on any particular look/feel but aims to provide the best user experience possible. And, KDE proves to be a better option. - -> Plasma has proven to have better tools for graphics artists and photographers, as can be seen in Gwenview, Krita, and even the file manager Dolphin. Additionally, it has Wacom tablet support better than any other desktop environment. - -> It has become so good that the majority of the Ubuntu Studio team is now using Kubuntu with Ubuntu Studio added-on via Ubuntu Studio Installer as their daily driver. With so many of us using Plasma, the timing just seems right to focus on a transition to Plasma with our next release. - -Of course every desktop environment has been tailored for something different. And, here, they think that KDE Plasma will be the most suitable desktop environment replacing XFCE to provide a better user experience to all the users. - -While I’m not sure how the users will react to this as every user has a different set of preferences. If the existing users won’t have a problem with KDE, it isn’t going to be a big deal. - -It is worth noting that Ubuntu Studio also mentioned why KDE is potentially a superior choice for them: - -> The Plasma desktop environment has, without Akonadi, become just as light in resource usage as Xfce, perhaps even lighter. Other audio-focused Linux distributions, such as Fedora Jam and KXStudio, have historically used the KDE Plasma desktop environment and done well with the audio. - -Also, they’ve highlighted [an article by Jason Evangelho at Forbes][7] where some benchmarks reveal that KDE is almost as light as Xfce. Even though that’s a good sign – we still have to wait for the users to test-drive the KDE-powered Ubuntu Studio. Only then we’ll be able to observe whether Ubuntu Studio’s decision to ditch XFCE desktop environment was the right thing to do. - -### What will change for Ubuntu Studio users after this change? - -The overall workflow may get affected (or improve) moving forward with KDE on Ubuntu Studio 20.10 and later. - -However, the upgrade process (from 20.04 to 20.10) will result in broken systems. So, a fresh install of Ubuntu Studio 20.10 or later versions will be the only way to go. - -They’ve also mentioned that they will be constantly evaluating for any duplication with the pre-installed apps. So, I believe more details will follow in the coming days. - -Ubuntu Studio is second distribution that has changed its main desktop environment in recent times. Earlier, [Lubuntu][8] switched to LXQt from LXDE. - -What do you think about this change? Feel free to share your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ubuntu-studio-opts-for-kde/ - -作者:[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://ubuntustudio.org/ -[2]: https://itsfoss.com/which-ubuntu-install/ -[3]: https://ubuntustudio.org/2020/04/ubuntu-studio-20-04-lts-released/ -[4]: https://xfce.org -[5]: https://kde.org/plasma-desktop -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-studio-kde-xfce.jpg?ssl=1 -[7]: https://www.forbes.com/sites/jasonevangelho/2019/10/23/bold-prediction-kde-will-steal-the-lightweight-linux-desktop-crown-in-2020 -[8]: https://itsfoss.com/lubuntu-20-04-review/ diff --git a/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md b/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md new file mode 100644 index 0000000000..1b9d4bb57a --- /dev/null +++ b/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment) +[#]: via: (https://itsfoss.com/ubuntu-studio-opts-for-kde/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu Studio 将用 KDE Plasma 桌面环境替换 Xfce +====== + +[Ubuntu Studio][1] 是一个流行的 [Ubuntu 官方变种][2],它是为从事音频制作、视频、图形、摄影和书籍出版的创意内容创建者量身定制的。它提供了许多拥有良好体验的开箱即用的多媒体内容创建应用。 + +在最近的 20.04 LTS 版本发布之后,Ubuntu Studio 团队在其[官方公告][3]中强调了一些非常重要的内容。而且,也许不是每个人都注意到关键信息,即 Ubuntu Studio 的未来。 + +Ubuntu Studio 20.04 将是带有 [Xfce 桌面环境][4]的最后一个版本。将来的所有发行版都将改用 [KDE Plasma][5]。 + +### 为什么 Ubuntu Studio 放弃 XFCE? + +![][6] + +据他们的澄清,Ubuntu Studio 并不致力于任何特定的外观,而是致力于提供最佳的用户体验。同时,KDE 被证明是一个更好的选择。 + +> Plasma 已被证明为图形艺术家和摄影师提供了更好的工具,例如在 Gwenview、Krita 甚至文件管理器 Dolphin 中都可以看到。此外,它对 Wacom 平板的支持比其他任何桌面环境都更好。 + +> 它已经变得不错,以至于大多数 Ubuntu Studio 团队现在都使用 Kubuntu,并通过 Ubuntu Studio Installer 将 Ubuntu Studio 作为日常附加驱动使用。由于我们中的许多人都在使用 Plasma,因此在我们的下一个版本中过渡到 Plasma 的时机似乎是正确的。 + +当然,每个桌面环境都针对不同的内容进行了量身定制。他们认为 KDE Plasma 将是取代 XFCE 的最适合的桌面环境,从而为所有用户提供更好的用户体验。 + +尽管我不确定用户对此会有何反应,因为每个用户都有不同的偏好。如果现有用户对 KDE 没有问题,那就没什么大不了的。 + +值得注意的是,Ubuntu Studio 还提到了为什么 KDE 可能是它们的更好选择: + +>在没有 Akonadi 的情况下,Plasma 桌面环境的资源使用与 Xfce 一样轻,甚至更轻。Fedora Jam 和 KXStudio 等其他以音频为重点的 Linux 发行版在历史上一直使用 KDE Plasma 桌面环境,并且在音频方面做得很好。 + +此外,他们还强调了[福布斯杂志中 Jason Evangelho 的文章][7],其中一些基准测试表明 KDE 几乎与 Xfce 一样轻。即使这是一个好征兆,我们仍然必须等待用户测试 KDE 驱动的 Ubuntu Studio。只有这样,我们才能观察 Ubuntu Studio 放弃 XFCE 桌面环境的决定是否正确。 + +### 更改后,Ubuntu Studio 用户将发生什么变化? + +在带 KDE 的 Ubuntu Studio 20.10 及更高版本上可能会影响(或改进)整个工作流程。 + +但是,升级过程(从 20.04 到 20.10)将导致系统损坏。因此,全新安装 Ubuntu Studio 20.10 或更高版本将是唯一的方法。 + +他们还提到,他们将不断评估与预安装的应用是否存在重复。因此,我相信在接下来的几天中将会有更多细节。 + +Ubuntu Studio 是最近第二个切换它主要桌面环境的发行版。先前,[Lubuntu] [8] 从 LXDE 切换到 LXQt。 + +你如何看待这种变化?欢迎在下面的评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-studio-opts-for-kde/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://ubuntustudio.org/ +[2]: https://itsfoss.com/which-ubuntu-install/ +[3]: https://ubuntustudio.org/2020/04/ubuntu-studio-20-04-lts-released/ +[4]: https://xfce.org +[5]: https://kde.org/plasma-desktop +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-studio-kde-xfce.jpg?ssl=1 +[7]: https://www.forbes.com/sites/jasonevangelho/2019/10/23/bold-prediction-kde-will-steal-the-lightweight-linux-desktop-crown-in-2020 +[8]: https://itsfoss.com/lubuntu-20-04-review/ From 11a1541e07790331c73bad8177b6b0b4d7996db6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 11 May 2020 08:48:20 +0800 Subject: [PATCH 2041/3057] translating --- ...etting started with FreeBSD as a desktop operating system.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md b/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md index 0ce2dc4e32..2f1be1e803 100644 --- a/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md +++ b/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 27acd36c548ab38b720fe293ff28beb5f985cea4 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Mon, 11 May 2020 21:42:52 +0800 Subject: [PATCH 2042/3057] TSL 20200404 Best Raspberry Pi Operating Systems for Various Purposes --- ... Operating Systems for Various Purposes.md | 296 ------------------ ... Operating Systems for Various Purposes.md | 296 ++++++++++++++++++ 2 files changed, 296 insertions(+), 296 deletions(-) delete mode 100644 sources/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md create mode 100644 translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md diff --git a/sources/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md b/sources/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md deleted file mode 100644 index 55c80a882a..0000000000 --- a/sources/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md +++ /dev/null @@ -1,296 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Best Raspberry Pi Operating Systems for Various Purposes) -[#]: via: (https://itsfoss.com/raspberry-pi-os/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Best Raspberry Pi Operating Systems for Various Purposes -====== - -[Raspberry Pi][1] is an indispensable single-board computer that comes in handy for a lot of work. Don’t believe me? Just [go through this list of Raspberry Pi projects][2] to get a gist of what this tiny device is capable of. - -Considering how useful a Raspberry Pi is – it is an important task to choose the right operating system for it. Of course, you can do a lot of things with Linux but an OS specially configured for a specific purpose can save you considerable time and effort. - -So, in this article, I will be mentioning some of the popular and useful operating systems tailored for Raspberry Pi. - -### Installing any OS on Raspberry Pi is really easy thanks to the Raspberry Pi Imager tool - -[Installing a Raspberry PI operating system on an SD card][3] is easier than ever before. You can simply get the [Raspberry Pi Imager][4] and get any Raspberry Pi OS installed quickly. Check the official video to see how easy it is. - -You may also utilize [NOOBS][5] (New Out Of the Box Software) to easily install different operating systems on Raspberry Pi. You might also get a pre-installed SD card from the list of their supported retailers mentioned in their [official NOOBS download page][5]. - -Feel free to explore more about installing the operating systems in their [official documentation][6]. - -[Raspberry Pi OS Download][4] - -Now that you know how to install it (and where to get it from), let me highlight a list of useful Raspberry Pi OS to help you out. - -### Various operating systems for Raspberry Pi - -Please keep in mind that I have taken some effort to list only those Raspberry Pi operating system projects that are being actively maintained. If a project gets discontinued in near future, let me know in the comment section and I’ll update this article. - -Another thing is that I have focused on the latest Raspberry 4 but this should not be considered a list of Raspberry Pi 4 OS. You should be able to use it on Raspberry Pi 3, 3 B+ and other variants as well but please check the official project websites for the exact details. - -**Note:** The list is in no particular order of ranking. - -#### 1\. Raspbian OS: The official Raspberry Pi OS - -![][7] - -Raspbian is the officially supported OS for Raspberry Pi boards. It comes baked in with several tools for education, programming, and general use. Specifically, it includes Python, Scratch, Sonic Pi, Java, and several other important packages. - -Originally, Raspbian is based on Debian and comes pre-installed with loads of useful packages. So, when you get this installed, you probably don’t need to install essentials separately – you should find almost everything pre-installed. - -Raspbian OS is actively maintained and it is one of the most popular Raspberry Pi OS out there. You can install it using [NOOBS][5] or follow the [official documentation][6] to get it installed. - -[Raspbian OS][8] - -#### 2\. Ubuntu MATE: For general purpose computing - -![][9] - -Even though Raspbian is the officially supported OS, it does not feature the latest and greatest packages. So, if you want quicker updates and potentially latest packages, you can try Ubuntu MATE for Raspberry Pi. - -Ubuntu MATE tailored as a Raspberry Pi OS is an incredibly lightweight distribution to have installed. It’s also popularly used on [NVIDIA’s Jetson Nano][10]. In other words, you can utilize it for several use-cases with the Raspberry Pi. - -To help you out, we also have a detailed guide on [how to install Ubuntu MATE on Raspberry Pi][11]. - -[Ubuntu MATE for Raspberry Pi][12] - -#### 3\. Ubuntu Server: To use it as a Linux server - -![][13] - -If you’re planning to use your Raspberry Pi as some sort of server for your project, Ubuntu Server can be a great choice to have installed. - -You can find both 32-bit and 64-bit images of the OS. And, depending on what board you have (if it supports 64-bit), you can go ahead and install the same. - -However, it is worth noting that Ubuntu Server isn’t tailored for desktop usage. So, you need to keep in mind that you will have no proper graphical user interface installed by default. - -[Ubuntu Server][14] - -#### 4\. LibreELEC: For media server - -![][15] - -While we already have a list of [media server software available for Linux][16], LibreELEC is one of them. - -It’s a great lightweight OS system capable enough to have [KODI][17] on your Raspberry Pi. You can try installing it using the Raspberry Pi Imager. - -You can easily head to their [official download webpage][18] and find a suitable installer image for your board. - -[LibreELEC][19] - -#### 5\. OSMC: For media server - -![][20] - -OSMC is yet another [popular media server software][16] for Linux. While considering the use of Raspberry Pi boards as media center devices, this is one of the best Raspberry Pi OS that you can recommend to someone. - -Similar to LibreELEC, OSMC also runs KODI to help you manage your media files and enjoy watching the content you already have. - -OSMC does not officially mention the support for **Raspberry Pi 4**. So, if you have Raspberry Pi 3 or lower, you should be good to go. - -[OSMC][21] - -#### 6\. RISC OS: The original ARM OS - -![][22] - -Originally crafted for ARM devices, RISC OS has been around for almost 30 years or so. - -We also have a separate detailed article on [RISC OS][23], if you’re curious to know more about it. Long story short, RISC OS is also tailored for modern ARM-based single-board computers like the Raspberry Pi. It presents a simple user interface with a focus on performance. - -Again, this is not something meant for the Raspberry Pi 4. So, only if you have a Raspberry Pi 3 or lower, you can give it a try. - -[RISC OS][24] - -#### 7\. Mozilla WebThings Gateway: For IoT projects - -![][25] - -As part of Mozilla’s [open-source implementation for IoT devices][26], WebThings Gateway lets you monitor and control all your connected IoT devices. - -You can follow the [official documentation][27] to check the requirements and the instructions to get it installed on a Raspberry Pi. Definitely, one of the most useful Raspberry Pi OS for IoT applications. - -[WebThings Gateway][28] - -#### 8\. Ubuntu Core: For IoT projects - -Yet another Raspberry Pi OS for potential [IoT][29] applications or just to simply test snaps – Ubuntu Core. - -Ubuntu core is specifically tailored for IoT devices or specifically Raspberry Pi, here. I wouldn’t make any claims about it- but Ubuntu Core is a suitable secure OS for Raspberry Pi boards. You can give this a try for yourself! - -[Ubuntu Core][30] - -#### 9\. DietPi: Lightweight Raspberry Pi OS - -![DietPi Screenshot via Distrowatch][31] - -DietPi is a lightweight [Debian][32] operating system that also claims to be lighter than the “Raspbian Lite” OS. - -While considering it as a lightweight Raspberry Pi OS, it offers a lot of features that could come in handy for several use-cases. Ranging from easy installers for software packages to a backup solution, there’s a lot to explore. - -If you’re aiming to get an OS with a low footprint but potentially better performance, you could give this a try. - -[DietPi][33] - -#### 10\. Lakka Linux: Make a retro gaming console - -![][34] - -Looking for a way to turn your Raspberry Pi to a retro gaming console? - -Lakka Linux distribution is originally built on the RetroArch emulator. So, you can have all your retro games on your Raspberry Pi in no time. - -We also have a separate article on [Lakka Linux][35] – if you’re curious to know about it. Or else, just go right ahead and test it out! - -[Lakka][36] - -#### 11\. RetroPie: For retro gaming - -![ ][37] - -RetroPie is yet another popular Raspberry Pi OS that turns it into a retro gaming console. It features several configuration tools so that you can customize the theme or just tweak the emulator to have the best retro games. - -It is worth noting that it does not include any copyrighted games. You can give it a try and see how it works! - -[RetroPie][38] - -#### 12\. Kali Linux: For hacking on budget - -![][39] - -Want to try and learn some ethical hacking skills on your Raspberry Pi? Kali Linux can be a perfect fit for it. And, yes, it usually supports the latest Raspberry Pi as soon as it launches. - -Not just limited to Raspberry Pi, but you can get a long list of other supported devices as well. Try it out and have fun! - -[Kali Linux][40] - -#### 13\. OpenMediaVault: For Network Attached Storage (NAS) - -![][41] - -If you’re trying to set up a [NAS][42] (Network Attached Storage) solution on minimal hardware, Raspberry Pi can help. - -Originally, based on Debian Linux, OpenMediaVault offers a bunch of features that include web-based administration capabilities, plugin support, and more. It does support most of the Raspberry Pi models – so you can try downloading it and get it installed! - -[OpenMediaVault][43] - -#### 14\. ROKOS: For crypto mining - -![][44] - -If you’re someone who’s interested in cryptocurrencies and bitcoins specifically, this could interest you. - -ROKOS is a Debian-based OS that basically lets you turn your Raspberry Pi into a node while having pre-installed drivers and packages for the same. Of course, you need to know how it works before getting it installed. So, I suggest you do some research if you’re not sure what you’re doing. - -[ROKOS][45] - -#### 15\. Alpine Linux: Lightweight security-focused Linux - -Nowadays, a lot of users are usually looking for security-focused and [privacy-focused distributions][46]. And, if you are one of them, you might as well try Alpine Linux for Raspberry Pi. - -It may not be as user-friendly as you’d expect (or beginner-friendly) if you’re just getting started with Raspberry Pi. But, if you want something different to start with, you can try Alpine Linux, which is a security-focused Linux distribution. - -[Alpine Linux][47] - -#### 16\. Kano OS: Operating system for kids’education - -![][48] - -If you’re looking for an open-source OS for Raspberry Pi to make things interesting to learn and educate kids, Kano OS is a good choice. - -It’s being actively maintained and the user experience for the desktop integration on Kano OS is quite simple and fun for someone to play and make kids learn from it. - -[Kano OS][49] - -#### 17\. KDE Plasma Bigscreen: To convert regular TVs into Smart TVs - -![][50] - -This is an under development project from KDE. With [KDE Plasma Bigscreen OS][51] installed on Raspberry Pi, you can use your regular TV like a smart TV. - -You don’t need a special remote to control the TV. You can use the regular remote control. - -Plasma Bigscreen also integrates [MyCroft open source AI][52] for voice control. - -The project is in beta phase so expect some bugs and issues if you are willing to give it a try. - -[Plasma Bigscreen][53] - -#### Wrapping Up - -I’m sure there are a lot of other operating systems tailored for Raspberry Pi – but I’ve tried to list the most popular or the useful ones that are actively maintained. - -If you think I missed one of best suited Raspberry Pi OS, feel free to let me know about it in the comments below! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/raspberry-pi-os/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.raspberrypi.org/ -[2]: https://itsfoss.com/raspberry-pi-projects/ -[3]: https://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/ -[4]: https://www.raspberrypi.org/downloads/ -[5]: https://www.raspberrypi.org/downloads/noobs/ -[6]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/raspbian_home_screen.jpg?resize=800%2C492&ssl=1 -[8]: https://www.raspbian.org/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/04/Desktop-ubuntu.jpg?resize=800%2C600&ssl=1 -[10]: https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/ -[11]: https://itsfoss.com/ubuntu-mate-raspberry-pi/ -[12]: https://ubuntu-mate.org/raspberry-pi/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubunt-server.png?ssl=1 -[14]: https://ubuntu.com/download/raspberry-pi -[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/libreelec.jpg?resize=800%2C600&ssl=1 -[16]: https://itsfoss.com/best-linux-media-server/ -[17]: https://kodi.tv/ -[18]: https://libreelec.tv/downloads_new/ -[19]: https://libreelec.tv/ -[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/osmc-server.jpg?resize=800%2C450&ssl=1 -[21]: https://osmc.tv/ -[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/10/riscos5.1.jpg?resize=800%2C600&ssl=1 -[23]: https://itsfoss.com/risc-os-is-now-open-source/ -[24]: https://www.riscosopen.org/content/ -[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/web-things-gateway.png?ssl=1 -[26]: https://iot.mozilla.org/about/ -[27]: https://iot.mozilla.org/docs/gateway-getting-started-guide.html -[28]: https://iot.mozilla.org/gateway/ -[29]: https://en.wikipedia.org/wiki/Internet_of_things -[30]: https://ubuntu.com/download/raspberry-pi-core -[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/diet-pi.jpg?ssl=1 -[32]: https://www.debian.org/ -[33]: https://dietpi.com/ -[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/08/lakkaos.jpg?resize=1024%2C640&ssl=1 -[35]: https://itsfoss.com/lakka-retrogaming-linux/ -[36]: http://www.lakka.tv/ -[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/retro-pie.png?ssl=1 -[38]: https://retropie.org.uk/ -[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/kali-linux-pi.png?ssl=1 -[40]: https://www.offensive-security.com/kali-linux-arm-images/ -[41]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/openmediavault.jpg?ssl=1 -[42]: https://en.wikipedia.org/wiki/Network-attached_storage -[43]: https://www.openmediavault.org/ -[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/rocos-bitcoin-pi.jpg?ssl=1 -[45]: https://rokos.space/ -[46]: https://itsfoss.com/privacy-focused-linux-distributions/ -[47]: https://alpinelinux.org/ -[48]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/kano-os-pi.jpeg?ssl=1 -[49]: https://kano.me/row/downloadable -[50]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/plasma-bigscreen-menu.jpg?ssl=1 -[51]: https://itsfoss.com/kde-plasma-bigscreen/ -[52]: https://itsfoss.com/mycroft-mark-2/ -[53]: https://plasma-bigscreen.org/#download-jumpto diff --git a/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md b/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md new file mode 100644 index 0000000000..f5fcff875b --- /dev/null +++ b/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md @@ -0,0 +1,296 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best Raspberry Pi Operating Systems for Various Purposes) +[#]: via: (https://itsfoss.com/raspberry-pi-os/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +不同需求下各自最适合的树莓派操作系统 +====== + +[树莓派][1] 是一种具有很多功能且使用便捷的不可或缺的卡片式计算机。不相信?那就[浏览下这个树莓派项目列表][2],来领会下这个小设备能做什么。 + +考虑到树莓派用途这么多,为它选择一个合适的操作系统就极其重要。当然,你可以用 Linux 做很多事,但是一个为某个目的特意配置的操作系统可以节省你大量的时间和精力。 + +因此,本文中我要介绍一些专门为树莓派量身定制的流行和有用的操作系统。 + +### 由于有树莓派镜像工具,安装任何操作系统到树莓派上都很容易 + +[把树莓派操作系统安装到 SD 卡上][3] 比以前容易得多。你可以很容易地下载[树莓派镜像][4]和很快地安装树莓派操作系统。看一下官方视频,你就知道有多简单。 + +你也可以使用 [NOOBS][5](New Out Of the Box Software)来很容易地安装不同的操作系统到树莓派上。你还可以从 [NOOBS官方下载页面][5] 提及的他们支持的零售商那里获取预先安装好系统的 SD 卡。 + +尽情去他们的[官方文档][6]里找更多关于安装操作系统的信息吧。 + +[下载树莓派操作系统][4] + +现在你知道了怎么安装它(以及从哪儿获取),让我来重点介绍下几个有用的树莓派操作系统来帮助你。 + +### 适用于树莓派的不同操作系统 + +请注意,我花了一些精力来筛选出那些被积极维护的树莓派操作系统项目。如果某个项目在不久的将来会停止维护,请在评论区告诉我,我会更新本文。 + +另一件事是,我关注到现在最新的版本是 Raspberry 4,但是下面的列表不应被认为是适 Raspberry 4 的操作系统列表。这些系统应该能用于树莓派 3、3B+ 和其他各种版本,但是请参照项目的官方网站核对详细信息。 + +**注意:** 排名不分先后。 + +#### 1\. Raspbian OS:官方的树莓派操作系统 + +![][7] + +Raspbian 是官方支持的树莓派板操作系统。它集成了很多工具,用于教育、编程以及其他广泛的用途。特别地,它包含 Python、Scratch、Sonic Pi、Java和一些其他的很重要的包。 + +最初,Raspbian 是基于 Debian 的,系统中预安装了很多有用的包。因此,当你安装 Raspbian 后,你可能就不需要特意安装基本工具了 — 你会发现大部分工具已经提前安装好了。 + +Raspbian OS 是被积极地维护着的,它也是最流行的树莓派操作系统之一。你可以使用 [NOOBS][5] 或参照[官方文档][6]来安装它。 + +[Raspbian OS][8] + +#### 2\. Ubuntu MATE:适合通用计算需求 + +![][9] + +虽然 Raspbian 是官方支持的操作系统,但是对于最新和最好的包它往往不能及时支持。因此,如果你想更新得更快并且在将来想用最新的包,你可以试试树莓派版本的 Ubuntu MATE。 + +树莓派定制版的 Ubuntu MATE 是很适合安装的不可思议的轻量级发行版本。它还被广泛用于 [NVIDIA 的 Jetson Nano][10]。换言之,你可以在树莓派的很多场景下使用它。 + +为了更好地帮助你,我们还有一份详细的教程:[怎样在树莓派上安装 Ubuntu MATE][11]。 + +[Ubuntu MATE for Raspberry Pi][12] + +#### 3\. Ubuntu Server:把树莓派作为一台 Linux 服务器来使用 + +![][13] + +如果你计划把你的树莓派当作你项目的服务器来使用,那么安装 Ubuntu Server 会是一个不错的选择。 + +Ubuntu Server 有 32 位和 64 位的镜像。你可以根据你的板的类型(是否支持 64 位)来选择对应的操作系统。 + +然而,值得注意的一点是 Ubuntu Server 不是为桌面用户定制的。因此,你需要留意 Ubuntu Server 默认不会安装图形用户界面。 + +[Ubuntu Server][14] + +#### 4\. LibreELEC:适合做媒体服务器 + +![][15] + +我们已经有一个 [Linux 下可用的媒体服务器软件][16],LibreELEC 在列表中。 + +它是一个伟大的轻量级操作系统,让你可以在树莓派上安装 [KODI][17]。你可以尝试使用 Raspberry Pi Imager 来安装它。 + +你可以很容易地找到他们的[官方下载页面][18],并找到适合你板子的安装镜像。 + +[LibreELEC][19] + +#### 5\. OSMC:适合做媒体服务器 + +![][20] + +OSMC 是另一个 Linux 下[流行的媒体服务器软件][16]。如果要把树莓派板作为媒体中心设备,那么 OSMC 是你可以向他人推荐的操作系统之一。 + +类似 LibreELEC,OSMC 也运行 KODI 来帮助你管理你的媒体文件和享受你已有的素材中。 + +OSMC 官方没有提及对 **Raspberry Pi 4** 的支持。因此,如果你的树莓派是 Raspberry Pi 3 或更早的版本,那么应该没有问题。 + +[OSMC][21] + +#### 6\. RISC OS:传统的 ARM 操作系统 + +![][22] + +ARM 设备的原始草稿版,RISC 已经存在了差不多 30 年了。 + +如果你想了解,我们也有篇详细介绍 [RISC OS][23] 的文章。简而言之,RISC OS 也是为诸如树莓派的现代基于 ARM 的卡片式计算机定制的。它的用于界面很简单,更专注于性能。 + +同样的,这个系统也不支持 Raspberry Pi 4。因此,如果你的树莓派是 Raspberry Pi 3 或更早的版本,你可以试一下。 + +[RISC OS][24] + +#### 7\. Mozilla WebThings Gateway:适合 IoT 项目 + +![][25] + +作为 Mozilla 的 [IoT 设备的开源实现][26] 的一部分,WebThings Gateway 让你可以监控和控制连接的 IoT 设备。 + +你可以参考[官方文档][27]来检查所需的环境,遵照指导把安装到树莓派上。它确实是适合 IoT 应用的最有用的树莓派操作系统之一。 + +[WebThings Gateway][28] + +#### 8\. Ubuntu Core:适合 IoT 项目 + +另一个适合 [IoT][29] 应用的树莓派操作系统,或者仅仅用来测试一下 — Ubuntu Core。 + +Ubuntu Core 是为 IoT 设备或特定的树莓派特意定制。我不会刻意主张大家使用它 — 但是 Ubuntu Core 是适合树莓派板的安全的操作系统。你可以自己尝试一下! + +[Ubuntu Core][30] + +#### 9\. DietPi:轻量级树莓派操作系统 + +![DietPi Screenshot via Distrowatch][31] + +DietPi 是一款轻量级的 [Debian][32] 操作系统,它还宣称比 “Raspbian Lite” 操作系统更轻量。 + +考虑到它是一款轻量级的树莓派操作系统,它在很多使用场景下以很便捷的方式提供了大量的功能。从简单的软件安装包到备份解决方案,还有很多功能等待发掘。 + +如果你想安装一个低内存占用而性能相对更好的操作系统,你可以尝试一下 DietPi。 + +[DietPi][33] + +#### 10\. Lakka Linux:打造复古的游戏控制台 + +![][34] + +想让你的树莓派变成一个复古的游戏控制台? + +Lakka Linux 发行版本最初是在 RetroArch 模拟器中构建的。因此,你可以立刻在树莓派上获得所有的复古游戏。 + +如果你想了解,我们也有一篇介绍 [Lakka Linux][35] 的文章。或者直接上手吧! + +[Lakka][36] + +#### 11\. RetroPie:适合复古游戏 + +![ ][37] + +RetroPie 是另一款可以让树莓派变成复古游戏控制台的树莓派操作系统。它提供了很多配置工具,因此你可以自定义主题,或者调整模拟器来找到最好的复古游戏。 + +值得注意的是它不包含任何有版权的游戏。你可以试一下,看看它是怎么工作的! + +[RetroPie][38] + +#### 12\. Kali Linux:适合低成本入侵 + +![][39] + +想要在你的树莓派上尝试和学习一些渗透测试技巧?Kali Linux 会是最佳选择。是的,Kali Linux 通常会支持最新的树莓派。 + +Kali Linux 不仅适合树莓派,它也支持很多其他设备。尝试一下,玩得愉快! + +[Kali Linux][40] + +#### 13\. OpenMediaVault:适合网络附加存储Network Attached Storage + +![][41] + +如果你想在最小的硬件上搭建 [NAS][42] 解决方案,树莓派可以帮助你。 + +OpenMediaVault 最初是基于 Debian Linux 的,提供了大量功能,如基于 web 的管理员能力、插件支持,等等。它支持大多数树莓派模块,因此你可以尝试下载并安装它! + +[OpenMediaVault][43] + +#### 14\. ROKOS:适合加密挖矿 + +![][44] + +如果你对加密货币和比特币很感兴趣,那么 ROKOS 会吸引你。 + +ROKOS 是基于 Debian 的操作系统,预安装的驱动和包基本可以让你的树莓派变成一个节点。当然,在安装之前你需要了解它是怎么工作的。因此,如果你对此不太了解,我建议你先调研下。 + +[ROKOS][45] + +#### 15\. Alpine Linux:专注于安全的轻量级 Linux + +当今年代,很多用户都在寻找专注于安全和[隐私的发行版本][46]。如果你也是其中一员,你可以试试在树莓派上安装 Alpine Linux。 + +如果你是个树莓派新手,它可能不像你想象的那样对用户友好(或对新手友好)。但是,如果你想尝试一些不一样的东西,那么你可以试试 Alpine Linux 这个专注于安全的 Linux 发行版本。 + +[Alpine Linux][47] + +#### 16\. Kano OS:适合儿童教育的操作系统 + +![][48] + +如果你在寻找一款能让学习变得有趣还能教育儿童的树莓派操作系统,那么 Kano OS 是个不错的选择。 + +它是被积极地维护着的,Kano 操作系统上的桌面对于儿童玩和学习的用户体验都是很简单的。 + +[Kano OS][49] + +#### 17\. KDE Plasma Bigscreen:适合把普通 TV 转换为智能 TV + +![][50] + +这是 KDE 的子开发项目。在树莓派上安装 [KDE Plasma Bigscreen OS][51] 后,你可以把普通 TV 变成智能 TV。 + +你不需要特殊的远程服务器来控制 TV。你可以使用普通的远程控制。 + +Plasma Bigscreen 也集成了 [MyCroft open source AI][52] 作为声控。 + +这个项目还在内测阶段,所以如果你想尝试,可能会有一些 bug 和问题。 + +[Plasma Bigscreen][53] + +#### 结语 + +我知道还有很多为树莓派定制的操作系统 — 但是我尽力列出了被积极维护的最流行的或最有用的操作系统。 + +如果你觉得我遗漏了最合适的树莓派操作系统,尽情在下面的评论去告诉我吧! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-os/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/ +[2]: https://itsfoss.com/raspberry-pi-projects/ +[3]: https://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/ +[4]: https://www.raspberrypi.org/downloads/ +[5]: https://www.raspberrypi.org/downloads/noobs/ +[6]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/raspbian_home_screen.jpg?resize=800%2C492&ssl=1 +[8]: https://www.raspbian.org/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/04/Desktop-ubuntu.jpg?resize=800%2C600&ssl=1 +[10]: https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/ +[11]: https://itsfoss.com/ubuntu-mate-raspberry-pi/ +[12]: https://ubuntu-mate.org/raspberry-pi/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubunt-server.png?ssl=1 +[14]: https://ubuntu.com/download/raspberry-pi +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/libreelec.jpg?resize=800%2C600&ssl=1 +[16]: https://itsfoss.com/best-linux-media-server/ +[17]: https://kodi.tv/ +[18]: https://libreelec.tv/downloads_new/ +[19]: https://libreelec.tv/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/osmc-server.jpg?resize=800%2C450&ssl=1 +[21]: https://osmc.tv/ +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/10/riscos5.1.jpg?resize=800%2C600&ssl=1 +[23]: https://itsfoss.com/risc-os-is-now-open-source/ +[24]: https://www.riscosopen.org/content/ +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/web-things-gateway.png?ssl=1 +[26]: https://iot.mozilla.org/about/ +[27]: https://iot.mozilla.org/docs/gateway-getting-started-guide.html +[28]: https://iot.mozilla.org/gateway/ +[29]: https://en.wikipedia.org/wiki/Internet_of_things +[30]: https://ubuntu.com/download/raspberry-pi-core +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/diet-pi.jpg?ssl=1 +[32]: https://www.debian.org/ +[33]: https://dietpi.com/ +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/08/lakkaos.jpg?resize=1024%2C640&ssl=1 +[35]: https://itsfoss.com/lakka-retrogaming-linux/ +[36]: http://www.lakka.tv/ +[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/retro-pie.png?ssl=1 +[38]: https://retropie.org.uk/ +[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/kali-linux-pi.png?ssl=1 +[40]: https://www.offensive-security.com/kali-linux-arm-images/ +[41]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/openmediavault.jpg?ssl=1 +[42]: https://en.wikipedia.org/wiki/Network-attached_storage +[43]: https://www.openmediavault.org/ +[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/rocos-bitcoin-pi.jpg?ssl=1 +[45]: https://rokos.space/ +[46]: https://itsfoss.com/privacy-focused-linux-distributions/ +[47]: https://alpinelinux.org/ +[48]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/kano-os-pi.jpeg?ssl=1 +[49]: https://kano.me/row/downloadable +[50]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/plasma-bigscreen-menu.jpg?ssl=1 +[51]: https://itsfoss.com/kde-plasma-bigscreen/ +[52]: https://itsfoss.com/mycroft-mark-2/ +[53]: https://plasma-bigscreen.org/#download-jumpto From 80266586e6d340b1bdf9613194876f790033ee74 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Mon, 11 May 2020 23:38:52 +0800 Subject: [PATCH 2043/3057] APL --- ...00509 Ensmallening Go binaries by prohibiting comparisons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md b/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md index 61ad40c73e..424434adbb 100644 --- a/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md +++ b/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a824deb9aeffbf71e5337f5dc595810a87040299 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 12 May 2020 00:11:28 +0800 Subject: [PATCH 2044/3057] PRF @messon007 --- ...12 Systemd Services- Reacting to Change.md | 211 +++++++++--------- 1 file changed, 102 insertions(+), 109 deletions(-) diff --git a/translated/tech/20180612 Systemd Services- Reacting to Change.md b/translated/tech/20180612 Systemd Services- Reacting to Change.md index 22c176ee80..8a7be7cde2 100644 --- a/translated/tech/20180612 Systemd Services- Reacting to Change.md +++ b/translated/tech/20180612 Systemd Services- Reacting to Change.md @@ -1,66 +1,59 @@ -Systemd服务:响应变更 +Systemd 服务:响应变化 ====== -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/webcam.png?itok=zzYUs5VK) +![](https://img.linux.net.cn/data/attachment/album/202005/12/001037iz91uu9b15dqb9w3.jpg) -[我有一个这样的电脑棒][1](图1),并将其用作通用服务器。它很小且安静,由于它是基于x86架构,因此我为我的打印机安装驱动没有任何问题,而且这就是它大多数时候干的事:与客厅的共享打印机和扫描仪通信。 +[我有一个这样的电脑棒][1](图1),我把它用作通用服务器。它很小且安静,由于它是基于 x86 架构的,因此我为我的打印机安装驱动没有任何问题,而且这就是它大多数时候干的事:与客厅的共享打印机和扫描仪通信。 ![ComputeStick][3] -一个英特尔电脑棒。欧元硬币大小。 +*一个英特尔电脑棒。欧元硬币大小。* -[Used with permission][4] +大多数时候它都是闲置的,尤其是当我们外出时,因此我认为用它作监视系统是个好主意。该设备没有自带的摄像头,也不需要一直监视。我也不想手动启动图像捕获,因为这样就意味着在出门前必须通过 SSH 登录,并在 shell 中编写命令来启动该进程。 -大多数时候,它都闲着,尤其是当我们外出时,因此我认为用它作监视系统是个好主意。该设备没有自带的摄像头,也不需要一直监视。我也不想手动启动图像捕获,因为这样就意味着在出门前必须通过SSH登录,并在shell中编写命令来启动该进程。 +因此,我以为应该这么做:拿一个 USB 摄像头,然后只需插入它即可自动启动监视系统。如果这个电脑棒重启后发现连接了摄像头也启动监视系统就更加分了。 -因此,我以为应该这么做:抓住USB摄像头,然后只需插入它即可自动启动监视系统。如果Stick重启后发现连接了摄像头也启动监视系统就更加分了。 +在先前的文章中,我们看到 systemd 服务既可以[手动启动或停止][5],也可以[在满足某些条件时启动或停止][6]。这些条件不限于操作系统在启动或关机时序中达到某种状态,还可以在你插入新硬件或文件系统发生变化时进行。你可以通过将 Udev 规则与 systemd 服务结合起来实现。 -在先前的文章中,我们看到[systemd服务可以手动启动或停止][5]或[在满足某些条件时][6]。这些条件不限于操作系统在启动或关机时序中达到某种状态,还可以在您插入新硬件或文件系统发生变化时进行。您可以通过将Udev规则与systemd服务结合起来实现。 +### 有 Udev 支持的热插拔 -### 有Udev(支持)的热插拔 +Udev 规则位于 `/etc/udev/rules` 目录中,通常是由导致一个动作action条件conditions赋值assignments的单行语句来描述。 -Udev规则位于 _/etc/udev/rules_ 目录中,通常是由导致一个 _动作(action)_ 的 _条件(conditions)_ 和 _赋值(assignments)_ 的单行语句来描述。 +有点神秘。让我们再解释一次: -有点神秘。让我们再试一次: +通常,在 Udev 规则中,你会告诉 systemd 当设备连接时需要查看什么信息。例如,你可能想检查刚插入的设备的品牌和型号是否与你让 Udev 等待的设备的品牌和型号相对应。这些就是前面提到的“条件”。 -通常,在Udev规则中,您告诉systemd当连接一个设备时需要查看什么信息。例如,您可能想检查刚插入的设备的品牌和型号是否与您让Udev等待的设备的品牌和型号相对应。这些就是前面提到的条件。 +然后,你可能想要更改一些内容,以便以后可以方便使用该设备。例如,更改设备的读写权限:如果插入 USB 打印机,你会希望用户能够从打印机读取信息(用户的打印应用程序需要知道其模型、制造商,以及是否准备好接受打印作业)并向其写入内容,即发送要打印的内容。更改设备的读写权限是通过你之前阅读的“赋值” 之一完成的。 -然后,您可能想要更改一些内容,以便以后可以轻松使用该设备。例如,更改设备的读写权限:如果插入USB打印机,您将希望用户能够从打印机读取信息(用户的打印应用程序需要知道其模型,制造商,以及是否准备好接受打印作业)并向其写入内容,即发送要打印的内容。更改设备的读写权限是通过您之前阅读的 _赋值(assignments)_ 之一完成的。 - -最后,您可能希望系统在满足上述条件时执行某些动作,例如在插入某个外接硬盘时启动备份程序以复制重要文件。这就是上面提到的 _动作(action)_ 的例子。 +最后,你可能希望系统在满足上述条件时执行某些动作,例如在插入某个外部硬盘时启动备份程序以复制重要文件。这就是上面提到的“动作”的例子。 了解这些之后, 来看看以下几点: ``` -ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="e207", +ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="e207", SYMLINK+="mywebcam", TAG+="systemd", MODE="0666", ENV{SYSTEMD_WANTS}="webcam.service" ``` 规则的第一部分, ``` -ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", +ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="e207" [etc... ] ``` -表明了执行您想让系统执行的其他动作之前设备必须满足的条件。设备必须被添加到(`ACTION=="add"`)机器上,并且必须添加到 `video4linux` 子系统中。为了确保仅在插入正确的设备时才应用该规则,您必须确保Udev正确识别设备的制造商(`ATTRS{idVendor}=="03f0"`)和型号(`ATTRS{idProduct}=="e207"`)。 +表明了执行你想让系统执行的其他动作之前设备必须满足的条件。设备必须被添加到(`ACTION=="add"`)机器上,并且必须添加到 `video4linux` 子系统中。为了确保仅在插入正确的设备时才应用该规则,你必须确保 Udev 正确识别设备的制造商(`ATTRS{idVendor}=="03f0"`)和型号(`ATTRS{idProduct}=="e207"`)。 在本例中,我们讨论的是这个设备(图2): ![webcam][8] -这个试验使用的是HP的摄像头。 +*这个试验使用的是 HP 的摄像头。* -[Used with permission][4] +注意怎样用 `==` 来表示这是一个逻辑操作。你应该像这样阅读上面的简要规则: -注意怎样用 `==` 来表示这是一个逻辑操作。您应该像这样阅读上面的简要规则: +> 如果添加了一个设备并且该设备由 video4linux 子系统控制,而且该设备的制造商编码是 03f0,型号是 e207,那么... -``` -如果添加了一个设备并且该设备由video4linux子系统控制 -而且该设备的制造商是03f0,型号是e207,那么... -``` - -但是,您从哪里获取的这些信息? 您在哪里找到触发事件的动作,制造商,模型等等?您可能必须使用多个来源。您可以通过将摄像头插入机器并运行 `lsusb` 来获得 `IdVendor` 和 `idProduct` : +但是,你从哪里获取的这些信息?你在哪里找到触发事件的动作、制造商、型号等?你可要使用多个来源。你可以通过将摄像头插入机器并运行 `lsusb` 来获得 `IdVendor` 和 `idProduct` : ``` lsusb @@ -74,74 +67,74 @@ Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ``` -我用的摄像头是HP的,您在上面的列表中只能看到一个HP设备。 `ID` 告诉了制造商和型号,它们以冒号( `:` )分隔。如果您有同一制造商的多个设备,不确定哪个是哪个设备,请拔下摄像头,再次运行 `lsusb` , 看看少了什么。 +我用的摄像头是 HP 的,你在上面的列表中只能看到一个 HP 设备。`ID` 提供了制造商和型号,它们以冒号(`:`)分隔。如果你有同一制造商的多个设备,不确定哪个是哪个设备,请拔下摄像头,再次运行 `lsusb` , 看看少了什么。 或者... -拔下摄像头,等待几秒钟,运行命令 `udevadmin monitor --environment` ,然后重新插入摄像头。当您使用的是HP摄像头时,您将看到: +拔下摄像头,等待几秒钟,运行命令 `udevadmin monitor --environment` ,然后重新插入摄像头。当你使用的是HP摄像头时,你将看到: ``` udevadmin monitor --environment -UDEV [35776.495221] add /devices/pci0000:00/0000:00:1c.3/0000:04:00.0 -  /usb3/3-1/3-1:1.0/input/input21/event11 (input) -.MM_USBIFNUM=00 -ACTION=add -BACKSPACE=guess -DEVLINKS=/dev/input/by-path/pci-0000:04:00.0-usb-0:1:1.0-event -  /dev/input/by-id/usb-Hewlett_Packard_HP_Webcam_HD_2300-event-if00 -DEVNAME=/dev/input/event11 +UDEV [35776.495221] add /devices/pci0000:00/0000:00:1c.3/0000:04:00.0 + /usb3/3-1/3-1:1.0/input/input21/event11 (input) +.MM_USBIFNUM=00 +ACTION=add +BACKSPACE=guess +DEVLINKS=/dev/input/by-path/pci-0000:04:00.0-usb-0:1:1.0-event + /dev/input/by-id/usb-Hewlett_Packard_HP_Webcam_HD_2300-event-if00 +DEVNAME=/dev/input/event11 DEVPATH=/devices/pci0000:00/0000:00:1c.3/0000:04:00.0/ -  usb3/3-1/3-1:1.0/input/input21/event11 -ID_BUS=usb -ID_INPUT=1 -ID_INPUT_KEY=1 -ID_MODEL=HP_Webcam_HD_2300 -ID_MODEL_ENC=HP\x20Webcam\x20HD\x202300 -ID_MODEL_ID=e207 -ID_PATH=pci-0000:04:00.0-usb-0:1:1.0 -ID_PATH_TAG=pci-0000_04_00_0-usb-0_1_1_0 -ID_REVISION=1020 -ID_SERIAL=Hewlett_Packard_HP_Webcam_HD_2300 -ID_TYPE=video -ID_USB_DRIVER=uvcvideo -ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:030000: -ID_USB_INTERFACE_NUM=00 -ID_VENDOR=Hewlett_Packard -ID_VENDOR_ENC=Hewlett\x20Packard -ID_VENDOR_ID=03f0 -LIBINPUT_DEVICE_GROUP=3/3f0/e207:usb-0000:04:00.0-1/button -MAJOR=13 -MINOR=75 -SEQNUM=3162 -SUBSYSTEM=input -USEC_INITIALIZED=35776495065 -XKBLAYOUT=es -XKBMODEL=pc105 -XKBOPTIONS= + usb3/3-1/3-1:1.0/input/input21/event11 +ID_BUS=usb +ID_INPUT=1 +ID_INPUT_KEY=1 +ID_MODEL=HP_Webcam_HD_2300 +ID_MODEL_ENC=HPx20Webcamx20HDx202300 +ID_MODEL_ID=e207 +ID_PATH=pci-0000:04:00.0-usb-0:1:1.0 +ID_PATH_TAG=pci-0000_04_00_0-usb-0_1_1_0 +ID_REVISION=1020 +ID_SERIAL=Hewlett_Packard_HP_Webcam_HD_2300 +ID_TYPE=video +ID_USB_DRIVER=uvcvideo +ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:030000: +ID_USB_INTERFACE_NUM=00 +ID_VENDOR=Hewlett_Packard +ID_VENDOR_ENC=Hewlettx20Packard +ID_VENDOR_ID=03f0 +LIBINPUT_DEVICE_GROUP=3/3f0/e207:usb-0000:04:00.0-1/button +MAJOR=13 +MINOR=75 +SEQNUM=3162 +SUBSYSTEM=input +USEC_INITIALIZED=35776495065 +XKBLAYOUT=es +XKBMODEL=pc105 +XKBOPTIONS= XKBVARIANT= ``` -可能看起来有很多信息要处理,但是,看一下这个:列表前面的 `ACTION` 字段, 它告诉您刚刚发生了什么事件,即一个设备被添加到系统中。您还可以在几行中看到设备名称的拼写,因此可以非常确定它就是您要找的设备。输出里还显示了制造商的ID(`ID_VENDOR_ID = 03f0`)和型号(`ID_VENDOR_ID = 03f0`)。 +可能看起来有很多信息要处理,但是,看一下这个:列表前面的 `ACTION` 字段, 它告诉你刚刚发生了什么事件,即一个设备被添加到系统中。你还可以在其中几行中看到设备名称的拼写,因此可以非常确定它就是你要找的设备。输出里还显示了制造商的ID(`ID_VENDOR_ID = 03f0`)和型号(`ID_VENDOR_ID = 03f0`)。 -这为您提供了规则条件部分需要的四个值中的三个。您可能也会想到它还给了您第四个,因为还有一行这样写道: +这为你提供了规则条件部分需要的四个值中的三个。你可能也会想到它还给了你第四个,因为还有一行这样写道: ``` SUBSYSTEM=input ``` -小心!尽管USB摄像头确实是提供输入的设备(键盘和鼠标也是),但它也属于 _usb_ 子系统和其他几个子系统。这意味着您的摄像头被添加到了多个子系统,并且看起来像多个设备。如果您选择了错误的子系统,那么您的规则可能无法按您期望的那样工作,或者根本无法工作。 +小心!尽管 USB 摄像头确实是提供输入的设备(键盘和鼠标也是),但它也属于 usb 子系统和其他几个子系统。这意味着你的摄像头被添加到了多个子系统,并且看起来像多个设备。如果你选择了错误的子系统,那么你的规则可能无法按你期望的那样工作,或者根本无法工作。 -因此,您必须检查的第三件事是摄像头添加到的所有子系统,并选择正确的那个。为此,请再次拔下摄像头,然后运行: +因此,第三件事就是检查网络摄像头被添加到的所有子系统,并选择正确的那个。为此,请再次拔下摄像头,然后运行: ``` ls /dev/video* ``` -这将向您显示连接到本机的所有视频设备。如果您使用的是笔记本,大多数笔记本都带有内置摄像头,它可能会显示为 `/dev/video0` 。重新插入摄像头,然后再次运行 `ls /dev/video*` 。 +这将向你显示连接到本机的所有视频设备。如果你使用的是笔记本,大多数笔记本都带有内置摄像头,它可能会显示为 `/dev/video0` 。重新插入摄像头,然后再次运行 `ls /dev/video*`。 -现在,您应该看到多一个视频设备(可能是`/dev/video1`)。 +现在,你应该看到多一个视频设备(可能是`/dev/video1`)。 -现在,您可以通过运行`udevadm info -a /dev/video1`找出它所属的所有子系统: +现在,你可以通过运行 `udevadm info -a /dev/video1` 找出它所属的所有子系统: ``` udevadm info -a /dev/video1 @@ -164,29 +157,30 @@ and the attributes from one single parent device. [etc...] ``` -输出持续了一段时间,但是您感兴趣的只是开始:`SUBSYSTEM =="video4linux"`。您可以将这行按文本复制并粘贴到规则中。输出的其余部分(为简便起见未显示)为您提供了更多的块,例如制造商和模型ID,您也可以以同样的格式复制并粘贴到规则中。 +输出持续了相当长的时间,但是你感兴趣的只是开头的部分:`SUBSYSTEM =="video4linux"`。你可以将这行文本直接复制粘贴到你的规则中。输出的其余部分(为简洁未显示)为你提供了更多的信息,例如制造商和型号 ID,同样是以你可以复制粘贴到你的规则中的格式。 -现在,您有了识别设备的方式并明确了什么事件应该触发该动作,该对设备进行修改了。 +现在,你有了识别设备的方式吗,并明确了什么事件应该触发该动作,该对设备进行修改了。 -规则的下一部分,`SYMLINK+="mywebcam", TAG+="systemd", MODE="0666"`告诉Udev做三件事:首先,您要创建设备的符号链接(例如 _/dev/video1_ 到 _/dev/mywebcam_ 。这是因为您无法预测系统默认情况下会把那个设备叫什么。当您拥有内置摄像头并热插拔一个新的时,内置摄像头通常为 _/dev/video0_ ,而外部摄像头通常为 _/dev/video1_ 。但是,如果您在插入外部USB摄像头的情况下重启计算机,则可能会相反,内部摄像头可能会变成 _/dev/video1_ ,而外部摄像头会变成 _/dev/video0_ 。这想告诉您的是,尽管您的图像捕获脚本(稍后将看到)总是需要指向外部摄像头设备,但是您不能依赖它是 _/dev/video0_ 或 _/dev/video1_ 。为了解决这个问题,您告诉Udev创建一个符号链接,该链接在设备被添加到 _video4linux_ 子系统的那一刻起就不会再变,您将使您的脚本指向该链接。 +规则的下一部分,`SYMLINK+="mywebcam", TAG+="systemd", MODE="0666"` 告诉 Udev 做三件事:首先,你要创建设备的符号链接(例如 `/dev/video1` 到 `/dev/mywebcam`。这是因为你无法预测系统默认情况下会把那个设备叫什么。当你拥有内置摄像头并热插拔一个新的时,内置摄像头通常为 `/dev/video0`,而外部摄像头通常为 `/dev/video1`。但是,如果你在插入外部 USB 摄像头的情况下重启计算机,则可能会相反,内部摄像头可能会变成 `/dev/video1` ,而外部摄像头会变成 `/dev/video0`。这想告诉你的是,尽管你的图像捕获脚本(稍后将看到)总是需要指向外部摄像头设备,但是你不能依赖它是 `/dev/video0` 或 `/dev/video1`。为了解决这个问题,你告诉 Udev 创建一个符号链接,该链接在设备被添加到 `video4linux` 子系统的那一刻起就不会再变,你将使你的脚本指向该链接。 -您要做的第二件事是将 `"systemd"` 添加到与此规则关联的Udev标记列表中。这告诉Udev,该规则触发的动作将由systemd管理,即它将是某种systemd服务。 +第二件事就是将 `systemd` 添加到与此规则关联的 Udev 标记列表中。这告诉 Udev,该规则触发的动作将由 systemd 管理,即它将是某种 systemd 服务。 -注意在两种情况下该如何使用 `+=` 运算符。这会将值添加到列表中,这意味着您可以向 `SYMLINK` 和 `TAG` 添加多个值。 +注意在这个两种情况下是如何使用 `+=` 运算符的。这会将值添加到列表中,这意味着你可以向 `SYMLINK` 和 `TAG` 添加多个值。 -另一方面,`MODE` 值只能包含一个值(因此,您可以使用简单的 `=` 赋值运算符)。`MODE` 的作用是告诉Udev谁可以读或写该设备。如果您熟悉 `chmod`(您读到此文, 应该会熟悉),您就也会熟悉[如何用数字表示权限][9]。这就是它的含义: `0666` 的含义是 “ _向所有人授予对设备的读写权限_ ”。 +另一方面,`MODE` 值只能包含一个值(因此,你可以使用简单的 `=` 赋值运算符)。`MODE` 的作用是告诉 Udev 谁可以读或写该设备。如果你熟悉 `chmod`(你读到此文, 应该会熟悉),你就也会熟悉[如何用数字表示权限][9]。这就是它的含义:`0666` 的含义是 “向所有人授予对设备的读写权限”。 -最后, `ENV{SYSTEMD_WANTS}="webcam.service"` 告诉Udev要运行什么systemd服务。 +最后, `ENV{SYSTEMD_WANTS}="webcam.service"` 告诉 Udev 要运行什么 systemd 服务。 -将此规则保存到 _/etc/udev/rules.d_ 目录名为 _90-webcam.rules_ (或类似的名称)的文件中,您可以通过重启机器或运行以下命令来加载它: +将此规则保存到 `/etc/udev/rules.d` 目录名为 `90-webcam.rules`(或类似的名称)的文件中,你可以通过重启机器或运行以下命令来加载它: ``` sudo udevadm control --reload-rules && udevadm trigger ``` -## 最后描述服务 +### 最后是服务 + +Udev 规则触发的服务非常简单: -Udev规则触发的服务非常简单: ``` # webcam.service @@ -195,57 +189,56 @@ Type=simple ExecStart=/home/[user name]/bin/checkimage.sh ``` -基本上,它只是运行存储在您个人 _bin/_ 中的 _checkimage.sh_ 脚本并将其放到后台。 [这是您在先前的部分中看过的内容][5]。 它看起来似乎很小,但那只是因为它是被Udev规则调用的,您刚刚创建了一种特殊的systemd单元,称为 _device_ 单元。 恭喜。 +基本上,它只是运行存储在你个人 `bin/` 中的 `checkimage.sh` 脚本并将其放到后台。[这是你在先前的文章中看过的内容][5]。它看起来似乎很小,但那只是因为它是被 Udev 规则调用的,你刚刚创建了一种特殊的 systemd 单元,称为 `device` 单元。 恭喜。 -至于 _webcam.service_ 调用的 _checkimage.sh_ 脚本,有几种方法从摄像头抓取图像并将其与前一个图像进行比较以检查变化(这是 _checkimage.sh_ 所做的事),但这是我的方法: +至于 `webcam.service` 调用的 `checkimage.sh` 脚本,有几种方法从摄像头抓取图像并将其与前一个图像进行比较以检查变化(这是 `checkimage.sh` 所做的事),但这是我的方法: ``` -#!/bin/bash +#!/bin/bash # This is the checkimage.sh script mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device= -  /dev/mywebcam &>/dev/null -mv 00000001.png /home/[user name]/monitor/monitor.png + /dev/mywebcam &>/dev/null +mv 00000001.png /home/[user name]/monitor/monitor.png -while true -do - mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device=/dev/mywebcam &>/dev/null - mv 00000001.png /home/[user name]/monitor/temp.png +while true +do + mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device=/dev/mywebcam &>/dev/null + mv 00000001.png /home/[user name]/monitor/temp.png - imagediff=`compare -metric mae /home/[user name]/monitor/monitor.png /home/[user name] -  /monitor/temp.png /home/[user name]/monitor/diff.png 2>&1 > /dev/null | cut -f 1 -d " "` - if [ `echo "$imagediff > 700.0" | bc` -eq 1 ] - then - mv /home/[user name]/monitor/temp.png /home/[user name]/monitor/monitor.png - fi - - sleep 0.5 + imagediff=`compare -metric mae /home/[user name]/monitor/monitor.png /home/[user name] + /monitor/temp.png /home/[user name]/monitor/diff.png 2>&1 > /dev/null | cut -f 1 -d " "` + if [ `echo "$imagediff > 700.0" | bc` -eq 1 ] + then + mv /home/[user name]/monitor/temp.png /home/[user name]/monitor/monitor.png + fi + + sleep 0.5 done ``` -首先使用[MPlayer][10]从摄像头抓取一帧(_00000001.png_)。注意,我们怎样将 `mplayer` 指向Udev规则中创建的 `mywebcam` 符号链接,而不是指向 `video0` 或 `video1` 。然后,将图像传输到主目录中的 _monitor/_ 目录。然后执行一个无限循环,一次又一次地执行相同的操作,但还使用了[Image Magick的_compare_工具][11]来查看最后捕获的图像与 _monitor/_ 目录中已有的图像之间是否存在差异。 +首先使用[MPlayer][10]从摄像头抓取一帧(`00000001.png`)。注意,我们怎样将 `mplayer` 指向 Udev 规则中创建的 `mywebcam` 符号链接,而不是指向 `video0` 或 `video1`。然后,将图像传输到主目录中的 `monitor/` 目录。然后执行一个无限循环,一次又一次地执行相同的操作,但还使用了[Image Magick 的 compare 工具][11]来查看最后捕获的图像与 `monitor/` 目录中已有的图像之间是否存在差异。 如果图像不同,则表示摄像头的镜框里某些东西动了。该脚本将新图像覆盖原始图像,并继续比较以等待更多变动。 ### 插线 -所有东西准备好后,当您插入摄像头后,您的Udev规则将被触发并启动 _webcam.service_ 。 _webcam.service_ 将在后台执行 _checkimage.sh_ ,而 _checkimage.sh_ 将开始每半秒拍一次照。您会感觉到,因为摄像头的LED在每次拍照时将开始闪。 +所有东西准备好后,当你插入摄像头后,你的 Udev 规则将被触发并启动 `webcam.service`。 `webcam.service` 将在后台执行 `checkimage.sh` ,而 `checkimage.sh` 将开始每半秒拍一次照。你会感觉到,因为摄像头的 LED 在每次拍照时将开始闪。 -与往常一样,如果出现问题,请运行 +与往常一样,如果出现问题,请运行: ``` systemctl status webcam.service ``` -检查您的服务和脚本正在做什么。 +检查你的服务和脚本正在做什么。 ### 接下来 -您可能想知道:为什么要覆盖原始图像? 当然,系统检测到任何动静,您都想知道发生了什么,对吗?您是对的,但是如您在下一部分中将看到的那样,将它们保持原样,并使用另一种类型的systemd单元处理图像将更好,更清晰和更简单。 +你可能想知道:为什么要覆盖原始图像?当然,系统检测到任何动静,你都想知道发生了什么,对吗?你是对的,但是如你在下一部分中将看到的那样,将它们保持原样,并使用另一种类型的 systemd 单元处理图像将更好,更清晰和更简单。 -请稍等。 +请期待下一篇。 -通过Linux基金会和edX的免费["Linux简介"][12]课程了解有关Linux的更多信息。 -------------------------------------------------------------------------------- via: https://www.linux.com/blog/intro-to-linux/2018/6/systemd-services-reacting-change @@ -253,7 +246,7 @@ via: https://www.linux.com/blog/intro-to-linux/2018/6/systemd-services-reacting- 作者:[Paul Brown][a] 选题:[lujun9972][b] 译者:[messon007](https://github.com/messon007) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -261,10 +254,10 @@ via: https://www.linux.com/blog/intro-to-linux/2018/6/systemd-services-reacting- [b]: https://github.com/lujun9972 [1]: https://www.intel.com/content/www/us/en/products/boards-kits/compute-stick/stk1a32sc.html [2]: https://www.linux.com/files/images/fig01png -[3]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/fig01.png?itok=cfEHN5f1 (ComputeStick) +[3]: https://lcom.static.linuxfound.org/sites/lcom/files/fig01.png [4]: https://www.linux.com/licenses/category/used-permission -[5]: https://www.linux.com/blog/learn/intro-to-linux/2018/5/writing-systemd-services-fun-and-profit -[6]: https://www.linux.com/blog/learn/2018/5/systemd-services-beyond-starting-and-stopping +[5]: https://linux.cn/article-9700-1.html +[6]: https://linux.cn/article-9703-1.html [7]: https://www.linux.com/files/images/fig02png [8]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/fig02.png?itok=esFv4BdM (webcam) [9]: https://chmod-calculator.com/ From 26b71c999d7b8408ba10b0824fdcd9123185c496 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 12 May 2020 00:11:54 +0800 Subject: [PATCH 2045/3057] PUB @messon007 https://linux.cn/article-12211-1.html --- .../20180612 Systemd Services- Reacting to Change.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180612 Systemd Services- Reacting to Change.md (100%) diff --git a/translated/tech/20180612 Systemd Services- Reacting to Change.md b/published/20180612 Systemd Services- Reacting to Change.md similarity index 100% rename from translated/tech/20180612 Systemd Services- Reacting to Change.md rename to published/20180612 Systemd Services- Reacting to Change.md From c871b8d15bfe3ad0ad2fe85d0ba8e2a5a6e3bd51 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 12 May 2020 00:55:22 +0800 Subject: [PATCH 2046/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200511=20Tips?= =?UTF-8?q?=20and=20tricks=20for=20optimizing=20container=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200511 Tips and tricks for optimizing container builds.md --- ... tricks for optimizing container builds.md | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 sources/tech/20200511 Tips and tricks for optimizing container builds.md diff --git a/sources/tech/20200511 Tips and tricks for optimizing container builds.md b/sources/tech/20200511 Tips and tricks for optimizing container builds.md new file mode 100644 index 0000000000..0a4fbed8cb --- /dev/null +++ b/sources/tech/20200511 Tips and tricks for optimizing container builds.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tips and tricks for optimizing container builds) +[#]: via: (https://opensource.com/article/20/5/optimize-container-builds) +[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) + +Tips and tricks for optimizing container builds +====== +Try these techniques to minimize the number and length of your container +build iterations. +![Toolbox drawing of a container][1] + +How many iterations does it take to get a container configuration just right? And how long does each iteration take? Well, if you answered "too many times and too long," then my experiences are similar to yours. On the surface, creating a configuration file seems like a straightforward exercise: implement the same steps in a configuration file that you would perform if you were installing the system by hand. Unfortunately, I've found that it usually doesn't quite work that way, and a few "tricks" are handy for such DevOps exercises. + +In this article, I'll share some techniques I've found that help minimize the number and length of iterations. In addition, I'll outline a few good practices beyond the [standard ones][2]. + +In the [tutorial repository][3] from my previous article about [containerizing build systems][4], I've added a folder called **/tutorial2_docker_tricks** with an example covering some of the tricks that I'll walk through in this post. If you want to follow along and you have Git installed, you can pull it locally with: + + +``` +`$ git clone https://github.com/ravi-chandran/dockerize-tutorial` +``` + +The tutorial has been tested with Docker Desktop Edition, although it should work with any compatible Linux container system (like [Podman][5]). + +### Save time on container image build iterations + +If the Dockerfile involves downloading and installing a 5GB file, each iteration of **docker image build** could take a lot of time even with good network speeds. And forgetting to include one item to be installed can mean rebuilding all the layers after that point. + +One way around that challenge is to use a local HTTP server to avoid downloading large files from the internet multiple times during **docker image build** iterations. To illustrate this by example, say you need to create a container image with Anaconda 3 under Ubuntu 18.04. The Anaconda 3 installer is a ~0.5GB file, so this will be the "large" file for this example. + +Note that you don't want to use the **COPY** instruction, as it creates a new layer. You should also delete the large installer after using it to minimize the container image size. You could use [multi-stage builds][6], but I've found the following approach sufficient and quite effective. + +The basic idea is to use a Python-based HTTP server locally to serve the large file(s) and have the Dockerfile **wget** the large file(s) from this local server. Let's explore the details of how to set this up effectively. As a reminder, you can access the [full example][7]. + +The necessary contents of the folder **tutorial2_docker_tricks/** in this example repository are: + + +``` +tutorial2_docker_tricks/ +├── build_docker_image.sh                   # builds the docker image +├── run_container.sh                        # instantiates a container from the image +├── install_anaconda.dockerfile             # Dockerfile for creating our target docker image +├── .dockerignore                           # used to ignore contents of the installer/ folder from the docker context +├── installer                               # folder with all our large files required for creating the docker image +│   └── Anaconda3-2019.10-Linux-x86_64.sh   # from +└── workdir                                 # example folder used as a volume in the running container +``` + +The key steps of the approach are: + + * Place the large file(s) in the **installer/** folder. In this example, I have the large Anaconda installer file **Anaconda3-2019.10-Linux-x86_64.sh**. You won't find this file if you clone my [Git repository][8] because only you, as the container image creator, need this source file. The end users of the image don't. [Download the installer][9] to follow along with the example. + * Create the **.dockerignore** file and have it ignore the **installer/** folder to avoid Docker copying all the large files into the build context. + * In a terminal, **cd** into the **tutorial2_docker_tricks/** folder and execute the build script as **./build_docker_image.sh**. + * In **build_docker_image.sh**, start the Python HTTP server to serve any files from the **installer/** folder: [code] cd installer +python3 -m http.server --bind 10.0.2.15 8888 & +cd .. +``` +* If you're wondering about the strange internet protocol (IP) address, I'm working with a VirtualBox Linux VM, and **10.0.2.15** shows up as the address of the Ethernet adapter when I run **ifconfig**. This IP seems to be the convention used by VirtualBox. If your setup is different, you'll need to update this IP address to match your environment and then update **build_docker_image.sh** and **install_anaconda.dockerfile**. The server's port number is set to **8888** for this example. Note that the IP and port numbers could be passed in as build arguments, but I've hard-coded them for brevity. +* Since the HTTP server is set to run in the background, stop the server near the end of the script with the **kill -9** command using an [elegant approach][10] I found: [code]`kill -9 `ps -ef | grep http.server | grep 8888 | awk '{print $2}'` +``` + * Note that this same **kill -9** is also used earlier in the script (before starting the HTTP server). In general, when I iterate on any build script that I might deliberately interrupt, this ensures a clean start of the HTTP server each time. + * In the [Dockerfile][11], there is a **RUN wget** instruction that downloads the Anaconda installer from the local HTTP server. It also deletes the installer file and cleans up after the installation. Most importantly, all these actions are performed within the same layer to keep the image size to a minimum: [code] # install Anaconda by downloading the installer via the local http server +ARG ANACONDA +RUN wget --no-proxy -O ~/anaconda.sh \ +    && /bin/bash ~/anaconda.sh -b -p /opt/conda \ +    && rm ~/anaconda.sh \ +    && rm -fr /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* +``` + * This file runs the wrapper script, **anaconda.sh**, and cleans up large files by removing them with **rm**. + * After the build is complete, you should see an image **anaconda_ubuntu1804:v1**. (You can list the images with **docker image ls**.) + * You can instantiate a container from this image using **./run_container.sh** at the terminal while in the folder **tutorial2_docker_tricks/**. You can verify that Anaconda is installed with: [code] $ ./run_container.sh +$ python --version +Python 3.7.5 +$ conda --version +conda 4.8.0 +$ anaconda --version +anaconda Command line client (version 1.7.2) +``` + * You'll note that **run_container.sh** sets up a volume **workdir**. In this example repository, the folder **workdir/** is empty. This is a convention I use to set up a volume where I can have my Python and other scripts that are independent of the container image. + + + +### Minimize container image size + +Each **RUN** command is equivalent to executing a new shell, and each **RUN** command creates a layer. The naive approach of mimicking installation instructions with separate **RUN** commands may eventually break at one or more interdependent steps. If it happens to work, it will typically result in a larger image. Chaining multiple installation steps in one **RUN** command and including the **autoremove**, **autoclean**, and **rm** commands (as in the example below) is useful to minimize the size of each layer. Some of these steps may not be needed, depending on what's being installed. However, since these steps take an insignificant amount of time, I always throw them in for good measure at the end of **RUN** commands invoking **apt-get**: + + +``` +RUN apt-get update \ +    && DEBIAN_FRONTEND=noninteractive \ +       apt-get -y --quiet --no-install-recommends install \ +       # list of packages being installed go here \ +    && apt-get -y autoremove \ +    && apt-get clean autoclean \ +    && rm -fr /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* +``` + +Also, ensure that you have a **.dockerignore** file in place to ignore items that don't need to be sent to the Docker build context (such as the Anaconda installer file in the earlier example). + +### Organize the build tool I/O + +For software build systems, the build inputs and outputs—all the scripts that configure and invoke the tools—should be outside the image and the eventually running container. The container itself should remain stateless so that different users will have identical results with it. I covered this extensively in my [previous article][4] but wanted to emphasize it because it's been a useful convention for my work. These inputs and outputs are best accessed by setting up container volumes. + +I've had to use a container image that provides data in the form of source code and large pre-built binaries. As a software developer, I was expected to edit the code in the container. This was problematic, because containers are by default stateless: they don't save data within the container, because they're designed to be disposable. But I worked on it, and at the end of each day, I stopped the container and had to be careful not to remove it, because the state had to be maintained so I could continue work the next day. The disadvantage of this approach was that there would be a divergence of development state had there been more than one person working on the project. The value of having identical build systems across developers is somewhat lost with this approach. + +### Generate output as non-root user + +An important aspect of I/O concerns the ownership of the output files generated when running the tools in the container. By default, since Docker runs as **root**, the output files would be owned by **root**, which is unpleasant. You typically want to work as a non-root user. Changing the ownership after the build output is generated can be done with scripts, but it is an additional and unnecessary step. It's best to set the [**USER**][12] argument in the Dockerfile at the earliest point possible: + + +``` +ARG USERNAME +# other commands... +USER ${USERNAME} +``` + +The **USERNAME** can be passed in as a build argument (**\--build-arg**) when executing the **docker image build**. You can see an example of this in the example [Dockerfile][11] and corresponding [build script][13]. + +Some portions of the tools may also need to be installed as a non-root user. So the sequence of installations in the Dockerfile may need to be different from the way it's done if you are installing manually and directly under Linux. + +### Non-interactive installation + +Interactivity is the opposite of container automation. I've found the + + +``` +`DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends` +``` + +options for the **apt-get install** instruction (as in the example above) necessary to prevent the installer from opening dialog boxes. Note that these options should be used as part of the **RUN** instruction. The **DEBIAN_FRONTEND=noninteractive** should not be set as an environment variable (**ENV**) in the Dockerfile, as this [FAQ explains][14], as it will be inherited by the containers. + +### Log your build and run output + +Debugging why a build failed is a common task, and logs are a great way to do this. Save a TypeScript of everything that happened during the container image build or container run session using the **tee** utility in a Bash script. In other words, add **|& tee $BASH_SOURCE.log** to the end of the **docker image build** and the **docker image run** commands in your scripts. See the examples in the [image build][13] and [container run][15] scripts. + +What this **tee**-ing technique does is generate a file with the same name as the Bash script but with a **.log** extension appended to it so that you know which script it originated from. Everything you see printed to the terminal when running the script will get logged to this file with a similar name. + +This is especially valuable for users of your container images to report issues to you when something doesn't work. You can ask them to send you the log file to help diagnose the issue. Many tools generate so much output that it easily overwhelms the default size of the terminal's buffer. Relying only on the terminal's buffer capacity to copy-paste error messages may not be sufficient for diagnosing issues because earlier errors may have been lost. + +I've found this to be useful, even in the container image-building scripts, especially when using the Python-based HTTP server discussed above. The server generates so many lines during a download that it typically overwhelms the terminal's buffer. + +### Deal with proxies elegantly + +In my work environment, proxies are required to reach the internet for downloading the resources in **RUN apt-get** and **RUN wget** commands. The proxies are typically inferred from the environment variables **http_proxy** or **https_proxy**. While **ENV** commands can be used to hard-code such proxy settings in the Dockerfile, there are multiple issues with using **ENV** for proxies directly. + +If you are the only one who will ever build the container, then perhaps this will work. But the Dockerfile couldn't be used by someone else at a different location with a different proxy setting. Another issue is that the IT department could change the proxy at some point, resulting in a Dockerfile that won't work any longer. Furthermore, the Dockerfile is a precise document specifying a configuration-controlled system, and every change will be scrutinized by quality assurance. + +One simple approach to avoid hard-coding the proxy is to pass your local proxy setting as a build argument in the **docker image build** command: + + +``` +docker image build \ +    --build-arg MY_PROXY= +``` + +And then, in the Dockerfile, set the environment variables based on the build argument. In the example shown here, you can still set a default proxy value that can be overridden by the build argument above: + + +``` +# set a default proxy +ARG MY_PROXY=MY_PROXY= +ENV http_proxy=$MY_PROXY +ENV https_proxy=$MY_PROXY +``` + +### Summary + +These techniques have helped me significantly reduce the time it takes to create container images and debug them when they go wrong. I continue to be on the lookout for additional best practices to add to my list. I hope you find the above techniques useful. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/optimize-container-builds + +作者:[Ravi Chandran][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ravichandran +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/toolbox-learn-draw-container-yearbook.png?itok=xDbwz1pP (Toolbox drawing of a container) +[2]: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ +[3]: https://github.com/ravi-chandran/dockerize-tutorial +[4]: https://opensource.com/article/20/4/how-containerize-build-system +[5]: https://podman.io/getting-started/installation +[6]: https://docs.docker.com/develop/develop-images/multistage-build/ +[7]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/ +[8]: https://github.com/ravi-chandran/dockerize-tutorial/ +[9]: https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh +[10]: https://stackoverflow.com/a/37214138 +[11]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/install_anaconda.dockerfile +[12]: https://docs.docker.com/engine/reference/builder/#user +[13]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/build_docker_image.sh +[14]: https://docs.docker.com/engine/faq/ +[15]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/run_container.sh From 5f7878abb20e02ef342f2b37dfb720fddbfbc26b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 12 May 2020 00:57:33 +0800 Subject: [PATCH 2047/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200511=20How?= =?UTF-8?q?=20I=20track=20my=20home's=20energy=20consumption=20with=20open?= =?UTF-8?q?=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200511 How I track my home-s energy consumption with open source.md --- ...e-s energy consumption with open source.md | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 sources/tech/20200511 How I track my home-s energy consumption with open source.md diff --git a/sources/tech/20200511 How I track my home-s energy consumption with open source.md b/sources/tech/20200511 How I track my home-s energy consumption with open source.md new file mode 100644 index 0000000000..10dfaa5f8e --- /dev/null +++ b/sources/tech/20200511 How I track my home-s energy consumption with open source.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I track my home's energy consumption with open source) +[#]: via: (https://opensource.com/article/20/5/energy-monitoring) +[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99) + +How I track my home's energy consumption with open source +====== +These open source components help you find ways to save money and +conserve resources. +![lightbulb drawing outline][1] + +An important step towards optimizing energy consumption is knowing your actual consumption. My house was built during the oil crisis in the 1970s, and due to the lack of a natural gas connection, the builders decided to use electricity to do all of the heating (water and home heating). This is not unusual for this area of Germany, and it remains an appropriate solution in countries that depend highly on nuclear power. + +Electricity prices here are quite high (around € 0.28/kWh), so I decided to monitor my home's energy consumption to get a feel for areas where I could save some energy. + +I used to work for a company that sold energy-monitoring systems for industrial customers. While this company mostly used proprietary software, you can set up a similar smart monitoring and logging solution for your home based on open source components. This article will show you how. + +In Germany, the grid operator owns the electricity meter. The grid operator is obliged to provide an interface on its metering device to enable the customer to access the meter reading. Here is the metering device on my home: + +![Actaris ACE3000 electricity meter][2] + +Actaris ACE3000 Type 110 (dry contact located behind the marked cover) + +Generally, almost every metering device has at least a [dry contact][3]—as my electricity meter does—that you can use to log metering. As you can see, my electricity meter has two counters: The upper one is for the day tariff (6am to 10pm), and the lower one is for the night tariff (10pm to 6am). The night tariff is a bit cheaper. Two-tariff meters are usually found only in houses with electric heating. + +### Design + +A reliable energy-monitoring solution for private use should meet the following requirements: + + * Logging of metering impulses (dry contact) + * 24/7 operation + * Energy-saving operation + * Visualization of consumption data + * Long-term recording of consumption data + * Connectivity (e.g., Ethernet, USB, WiFi, etc.) + * Affordability + + + +I choose the Siemens SIMATIC IOT2020 as my hardware platform. This industrial-proven device is based on an Intel Quark x86 CPU, has programmable interrupts, and is compatible with many Arduino shields. + +![Siemens SIMATIC IOT2020][4] + +Siemens SIMATIC IOT2020 + +The Siemens device comes without an SD card and, therefore, without an operating system. Luckily, you can find a current Yocto-based Linux OS image and instructions on how to flash the SD card in the [Siemens forum][5]. + +In addition to the hardware platform, you also need some accessories. The following materials list shows the minimum components you need. Each item includes links to the parts I purchased, so you can get a sense of the project's costs. + +#### Materials list + + * [Siemens SIMATIC IoT2020 unit][6] + * [Siemens I/O Shield for SIMATIC IoT2000 series][7] + * [microSD card][8] (2GB or more) + * [CSL 300Mbit USB-WLAN adapter][9] + * 24V power supply (I used a 2.1A [TDK-Lambda DRB50-24-1][10], which I already owned). You could use a less expensive power supply with less power: the SIMATIC IOT2020 has a maximum current of 1.4A, and the dry contact needs an additional 0.1A (24V / 220Ω). + * 5 terminal blocks ([Weidmueller WDU 2.5mm][11]) + * 2 terminal cross-connecting bridges ([Weidmueller WQV][12]) + * [DIN rail][13] (~300 mm) + * [220Ω / 3W resistor][14] + * Wire + + + +Here is the assembled result: + +![Mounted and hooked up energy logger][15] + +Energy logger mounted and hooked up + +Unfortunately, I didn't have enough space at the rear wall of the cabinet; therefore, the DIN rail with the mounted parts lies on the ground. + +The connections between the meter and the Siemens device look like this: + +![Wiring between meter and energy logger][16] + +### How it works + +A dry contact is a current interface. When the electricity meter triggers, a current of 0.1A starts flowing between **s0+** and **s0-**. On **DI0**, the voltage rises to 24V and triggers an interrupt. When the electricity meter disconnects **s0+** and **s0-**, **DI0** is grounded over the resistor. + +On my device, the contact closes 1,000 times per kWh (this value varies between metering devices). + +To count these peaks reliably, I created [a C program][17] that registers an interrupt service routine on the DI0 input and counts upwards in memory. Once a minute, the values from memory are written to an [SQLite][18] database. + +The overall meter reading is also written to a text file and can be preset with a starting value. This acts as a copy of the overall metering value of the meter in the cabinet. + +![Energy logger architecture][19] + +Energy logger architecture + +The data is visualized using [Node-RED][20], and I can access overviews, like the daily consumption dashboard below, over a web-based GUI. + +![Node-RED based GUI][21] + +Daily overview in the Node-RED GUI + +For the daily overview, I calculate the hourly costs based on the consumption data (the large bar chart). On the top-left of the dashboard you can see the actual power; below that is the daily consumption (energy and costs). The water heater for the shower causes the large peak in the bar chart. + +### A reliable system + +Aside from a lost timestamp during a power failure (the real-time clock in the Siemens device is not backed by a battery by default), everything has been working fine for more than one-and-a-half years. + +If you can set up the whole Linux system completely from the command line, you'll get a reliable and flexible system with the ability to link interrupt service routines to the I/O level. + +Because the I/O Shield runs on standard control voltage (24V), you can extend its functionality with the whole range of standardized industrial components (e.g., relays, sensors, actors, etc.). And, due to its open architecture, this system can be extended easily and applied to other applications, like for monitoring gas or water consumption or as a weather station, a simple controller for tasks, and more. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/energy-monitoring + +作者:[Stephan Avenwedde][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hansic99 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Collaboration%20for%20health%20innovation.png?itok=s4O5EX2w (lightbulb drawing outline) +[2]: https://opensource.com/sites/default/files/uploads/openenergylogger_1_electricity_meter.jpg (Actaris ACE3000 electricity meter) +[3]: https://en.wikipedia.org/wiki/Dry_contact +[4]: https://opensource.com/sites/default/files/uploads/openenergylogger_2_siemens_device.jpg (Siemens SIMATIC IOT2020) +[5]: https://support.industry.siemens.com/tf/ww/en/posts/new-example-image-version-online/189090/?page=0&pageSize=10 +[6]: https://de.rs-online.com/web/p/products/1244037 +[7]: https://de.rs-online.com/web/p/products/1354133 +[8]: https://de.rs-online.com/web/p/micro-sd-karten/7582584/ +[9]: https://www.amazon.de/300Mbit-WLAN-Adapter-Hochleistungs-Antennen-Dual-Band/dp/B00LLIOT34 +[10]: https://de.rs-online.com/web/p/products/8153133 +[11]: https://de.rs-online.com/web/p/din-schienenklemmen-ohne-sicherung/0425190/ +[12]: https://de.rs-online.com/web/p/din-schienenklemmen-zubehor/0202574/ +[13]: https://de.rs-online.com/web/p/din-schienen/2835729/ +[14]: https://de.rs-online.com/web/p/widerstande-durchsteckmontage/2142673/ +[15]: https://opensource.com/sites/default/files/uploads/openenergylogger_3_assembled_device.jpg (Mounted and hooked up energy logger) +[16]: https://opensource.com/sites/default/files/uploads/openenergylogger_4_wiring.png (Wiring between meter and energy logger) +[17]: https://github.com/hANSIc99/OpenEnergyLogger +[18]: https://www.sqlite.org/index.html +[19]: https://opensource.com/sites/default/files/uploads/openenergylogger_5_architecure.png (Energy logger architecture) +[20]: https://nodered.org/ +[21]: https://opensource.com/sites/default/files/uploads/openenergylogger_6_dashboard.png (Node-RED based GUI) From 8444eebe508b9f12b7074679ac15165965d2deea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 12 May 2020 00:58:29 +0800 Subject: [PATCH 2048/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200511=20Modi?= =?UTF-8?q?fy=20a=20disk=20image=20to=20create=20a=20Raspberry=20Pi-based?= =?UTF-8?q?=20homelab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md --- ... to create a Raspberry Pi-based homelab.md | 240 ++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md diff --git a/sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md b/sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md new file mode 100644 index 0000000000..fd73137fea --- /dev/null +++ b/sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md @@ -0,0 +1,240 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Modify a disk image to create a Raspberry Pi-based homelab) +[#]: via: (https://opensource.com/article/20/5/disk-image-raspberry-pi) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +Modify a disk image to create a Raspberry Pi-based homelab +====== +Create a "private cloud at home" with a Raspberry Pi or other +single-board computer. +![Science lab with beakers][1] + +Building a [homelab][2] can be a fun way to entertain yourself while learning new concepts and experimenting with new technologies. Thanks to the popularity of single-board computers (SBCs), led by the [Raspberry Pi][3], it is easier than ever to build a multi-computer lab right from the comfort of your home. Creating a "private cloud at home" is also a great way to get exposure to cloud-native technologies for considerably less money than trying to replicate the same setup with a major cloud provider. + +This article explains how to modify a disk image for the Raspberry Pi or another SBC, pre-configure the host for SSH (secure shell), and disable the service that forces interaction for configuration on first boot. This is a great way to make your devices "boot and go," similar to cloud instances. Later, you can do more specialized, in-depth configurations using automated processes over an SSH connection. + +Also, as you add more Pis to your lab, modifying disk images lets you just write the image to an SD card, drop it into the Pi, and go! + +![Multiple Raspberry Pi computers, a switch, and a power bank][4] + +### Decompress and mount the image + +For this project, you need to modify a server disk image. I used the [Fedora Server 31 ARM][5] image during testing. After you download the disk image and [verify its checksum][6], you need to decompress and mount it to a location on the host computer's file system so you can modify it as needed. + +You can use the **[xz][7]** command to decompress the Fedora Server image by using the **\--decompress** argument: + + +``` +`xz --decompress Fedora-Server-armhfp-X-y.z-sda.raw.xz` +``` + +This leaves you with a raw, decompressed disk image (which automatically replaces the **.xz** compressed file). This raw disk image is just what it sounds like: a file containing all the data that would be on a formatted and installed disk. That includes partition information, the boot partition, the root partition, and any other partitions. You need to mount the partition you intend to work in, but to do that, you need information about where that partition starts in the disk image and the size of the sectors on the disk, so you can mount the file at the right sector. + +Luckily, you can use the [**fdisk**][8] command on a disk image just as easily as on a real disk and use the **\--list** or **-l** argument to view the list of partitions and their information: + + +``` +# Use fdisk to list the partitions in the raw image: +$ fdisk -l Fedora-Server-armhfp-31-1.9-sda.raw +Disk Fedora-Server-armhfp-X-y.z-sda.raw: 3.2 GiB, 3242196992 bytes, 6332416 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xdaad9f57 + +Device                               Boot   Start     End Sectors  Size Id Type +Fedora-Server-armhfp-X-y.z-sda.raw1         8192  163839  155648   76M  c W95 F +Fedora-Server-armhfp-X-y.z-sda.raw2 *     163840 1163263  999424  488M 83 Linux +Fedora-Server-armhfp-X-y.z-sda.raw3      1163264 6047743 4884480  2.3G 83 Linux +``` + +All the information you need is available in this output. Line 3 indicates the sector size, both logical and physical: (512 bytes / 512 bytes). + +The list of devices shows the partitions inside the raw disk image. The first one, **Fedora-Server-armhfp-X-y.z-sda.raw1** is no doubt the bootloader partition because it is the first, small (only 76MB), and type W95 FAT32 (LBA), as identified by the Id "c," a FAT32 partition for booting off the SD card. + +The second partition is not very large either, just 488MB. This partition is a Linux native-type partition (Id 83), and it probably is the Linux boot partition containing the kernel and [initramfs][9]. + +The third partition is what you probably want: it is 2.3GB, so it should have the majority of the distribution on it, and it is a Linux-native partition type, which is expected. This should contain the partition and data you want to modify. + +The third partition starts on sector 1163264 (indicated by the "Start" column in the output of **fdisk**), so your mount offset is **595591168**, calculated by multiplying the sector size (512) by the start sector (1163264) (i.e., **512 * 1163264**). This means you need to mount the file with an offset of 595591168 to be in the right place at the mount point. + +ARMed (see what I did there?) with this information, you can now mount the third partition to a directory in your homedir: + + +``` +$ mkdir ~/mnt +$ sudo mount -o loop,offset=595591168 Fedora-Server-armhfp-X-y.z-sda.raw ~/mnt +$ ls ~/mnt +``` + +### Work directly within the disk image + +Once the disk image has been decompressed and mounted to a spot on the host computer, it is time to start modifying the image to suit your needs. In my opinion, the easiest way to make changes to the image is to use **chroot** to change the working root of your session to that of the mounted image. There's a tricky bit, though. + +When you change root, your session will use the binaries from the new root. Unless you are doing all of this from an ARM system, the architecture of the decompressed disk image will not be the same as the host system you are using. Even inside the **chroot**, the host system will not be able to make use of binaries with a different architecture. At least, not natively. + +Luckily, there is a solution: **qemu-user-static**. From the [Debian Wiki][10]: + +> "[qemu-user-static] provides the user mode emulation binaries, built statically. In this mode QEMU can launch Linux processes compiled for one CPU on another CPU… If binfmt-support package is installed, qemu-user-static package will register binary formats which the provided emulators can handle, so that it will be possible to run foreign binaries directly." + +This is exactly what you need to be able to work in the non-native architecture inside your chroot. If the host system is Fedora, install the **qemu-user-static** package with DNF, and restart **systemd-binfmt.service**: + + +``` +# Enable non-native arch chroot with DNF, adding new binary format information +# Output suppressed for brevity +$ dnf install qemu-user-static +$ systemctl restart systemd-binfmt.service +``` + +With this, you should be able to change root to the mounted disk image and run the **uname** command to verify that everything is working: + + +``` +sudo chroot ~/mnt/ /usr/bin/uname -a -r +Linux marvin 5.5.16-200.fc31.x86_64 #1 SMP Wed Apr 8 16:43:33 UTC 2020 armv7l armv7l armv7l GNU/Linux +``` + +Running **uname** from within the changed root shows **armv7l** in the output—the architecture of the raw disk image—and not the host machine. Everything is working as expected, and you can continue on to modify the image. + +### Modify the disk image + +Now that you can change directly into the ARM-based disk image and work in that environment, you can begin to make changes to the image itself. You want to set up the image so it can be booted and immediately accessed without having to do any additional setup directly on the Raspberry Pi. To do this, you need to install and enable sshd (the OpenSSH daemon) and add the authorized keys for SSH access. + +And to make this behave more like a cloud environment and realize the dream of a private cloud at home, add a local user, give that user **sudo** rights, and (to be just like the cloud heavyweights) allow that user to use **sudo** without a password. + +So, your to-do list is: + + * Install and enable SSHD (SSHD is already installed and enabled in the Fedora ARM image, but you may need to do this manually for your distribution) + * Set up a local user + * Allow the local user to use sudo (without a password, optional) + * Add authorized keys + * Allow root to SSH with the authorized keys (optional) + + + +I use the GitHub feature that allows you to upload your public SSH keys and make them available at **[https://github.com/<your_github_username>.keys][11]**. I find this to be a convenient way to distribute public keys, although I am paranoid enough that I always check that the downloaded keys match what I am expecting. If you don't want to use this method, you can copy your public keys into the **chroot** directly from your host computer, or you can host your keys on a web server that you control in order to use the same workflow. + +To start modifying the disk image, **chroot** into the mounted disk image again, this time starting a shell so multiple commands can be run: + + +``` +# Output of these commands (if any) are omitted for brevity +$ sudo chroot ~/mnt /bin/bash + +# Install openssh-server and enable it (already done on Fedora) +$ dnf install -y openssh-server +$ systemctl enable sshd.service + +# Allow root to SSH with your authorized keys +$ mkdir /root/.ssh + +# Download, or otherwise add to the authorized_keys file, your public keys +# Replace the URL with the path to your own public keys +$ curl -o /root/.ssh/authorized_keys +$ chmod 700 /root/.ssh +$ chmod 600 /root/.ssh/authorized_keys + +# Add a local user, and put them in the wheel group +# Change the group and user to whatever you desire +groupadd chris +useradd -g chris -G wheel -m -u 1000 chris + +# Download or add your authorized keys +# Change the homedir and URL as you've done above +mkdir /home/chris/.ssh +curl -o /home/chris/.ssh/authorized_keys +chmod 700 /home/chris/.ssh +chmod 600 /home/chris/.ssh/authorized_keys +chown -R chris.chris /home/chris/.ssh/ + +# Allow the wheel group (with your local user) to use suso without a password +echo "%wheel ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/91-wheel-nopasswd +``` + +This is all that generally needs to be done to set up SSH into a Raspberry Pi or other single-board computer on first boot. However, each distribution has its own quirks. For example, Rasbian already includes a local user, **pi**, and does not use the **wheel** group. So for Raspbian, it may be better to use the existing user or to delete the **pi** user and replace it with another. + +In the case of Fedora ARM, the image prompts you to finish setup on first boot. This defeats the purpose of the changes you made above, especially since it blocks startup entirely until setup is complete. Your goal is to make the Raspberry Pi function like part of a private cloud infrastructure, and that workflow includes setting up the host remotely via SSH when it starts up.  Disable the initial setup, controlled by the service **initial-setup.service**: + + +``` +# Disable the initial-setup.service for both the multi-user and graphical targets +unlink /etc/systemd/system/multi-user.target.wants/initial-setup.service +unlink /etc/systemd/system/graphical.target.wants/initial-setup.service +``` + +While you are in the change root, you can make any other changes you might want for your systems or just leave it at that and follow the cloud-native workflow of configuration over SSH after first boot. + +### Recompress and install the modified image + +With these changes to your system completed, all that is left is to recompress the disk image and install it on an SD card for your Raspberry Pi. + +Make sure to exit the chroot, then unmount the disk image: + + +``` +`$ sudo umount ~/mnt/` +``` + +Just as you decompressed the image initially, you can use the **xz** command again to compress the image. By using the **\--keep** argument, **xz** will leave the raw image rather than cleaning it up. While this uses more disk space, leaving the uncompressed image allows you to make incremental changes to the images you are working with without needing to decompress them each time. This is great for saving time while testing and tweaking images to your liking: + + +``` +# Compress the raw disk image to a .xz file, but keep the raw disk image +xz --compress Fedora-Server-armhfp-31-1.9-sda.raw --keep +``` + +The compression takes a while, so take this time to stand up, stretch, and get your blood flowing again. + +Once the compression is done, the new, modified disk image can be copied to an SD card to use with a Raspberry Pi. The standard **dd** method to copy the image to the SD card works fine, but I like to use Fedora's **arm-image-installer** because of the options it provides when working with unedited images. It also works great for edited images and is a little more user-friendly than the **dd** command. + +Make sure to check which disk the SD card is on and use that for the **\--media** argument: + + +``` +# Use arm-image-installer to copy the modified disk image to the SD card +arm-image-installer --image=Fedora-Server-armhfp-X-y.z-sda.raw.xz --target=rpi3 --media=/dev/sdc --norootpass --resizefs -y +``` + +Now you are all set with a new, modified Fedora Server ARM image for Raspberry Pis or other single board computers, ready to boot and immediately SSH into with your modifications. This method can also be used to make other changes, and you can use it with other distributions' raw disk images if you prefer them to Fedora. This is a good base to start building a private-cloud-at-home homelab. In future articles, I will guide you through setting up a homelab using cloud technologies and automation. + +### Further reading + +A lot of research went into learning how to do the things in this article. Two of the most helpful sources I found for learning how to customize disk images and work with non-native architectures are listed below. They were extremely helpful in rounding the corner from "I have no idea what I'm doing" to "OK, I can do this!" + + * [How to modify a raw disk image of your custom Linux distro][12] + * [Using DNF wiki][13] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/disk-image-raspberry-pi + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/science_experiment_beaker_lab.png?itok=plKWRhlU (Science lab with beakers) +[2]: https://opensource.com/article/19/3/home-lab +[3]: https://opensource.com/resources/raspberry-pi +[4]: https://opensource.com/sites/default/files/uploads/raspberrypi_homelab.jpg (Multiple Raspberry Pi computers, a switch, and a power bank) +[5]: https://arm.fedoraproject.org/ +[6]: https://arm.fedoraproject.org/verify.html +[7]: https://tukaani.org/xz/ +[8]: https://en.wikipedia.org/wiki/Fdisk +[9]: https://wiki.debian.org/initramfs +[10]: https://wiki.debian.org/RaspberryPi/qemu-user-static +[11]: https://github.com/%3Cyour_github_username%3E.keys +[12]: https://www.linux.com/news/how-modify-raw-disk-image-your-custom-linux-distro/ +[13]: https://wiki.mageia.org/en/Using_DNF#Setting_up_a_container_for_a_non-native_architectur From cdc3319ccbe1418776d2d65f487bd1ec9c3caa9b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 12 May 2020 00:59:21 +0800 Subject: [PATCH 2049/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200511=20Star?= =?UTF-8?q?t=20using=20systemd=20as=20a=20troubleshooting=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200511 Start using systemd as a troubleshooting tool.md --- ...using systemd as a troubleshooting tool.md | 269 ++++++++++++++++++ 1 file changed, 269 insertions(+) create mode 100644 sources/tech/20200511 Start using systemd as a troubleshooting tool.md diff --git a/sources/tech/20200511 Start using systemd as a troubleshooting tool.md b/sources/tech/20200511 Start using systemd as a troubleshooting tool.md new file mode 100644 index 0000000000..372be7660e --- /dev/null +++ b/sources/tech/20200511 Start using systemd as a troubleshooting tool.md @@ -0,0 +1,269 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Start using systemd as a troubleshooting tool) +[#]: via: (https://opensource.com/article/20/5/systemd-troubleshooting-tool) +[#]: author: (David Both https://opensource.com/users/dboth) + +Start using systemd as a troubleshooting tool +====== +While systemd is not really a troubleshooting tool, the information in +its output points the way toward solving problems. +![Magnifying glass on code][1] + +No one would really consider systemd to be a troubleshooting tool, but when I encountered a problem on my webserver, my growing knowledge of systemd and some of its features helped me locate and circumvent the problem. + +The problem was that my server, yorktown, which provides name services, DHCP, NTP, HTTPD, and SendMail email services for my home office network, failed to start the Apache HTTPD daemon during normal startup. I had to start it manually after I realized that it was not running. The problem had been going on for some time, and I recently got around to trying to fix it. + +Some of you will say that systemd itself is the cause of this problem, and, based on what I know now, I agree with you. However, I had similar types of problems with SystemV. (In the [first article][2] in this series, I looked at the controversy around systemd as a replacement for the old SystemV init program and startup scripts. If you're interested in learning more about systemd, read the [second][3] and [third][4] articles, too.) No software is perfect, and neither systemd nor SystemV is an exception, but systemd provides far more information for problem-solving than SystemV ever offered. + +### Determining the problem + +The first step to finding the source of this problem is to determine the httpd service's status: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +   Active: failed (Result: exit-code) since Thu 2020-04-16 11:54:37 EDT; 15min ago +     Docs: man:httpd.service(8) +  Process: 1101 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) + Main PID: 1101 (code=exited, status=1/FAILURE) +   Status: "Reading configuration..." +      CPU: 60ms + +Apr 16 11:54:35 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 11:54:37 yorktown.both.org httpd[1101]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 192.168.0.52:80 +Apr 16 11:54:37 yorktown.both.org httpd[1101]: no listening sockets available, shutting down +Apr 16 11:54:37 yorktown.both.org httpd[1101]: AH00015: Unable to open logs +Apr 16 11:54:37 yorktown.both.org systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE +Apr 16 11:54:37 yorktown.both.org systemd[1]: httpd.service: Failed with result 'exit-code'. +Apr 16 11:54:37 yorktown.both.org systemd[1]: Failed to start The Apache HTTP Server. +[root@yorktown ~]# +``` + +This status information is one of the systemd features that I find much more useful than anything SystemV offers. The amount of helpful information here leads me easily to a logical conclusion that takes me in the right direction. All I ever got from the old **chkconfig** command is whether or not the service is running and the process ID (PID) if it is. That is not very helpful. + +The key entry in this status report shows that HTTPD cannot bind to the IP address, which means it cannot accept incoming requests. This indicates that the network is not starting fast enough to be ready for the HTTPD service to bind to the IP address because the IP address has not yet been set. This is not supposed to happen, so I explored my network service systemd startup configuration files; all appeared to be correct with the right "after" and "requires" statements. Here is the **/lib/systemd/system/httpd.service** file from my server: + + +``` +# Modifying this file in-place is not recommended, because changes                                                                                     +# will be overwritten during package upgrades.  To customize the                                                                                       +# behaviour, run "systemctl edit httpd" to create an override unit.                                                                                   +                                                                                                                                                      +# For example, to pass additional options (such as -D definitions) to                                                                                 +# the httpd binary at startup, create an override unit (as is done by                                                                                 +# systemctl edit) and enter the following:                                                                                                             +                                                                                                                                                      +#       [Service]                                                                                                                                     +#       Environment=OPTIONS=-DMY_DEFINE                                                                                                               +                                                                                                                                                      +[Unit]                                                                                                                                                 +Description=The Apache HTTP Server                                                                                                                     +Wants=httpd-init.service                                                                                                                               +After=network.target remote-fs.target nss-lookup.target httpd-init.service                                                                             +Documentation=man:httpd.service(8)                                                                                                                     +                                                                                                                                                      +[Service]                                                                                                                                             +Type=notify                                                                                                                                           +Environment=LANG=C                                                                                                                                     +                                                                                                                                                      +ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND                                                                                                       +ExecReload=/usr/sbin/httpd $OPTIONS -k graceful                                                                                                       +# Send SIGWINCH for graceful stop                                                                                                                     +KillSignal=SIGWINCH                                                                                                                                   +KillMode=mixed                                                                                                                                         +PrivateTmp=true                                                                                                                                       +                                                                                                                                                      +[Install]                                                                                                                                             +WantedBy=multi-user.target +``` + +The **httpd.service** unit file explicitly specifies that it should load after the **network.target** and the **httpd-init.service** (among others). I tried to find all of these services using the **systemctl list-units** command and searching for them in the resulting data stream. All were present and should have ensured that the httpd service did not load before the network IP address was set. + +### First solution + +A bit of searching on the internet confirmed that others had encountered similar problems with httpd and other services. This appears to happen because one of the required services indicates to systemd that it has finished its startup—but it actually spins off a child process that has not finished. After a bit more searching, I came up with a circumvention. + +I could not figure out why the IP address was taking so long to be assigned to the network interface card. So, I thought that if I could delay the start of the HTTPD service by a reasonable amount of time, the IP address would be assigned by that time. + +Fortunately, the **/lib/systemd/system/httpd.service** file above provides some direction. Although it says not to alter it, it does indicate how to proceed: Use the command **systemctl edit httpd**, which automatically creates a new file (**/etc/systemd/system/httpd.service.d/override.conf**) and opens the [GNU Nano][5] editor. (If you are not familiar with Nano, be sure to look at the hints at the bottom of the Nano interface.) + +Add the following text to the new file and save it: + + +``` +[root@yorktown ~]# cd /etc/systemd/system/httpd.service.d/ +[root@yorktown httpd.service.d]# ll +total 4 +-rw-r--r-- 1 root root 243 Apr 16 11:43 override.conf +[root@yorktown httpd.service.d]# cat override.conf +# Trying to delay the startup of httpd so that the network is +# fully up and running so that httpd can bind to the correct +# IP address +# +# By David Both, 2020-04-16 + +[Service] +ExecStartPre=/bin/sleep 30 +``` + +The **[Service]** section of this override file contains a single line that delays the start of the HTTPD service by 30 seconds. The following status command shows the service status during the wait time: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +  Drop-In: /etc/systemd/system/httpd.service.d +           └─override.conf +           /usr/lib/systemd/system/httpd.service.d +           └─php-fpm.conf +   Active: activating (start-pre) since Thu 2020-04-16 12:14:29 EDT; 28s ago +     Docs: man:httpd.service(8) +Cntrl PID: 1102 (sleep) +    Tasks: 1 (limit: 38363) +   Memory: 260.0K +      CPU: 2ms +   CGroup: /system.slice/httpd.service +           └─1102 /bin/sleep 30 + +Apr 16 12:14:29 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 12:15:01 yorktown.both.org systemd[1]: Started The Apache HTTP Server. +[root@yorktown ~]# +``` + +And this command shows the status of the HTTPD service after the 30-second delay expires. The service is up and running correctly: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +  Drop-In: /etc/systemd/system/httpd.service.d +           └─override.conf +           /usr/lib/systemd/system/httpd.service.d +           └─php-fpm.conf +   Active: active (running) since Thu 2020-04-16 12:15:01 EDT; 1min 18s ago +     Docs: man:httpd.service(8) +  Process: 1102 ExecStartPre=/bin/sleep 30 (code=exited, status=0/SUCCESS) + Main PID: 1567 (httpd) +   Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec" +    Tasks: 213 (limit: 38363) +   Memory: 21.8M +      CPU: 82ms +   CGroup: /system.slice/httpd.service +           ├─1567 /usr/sbin/httpd -DFOREGROUND +           ├─1569 /usr/sbin/httpd -DFOREGROUND +           ├─1570 /usr/sbin/httpd -DFOREGROUND +           ├─1571 /usr/sbin/httpd -DFOREGROUND +           └─1572 /usr/sbin/httpd -DFOREGROUND + +Apr 16 12:14:29 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 12:15:01 yorktown.both.org systemd[1]: Started The Apache HTTP Server. +``` + +I could have experimented to see if a shorter delay would work as well, but my system is not that critical, so I decided not to. It works reliably as it is, so I am happy. + +Because I gathered all this information, I reported it to Red Hat Bugzilla as Bug [1825554][6]. I believe that it is much more productive to report bugs than it is to complain about them. + +### The better solution + +A couple of days after reporting this as a bug, I received a response indicating that systemd is just the manager, and if httpd needs to be ordered after some requirements are met, it needs to be expressed in the unit file. The response pointed me to the **httpd.service** man page. I wish I had found this earlier because it is a better solution than the one I came up with. This solution is explicitly targeted to the prerequisite target unit rather than a somewhat random delay. + +From the [**httpd.service** man page][7]: + +> **Starting the service at boot time** +> +> The httpd.service and httpd.socket units are _disabled_ by default. To start the httpd service at boot time, run: **systemctl enable httpd.service**. In the default configuration, the httpd daemon will accept connections on port 80 (and, if mod_ssl is installed, TLS connections on port 443) for any configured IPv4 or IPv6 address. +> +> If httpd is configured to depend on any specific IP address (for example, with a "Listen" directive) which may only become available during start-up, or if httpd depends on other services (such as a database daemon), the service _must_ be configured to ensure correct start-up ordering. +> +> For example, to ensure httpd is only running after all configured network interfaces are configured, create a drop-in file (as described above) with the following section: +> +> [Unit] +> After=network-online.target +> Wants=network-online.target + +I still think this is a bug because it is quite common—at least in my experience—to use a **Listen** directive in the **httpd.conf** configuration file. I have always used **Listen** directives, even on hosts with only a single IP address, and it is clearly necessary on hosts with multiple network interface cards (NICs) and internet protocol (IP) addresses. Adding the lines above to the **/usr/lib/systemd/system/httpd.service** default file would not cause problems for configurations that do not use a **Listen** directive and would prevent this problem for those that do. + +In the meantime, I will use the suggested solution. + +### Next steps + +This article describes a problem I had with starting the Apache HTTPD service on my server. It leads you through the problem determination steps I took and shows how I used systemd to assist. I also covered the circumvention I implemented using systemd and the better solution that followed from my bug report. + +As I mentioned at the start, it is very likely that this is the result of a problem with systemd, specifically the configuration for httpd startup. Nevertheless, systemd provided me with the tools to locate the likely source of the problem and to formulate and implement a circumvention. Neither solution really resolves the problem to my satisfaction. For now, the root cause of the problem still exists and must be fixed. If that is simply adding the recommended lines to the **/usr/lib/systemd/system/httpd.service** file, that would work for me. + +One of the things I discovered during this is process is that I need to learn more about defining the sequences in which things start. I will explore that in my next article, the fifth in this series. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. + + * The Fedora Project has a good, practical [guide][8] [to systemd][8]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][9] that cross-references the old SystemV commands to comparable systemd ones. + * For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][10]'s [description of systemd][11]. + * [Linux.com][12]'s "More systemd fun" offers more advanced systemd [information and tips][13]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][14] + * [systemd for Administrators, Part I][15] + * [systemd for Administrators, Part II][16] + * [systemd for Administrators, Part III][17] + * [systemd for Administrators, Part IV][18] + * [systemd for Administrators, Part V][19] + * [systemd for Administrators, Part VI][20] + * [systemd for Administrators, Part VII][21] + * [systemd for Administrators, Part VIII][22] + * [systemd for Administrators, Part IX][23] + * [systemd for Administrators, Part X][24] + * [systemd for Administrators, Part XI][25] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/systemd-troubleshooting-tool + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) +[2]: https://opensource.com/article/20/4/systemd +[3]: https://opensource.com/article/20/4/systemd-startup +[4]: https://opensource.com/article/20/4/understanding-and-using-systemd-units +[5]: https://www.nano-editor.org/ +[6]: https://bugzilla.redhat.com/show_bug.cgi?id=1825554 +[7]: https://www.mankier.com/8/httpd.service#Description-Starting_the_service_at_boot_time +[8]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[9]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[10]: http://Freedesktop.org +[11]: http://www.freedesktop.org/wiki/Software/systemd +[12]: http://Linux.com +[13]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[14]: http://0pointer.de/blog/projects/systemd.html +[15]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[16]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[18]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[19]: http://0pointer.de/blog/projects/three-levels-of-off.html +[20]: http://0pointer.de/blog/projects/changing-roots +[21]: http://0pointer.de/blog/projects/blame-game.html +[22]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[23]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[24]: http://0pointer.de/blog/projects/instances.html +[25]: http://0pointer.de/blog/projects/inetd.html From ff398b5c4003a285cd4ce63af944d8ffd4dca16f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 12 May 2020 03:50:20 +0800 Subject: [PATCH 2050/3057] Revert "Translating by MjSeven" This reverts commit b8be7d43683d0dfc5a439c370b153abbb18fce97. --- ... to use pyenv to run multiple versions of Python on a Mac.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md b/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md index a77ff4ede5..4d15072b90 100644 --- a/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md +++ b/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (MjSeven) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8650af3c8ccef6e29dacca2028b0ce61ebaa763f Mon Sep 17 00:00:00 2001 From: guevaraya Date: Tue, 12 May 2020 05:53:55 +0800 Subject: [PATCH 2051/3057] Update 20200428 Open source has room for everyone.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申领文章 --- sources/tech/20200428 Open source has room for everyone.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200428 Open source has room for everyone.md b/sources/tech/20200428 Open source has room for everyone.md index bab55ddfbe..4804b15168 100644 --- a/sources/tech/20200428 Open source has room for everyone.md +++ b/sources/tech/20200428 Open source has room for everyone.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( guevaraya) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fc4880425cdcd4ded5d34970d1f89e97732d273e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 May 2020 08:44:41 +0800 Subject: [PATCH 2052/3057] translated --- ...in Ubuntu and Other Linux Distributions.md | 112 ------------------ ...in Ubuntu and Other Linux Distributions.md | 112 ++++++++++++++++++ 2 files changed, 112 insertions(+), 112 deletions(-) delete mode 100644 sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md create mode 100644 translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md b/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md deleted file mode 100644 index 637f438ed8..0000000000 --- a/sources/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md +++ /dev/null @@ -1,112 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions) -[#]: via: (https://itsfoss.com/unable-to-parse-package-file/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions -====== - -I have discussed a number of [Ubuntu update errors][1] in the past. If you [use the command line to update Ubuntu][2], you might run into some ‘errors’. - -Some of these ‘errors’ are basically built-in features to prevent unwarranted changes to your system. I am not going into those details in this quick tutorial. - -In this quick tip, I’ll show you how to tackle the following error that you could encounter while updating your system or installing new software: - -**Reading package lists… Error! -E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease -E: The package lists or status file could not be parsed or opened.** - -A similar error can be encountered in Debian: - -**E: Unable to parse package file /var/lib/apt/extended_states (1)** - -There is absolutely no need to panic even thought it says ‘**The package cache file is corrupted**‘. This is really easy to ‘fix’. - -### Handling “Unable to parse package file” error in Ubuntu and Debian-based Linux distributions - -![][3] - -Here’s what you need to do. Take a closer look at the name and path of the file the [Ubuntu][4] is complaining about. - -Reading package lists… Error! -**E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease** -E: The package lists or status file could not be parsed or opened. - -For example, in the above error, it was complaining about /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease - -This gives you the idea that something is not right with this file. Now all you need to do is to remove this file and regenerate the cache. - -``` -sudo rm -``` - -So in my case, I could use this command: **sudo rm /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease** and then rebuild the cache with sudo apt update command. - -#### Step by step for beginners - -If you are familiar with Linux commands, you may know how to do delete the file with its absolute path. For novice users, let me guide you to safely delete the file. - -First, you should go to the directory where the file is stored: - -``` -cd /var/lib/apt/lists/ -``` - -Now delete the file which is not being parsed: - -``` -sudo rm archive.ubuntu.com_ubuntu_dists_bionic_InRelease -``` - -Now if you run the update again, the apt cache will be regenerated. - -``` -sudo apt update -``` - -#### Too many files cannot be parsed? - -This is fine if you have one or two files that are not being parsed while updating the system. But if the system complains about ten or twenty such files, removing them one by one is too tiring. - -What you can do in such a case to remove the entire cache and then generate it again: - -``` -sudo rm -r /var/lib/apt/lists/* -sudo apt update -``` - -#### Explanation of how it fixed your problem - -The /var/lib/apt is the directory where files and data related to the apt package manager are stored. The /var/lib/apt/lists is the directory which is used for storing information for each package resource specified in your system’s sources.list. - -In slightly non complicated terms, this /var/lib/apt/lists stores the package information cache. When you want to install or update a program, your system checks in this directory for the information on the said package. If it finds the detail on the package, then it goes to remote repository and actually download the program or its update. - -When you run the “sudo apt update”, it builds the cache. This is why even when you remove everything in the /var/lib/apt/lists directory, running the update will build a fresh cache. - -This is how it handles the issue of file not being parsed. Your system complained about a particular package or repository information that somehow got corrupted (either a failed download or manual change to sources.list). Removing that file (or everything) and rebuilding the cache solves the issue. - -#### Still facing error? - -This should fix the issue for you. But if the problem still persists or if you have some other related issue, let me know in the comment section and I’ll try to help you out. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/unable-to-parse-package-file/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/ubuntu-update-error/ -[2]: https://itsfoss.com/update-ubuntu/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Unable-to-parse-package-file.png?ssl=1 -[4]: https://ubuntu.com/ diff --git a/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md b/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..cfad9fdfc4 --- /dev/null +++ b/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/unable-to-parse-package-file/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +修复 Ubuntu 和其他 Linux 发行版中的 “Unable to parse package file /var/lib/apt/lists” 错误 +====== + +过去,我已经讨论了许多 [Ubuntu 更新错误][1]。如果你[使用命令行更新 Ubuntu][2],那可能会遇到一些“错误”。 + +其中一些“错误”基本上是内置功能,可防止对系统进行不必要的更改。在本教程中,我不会涉及那些细节。 + +在本文中,我将向你展示如何解决在更新系统或安装新软件时可能遇到的以下错误: + +**Reading package lists… Error! +E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease +E: The package lists or status file could not be parsed or opened.** + +在 Debian 中可能会遇到类似的错误: + +**E: Unable to parse package file /var/lib/apt/extended_states (1)** + +即使遇到 “**The package cache file is corrupted**” 也完全不必惊慌。这真的很容易“修复”。 + +### 在基于 Ubuntu 和 Debian 的 Linux 发行版中处理 “Unable to parse package file” 错误 + +![][3] + +以下是你需要做的。仔细查看 [Ubuntu][4] 报错文件的名称和路径。 + +Reading package lists… Error! +**E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease** +E: The package lists or status file could not be parsed or opened. + +例如,上面的错误是在报 /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease 文件错误。 + +这让你想到这个文件不正确。现在,你需要做的就是删除该文件并重新生成缓存。 + +``` +sudo rm +``` + +因此,这里我可以使用以下命令:**sudo rm /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease**,然后使用 sudo apt update 命令重建缓存。 + +#### 给初学者的分步指导 + +如果你熟悉 Linux 命令,那么可能知道如何使用绝对路径删除文件。对于新手用户,让我指导你安全删除文件。 + +首先,你应该进入文件目录: + +``` +cd /var/lib/apt/lists/ +``` + +现在删除无法解析的文件: + +``` +sudo rm archive.ubuntu.com_ubuntu_dists_bionic_InRelease +``` + +现在,如果你再次运行更新,将重新生成 apt 缓存。 + +``` +sudo apt update +``` + +#### 有很多文件无法解析? + +如果你在更新系统时有一个或两个文件无法解析,那么问题不大。但是,如果系统报错有十个或二十个此类文件,那么一一删除它们就太累了。 + +在这种情况下,你可以执行以下操作来删除整个缓存,然后再次生成它: + +``` +sudo rm -r /var/lib/apt/lists/* +sudo apt update +``` + +#### 解释这为何能解决问题 + +/var/lib/apt 是与 apt 软件包管理器相关的文件和数据的存储目录。/var/lib/apt/lists 是用于保存系统 source.list 中指定的每个软件包资源信息的目录。 + +简单点来说,/var/lib/apt/lists 保存软件包信息缓存。当你要安装或更新程序时,系统会在此目录中检查该软件包中的信息。如果找到了该包的详细信息,那么它将进入远程仓库并实际下载程序或其更新。 + +当你运行 “sudo apt update” 时,它将构建缓存。这就是为什么即使删除 /var/lib/apt/lists 目录中的所有内容,运行更新也会建立新的缓存的原因。 + +这就是处理文件无法解析问题的方式。你的系统报某个软件包或仓库信息以某种方式损坏(下载失败或手动更改 sources.list)。删除该文件(或所有文件)并重建缓存即可解决此问题。 + +#### 仍然有错误? + +这应该能解决你的问题。但是,如果问题仍然存在,或者你还有其他相关问题,请在评论栏告诉我,我将尽力帮助你。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/unable-to-parse-package-file/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-update-error/ +[2]: https://itsfoss.com/update-ubuntu/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Unable-to-parse-package-file.png?ssl=1 +[4]: https://ubuntu.com/ From f78f16c497b82f519a5f3842dcbea1735a9ce9d5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 May 2020 09:03:44 +0800 Subject: [PATCH 2053/3057] translating --- ...tall Deb File on Ubuntu 20.04- Here-s What You Need to do.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md b/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md index d5b106895b..3aee14cf14 100644 --- a/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md +++ b/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d1ae6300992dba923927b26d72641e6233185313 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 12 May 2020 20:20:42 +0800 Subject: [PATCH 2054/3057] TSL --- ... Go binaries by prohibiting comparisons.md | 164 ------------------ ... Go binaries by prohibiting comparisons.md | 164 ++++++++++++++++++ 2 files changed, 164 insertions(+), 164 deletions(-) delete mode 100644 sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md create mode 100644 translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md diff --git a/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md b/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md deleted file mode 100644 index 424434adbb..0000000000 --- a/sources/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md +++ /dev/null @@ -1,164 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Ensmallening Go binaries by prohibiting comparisons) -[#]: via: (https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons) -[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) - -Ensmallening Go binaries by prohibiting comparisons -====== - -Conventional wisdom dictates that the larger the number of types declared in a Go program, the larger the resulting binary. Intuitively this makes sense, after all, what’s the point in defining a bunch of types if you’re not going to write code that operates on them. However, part of the job of a linker is to detect functions which are not referenced by a program–say they are part of a library of which only a subset of functionality is used–and remove them from the final output. Yet, the adage mo’ types, mo’ binary holds true for the majority of Go programs. - -In this post I’ll dig into what equality, in the context of a Go program, means and why changes [like this][1] have a measurable impact on the size of a Go program. - -### Defining equality between two values - -The Go spec defines the concepts of assignability and equality. Assignabiity is the act of assigning a value to an identifier. Not everything which is declared can be assigned, for example constants and functions. Equality is the act of comparing two identifies by asking _are their contents the same?_ - -Being a strongly typed language, the notion of sameness is fundamentally rooted in the identifier’s type. Two things can only be the same if they are of the same type. Beyond that, the type of the values defines how they are compared. - -For example, integers are compared arithmetically. For pointer types, equality is determining if the addresses they point too are the same. Reference types like maps and channels, like pointers, are considered to be the same if they have the same address. - -These are all examples of bitwise equality, that is, if the bit patterns of the memory that value occupies are the same, those values are equal. This is known as memcmp, short for memory comparison, as equality is defined by comparing the contents of two areas of memory. - -Hold on to this idea, I’ll come back to in a second. - -### Struct equality - -Beyond scalar types like integers, floats, and pointers is the realm of compound types; structs. All structs are laid out in memory in program order, thus this declaration: - -``` -type S struct { - a, b, c, d int64 -} -``` - -will consume 32 bytes of memory; 8 bytes for `a`, then 8 bytes for `b`, and so on. The spec says that _struct values are comparable if all their fields are comparable_. Thus two structs are equal iff each of their fields are equal. - -``` -a := S{1, 2, 3, 4} -b := S{1, 2, 3, 4} -fmt.Println(a == b) // prints true -``` - -Under the hood the compiler uses memcmp to compare the 32 bytes of `a` and `b`. - -### Padding and alignment - -However the simplistic bitwise comparison strategy will fail in situations like this: - -``` -type S struct { - a byte - b uint64 - c int16 - d uint32 -} - -func main() - a := S{1, 2, 3, 4} - b := S{1, 2, 3, 4} - fmt.Println(a == b) // prints true -} -``` - -The code compiles, the comparison is still true, but under the hood the compiler cannot rely on comparing the bit patterns of `a` and `b` because the structure contains _padding_. - -Go requires each field in a struct to be naturally aligned. 2 byte values must start on an even address, four byte values on an address divisible by 4, and so on[1][2]. The compiler inserts padding to ensure the fields are _aligned_ to according to their type and the underlying platform. In effect, after padding, this is what the compiler sees[2][3]: - -``` -type S struct { - a byte - _ [7]byte // padding - b uint64 - c int16 - _ [2]int16 // padding - d uint32 -} -``` - -Padding exists to ensure the correct field alignments, and while it does take up space in memory, the contents of those padding bytes are unknown. You might assume that, being Go, the padding bytes are always zero, but it turns out that’s not the case–the contents of padding bytes are simply not defined. Because they’re not defined to always be a certain value, doing a bitwise comparison may return false because the nine bytes of padding spread throughout the 24 bytes of `S` are may not be the same. - -The Go compiler solves this problem by generating what is known as an equality function. In this case `S`‘s equality function knows how to compare two values of type `S` by comparing only the fields in the function while skipping over the padding. - -### Type algorithms - -Phew, that was a lot of setup to illustrate why, for each type defined in a Go program, the compiler may generate several supporting functions, known inside the compiler as the type’s algorithms. In addition to the equality function the compiler will generate a hash function if the type is used as a map key. Like the equality function, the hash function must consider factors like padding when computing its result to ensure it remains stable. - -It turns out that it can be hard, and sometimes non obvious, to intuit when the compiler will generate these functions–it’s more than you’d expect–and it can be hard for the linker to eliminate the ones that are not needed as reflection often causes the linker to be more conservative when trimming types. - -### Reducing binary size by prohibiting comparisons - -Now we’re at a point to explain Brad’s change. By adding an incomparable field [3][4] to the type, the resulting struct is by extension incomparable, thus forcing the compiler to elide the generation of eq and hash algorithms, short circuiting the linkers elimination of those types and, in practice, reducing the size of the final binary. As an example of this technique, this program: - -``` -package main - -import "fmt" - -func main() { - type t struct { - // _ [0][]byte uncomment to prevent comparison - a byte - b uint16 - c int32 - d uint64 - } - var a t - fmt.Println(a) -} -``` - -when compiled with Go 1.14.2 (darwin/amd64), decreased from 2174088 to 2174056, a saving of 32 bytes. In isolation this 32 byte saving may seem like small beer, but consider that equality and hash functions can be generated for every type in the transitive closure of your program and all its dependencies, and the size of these functions varies depending on the size of the type and its complexity, prohibiting them can have a sizeable impact on the final binary over and above the old saw of `-ldflags="-s -w"`. - -The bottom line, if you don’t wish to make your types comparable, a hack like this enforces it at the source level while contributing to a small reduction in the size of your binary. - -* * * - -Addendum: thanks to Brad’s prodding, Go 1.15 already has a bunch of improvements by [Cherry Zhang][5] and [Keith Randall][6] that fix the most egregious of the failures to eliminate unnecessary equality and hash functions (although I suspect it was also to avoid the proliferation of this class of CLs). - - 1. On 32bit platforms `int64` and `uint64` values may not be 8 byte aligned as the natural alignment of the platform is 4 bytes. See [issue 599][7] for the gory details.[][8] - 2. 32 bit platforms would see `_ [3]byte` padding between the declaration of `a` and `b`. See previous.[][9] - 3. Brad used `[0]func()`, but any type that the spec limits or prohibits comparisons on will do. By declaring the array has zero elements the type has no impact on the size or alignment of the struct.[][10] - - - -#### Related posts: - - 1. [How the Go runtime implements maps efficiently (without generics)][11] - 2. [The empty struct][12] - 3. [Padding is hard][13] - 4. [Typed nils in Go 2][14] - - - --------------------------------------------------------------------------------- - -via: https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons - -作者:[Dave Cheney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://dave.cheney.net/author/davecheney -[b]: https://github.com/lujun9972 -[1]: https://github.com/golang/net/commit/e0ff5e5a1de5b859e2d48a2830d7933b3ab5b75f -[2]: tmp.uBLyaVR1Hm#easy-footnote-bottom-1-4116 (On 32bit platforms int64 and uint64 values may not be 8 byte aligned as the natural alignment of the platform is 4 bytes. See issue 599 for the gory details.) -[3]: tmp.uBLyaVR1Hm#easy-footnote-bottom-2-4116 (32 bit platforms would see _ [3]byte padding between the declaration of a and b. See previous.) -[4]: tmp.uBLyaVR1Hm#easy-footnote-bottom-3-4116 (Brad used [0]func(), but any type that the spec limits or prohibits comparisons on will do. By declaring the array has zero elements the type has no impact on the size or alignment of the struct.) -[5]: https://go-review.googlesource.com/c/go/+/231397 -[6]: https://go-review.googlesource.com/c/go/+/191198 -[7]: https://github.com/golang/go/issues/599 -[8]: tmp.uBLyaVR1Hm#easy-footnote-1-4116 -[9]: tmp.uBLyaVR1Hm#easy-footnote-2-4116 -[10]: tmp.uBLyaVR1Hm#easy-footnote-3-4116 -[11]: https://dave.cheney.net/2018/05/29/how-the-go-runtime-implements-maps-efficiently-without-generics (How the Go runtime implements maps efficiently (without generics)) -[12]: https://dave.cheney.net/2014/03/25/the-empty-struct (The empty struct) -[13]: https://dave.cheney.net/2015/10/09/padding-is-hard (Padding is hard) -[14]: https://dave.cheney.net/2017/08/09/typed-nils-in-go-2 (Typed nils in Go 2) diff --git a/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md b/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md new file mode 100644 index 0000000000..ba2e321bb3 --- /dev/null +++ b/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ensmallening Go binaries by prohibiting comparisons) +[#]: via: (https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +通过禁止比较让 Go 二进制文件变小 +====== + +大家常规的认知是,Go 程序中声明的类型越多,生成的二进制文件就越大。这个符合直觉,毕竟如果你写的代码不去操作定义的类型,那么定义一堆类型就没有意义了。然而,链接器的部分工作就是检测程序没有引用的函数,比如仅仅有某个功能的子功能使用的库中的某些函数,然后把他们从最后的编译产出中删除。常言道,“类型越多,二进制文件越大“,对于多数 Go 程序还是正确的。 + +本文中我会深入讲解在 Go 程序的上下文中相等的意义,以及为什么[像这样][1]的修改会对 Go 程序的大小有重大的影响。 + +### 定义两个值相等 + +Go 的语法定义了赋值和相等的概念。赋值是把一个值赋给一个标识符的行为。并不是所有声明的标识符都可以被赋值,如常量和函数就不可以。相等是通过检查标识符的内容是否相等来比较两个标识符的行为。 + +作为强类型语言,“相同”的概念从根源上被植入标识符的类型中。两个标识符只有是相同类型的前提下,才有可能相同。除此之外,值的类型定义了如何比较该类型的两个值。 + +例如,整型是用算数方法进行比较的。对于指针类型,是否相等是指他们指向的地址是否相同。map 和 channel 等引用类型,跟指针类似,如果它们有相同的地址,那么就认为它们是相同的。 + +上面都是按位比较相等的例子,即值占用的位模式内存是相同的,那么这些值就相等。这个就是 memcmp,全称为 memory comparison,相等是通过比较两个内存区域的内容来定义的。 + +记住这个思路,我会很快回来的。 + +### 结构体相等 + +除了整型、浮点型和指针等标量类型,还有复合类型;结构体。所有的结构体以程序中的顺序被排列在内存中。因此下面这个声明 + +``` +type S struct { + a, b, c, d int64 +} +``` + +会占用 32 字节的内存空间;`a` 占用 8 个字节,`b` 占用 8 个字节,以此类推。Go 的规则说如果结构体所有的字段都是可以比较的,那么结构体的值就是可以比较的。因此如果两个结构体所有的字段都相等,那么它们就相等。 + +``` +a := S{1, 2, 3, 4} +b := S{1, 2, 3, 4} +fmt.Println(a == b) // prints true +``` + +编译器在底层使用 memcmp 来比较 `a` 的 32 个字节和 `b` 的 32 个字节。 + +### 填充和对齐 + +然而,在下面的场景下过分简单化的按位比较的策略会返回错误的结果: + +``` +type S struct { + a byte + b uint64 + c int16 + d uint32 +} + +func main() + a := S{1, 2, 3, 4} + b := S{1, 2, 3, 4} + fmt.Println(a == b) // prints true +} +``` + +编译代码后,这个比较表达式的结果还是 true,但是编译器在底层并不能仅依赖比较 `a` 和 `b` 的位模式,因为结构体有*填充*。 + +Go 要求结构体的所有字段都对齐。2 字节的值必须从偶数地址开始,4 字节的值必须从 4 的倍数地址开始,以此类推[1][2]。编译器根据字段的类型和底层平台加入了填充来确保字段都*对齐*。在填充之后,编译器实际上看到的是[2][3]: + +``` +type S struct { + a byte + _ [7]byte // padding + b uint64 + c int16 + _ [2]int16 // padding + d uint32 +} +``` + +填充的存在保证了字段正确对齐,而填充确实占用了内存空间,但是填充字节的内容是未知的。你可能会认为在 Go 中 填充字节都是 0,但实际上并不是 — 填充字节的内容是未定义的。由于它们并不是被定义为某个确定的值,因此按位比较会因为分布在 `s` 的 24 字节中的 9 个填充字节不一样而返回错误结果。 + +Go 通过生成相等函数来解决这个问题。在这个例子中,`s` 的相等函数只比较函数中的字段略过填充部分,这样就能正确比较类型 `s` 的两个值。 + +### 类型算法 + +嚄,需要做很多准备工作才能解释原因,对于 Go 程序中定义的每种类型,编译器都会生成几个支持它的函数,编译器内部把它们识别为类型的算法。如果类型是一个 map 的 key,那么除相等函数外,编译器还会生成一个哈希函数。为了维持稳定,哈希函数在计算结果时也会像相等函数一样考虑诸如填充等因素。 + +凭直觉判断编译器什么时候生成这些函数实际上很难,有时并不明显,(因为)这超出了你的预期,而且链接器也很难消除没有被使用的类型,因为反射往往导致链接器在裁剪类型时变得更保守。 + +### 通过禁止比较来减小二进制文件的大小 + +现在,我们能解释 Brad 的修改了。向类型添加一个不可比较的字段[3][4],结构体也随之变成不可比较的,从而强制编译器不再生成相等和哈希算法、规避了链接器对那些类型的消除、在实际应用中减小了生成的二进制文件的大小。作为这项技术的一个例子,下面的程序: + +``` +package main + +import "fmt" + +func main() { + type t struct { + // _ [0][]byte uncomment to prevent comparison + a byte + b uint16 + c int32 + d uint64 + } + var a t + fmt.Println(a) +} +``` + +用 Go 1.14.2(darwin/amd64)编译,大小从 2174088 降到了 2174056,节省了 32 字节。单独看节省的这 32 字节似乎微不足道,但是考虑到你的程序中每个类型及其传递闭包都会生成相等和哈希函数,还有他们的依赖,这些函数的大小随类型大小和复杂度的不同而不同,禁止它们会大大减小最终的二进制文件的大小,效果比之前使用 `-ldflags="-s -w"` 还要好。 + +最后总结一下,如果你不想把类型定义为可比较的,像这样的入侵可以在源码层级强制实现,而且会使生成的二进制文件变小。 + +* * * + +附录:在 Brad 的推动下,[Cherry Zhang][5] 和 [Keith Randall][6] 已经在 Go 1.15 做了大量的改进来修复最恶名昭彰的消除无用相等和哈希函数失败(虽然我猜想这也是为了避免这类 CL 的扩散)。 + + 1. 在 32 位平台上 `int64` 和 `unit64` 的值可能不是按 8 字节对齐的,因为平台原生的是以 4 字节对齐的。查看 [issue 599][7] 了解内部详细信息[][8]。 + 2. 32 位平台会在 `a` 和 `b` 的声明中填充 `_ [3]byte`。查看前面的内容[][9]。 + 3. Brad 使用的是`[0]func()`,但是所有能限制和禁止比较的类型都可以。添加了一个有 0 个元素的数组的声明后,结构体的大小和对齐不会受影响。[][10] + + + +#### 相关文章: + + 1. [Go 运行时如何高效地实现 map(不使用泛型)][11] + 2. [空结构体][12] + 3. [填充很难][13] + 4. [Go 中有类型的 nil 2][14] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/net/commit/e0ff5e5a1de5b859e2d48a2830d7933b3ab5b75f +[2]: tmp.uBLyaVR1Hm#easy-footnote-bottom-1-4116 (On 32bit platforms int64 and uint64 values may not be 8 byte aligned as the natural alignment of the platform is 4 bytes. See issue 599 for the gory details.) +[3]: tmp.uBLyaVR1Hm#easy-footnote-bottom-2-4116 (32 bit platforms would see _ [3]byte padding between the declaration of a and b. See previous.) +[4]: tmp.uBLyaVR1Hm#easy-footnote-bottom-3-4116 (Brad used [0]func(), but any type that the spec limits or prohibits comparisons on will do. By declaring the array has zero elements the type has no impact on the size or alignment of the struct.) +[5]: https://go-review.googlesource.com/c/go/+/231397 +[6]: https://go-review.googlesource.com/c/go/+/191198 +[7]: https://github.com/golang/go/issues/599 +[8]: tmp.uBLyaVR1Hm#easy-footnote-1-4116 +[9]: tmp.uBLyaVR1Hm#easy-footnote-2-4116 +[10]: tmp.uBLyaVR1Hm#easy-footnote-3-4116 +[11]: https://dave.cheney.net/2018/05/29/how-the-go-runtime-implements-maps-efficiently-without-generics (How the Go runtime implements maps efficiently (without generics)) +[12]: https://dave.cheney.net/2014/03/25/the-empty-struct (The empty struct) +[13]: https://dave.cheney.net/2015/10/09/padding-is-hard (Padding is hard) +[14]: https://dave.cheney.net/2017/08/09/typed-nils-in-go-2 (Typed nils in Go 2) From 22135999d1505f3f273fdff3674a5e9f45955128 Mon Sep 17 00:00:00 2001 From: Acceleratorrrr <542383480@qq.com> Date: Tue, 12 May 2020 17:29:41 +0100 Subject: [PATCH 2055/3057] translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md --- ... your Linux email services with SSL-TLS.md | 209 ------------------ ... your Linux email services with SSL-TLS.md | 201 +++++++++++++++++ 2 files changed, 201 insertions(+), 209 deletions(-) delete mode 100644 sources/tech/20200427 How to secure your Linux email services with SSL-TLS.md create mode 100644 translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md diff --git a/sources/tech/20200427 How to secure your Linux email services with SSL-TLS.md b/sources/tech/20200427 How to secure your Linux email services with SSL-TLS.md deleted file mode 100644 index 163e6b017f..0000000000 --- a/sources/tech/20200427 How to secure your Linux email services with SSL-TLS.md +++ /dev/null @@ -1,209 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to secure your Linux email services with SSL/TLS) -[#]: via: (https://opensource.com/article/20/4/securing-linux-email) -[#]: author: (Marc Skinner https://opensource.com/users/marc-skinner) - -How to secure your Linux email services with SSL/TLS -====== -Protect your Linux email services by understanding security -certificates. -![email or newsletters via inbox and browser][1] - -Traditionally, email services send data in an unprotected way—whether you are sending emails via SMTP or receiving them via IMAP or POP, the defaults are in cleartext. With more online applications enforcing encryption and the general consensus to protect your data, it's best to secure your email services with a Secure Sockets Layer/Transport Layer Security (SSL/TLS) security certificate. - -First, a quick review of email services and protocols. Email is sent via a service called Simple Mail Transport Protocol (SMTP) using TCP port 25. This protocol sends emails from server to server based on DNS mail exchanger (MX) record lookups. Once an email is on the email server, it is retrieved using one of two services: Internet Message Access Protocol (IMAP) using port TCP 143, or Post Office Protocol (POP3) using port TCP 110. All of these services, by default, send your email and authentication to/from these services in plain text—thus, it's very unprotected! - -To protect the email data and authentication, these services have added a security feature in which they can utilize an SSL/TLS certificate to wrap the data flow and communication with encryption. How SSL/TLS encryption secures information is beyond the scope of this article, but [Bryant Son's internet security article][2] covers it in great detail. At a high level, SSL/TLS encryption is a public/private encryption algorithm. - -By adding these security features into the services, they can listen on new TCP ports: - -Service | Default TCP Port | SSL/TLS Port ----|---|--- -SMTP | 25 | 587 -IMAP | 143 | 993 -POP3 | 110 | 995 - -### Generate SSL/TLS certificates - -SSL/TLS certificates can be generated for free using tools like [OpenSSL][3], or they can be purchased for a range of prices from public certificate authorities (CAs). In the past, generating your own certificate was easy and worked in most cases, but with the increasing demand for better security, most email clients don't trust self-generated SSL/TLS certificates without a manual exception. - -If your use case is private or for testing, then saving money with a self-generated certificate makes sense. But if you're rolling this out to a large group or have paying customers, then you're better served by purchasing a certificate from a public, trusted company that sells them. - -In either case, the process to start requesting a new certificate is to use the OpenSSL tooling on your Linux system to create a certificate signing request (CSR): - - -``` -`$ openssl req -new -newkey rsa:2048 -nodes -keyout mail.mydomain.key -out mail.mydomain.csr` -``` - -This command will create a new CSR and private key at the same time for the service you are trying to secure. The process will ask you a number of questions associated with the certificate: location details, server fully qualified domain name (FQDN), email contact information, etc. Once you have filled out the information, the key and CSR will be generated. - -#### If you generate your own certificate - -If you want to generate your own certificate, you must create your own [root CA][4] before issuing the CSR command above. You can create your own root CA with: - - -``` -`$ openssl genrsa -des3 -out myCA.key 2048` -``` - -It will prompt you to add a passphrase. Please give it a secure passphrase and don't lose it—this is your private root CA key, and as the name states, it's the root of all trust in your certificates. - -Next, generate the root CA certificate: - - -``` -`$ openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem` -``` - -After answering a few more questions, you will generate a root CA certificate with a five-year lifespan. - -Using the CSR file from the steps above, you can request a new certificate to be generated and signed by the root CA you just created: - - -``` -`$ openssl x509 -req -in mail.mydomain.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial -out mail.mydomain.pem -days 1825 -sha256` -``` - -Enter your private root CA key passphrase to create and sign the certificate. - -Now you have the two files needed to configure your email services for enhanced security: the private key file, **mail.mydomain.key**, and the public certificate file, **mail.mydomain.pem**. - -#### If you purchase a certificate - -If you purchase a certificate from a vendor, it will ask you to upload that CSR to its system, as it is used as the input to generate the SSL/TLS certificate. The certificate will be accessible as a file (such as **mail.mydomain.pem**). Many SSL vendors also require you to download an intermediate certificate. If this is the case, you must combine the two certificate files into one, so the email service can process them both in combination. You can combine your certificate with a third-party intermediate certificate with: - - -``` -`$ cat mail.mydomain.pem gd_bundle-g2-g1.crt > mail.mydomain.pem` -``` - -Notice that the output's file extension is **.pem**, which stands for Privacy-Enhanced Mail. - -Now you have the two files you need to configure your email services for enhanced security: the private key file, **mail.mydomain.key**, and the public combined certificate file, **mail.mydomain.pem**. - -### Create a safe directory for your files - -Whether you created your own key or bought one from a vendor, create a safe, root-owned directory for the two files you created above. An example workflow to create a safe play would be: - - -``` -$ mkdir /etc/pki/tls -$ chown root:root /etc/pki/tls -$ chmod 700 /etc/pki/tls -``` - -Make sure to set the permissions on your files after you copy them into **/etc/pki/tls** with: - - -``` -`$ chmod 600 /etc/pki/tls/*` -``` - -### Configure your SMTP and IMAP services - -Next, configure both the SMTP and the IMAP services to use the new security certificates. The programs used in this example for SMTP and IMAP are **postfix** and **dovecot**. - -Edit ***/_****etc****_/*****postfix/main.cf** in your preferred text editor. Add the following lines: - - -``` -smtpd_use_tls = yes -smtpd_tls_cert_file = /etc/pki/tls/mail.mydomain.pem -smtpd_tls_key_file = /etc/pki/tls/mail.mydomain.key -``` - -### Customize your config - -The following options allow you to disable/enable different ciphers, protocols, etc.: - - -``` -smtpd_tls_eecdh_grade = strong -smtpd_tls_protocols= !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 -smtpd_tls_mandatory_protocols= !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 -smtpd_tls_mandatory_ciphers = high -smtpd_tls_security_level=may -smtpd_tls_ciphers = high -tls_preempt_cipherlist = yes -smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL -smtpd_tls_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL -smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 -smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 -``` - -Edit **/etc/dovecot/dovecot.conf** by adding these three lines: - - -``` -ssl = required -ssl_cert = </etc/pki/tls/mail.mydomain.pem -ssl_key = </etc/pki/tls/mail.mydomain.key -``` - -Add the following options to disable/enable different ciphers, protocols, and more (I'll leave understanding and considering these up to you): - - -``` -ssl_cipher_list = EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:ALL:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SSLv2 -ssl_prefer_server_ciphers = yes -ssl_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1 -ssl_min_protocol = TLSv1.2 -``` - -### Set context for SELinux - -If your Linux distribution has SELinux enabled, set the correct SELinux context for your new certificate files. - -For Postfix SELinux: - - -``` -`$ chcon -u system_u -t cert_t mail.mydomain.*` -``` - -For Dovecot SELinux: - - -``` -`$ chcon -u system_u -t dovecot_cert_t mail.mydomain.*` -``` - -Restart both services and connect with your updated email client configurations. Some email clients will auto-detect the new port numbers; others will require you to update them. - -### Test your setup - -Quickly test from the command line with **openssl** and the **s_client** plugin: - - -``` -$ openssl s_client -connect mail.mydomain.com:993 -$ openssl s_client -starttls imap -connect mail.mydomain.com:143 -$ openssl s_client -starttls smtp -connect mail.mydomain.com:587 -``` - -These test commands will show a plethora of data about the connection, certificate, cipher, session, and protocol you're using. This is not only a good way to validate that the new configuration is working but also to confirm you're using the appropriate certificate and security settings you defined in the **postfix** or **dovecot** configuration files. - -Stay secure! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/4/securing-linux-email - -作者:[Marc Skinner][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/marc-skinner -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) -[2]: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority -[3]: https://www.openssl.org/ -[4]: https://en.wikipedia.org/wiki/Root_certificate diff --git a/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md b/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md new file mode 100644 index 0000000000..0c300160fe --- /dev/null +++ b/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: (Acceleratorrrr) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to secure your Linux email services with SSL/TLS) +[#]: via: (https://opensource.com/article/20/4/securing-linux-email) +[#]: author: (Marc Skinner https://opensource.com/users/marc-skinner) + +如何利用 SSL/TLS 保护你的Linux邮箱服务 +====== + +通过理解安全证书来保护你的Linux邮箱服务。 +![email or newsletters via inbox and browser][1] + +通常,不管你是通过简单邮件传输协议(SMTP)或者邮局协议(POP)发送或者接受邮件,邮箱服务默认使用无保护明文来传输数据。近来随着数据加密成为越来越多程序的共识,你需要传输层安全性协议 / 安全套接层(SSL/TLS)的安全证书来保护你的邮箱服务。 + +首先,快速回顾一下邮箱服务和协议的基本流程。邮件通过简单邮件传输协议从端口25发出。这个协议依靠DNS邮件交换服务器里的地址信息来传输邮件。当邮件到达邮件服务器后,可以被以下两种服务中的任意一种检索:因特网信息访问协议(IMAP)使用端口143,或者邮局协议第3版本(POP3)使用端口110。然而,以上服务默认默认使用明文传输邮件和验证信息。这非常的不安全! + +以上服务已经添加了安全功能来保护邮件内容和验证信息,使它们可以利用SSL/TLS证书包裹和加密数据流。SSL/TLS如何加密数据的细节不在本文讨论范围,有兴趣的话可以阅读[布莱恩特关于网络安全的文章][2]。概括的说,SSL/TLS 加密本质是一种基于公钥和私钥的算法。 + +通过加入新的安全功能后,这些服务可以监听新的TCP端口: + +服务 | 默认TCP端口 | SSL/TLS 端口 +---|---|--- +SMTP | 25 | 587 +IMAP | 143 | 993 +POP3 | 110 | 995 + +### 生成 SSL/TLS 证书 + +[OpenSSL][3] 可以生成免费的 SSL/TLS 证书,或者你也可以从根证书颁发机构购买。过去,生成自签发证书十分简单而且通用,但是由于安全被日益重视,大部分的邮箱客户端是不信任自签发证书的,除非手动设置。 + +如果你只是自己使用或者做做测试,那就使用自签发证书省点钱吧。但是如果很多人或者客户也需要使用的话,那最好还是从受信任的根证书颁发机构购买。 + +总之,Linux 系统里的 OpenSSL 工具需要一个证书来生成凭证签发请求文件(CSR): + +``` +`$ openssl req -new -newkey rsa:2048 -nodes -keyout mail.mydomain.key -out mail.mydomain.csr` +``` + +这个命令会为你想保护的服务同时生成一个新的 CSR 文件和一个私匙。它会询问你一些证书相关的问题,如:路径,服务器的完整网络域名,邮件联系信息等等。当你输入完这些信息后,密匙和CSR文件就生成完毕了。 + +#### 如果你想生成自签发证书 + +如果你想要生成自签发证书的话,在运行以上 CSR 命令之前,你必须先创建一个[自签发证书机构][4]。 + +``` +`$ openssl genrsa -des3 -out myCA.key 2048` +``` + +命令行会提示你输入密码。请输入一个复杂点的密码而且不要弄丢了,因为这将会是自签发证书机构的密码,并且决定了其签发证书的受信任度。 + +接下来,生成自签发证书机构: + +``` +`$ openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem` +``` + +在回答完一些问题后,你就拥有一个有效期为5年的自签发证书机构了。 + +用之前生成的 CSR 文件,你可以向刚生成的自签发证书机构请求生成一个新的证书。 + +``` +`$ openssl x509 -req -in mail.mydomain.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial -out mail.mydomain.pem -days 1825 -sha256` +``` + +输入自签发证书机构的密码来生成和签发证书。 + +现在你还需要两个文件来设置你的邮箱服务安全:私匙文件 **mail.mydomain.key**, 和证书文件 **mail.mydomain.pem**。 + +#### 如果你愿意购买证书 + +If you purchase a certificate from a vendor, it will ask you to upload that CSR to its system, as it is used as the input to generate the SSL/TLS certificate. The certificate will be accessible as a file (such as **mail.mydomain.pem**). Many SSL vendors also require you to download an intermediate certificate. If this is the case, you must combine the two certificate files into one, so the email service can process them both in combination. You can combine your certificate with a third-party intermediate certificate with: +如果你愿意从机构购买证书,则需要上传 CSR 文件到机构的系统中,它将会被用于生成 SSL/TLS 证书。证书可作为文件下载,比如 **mail.mydomain.pem**。很多SSL机构也需要你下载一个中间证书。这样的话,你必须把这个两个证书合并称一个,邮件服务才能够正常运行。可以使用以下命令把你的证书和第三方中间证书合并在一起: + +``` +`$ cat mail.mydomain.pem gd_bundle-g2-g1.crt > mail.mydomain.pem` +``` + +值得一提的是 **.pem** 文件后缀代表隐私增强邮件。 + +Now you have the two files you need to configure your email services for enhanced security: the private key file, **mail.mydomain.key**, and the public combined certificate file, **mail.mydomain.pem**. +现在你就有全部的设置邮箱服务安全所需文件了:私匙文件 **mail.mydomain.key**, 和证书文件 **mail.mydomain.pem**。 + +### 为你的文件生成一个安全的文件夹 + +不管你是的证书是自签发的或者从机构购买,你都需要生成一个安全的,管理员权限级别的文件夹用于保存这两个文件。可以使用以下命令来生成: + +``` +$ mkdir /etc/pki/tls +$ chown root:root /etc/pki/tls +$ chmod 700 /etc/pki/tls +``` + +在复制文件到 **/etc/pki/tls** 后,再次设置这些文件的权限: + +``` +`$ chmod 600 /etc/pki/tls/*` +``` + +### 配置你的 SMTP 和 IMAP 服务 + +接下来,让 SMTP 和 IMAP 服务使用新的安全证书。我们用 **postfix** and **dovecot** 来作为例子。 + +Edit ***/_****etc****_/*****postfix/main.cf** in your preferred text editor. Add the following lines: +用你顺手的编辑器来编辑 ***/_etc_/postfix/main.cf** 文件。添加以下几行: + +``` +smtpd_use_tls = yes +smtpd_tls_cert_file = /etc/pki/tls/mail.mydomain.pem +smtpd_tls_key_file = /etc/pki/tls/mail.mydomain.key +``` + +### 自定义选项 + +以下选项可以启用或禁用各种加密算法,协议等等: + +``` +smtpd_tls_eecdh_grade = strong +smtpd_tls_protocols= !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtpd_tls_mandatory_protocols= !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtpd_tls_mandatory_ciphers = high +smtpd_tls_security_level=may +smtpd_tls_ciphers = high +tls_preempt_cipherlist = yes +smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL +smtpd_tls_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL +smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +``` + +**/etc/dovecot/dovecot.conf** 文件添加以下三行: + +``` +ssl = required +ssl_cert = </etc/pki/tls/mail.mydomain.pem +ssl_key = </etc/pki/tls/mail.mydomain.key +``` + +添加更多选项来启用或禁用各种加密算法,协议等等(可选): + +``` +ssl_cipher_list = EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:ALL:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SSLv2 +ssl_prefer_server_ciphers = yes +ssl_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1 +ssl_min_protocol = TLSv1.2 +``` + +### 安全增强式Linux上下文设置 + +如果使用安全增强式Linux发行版,你需要给新证书文件配置正确的安全上下文。 + +Postfix SELinux 用户: + +``` +`$ chcon -u system_u -t cert_t mail.mydomain.*` +``` + +Dovecot SELinux 用户: + +``` +`$ chcon -u system_u -t dovecot_cert_t mail.mydomain.*` +``` + +Restart both services and connect with your updated email client configurations. Some email clients will auto-detect the new port numbers; others will require you to update them. +重启这些服务,然后联接上更新后的邮箱客户端。有些邮箱客户端会自动探测到新的端口,有些则需要你手动升级。 + +### 测试 + +用 **openssl** 命令行和 **s_client** 插件来简单测试一下: + +``` +$ openssl s_client -connect mail.mydomain.com:993 +$ openssl s_client -starttls imap -connect mail.mydomain.com:143 +$ openssl s_client -starttls smtp -connect mail.mydomain.com:587 +``` + +These test commands will show a plethora of data about the connection, certificate, cipher, session, and protocol you're using. This is not only a good way to validate that the new configuration is working but also to confirm you're using the appropriate certificate and security settings you defined in the **postfix** or **dovecot** configuration files. +这些测试命令会打印出很多信息,关于你使用的联接,证书,加密算法,会话和协议。这不仅是一个验证新设置的好方法,也可以检查你是否使用了适当的证书,以及 **postfix** 或者 **dovecot** 配置文件里的安全设置是否生效。 + +Stay secure! +保持安全! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/securing-linux-email + +作者:[Marc Skinner][a] +选题:[lujun9972][b] +译者:[Acceleratorrrr](https://github.com/Acceleratorrrr) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/marc-skinner +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) +[2]: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority +[3]: https://www.openssl.org/ +[4]: https://en.wikipedia.org/wiki/Root_certificate From c3589f17ed70867e6b0b7ab4b1e1b297c82b67ea Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 May 2020 08:51:17 +0800 Subject: [PATCH 2056/3057] PRF @messon007 --- .../tech/20200416 Learning to love systemd.md | 343 +++++++++--------- 1 file changed, 168 insertions(+), 175 deletions(-) diff --git a/translated/tech/20200416 Learning to love systemd.md b/translated/tech/20200416 Learning to love systemd.md index 34bc8ea314..328716266c 100644 --- a/translated/tech/20200416 Learning to love systemd.md +++ b/translated/tech/20200416 Learning to love systemd.md @@ -1,291 +1,284 @@ [#]: collector: (lujun9972) [#]: translator: (messon007) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Learning to love systemd) [#]: via: (https://opensource.com/article/20/4/systemd) [#]: author: (David Both https://opensource.com/users/dboth) -学会爱上systemd +学会爱上 systemd ====== -systemd是所有进程的源头,负责将Linux主机启动到可以做生产性任务的状态。 -![Penguin driving a car with a yellow background][1] +> systemd 是所有进程之母,负责将 Linux 主机启动到可以做生产性任务的状态。 -systemd(是的,全小写,即使在句子开头也是小写),是init和SystemV init脚本的现代替代者。它还有更多功能。 +![](https://img.linux.net.cn/data/attachment/album/202005/13/085016gy86wj713zh7xq71.jpg) -当我想到init和SystemV时,像大多数系统管理员一样,我想到的是Linux的启动和关闭,而没有太多其他的,例如在服务启动和运行后对其进行管理。像init一样,systemd是所有进程的源头,它负责使Linux主机启动到可以做生产性任务的状态。 systemd设定的一些功能比老的init要广泛得多,它要管理正在运行的Linux主机的许多方面,包括挂载文件系统,管理硬件,处理定时器以及启动和管理生产性主机所需的系统服务。 +systemd(是的,全小写,即使在句子开头也是小写),是初始化程序(`init`)和 SystemV 初始化脚本的现代替代者。此外,它还有更多功能。 -本系列文章是基于我的部分三期Linux培训课程[_使用和管理Linux:从零开始进行学习系统管理_][2]的摘录,探讨了systemd在启动和启动完成后的功能。 +当我想到 `init` 和 SystemV 初始化时,像大多数系统管理员一样,我想到的是 Linux 的启动和关闭,而不是真正意义上的管理服务,例如在服务启动和运行后对其进行管理。像 `init` 一样,systemd 是所有进程之母,它负责使 Linux 主机启动到可以做生产性任务的状态。systemd 设定的一些功能比老的初始化程序要广泛得多,它要管理正在运行的 Linux 主机的许多方面,包括挂载文件系统、管理硬件、处理定时器以及启动和管理生产性主机所需的系统服务。 -### Linux启动 +本系列文章是基于我的三期 Linux 培训课程《[使用和管理 Linux:从零开始进行学习系统管理][2]》部分内容的摘录,探讨了 systemd 在启动和启动完成后的功能。 -Linux主机从关机状态到运行状态的完整启动过程很复杂,但它是开放的并且是可知的。在详细介绍之前,我将简要介绍一下从主机硬件被上电到系统准备好用户登录(的过程)。大多数时候,“启动过程”被作为单个概念来讨论,但这是不准确的。实际上,完整的引导和启动过程包含三个主要部分: +### Linux 引导 -   * **硬件引导:** 初始化系统硬件 - * **Linux引导:** 加载Linux内核和systemd - * **Linux启动:** systemd启动, 为生产工作做准备 - +Linux 主机从关机状态到运行状态的完整启动过程很复杂,但它是开放的并且是可知的。在详细介绍之前,我将简要介绍一下从主机硬件被上电到系统准备好用户登录的过程。大多数时候,“引导过程”被作为一个整体来讨论,但这是不准确的。实际上,完整的引导和启动过程包含三个主要部分: -Linux启动阶段在内核加载了init或systemd(取决于具体发行版使用的是旧的方式还是还是新的方式)之后开始。init和systemd程序启动并管理所有其他进程,他们在各自的系统上都被称为“所有进程之母”。 +* `硬件引导`:初始化系统硬件 +* `Linux 引导boot`:加载 Linux 内核和 systemd +* `Linux 启动startup`:systemd 为主机的生产性工作做准备 -将硬件引导与Linux引导及Linux启动区分开,并明确定义它们之间的分界点是很重要的。理解他们的差异以及他们每一个在使Linux系统进入生产准备状态所起的作用,才能够管理这些进程并更好地确定大部分人所谓的“启动”问题出在哪里。 +Linux 启动阶段始于内核加载了 `init` 或 systemd(取决于具体发行版使用的是旧的方式还是还是新的方式)之后。`init` 和 systemd 程序启动并管理所有其它进程,它们在各自的系统上都被称为“所有进程之母”。 -启动过程按照三步引导流程使Linux计算机进入可进行生产工作的状态。当内核将主机的控制权转移到systemd时,启动环节开始。 +将硬件引导与 Linux 引导及 Linux 启动区分开,并明确定义它们之间的分界点是很重要的。理解它们的差异以及它们每一个在使 Linux 系统进入生产状态所起的作用,才能够管理这些进程,并更好地确定大部分人所谓的“启动”问题出在哪里。 -### systemd之争 +启动过程按照三步引导流程,使 Linux 计算机进入可进行生产工作的状态。当内核将主机的控制权转移到 systemd 时,启动环节开始。 -systemd引起了系统管理员和其他负责维护Linux系统正常运行人员的广泛回应。systemd正在许多Linux系统中接管大量任务的事实造成了某些开发人群和系统管理员群组之间的阻挠和争议。 +### systemd 之争 -SystemV和systemd是执行Linux启动环节的两种不同的方法。 SystemV启动脚本和init程序是老的方法,而使用目标(targets)的systemd是新方法。尽管大多数现代Linux发行版都使用较新的systemd进行启动,关机和进程管理,但仍有一些发行版未采用。原因之一是某些发行版维护者和系统管理员喜欢老的SystemV方法,而不是新的systemd。 +systemd 引起了系统管理员和其它负责维护 Linux 系统正常运行人员的广泛争议。在许多 Linux 系统中,systemd 接管了大量任务,这在某些开发者和sysadmins群体中引起了反对和不和谐。 + +SystemV 和 systemd 是执行 Linux 启动环节的两种不同的方法。SystemV 启动脚本和 `init` 程序是老的方法,而使用目标target的 systemd 是新方法。尽管大多数现代 Linux 发行版都使用较新的 systemd 进行启动、关机和进程管理,但仍有一些发行版未采用。原因之一是某些发行版维护者和系统管理员喜欢老的 SystemV 方法,而不是新的 systemd。 我认为两者都有其优势。 -#### 为何我更喜欢SystemV +#### 为何我更喜欢 SystemV -我更喜欢SystemV,因为它更开放。使用Bash脚本来完成启动。内核启动init程序(编译后的二进制)后,init启动 **rc.sysinit** 脚本,该脚本执行许多系统初始化任务。 **rc.sysinit** 执行完后,init启动 **/etc/rc.d/rc** 脚本,该脚本依次启动 **/etc/rc.d/rcX.d** 中由SystemV启动脚本定义的各种服务。 其中“ X”是待启动的运行级别号。 +我更喜欢 SystemV,因为它更开放。使用 Bash 脚本来完成启动。内核启动 `init` 程序(这是一个编译后的二进制)后,`init` 启动 `rc.sysinit` 脚本,该脚本执行许多系统初始化任务。`rc.sysinit` 执行完后,`init` 启动 `/etc/rc.d/rc` 脚本,该脚本依次启动 `/etc/rc.d/rcX.d` 中由 SystemV 启动脚本定义的各种服务。其中 `X` 是待启动的运行级别号。 -除了init程序本身之外,所有这些程序都是开放且易于理解的脚本。可以通读这些脚本并确切了解整个启动过程中发生的事情,但是我不认为有太多系统管理员会实际这样做。每个启动脚本都被编了号,以便按特定顺序启动预期的服务。服务是串行启动的,一次只能启动一个服务。 +除了 `init` 程序本身之外,所有这些程序都是开放且易于理解的脚本。可以通读这些脚本并确切了解整个启动过程中发生的事情,但是我不认为有太多系统管理员真正做到这一点。每个启动脚本都被编了号,以便按特定顺序启动预期的服务。服务是串行启动的,一次只能启动一个服务。 -由Red Hat的Lennart Poettering和Kay Sievers开发的systemd是一个由大的已编译的二进制可执行文件构成的复杂系统,不访问其源码就无法理解。它是开源的,因此“访问其源代码”并不难,只是不太方便。systemd似乎表现出对Linux哲学多个原则的重大驳斥。作为二进制文件,systemd无法被直接打开供系统管理员查看或进行简单更改。systemd试图做所有事情,例如管理正在运行的服务,同时提供比SystemV更多的状态信息。它还管理硬件,进程,进程组,文件系统挂载等。 systemd几乎涉足于现代Linux主机的每方面,使它成为系统管理的一站式工具。所有这些都明显违反了"程序应该小且每个程序都应该只做一件事并且做好"的原则。 +systemd 是由 Red Hat 的 Lennart Poettering 和 Kay Sievers 开发的,它是一个由大型的、编译的二进制可执行文件构成的复杂系统,不访问其源码就无法理解。它是开源的,因此“访问其源代码”并不难,只是不太方便。systemd 似乎表现出对 Linux 哲学多个原则的重大驳斥。作为二进制文件,systemd 无法被直接打开供系统管理员查看或进行简单更改。systemd 试图做所有事情,例如管理正在运行的服务,同时提供明显比 SystemV 更多的状态信息。它还管理硬件、进程、进程组、文件系统挂载等。systemd 几乎涉足于现代 Linux 主机的每个方面,使它成为系统管理的一站式工具。所有这些都明显违反了“程序应该小,且每个程序都应该只做一件事并做好”的原则。 -#### 为何我更喜欢systemd +#### 为何我更喜欢 systemd -我更喜欢用systemd作为启动机制,因为它会根据启动阶段并行地启动尽可能多的服务。这样可以加快整个的启动速度,使得主机系统比SystemV更快地到达登录屏幕。 +我更喜欢用 systemd 作为启动机制,因为它会根据启动阶段并行地启动尽可能多的服务。这样可以加快整个的启动速度,使得主机系统比 SystemV 更快地到达登录屏幕。 -systemd几乎可以管理正在运行的Linux系统的各个方面。它可以管理正在运行的服务,同时提供比SystemV多得多的状态信息。它还管理硬件,进程和进程组,文件系统挂载等。 systemd几乎涉足于现代Linux操作系统的每方面,使其成为系统管理的一站式工具。(听起来熟悉吧?) +systemd 几乎可以管理正在运行的 Linux 系统的各个方面。它可以管理正在运行的服务,同时提供比SystemV 多得多的状态信息。它还管理硬件、进程和进程组、文件系统挂载等。systemd 几乎涉足于现代 Linux 操作系统的每方面,使其成为系统管理的一站式工具。(听起来熟悉吧?) -systemd工具是编译后的二进制文件,但该工具包是开放的,因为所有配置文件都是ASCII文本文件。可以通过各种GUI和命令行工具来修改启动配置,也可以添加或修改各种配置文件来满足特定的本地计算环境的需求。 +systemd 工具是编译后的二进制文件,但该工具包是开放的,因为所有配置文件都是 ASCII 文本文件。可以通过各种 GUI 和命令行工具来修改启动配置,也可以添加或修改各种配置文件来满足特定的本地计算环境的需求。 #### 真正的问题 -您认为我不能喜欢两种启动系统吗?我能,我会用它们中的任何一个。 +你认为我不能喜欢两种启动系统吗?我能,我会用它们中的任何一个。 -我认为,SystemV和systemd之间大多数争议的真正问题和根本原因在于,系统管理阶段[没有选择权][3]。使用SystemV还是systemd已经由各种发行版的开发人员,维护人员和打包人员选择了(但有充分的理由)。由于init极端的侵入性, 挖出(scooping out)并替换init系统会带来很多影响,发行版设计过程之外(的环节)很难处理这些影响。 +我认为,SystemV 和 systemd 之间大多数争议的真正问题和根本原因在于,在系统管理层面[没有选择权][3]。使用 SystemV 还是 systemd 已经由各种发行版的开发人员、维护人员和打包人员选择了(但有充分的理由)。由于 `init` 极端的侵入性,挖出并替换 `init` 系统会带来很多影响,会带来很多在发行版设计过程之外难以解决的后果。 -尽管该选择实际上是为我而选的,我通常最关心的是我的Linux主机仍然可以启动并正常工作。作为最终用户,甚至是系统管理员,我主要关心的是我是否可以完成我的工作,例如写我的书和这篇文章,安装更新以及编写脚本来自动化所有事情。只要我能做我的工作,我就不会真正在意发行版中使用的启动系统。 +尽管该选择实际上是为我而选的,但我的Linux主机能不能开机、能不能工作,这是我平时最关心的。作为最终用户,甚至是系统管理员,我主要关心的是我是否可以完成我的工作,例如写我的书和这篇文章,安装更新以及编写脚本来自动化所有事情。只要我能做我的工作,我就不会真正在意发行版中使用的启动系统。 在启动或服务管理出现问题时,我会在意。无论主机上使用哪种启动系统,我都足够了解如何沿着事件顺序来查找故障并进行修复。 #### 替换SystemV -以前曾有过用更现代的东西替代SystemV的尝试。在大约两个版本中,Fedora使用了一个叫作Upstart的东西来替换老化的SystemV,但是它没有替换init并且没有我能感知到的变化。由于Upstart并未对SystemV的问题进行任何重大更改,因此这个方向的努力很快就被systemd放弃了。 +以前曾有过用更现代的东西替代 SystemV 的尝试。大约在两个版本中,Fedora 使用了一个叫作 Upstart 的东西来替换老化的 SystemV,但是它没有取代 `init`,也没有提供我所注意到的任何变化。由于 Upstart 并未对 SystemV 的问题进行任何显著的改变,所以在这个方向上的努力很快就被放弃了,转而使用 systemd。 -尽管大部分Linux开发人员都认可替换旧的SystemV启动系统是个好主意,但许多开发人员和系统管理员并不喜欢systemd。与其重新讨论人们在systemd中遇到的或曾经遇到过的所有所谓的问题,不如带您去看两篇好文章,尽管有些陈旧,但它们涵盖了大多数内容。Linux内核的创建者Linus Torvalds对systemd似乎不感兴趣。在2014年ZDNet的文章_[Linus Torvalds和其他人对Linux上的systemd的看法][4]_中,Linus清楚地表达了他的感受。 +尽管大部分 Linux 开发人员都认可替换旧的 SystemV 启动系统是个好主意,但许多开发人员和系统管理员并不喜欢 systemd。与其重新讨论人们在 systemd 中遇到的或曾经遇到过的所有所谓的问题,不如带你去看两篇好文章,尽管有些陈旧,但它们涵盖了大多数内容。Linux 内核的创建者 Linus Torvalds 对 systemd 似乎不感兴趣。在 2014 年 ZDNet 的一篇文章《[Linus Torvalds 和其他人对 Linux 上的 systemd 的看法][4]》中,Linus 清楚地表达了他的感受。 ->“实际上我对systemd本身没有任何特别强烈的意见。我对一些核心开发人员有一些意见,我认为它们在对待bugs和兼容性方面过于轻率,而且我认为某些设计细节是疯狂的(例如,我不喜欢二进制日志),但这只是细节,不是大问题。” +> “实际上我对 systemd 本身没有任何特别强烈的意见。我对一些核心开发人员有一些问题,我认为他们在对待错误和兼容性方面过于轻率,而且我认为某些设计细节是疯狂的(例如,我不喜欢二进制日志),但这只是细节,不是大问题。” -如果您对Linus不太了解,我可以告诉您,如果他不喜欢某事,那么他非常直率,坦率,并且非常清楚这种不喜欢。他解决自己对事物不满的方式已经被社会更好地接受了。 +如果你对 Linus 不太了解的话,我可以告诉你,如果他不喜欢某事,他是非常直言不讳的,很明确,而且相当明确的表示不喜欢。他解决自己对事物不满的方式已经被社会更好地接受了。 -2013年,Poettering写了一篇很长的博客,其中他在揭穿[systemd的神话][5]的同时透露了创建它的一些原因。这是一本很好的读物,我强烈建议您阅读。 +2013 年,Poettering 写了一篇很长的博客,他在文章驳斥了[关于 systemd 的迷思][5],同时对创建 systemd 的一些原因进行了深入的剖析。这是一分很好的读物,我强烈建议你阅读。 -### systemd任务 +### systemd 任务 -根据编译过程中使用的选项(不在本系列中介绍),systemd可以有多达69个二进制可执行文件用于执行任务,其中包括: - - * systemd程序以1号进程(PID 1)运行,并提供使尽可能多服务并行启动的系统启动能力,它额外加快了总体启动时间。它还管理关机顺序。 - * systemctl程序提供了服务管理的用户接口。 - * 支持SystemV和LSB启动脚本,以便向后兼容。 -  * 服务管理和报告提供了比SystemV更多的服务状态数据。 - * 提供基本的系统配置工具,例如主机名,日期,语言环境,已登录用户的列表,正在运行的容器和虚拟机,系统帐户,运行时目录和设置;用于简易网络配置,网络时间同步,日志转发和名称解析的守护程序。 -  * 提供套接字管理。 - * systemd定时器提供类似cron的高级功能,包括在相对于系统启动,systemd启动,定时器上次启动时刻的某个时间点运行脚本。 - * 提供了一个工具来分析定时器规格中使用的日期和时间。 - * 能感知层次的文件系统挂载和卸载可以更安全地级联挂载的文件系统。 - * 允许主动的创建和管理临时文件,包括删除文件。 - * D-Bus的接口提供在插入或移除设备时运行脚本的能力。这允许将所有设备(无论是否可插拔)都被视为即插即用,从而大大简化了设备的处理。 - * 分析启动顺序的工具可用于查找耗时最多的服务。 -  * 包括用于存储系统消息的日志以及管理日志的工具。 +根据编译过程中使用的选项(不在本系列中介绍),systemd 可以有多达 69 个二进制可执行文件执行以下任务,其中包括: +* `systemd` 程序以 1 号进程(PID 1)运行,并提供使尽可能多服务并行启动的系统启动能力,它额外加快了总体启动时间。它还管理关机顺序。 +* `systemctl` 程序提供了服务管理的用户接口。 +* 支持 SystemV 和 LSB 启动脚本,以便向后兼容。 +* 服务管理和报告提供了比 SystemV 更多的服务状态数据。 +* 提供基本的系统配置工具,例如主机名、日期、语言环境、已登录用户的列表,正在运行的容器和虚拟机、系统帐户、运行时目录及设置,用于简易网络配置、网络时间同步、日志转发和名称解析的守护进程。 +* 提供套接字管理。 +* systemd 定时器提供类似 cron 的高级功能,包括在相对于系统启动、systemd 启动时间、定时器上次启动时间的某个时间点运行脚本。 +* 它提供了一个工具来分析定时器规范中使用的日期和时间。 +* 能感知分层的文件系统挂载和卸载功能可以更安全地级联挂载的文件系统。 +* 允许主动的创建和管理临时文件,包括删除。 +* D-Bus 的接口提供了在插入或移除设备时运行脚本的能力。这允许将所有设备(无论是否可插拔)都被视为即插即用,从而大大简化了设备的处理。 +* 分析启动环节的工具可用于查找耗时最多的服务。 +* 它包括用于存储系统消息的日志以及管理日志的工具。 ### 架构 -这些和更多的任务通过许多守护程序,控制程序和配置文件来支持。图1显示了许多属于systemd的组件。这是一个简化的图,旨在提供概要描述,因此它并不包括所有独立的程序或文件。它也不提供数据流的视角,数据流是如此复杂,因此在本系列文章的背景下没用。 +这些以及更多的任务通过许多守护程序、控制程序和配置文件来支持。图 1 显示了许多属于 systemd 的组件。这是一个简化的图,旨在提供概要描述,因此它并不包括所有独立的程序或文件。它也不提供数据流的视角,数据流是如此复杂,因此在本系列文章的背景下没用。 ![系统架构][6] -完整的systemd讲解就需要一本书。您不需要了解图1中的systemd组件是如何组合在一起的细节。了解支持各种Linux服务管理以及日志文件和日志处理的程序和组件就够了。 但是很明显,systemd并不是某些批评者所说的那样的庞然大物。 +*图 1:systemd 的架构,作者 Shmuel Csaba Otto Traian (CC BY-SA 3.0)* -### 作为1号进程的systemd +如果要完整地讲解 systemd 就需要一本书。你不需要了解图 1 中的 systemd 组件是如何组合在一起的细节。只需了解支持各种 Linux 服务管理以及日志文件和日志处理的程序和组件就够了。但是很明显, systemd 并不是某些批评者所宣称的那样,它是一个单一的怪物。 -systemd是1号进程(PID 1)。它的一些功能(比老的SystemV3 init要广泛得多)用于管理正在运行的Linux主机的许多方面,包括挂载文件系统以及启动和管理Linux生产主机所需的系统服务。与启动顺序无关的任何systemd任务都不在本文讨论范围之内(但本系列后面的一些文章将探讨其中的一些任务)。 +### 作为 1 号进程的 systemd -首先,systemd挂载 **/etc/fstab** 所定义的文件系统,包括所有交换文件或分区。此时,它可以访问位于 **/etc** 中的配置文件,包括它自己的配置文件。它使用其配置链接 **/etc/systemd/system/default.target** 来确定将主机引导至哪个状态或目标。 **default.target** 文件是指向真实目标文件的符号链接。对于桌面工作站,通常是 **graphical.target**,它相当于SystemV中的运行级别5。对于服务器,默认值更可能是 **multi-user.target**,相当于SystemV中的运行级别3。 **emergency.target** 类似于单用户模式。目标(targets)和服务(services)是systemd的单位。 +systemd 是 1 号进程(PID 1)。它的一些功能,比老的 SystemV3 `init` 要广泛得多,用于管理正在运行的 Linux 主机的许多方面,包括挂载文件系统以及启动和管理 Linux 生产主机所需的系统服务。与启动环节无关的任何 systemd 任务都不在本文讨论范围之内(但本系列后面的一些文章将探讨其中的一些任务)。 -下表(图2)将systemd目标与老的SystemV启动运行级别进行了比较。systemd提供systemd目标别名以便向后兼容。目标别名允许脚本(以及许多系统管理员)使用SystemV命令(如**init 3**)更改运行级别。当然,SystemV命令被转发给systemd进行解释和执行。 +首先,systemd 挂载 `/etc/fstab` 所定义的文件系统,包括所有交换文件或分区。此时,它可以访问位于 `/etc` 中的配置文件,包括它自己的配置文件。它使用其配置链接 `/etc/systemd/system/default.target` 来确定将主机引导至哪个状态或目标。`default.target` 文件是指向真实目标文件的符号链接。对于桌面工作站,通常是 `graphical.target`,它相当于 SystemV 中的运行级别 5。对于服务器,默认值更可能是 `multi-user.target`,相当于 SystemV 中的运行级别 3。`emergency.target` 类似于单用户模式。目标target服务service是 systemd 的单元unit。 -**systemd目标** | **SystemV运行级别** | **目标别名** | **描述** ---- | --- | ---- |- -default.target | | |此目标总是通过符号连接的方式成为“多用户目标”或“图形化目标”的别名。systemd始终使用 **default.target** 来启动系统。 ** default.target** 绝不应该设为 **halt.target**,**poweroff.target** 或 **reboot.target** 的别名 -graphic.target | 5 | runlevel5.target |带有GUI的 **Multi-user.target** -| 4 | runlevel4.target |未用。在SystemV中运行级别4与运行级别3相同。可以创建并自定义此目标以启动本地服务,而无需更改默认的 **multi-user.target** -multi-user.target | 3 | runlevel3.target |所有服务在运行,但仅有命令行界面(CLI) -| 2 | runlevel2.target |多用户,没有NFS,其他所有非GUI服务在运行 -rescue.target | 1 | runlevel1.target |基本系统,包括挂载文件系统,运行最基本的服务和主控制台的恢复shell -Emergency.target | S | |单用户模式-没有服务运行;不挂载文件系统。这是最基本的工作级别,只有主控制台上运行的一个紧急Shell供用户与系统交互 -halt.target | | |在不关电源的情况下停止系统 -reboot.target | 6 | runlevel6.target |重启 -poweroff.target | 0 | runlevel0.target |停止系统并关闭电源 +下表(图 2)将 systemd 目标与老的 SystemV 启动运行级别进行了比较。systemd 提供 systemd 目标别名以便向后兼容。目标别名允许脚本(以及许多系统管理员)使用 SystemV 命令(如 `init 3`)更改运行级别。当然,SystemV 命令被转发给 systemd 进行解释和执行。 -每个目标在其配置文件中都描述了一个依赖集。systemd启动必须的依赖,这些依赖是运行Linux主机到特定功能级别所需的服务。当目标配置文件中列出的所有依赖项被加载并运行后,系统就在该目标级别运行了。 在图2中,功能最多的目标位于表的顶部,从顶向下,功能逐步递减。 +systemd 目标 | SystemV 运行级别 | 目标别名 | 描述 +--- | --- | --- | --- +`default.target` | | | 此目标总是通过符号连接的方式成为 `multi-user.target` 或 `graphical.target` 的别名。systemd 始终使用 `default.target` 来启动系统。`default.target` 绝不应该设为 `halt.target`,`poweroff.target` 或 `reboot.target` 的别名。 +`graphic.target` | 5 | `runlevel5.target` |带有 GUI 的 `multi-user.target`。 + | 4 | `runlevel4.target` |未用。在 SystemV 中运行级别 4 与运行级别 3 相同。可以创建并自定义此目标以启动本地服务,而无需更改默认的 `multi-user.target`。 +`multi-user.target` | 3 | `runlevel3.target` |所有服务在运行,但仅有命令行界面(CLI)。 + | 2 | `runlevel2.target` | 多用户,没有 NFS,其它所有非 GUI 服务在运行。 +`rescue.target` | 1 | `runlevel1.target` | 基本系统,包括挂载文件系统,运行最基本的服务和主控制台的恢复 shell。 +`emergency.target` | S | |单用户模式:没有服务运行;不挂载文件系统。这是最基本的工作级别,只有主控制台上运行的一个紧急 Shell 供用户与系统交互。 +`halt.target` | | | 停止系统而不关闭电源。 +`reboot.target` | 6 | `runlevel6.target` | 重启。 +`poweroff.target` | 0 | `runlevel0.target` | 停止系统并关闭电源。 -systemd还会检查老的SystemV init目录,以确认是否存在任何启动文件。如果有,systemd会将它们作为配置文件以启动它们描述的服务。网络服务是一个很好的例子,在Fedora中它仍然使用SystemV启动文件。 +*图 2:SystemV 运行级别与 systemd 目标和一些目标别名的比较* -图3(如下)是直接从启动手册页复制来的。它显示了systemd启动期间普遍的事件顺序以及确保成功启动的基本顺序要求。 +每个目标在其配置文件中都描述了一个依赖集。systemd 启动必须的依赖项,这些依赖项是运行 Linux 主机到特定功能级别所需的服务。当目标配置文件中列出的所有依赖项被加载并运行后,系统就在该目标级别运行了。在图 2 中,功能最多的目标位于表的顶部,从顶向下,功能逐步递减。 + +systemd 还会检查老的 SystemV `init` 目录,以确认是否存在任何启动文件。如果有,systemd 会将它们作为配置文件以启动它们描述的服务。网络服务是一个很好的例子,在 Fedora 中它仍然使用 SystemV 启动文件。 + +图 3(如下)是直接从启动手册页复制来的。它显示了 systemd 启动期间一般的事件环节以及确保成功启动的基本顺序要求。 ``` -                                         cryptsetup-pre.target -                                                   | - (various low-level                                v -     API VFS mounts:                 (various cryptsetup devices...) -  mqueue, configfs,                                |    | -  debugfs, ...)                                    v    | -  |                                  cryptsetup.target  | -  |  (various swap                                 |    |    remote-fs-pre.target -  |   devices...)                                  |    |     |        | -  |    |                                           |    |     |        v -  |    v                       local-fs-pre.target |    |     |  (network file systems) -  |  swap.target                       |           |    v     v                 | -  |    |                               v           |  remote-cryptsetup.target  | -  |    |  (various low-level  (various mounts and  |             |              | -  |    |   services: udevd,    fsck services...)   |             |    remote-fs.target -  |    |   tmpfiles, random            |           |             |             / -  |    |   seed, sysctl, ...)          v           |             |            / -  |    |      |                 local-fs.target    |             |           / -  |    |      |                        |           |             |          / -  \\____|______|_______________   ______|___________/             |         / -                              \ /                                |        / -                               v                                 |       / -                        sysinit.target                           |      / -                               |                                 |     / -        ______________________/|\\_____________________           |    / -       /              |        |      |               \          |   / -       |              |        |      |               |          |  / -       v              v        |      v               |          | / -  (various       (various      |  (various            |          |/ -   timers...)      paths...)   |   sockets...)        |          | -       |              |        |      |               |          | -       v              v        |      v               |          | - timers.target  paths.target   |  sockets.target      |          | -       |              |        |      |               v          | -       v              \\_______ | _____/         rescue.service   | -                              \|/                     |          | -                               v                      v          | -                           basic.target         rescue.target    | -                               |                                 | -                       ________v____________________             | -                      /              |              \            | -                      |              |              |            | -                      v              v              v            | -                  display-    (various system   (various system  | -              manager.service     services        services)      | -                      |         required for        |            | -                      |        graphical UIs)       v            v -                      |              |            multi-user.target - emergency.service    |              |              | -         |            \\_____________ | _____________/ -         v                          \|/ - emergency.target                    v -                              graphical.target + cryptsetup-pre.target + | + (various low-level v + API VFS mounts: (various cryptsetup devices...) + mqueue, configfs, | | + debugfs, ...) v | + | cryptsetup.target | + | (various swap | | remote-fs-pre.target + | devices...) | | | | + | | | | | v + | v local-fs-pre.target | | | (network file systems) + | swap.target | | v v | + | | v | remote-cryptsetup.target | + | | (various low-level (various mounts and | | | + | | services: udevd, fsck services...) | | remote-fs.target + | | tmpfiles, random | | | / + | | seed, sysctl, ...) v | | / + | | | local-fs.target | | / + | | | | | | / + \____|______|_______________ ______|___________/ | / + \ / | / + v | / + sysinit.target | / + | | / + ______________________/|\_____________________ | / + / | | | \ | / + | | | | | | / + v v | v | | / + (various (various | (various | |/ + timers...) paths...) | sockets...) | | + | | | | | | + v v | v | | + timers.target paths.target | sockets.target | | + | | | | v | + v \_______ | _____/ rescue.service | + \|/ | | + v v | + basic.target rescue.target | + | | + ________v____________________ | + / | \ | + | | | | + v v v | + display- (various system (various system | + manager.service services services) | + | required for | | + | graphical UIs) v v + | | multi-user.target + emergency.service | | | + | \_____________ | _____________/ + v \|/ + emergency.target v + graphical.target ``` -**sysinit.target** 和 **basic.target** 目标可以看作启动过程中的检查点。尽管systemd的设计目标之一是并行启动系统服务,但是某些服务和功能目标必须先启动,然后才能启动其他服务和目标。直到该检查点所需的所有服务和目标被满足后才能通过这些检查点。 +*图 3: systemd 启动图* -当它依赖的所有单元都完成时,将到达 **sysinit.target**。所有这些单元,挂载文件系统,设置交换文件,启动udev,设置随机数生成器种子,启动低层服务以及配置安全服务(如果一个或多个文件系统是加密的)都必须被完成,但 **sysinit.target** 的这些任务可以并行执行。 +`sysinit.target` 和 `basic.target` 目标可以看作启动过程中的检查点。尽管 systemd 的设计目标之一是并行启动系统服务,但是某些服务和功能目标必须先启动,然后才能启动其它服务和目标。直到该检查点所需的所有服务和目标被满足后才能通过这些检查点。 -**sysinit.target** 将启动系统接近正常运行所需的所有低层服务和单元,以及转移到 **basic.target** 所需的服务和单元。 +当 `sysinit.target` 所依赖的所有单元都完成时,就会到达 `sysinit.target`。所有这些单元,包括挂载文件系统、设置交换文件、启动 Udev、设置随机数生成器种子、启动低层服务以及配置安全服务(如果一个或多个文件系统是加密的)都必须被完成,但在 `sysinit.target` 中,这些任务可以并行执行。 -在完成 **sysinit.target** 目标之后,systemd会启动实现下一个目标所需的所有单元。基本目标通过启动所有下一目标所需的单元来提供一些其他功能。包括设置如PATHs为各种可执行程序的路径,设置通信套接字和计时器之类。 +`sysinit.target` 启动了系统接近正常运行所需的所有低层服务和单元,它们也是进入 `basic.target` 所需的。 -最后,用户级目标 **multi-user.target** 或 **graphical.target** 被初始化。要满足图形目标的依赖必须先达到**multi-user.target**。图3中带下划线的目标是通常的启动目标。当达到这些目标之一时,启动就完成了。如果 **multi-user.target** 是默认设置,那么您应该在控制台上看到文本模式的登录界面。如果 **graphical.target** 是默认设置,那么您应该看到图形的登录界面。您看到的特定的GUI登录界面取决于您默认的显示管理器。 +在完成 `sysinit.target` 之后,systemd 会启动实现下一个目标所需的所有单元。`basic.target` 通过启动所有下一目标所需的单元来提供一些额外功能。包括设置为各种可执行程序目录的路径、设置通信套接字和计时器之类。 -引导手册页还描述并提供了引导到初始RAM磁盘和systemd关机过程的地图。 +最后,用户级目标 `multi-user.target` 或 `graphical.target` 被初始化。要满足 `graphical.target` 的依赖必须先达到 `multi-user.target`。图 3 中带下划线的目标是通常的启动目标。当达到这些目标之一时,启动就完成了。如果 `multi-user.target` 是默认设置,那么你应该在控制台上看到文本模式的登录界面。如果 `graphical.target` 是默认设置,那么你应该看到图形的登录界面。你看到的具体的 GUI 登录界面取决于你的默认显示管理器。 -systemd还提供了一个工具,该工具列出了完整启动或指定单元的依赖。单元是可控制的systemd资源实体,其范围从特定服务(例如httpd或sshd)到计时器,挂载,套接字等。尝试以下命令并滚动查看结果。 +引导手册页还描述并提供了引导到初始化 RAM 磁盘和 systemd 关机过程的图。 + +systemd 还提供了一个工具,该工具列出了完整的启动过程或指定单元的依赖项。单元是一个可控的 systemd 资源实体,其范围可以从特定服务(例如 httpd 或 sshd)到计时器、挂载、套接字等。尝试以下命令并滚动查看结果。 ``` -`systemctl list-dependencies graphical.target` +systemctl list-dependencies graphical.target ``` -注意,这完全展开了使系统进入图形目标运行模式所需的顶层目标单元列表。 也可以使用 **\-all** 选项来展开所有其他单元。 +注意,这会完全展开使系统进入 `graphical.target` 运行模式所需的顶层目标单元列表。也可以使用 `--all` 选项来展开所有其它单元。 ``` -`systemctl list-dependencies --all graphical.target` +systemctl list-dependencies --all graphical.target ``` -您可以使用 **less** 命令来搜索诸如“target”,“slice”和“ socket”之类的字符串。 +你可以使用 `less` 命令来搜索诸如 `target`、`slice` 和 `socket` 之类的字符串。 现在尝试下面的方法。 ``` -`systemctl list-dependencies multi-user.target` +systemctl list-dependencies multi-user.target ``` 和 - ``` -`systemctl list-dependencies rescue.target` +systemctl list-dependencies rescue.target ``` 和 - ``` -`systemctl list-dependencies local-fs.target` +systemctl list-dependencies local-fs.target ``` 和 - ``` -`systemctl list-dependencies dbus.service` -``` -``` -`systemctl list-dependencies graphic.target` +systemctl list-dependencies dbus.service ``` +这个工具帮助我可视化我正用的主机的启动依赖细节。继续花一些时间探索一个或多个 Linux 主机的启动树。但是要小心,因为 systemctl 手册页包含以下注释: - -这个工具帮助我可视化我正用的主机的启动依赖细节。继续花一些时间探索一个或多个Linux主机的启动树。但是要小心,因为systemctl手册页包含以下注释: - -> _“请注意,此命令仅列出当前被服务管理器加载到内存的单元。尤其是,此命令根本不适合用于获取特定单元的全部反向依赖列表,因为它不会列出被单元声明了但是未加载的依赖项。” _ +> “请注意,此命令仅列出当前被服务管理器加载到内存的单元。尤其是,此命令根本不适合用于获取特定单元的全部反向依赖关系列表,因为它不会列出被单元声明了但是未加载的依赖项。” ### 结尾语 -即使在深入研究systemd之前,很明显能看出它既强大又复杂。显然,systemd不是单一,庞大,整体且不可知的二进制文件。相反,它是由许多较小的组件和旨在执行特定任务的子命令组成。 +即使在没有深入研究 systemd 之前,很明显能看出它既强大又复杂。显然,systemd 不是单一、庞大、独体且不可知的二进制文件。相反,它是由许多较小的组件和旨在执行特定任务的子命令组成。 -本系列的下一篇文章将更详细地探讨systemd的启动,以及systemd的配置文件,更改默认的目标以及如何创建简单服务单元。 +本系列的下一篇文章将更详细地探讨 systemd 的启动,以及 systemd 的配置文件,更改默认的目标以及如何创建简单服务单元。 ### 资源 -互联网上有大量关于systemd的信息,但是很多都简短,晦涩甚至是误导。除了本文提到的资源外,以下网页还提供了有关systemd启动的更详细和可靠的信息。 +互联网上有大量关于 systemd 的信息,但是很多都很简短、晦涩甚至是带有误导。除了本文提到的资源外,以下网页还提供了有关 systemd 启动的更详细和可靠的信息。 - * Fedora项目有一个很好的,实用的[guide to systemd][7]。它有你需要知道的通过systemd来配置,管理和维护Fedora主机所需的几乎所有知识。 - * Fedora项目还有一个不错的[cheat sheet][8],将老的SystemV命令与对比的systemd命令相互关联。 -  * 有关systemd及其创建原因的详细技术信息,请查看[Freedesktop.org][9]的[systemd描述][10]。 - * [Linux.com][11]的“systemd的更多乐趣”提供了更高级的systemd [信息和技巧][12]。 +* Fedora 项目有一个很好的实用的 [systemd 指南][7]。它有你需要知道的通过 systemd 来配置、管理和维护 Fedora 主机所需的几乎所有知识。 +* Fedora 项目还有一个不错的[速记表][8],将老的 SystemV 命令与对比的 systemd 命令相互关联。 +* 有关 systemd 的详细技术信息及创建它的原因,请查看 [Freedesktop.org][9] 对 [systemd 描述][10]。 +* [Linux.com][11] 的“systemd 的更多乐趣”提供了更高级的 systemd [信息和技巧][12]。 +还有针对 Linux 系统管理员的一系列技术性很强的文章,作者是 systemd 的设计师和主要开发者 Lennart Poettering。这些文章是在 2010 年 4 月至 2011 年 9 月之间撰写的,但它们现在和那时一样有用。关于 systemd 及其生态的其它许多好文都基于这些论文。 -还有systemd的设计师和主要开发者Lennart Poettering撰写的针对Linux系统管理员的一系列技术文章。这些文章是在2010年4月至2011年9月之间撰写的,但它们现在和那时一样有用。关于systemd及其生态的其他许多好文都基于这些论文。 +* [重新思考 1 号进程][13] +* [systemd 系统管理员篇 I][14] +* [systemd 系统管理员篇 II][15] +* [systemd 系统管理员篇 III][16] +* [systemd 系统管理员篇 IV][17] +* [systemd 系统管理员篇 V][18] +* [systemd 系统管理员篇 VI][19] +* [systemd 系统管理员篇 VII][20] +* [systemd 系统管理员篇 VIII][21] +* [systemd 系统管理员篇 IX][22] +* [systemd 系统管理员篇 X][23] +* [systemd 系统管理员篇 XI][24] - * [重新思考1号进程][13] - * [systemd之系统管理员, I][14] - * [systemd之系统管理员, II][15] - * [systemd之系统管理员, III][16] - * [systemd之系统管理员, IV][17] - * [systemd之系统管理员, V][18] - * [systemd之系统管理员, VI][19] - * [systemd之系统管理员, VII][20] - * [systemd之系统管理员, VIII][21] - * [systemd之系统管理员, IX][22] - * [systemd之系统管理员, X][23] - * [systemd之系统管理员, XI][24] - - - -Mentor Graphics的Linux内核和系统程序员Alison Chiaken预览了此文... -------------------------------------------------------------------------------- via: https://opensource.com/article/20/4/systemd @@ -293,7 +286,7 @@ via: https://opensource.com/article/20/4/systemd 作者:[David Both][a] 选题:[lujun9972][b] 译者:[messon007](https://github.com/messon007) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From db3dd6c57fd7f8384e1f92c1a910b772287891f4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 May 2020 08:52:15 +0800 Subject: [PATCH 2057/3057] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @messon007 https://linux.cn/article-12214-1.html 升级三星了,辛苦了!! --- .../tech => published}/20200416 Learning to love systemd.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200416 Learning to love systemd.md (99%) diff --git a/translated/tech/20200416 Learning to love systemd.md b/published/20200416 Learning to love systemd.md similarity index 99% rename from translated/tech/20200416 Learning to love systemd.md rename to published/20200416 Learning to love systemd.md index 328716266c..ef70caee08 100644 --- a/translated/tech/20200416 Learning to love systemd.md +++ b/published/20200416 Learning to love systemd.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (messon007) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12214-1.html) [#]: subject: (Learning to love systemd) [#]: via: (https://opensource.com/article/20/4/systemd) [#]: author: (David Both https://opensource.com/users/dboth) From d99266c23770a1b9552bc482593e9c24aeb31c38 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 13 May 2020 08:55:14 +0800 Subject: [PATCH 2058/3057] translated --- ...h FreeBSD as a desktop operating system.md | 70 ------------------- ...h FreeBSD as a desktop operating system.md | 67 ++++++++++++++++++ 2 files changed, 67 insertions(+), 70 deletions(-) delete mode 100644 sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md create mode 100644 translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md diff --git a/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md b/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md deleted file mode 100644 index 2f1be1e803..0000000000 --- a/sources/tech/20200508 Getting started with FreeBSD as a desktop operating system.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with FreeBSD as a desktop operating system) -[#]: via: (https://opensource.com/article/20/5/furybsd-linux) -[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) - -Getting started with FreeBSD as a desktop operating system -====== -FuryBSD's live desktop environment lets you try it before committing to -it. -![web development and design, desktop and browser][1] - -[FreeBSD][2] is a great operating system, but, by design, it does not come with a desktop environment. Without installing additional software from FreeBSD's [ports and packages collection][3], FreeBSD is a command-line only experience. The screenshot below shows what logging into FreeBSD 12.1 looks like when every one of the "optional system components" is selected during installation. - -![FreeBSD][4] - -FreeBSD can be turned into a desktop operating system with any of a wide selection of desktop environments, but it takes time, effort, and [following a lot of written instructions][5]. Using the **desktop-installer** package, which provides the user with options in a text-based menu and helps automate much of the process, is still time-consuming. The biggest problem with either of these methods is that users might find out that their system is not fully compatible with FreeBSD after they have taken all the time to set things up. - -[FuryBSD][6] solves that problem by providing a live desktop image that users can evaluate before installing. Currently, FuryBSD provides an Xfce image and a KDE image. Each of these images provides an installation of FreeBSD that has a desktop environment pre-installed. If users try out the image and find that their hardware works, they can install FuryBSD and have a ready-to-go desktop operating system powered by FreeBSD. For the purposes of this article, I will be using the Xfce image, but the KDE image works the exact same way. - -Getting started with FuryBSD should be a familiar process to anyone who has installed a Linux distribution, any of the BSDs, or any other Unix-like open source operating system. Download the ISO from the FuryBSD website, copy it to a flash drive, and boot a computer from the flash drive. If booting from the flash drive fails, make sure Secure Boot is disabled. - -![FuryBSD Live XFCE Desktop][7] - -After booting from the flash drive, the desktop environment loads automatically. In addition to the Home, File System, and Trash icons, the live desktop has icons for a tool to configure Xorg, getting started instructions, the FuryBSD installer, and a system information utility. Other than these extras and some custom Xfce settings and wallpaper, the desktop environment does not come with much beyond the basic Xfce applications and Firefox. - -![FuryBSD Xorg Tool][8] - -Only basic graphics drivers are loaded at this point, but it is enough to check to see if the system's wired and wireless network interfaces are supported by FuryBSD. If none of the network interfaces is working automatically, the **Getting Started.txt** file contains instructions for attempting to configure network interfaces and other configuration tasks. If at least one of the network interfaces works, the **Configure Xorg** application can be used to install Intel, NVidia, or VirtualBox graphics drivers. The drivers will be downloaded and installed, and Xorg will need to be restarted. If the system does not automatically re-login to the live image user, the password is **furybsd**. Once they are configured, the graphics drivers will carry over to an installed system. - -![FuryBSD Installer - ZFS Configuration][9] - -If everything works well in the live environment, the FuryBSD installer can configure and install FuryBSD onto the computer. This installer runs in a terminal, but it provides the same options found in most other BSD and Linux installers. The user will be asked to set the system's hostname, configure ZFS storage, set the root password, add at least one non-root user, and configure the time and date settings. Once the process is complete, the system can be rebooted into a pre-configured FreeBSD with an Xfce (or KDE) desktop. FuryBSD did all the hard work and even took the extra effort to make the desktop look nice. - -![FuryBSD Post-Install XFCE Desktop][10] - -As noted above, the desktop environment does not come with a lot of pre-installed software, so installing additional packages is almost certainly necessary. The quickest way to do this is by using the **pkg** command in the terminal. This command behaves much like **dnf** and **apt**, so users coming from a Linux distribution that uses one of those should feel right at home when it comes to finding and installing packages. FreeBSD's package collection is large, so most of the big-name open source software packages are available. - -Users trying out FuryBSD without having much FreeBSD experience should consult the [FreeBSD Handbook][11] to learn more about how to do things the FreeBSD way. Users with experience using any Linux distribution or one of the other BSDs should be able to figure out a lot of things, but there are differences that the handbook can help clarify. Another great resource for learning more about the FreeBSD way of doing things is _[Absolute FreeBSD, 3rd Edition][12],_ by Michael W. Lucas. - -A brief overview of PC-BSD and thoughts about the distribution. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/5/furybsd-linux - -作者:[Joshua Allen Holm][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/holmja -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) -[2]: https://www.freebsd.org -[3]: https://www.freebsd.org/ports/ -[4]: https://opensource.com/sites/default/files/uploads/freebsd.png (FreeBSD) -[5]: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/ -[6]: https://www.furybsd.org -[7]: https://opensource.com/sites/default/files/uploads/furybsd_live_xfce_desktop.png (FuryBSD Live XFCE Desktop) -[8]: https://opensource.com/sites/default/files/uploads/furybsd_xorg_tool.png (FuryBSD Xorg Tool) -[9]: https://opensource.com/sites/default/files/uploads/furybsd_installer_-_zfs_configuration.png (FuryBSD Installer - ZFS Configuration) -[10]: https://opensource.com/sites/default/files/uploads/furybsd_post-install_xfce_desktop.png (FuryBSD Post-Install XFCE Desktop) -[11]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ -[12]: https://nostarch.com/absfreebsd3 diff --git a/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md b/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md new file mode 100644 index 0000000000..ceebbcfa81 --- /dev/null +++ b/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with FreeBSD as a desktop operating system) +[#]: via: (https://opensource.com/article/20/5/furybsd-linux) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +开始用 FreeBSD 作为桌面操作系统 +====== +FuryBSD 的 live 桌面环境能让你在实际使用之前先尝试。 +![web development and design, desktop and browser][1] + +[FreeBSD][2] 是一个很棒的操作系统,但是从设计上讲,它没有桌面环境。如果不从 FreeBSD 的 [ports 和软件包集][3]安装其他软件,那么 FreeBSD 仅能体验命令行。下面的截图显示了在安装过程中选择了每个“可选系统组件”后,登录 FreeBSD 12.1 的样子。 + +![FreeBSD][4] + +可以将 FreeBSD 变成包含各种桌面环境的操作系统,但是这需要时间、精力和[遵循大量书面说明][5]。使用使用 **desktop-installer** 包(为用户提供基于文本的菜单并帮助自动执行大部分过程)仍然非常耗时。这两种方法的最大问题是,用户在花了很多时间进行设置之后,可能会发现他们的系统与 FreeBSD 不完全兼容。 + +[FuryBSD][6] 通过提供 live 桌面镜像来解决此问题,用户可以在安装之前对其进行评估。目前,FuryBSD 提供 Xfce 镜像和 KDE 镜像。每个镜像都提供已预安装桌面环境的 FreeBSD。如果用户试用镜像并发现其硬件工作正常,那么他们可以安装 FuryBSD,并拥有由 FreeBSD 提供支持的即用桌面操作系统。在本文中,我将使用 Xfce 镜像,但 KDE 镜像的使用完全一样。 + +对于任何安装过 Linux 发行版、BSD 或任何其他类 Unix 的开源操作系统的人,开始用 FuryBSD 都应该是一个熟悉的过程。从 FuryBSD 网站下载 ISO,将它复制到闪存,然后从闪存启动计算机。如果从闪存引导失败,请确保安全引导已禁用。 + +![FuryBSD Live XFCE Desktop][7] + +从闪存启动后,桌面环境将自动加载。除了“家”、“文件系统”和“回收站”图标外,live 桌面还有用于配置 Xorg 的工具、入门指南、FuryBSD 安装程序和系统信息程序的图标。除了这些额外功能以及一些自定义的 Xfce 设置和墙纸外,桌面环境除了基本的 Xfce 应用和 Firefox 之外并没有其他功能。 + +![FuryBSD Xorg Tool][8] + +此时仅加载基本的图形驱动,但足以检查 FuryBSD 是否支持系统的有线和无线网络接口。如果没有网络接口自动工作,那么 **Getting Started.txt** 文件包含有关尝试配置网络接口和其他配置任务的说明。如果至少有一个网络接口有效,那么可以使用 **Configure Xorg** 应用安装 Intel、NVidia 或 VirtualBox 图形驱动。它将下载并安装驱动,并且需要重新启动 Xorg。如果系统未自动重新登录到 live 用户,那么密码为 **furybsd**。配置后,图形驱动将转移到已安装的系统中。 + +![FuryBSD Installer - ZFS Configuration][9] + +如果一切都可以在 live 环境中正常运行,那么 FuryBSD 安装程序可以将 FuryBSD 配置并安装到计算机上。该安装程序在终端中运行,但提供与大多数其他 BSD 和 Linux 安装程序相同的选项。系统将要求用户设置系统的主机名、配置 ZFS 存储,设置 root 密码,添加至少一个非 root 用户以及配置时间和日期。完成后,系统可以引导到预装有 Xfce (或 KDE)的 FreeBSD 中。FuryBSD 完成了所有困难的工作,甚至还花了很多精力使桌面看起来更漂亮。 + +![FuryBSD Post-Install XFCE Desktop][10] + +如上所述,桌面环境没有大量预装软件,因此几乎肯定要安装额外的软件包。最快的方法是在终端中使用 **pkg** 命令。该命令的行为很像 dnf 和 apt,因此来自 Linux 发行版的用户(使用其中之一)在查找和安装软件包时应该感到很熟悉。 FreeBSD的软件包集合很大,因此大多数知名的开源软件包都可用。 + +在没有太多 FreeBSD 经验的情况下尝试 FuryBSD 的用户应查阅 [FreeBSD 手册][11],以了解有关如何以 FreeBSD 的方式做事。有任何 Linux 发行版或其他 BSD 使用经验的用户应该能弄清很多事情,但是手册可以帮助你弄清一些差异。进一步了解 FreeBSD 的一个很好的资源是 Michael W. Lucas 的 _[Absolute FreeBSD,第三版][12]_。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/furybsd-linux + +作者:[Joshua Allen Holm][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/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) +[2]: https://www.freebsd.org +[3]: https://www.freebsd.org/ports/ +[4]: https://opensource.com/sites/default/files/uploads/freebsd.png (FreeBSD) +[5]: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/ +[6]: https://www.furybsd.org +[7]: https://opensource.com/sites/default/files/uploads/furybsd_live_xfce_desktop.png (FuryBSD Live XFCE Desktop) +[8]: https://opensource.com/sites/default/files/uploads/furybsd_xorg_tool.png (FuryBSD Xorg Tool) +[9]: https://opensource.com/sites/default/files/uploads/furybsd_installer_-_zfs_configuration.png (FuryBSD Installer - ZFS Configuration) +[10]: https://opensource.com/sites/default/files/uploads/furybsd_post-install_xfce_desktop.png (FuryBSD Post-Install XFCE Desktop) +[11]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ +[12]: https://nostarch.com/absfreebsd3 From 3fe37353aeb136862c7640c3f45aad3dd8628c9b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 May 2020 08:55:17 +0800 Subject: [PATCH 2059/3057] PRF --- published/20200416 Learning to love systemd.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/published/20200416 Learning to love systemd.md b/published/20200416 Learning to love systemd.md index ef70caee08..5cacf21a0c 100644 --- a/published/20200416 Learning to love systemd.md +++ b/published/20200416 Learning to love systemd.md @@ -24,9 +24,9 @@ systemd(是的,全小写,即使在句子开头也是小写),是初始 Linux 主机从关机状态到运行状态的完整启动过程很复杂,但它是开放的并且是可知的。在详细介绍之前,我将简要介绍一下从主机硬件被上电到系统准备好用户登录的过程。大多数时候,“引导过程”被作为一个整体来讨论,但这是不准确的。实际上,完整的引导和启动过程包含三个主要部分: -* `硬件引导`:初始化系统硬件 -* `Linux 引导boot`:加载 Linux 内核和 systemd -* `Linux 启动startup`:systemd 为主机的生产性工作做准备 +* 硬件引导:初始化系统硬件 +* Linux 引导boot:加载 Linux 内核和 systemd +* Linux 启动startup:systemd 为主机的生产性工作做准备 Linux 启动阶段始于内核加载了 `init` 或 systemd(取决于具体发行版使用的是旧的方式还是还是新的方式)之后。`init` 和 systemd 程序启动并管理所有其它进程,它们在各自的系统上都被称为“所有进程之母”。 From 2b31fa3a728d8721df0b67e9cd96d49b5907fe17 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 13 May 2020 09:03:24 +0800 Subject: [PATCH 2060/3057] translating --- ...tomizing my open source PHP framework for web development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200506 Customizing my open source PHP framework for web development.md b/sources/tech/20200506 Customizing my open source PHP framework for web development.md index 8247a6ad49..241f31754f 100644 --- a/sources/tech/20200506 Customizing my open source PHP framework for web development.md +++ b/sources/tech/20200506 Customizing my open source PHP framework for web development.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 818965736417b964267c63818f89a5cd43549941 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 May 2020 10:46:06 +0800 Subject: [PATCH 2061/3057] PRF --- published/20200417 How to compress files on Linux 5 ways.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20200417 How to compress files on Linux 5 ways.md b/published/20200417 How to compress files on Linux 5 ways.md index d0cb239d11..5ba0c7feeb 100644 --- a/published/20200417 How to compress files on Linux 5 ways.md +++ b/published/20200417 How to compress files on Linux 5 ways.md @@ -62,7 +62,7 @@ $ ls -l bigfile bigfile.zip ### gzip -`gzip` 命令非常容易使用。你只需要键入 `gzip`,紧随其后的是你想要压缩的文件名称。不像上述描述的命令,`gzip` 将“就地”加密文件。换句话说,原始文件将被加密文件替换。 +`gzip` 命令非常容易使用。你只需要键入 `gzip`,紧随其后的是你想要压缩的文件名称。不像上述描述的命令,`gzip` 将“就地”“加密”文件。换句话说,原始文件将被“加密”文件替换。 ``` $ gzip bigfile @@ -120,7 +120,7 @@ $ ls -l bigfile* #### 运行时间 -`xz` 命令似乎比其它命令需要花费更多的时间来加密文件。对于 `bigfile` 来说,大概的时间是: +`xz` 命令似乎比其它命令需要花费更多的时间来“加密”文件。对于 `bigfile` 来说,大概的时间是: ``` 命令 运行时间 From 656b0454fb8671392b432c07c1062cb2b97ac6bd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 May 2020 16:20:34 +0800 Subject: [PATCH 2062/3057] PRF @geekpi --- ...in Ubuntu and Other Linux Distributions.md | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md b/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md index cfad9fdfc4..7fc69dfdec 100644 --- a/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md +++ b/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions) [#]: via: (https://itsfoss.com/unable-to-parse-package-file/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -修复 Ubuntu 和其他 Linux 发行版中的 “Unable to parse package file /var/lib/apt/lists” 错误 +修复 Ubuntu 中的 “Unable to parse package file” 错误 ====== 过去,我已经讨论了许多 [Ubuntu 更新错误][1]。如果你[使用命令行更新 Ubuntu][2],那可能会遇到一些“错误”。 @@ -16,15 +16,19 @@ 在本文中,我将向你展示如何解决在更新系统或安装新软件时可能遇到的以下错误: -**Reading package lists… Error! +``` +Reading package lists… Error! E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease -E: The package lists or status file could not be parsed or opened.** +E: The package lists or status file could not be parsed or opened. +``` 在 Debian 中可能会遇到类似的错误: -**E: Unable to parse package file /var/lib/apt/extended_states (1)** +``` +E: Unable to parse package file /var/lib/apt/extended_states (1) +``` -即使遇到 “**The package cache file is corrupted**” 也完全不必惊慌。这真的很容易“修复”。 +即使遇到 `The package cache file is corrupted` 也完全不必惊慌。这真的很容易“修复”。 ### 在基于 Ubuntu 和 Debian 的 Linux 发行版中处理 “Unable to parse package file” 错误 @@ -32,11 +36,13 @@ E: The package lists or status file could not be parsed or opened.** 以下是你需要做的。仔细查看 [Ubuntu][4] 报错文件的名称和路径。 +``` Reading package lists… Error! -**E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease** +E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease E: The package lists or status file could not be parsed or opened. +``` -例如,上面的错误是在报 /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease 文件错误。 +例如,上面的错误是在报 `/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease` 文件错误。 这让你想到这个文件不正确。现在,你需要做的就是删除该文件并重新生成缓存。 @@ -44,7 +50,7 @@ E: The package lists or status file could not be parsed or opened. sudo rm ``` -因此,这里我可以使用以下命令:**sudo rm /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease**,然后使用 sudo apt update 命令重建缓存。 +因此,这里我可以使用以下命令:`sudo rm /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease`,然后使用 `sudo apt update` 命令重建缓存。 #### 给初学者的分步指导 @@ -81,13 +87,13 @@ sudo apt update #### 解释这为何能解决问题 -/var/lib/apt 是与 apt 软件包管理器相关的文件和数据的存储目录。/var/lib/apt/lists 是用于保存系统 source.list 中指定的每个软件包资源信息的目录。 +`/var/lib/apt` 是与 apt 软件包管理器相关的文件和数据的存储目录。`/var/lib/apt/lists` 是用于保存系统 `source.list` 中指定的每个软件包资源信息的目录。 -简单点来说,/var/lib/apt/lists 保存软件包信息缓存。当你要安装或更新程序时,系统会在此目录中检查该软件包中的信息。如果找到了该包的详细信息,那么它将进入远程仓库并实际下载程序或其更新。 +简单点来说,`/var/lib/apt/lists` 保存软件包信息缓存。当你要安装或更新程序时,系统会在此目录中检查该软件包中的信息。如果找到了该包的详细信息,那么它将进入远程仓库并实际下载程序或其更新。 -当你运行 “sudo apt update” 时,它将构建缓存。这就是为什么即使删除 /var/lib/apt/lists 目录中的所有内容,运行更新也会建立新的缓存的原因。 +当你运行 `sudo apt update` 时,它将构建缓存。这就是为什么即使删除 `/var/lib/apt/lists` 目录中的所有内容,运行更新也会建立新的缓存的原因。 -这就是处理文件无法解析问题的方式。你的系统报某个软件包或仓库信息以某种方式损坏(下载失败或手动更改 sources.list)。删除该文件(或所有文件)并重建缓存即可解决此问题。 +这就是处理文件无法解析问题的方式。你的系统报某个软件包或仓库信息以某种方式损坏(下载失败或手动更改 `sources.list`)。删除该文件(或所有文件)并重建缓存即可解决此问题。 #### 仍然有错误? @@ -100,7 +106,7 @@ via: https://itsfoss.com/unable-to-parse-package-file/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a71aca861855cf4b13d2209368b2814df454a8e2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 May 2020 16:21:05 +0800 Subject: [PATCH 2063/3057] PUB @geekpi https://linux.cn/article-12216-1.html --- ...pt-lists- Error in Ubuntu and Other Linux Distributions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md (98%) diff --git a/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md b/published/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md similarity index 98% rename from translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md rename to published/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md index 7fc69dfdec..41c25c7d8d 100644 --- a/translated/tech/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md +++ b/published/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12216-1.html) [#]: subject: (Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions) [#]: via: (https://itsfoss.com/unable-to-parse-package-file/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From f37554435ae620594fdd34c94cf042045ca6e6d2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 May 2020 21:57:51 +0800 Subject: [PATCH 2064/3057] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Acceleratorrrr 恭喜你完成了第一篇翻译贡献! --- ... your Linux email services with SSL-TLS.md | 101 +++++++++--------- 1 file changed, 48 insertions(+), 53 deletions(-) diff --git a/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md b/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md index 0c300160fe..7f2da93436 100644 --- a/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md +++ b/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md @@ -1,27 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (Acceleratorrrr) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to secure your Linux email services with SSL/TLS) [#]: via: (https://opensource.com/article/20/4/securing-linux-email) [#]: author: (Marc Skinner https://opensource.com/users/marc-skinner) -如何利用 SSL/TLS 保护你的Linux邮箱服务 +如何利用 SSL/TLS 保护你的 Linux 邮件服务 ====== -通过理解安全证书来保护你的Linux邮箱服务。 -![email or newsletters via inbox and browser][1] +> 通过理解安全证书来保护你的 Linux 邮件服务。 -通常,不管你是通过简单邮件传输协议(SMTP)或者邮局协议(POP)发送或者接受邮件,邮箱服务默认使用无保护明文来传输数据。近来随着数据加密成为越来越多程序的共识,你需要传输层安全性协议 / 安全套接层(SSL/TLS)的安全证书来保护你的邮箱服务。 +![](https://img.linux.net.cn/data/attachment/album/202005/13/215637khaogmririavnrlk.jpg) -首先,快速回顾一下邮箱服务和协议的基本流程。邮件通过简单邮件传输协议从端口25发出。这个协议依靠DNS邮件交换服务器里的地址信息来传输邮件。当邮件到达邮件服务器后,可以被以下两种服务中的任意一种检索:因特网信息访问协议(IMAP)使用端口143,或者邮局协议第3版本(POP3)使用端口110。然而,以上服务默认默认使用明文传输邮件和验证信息。这非常的不安全! +通常,不管你是通过简单邮件传输协议Simple Mail Transport Protocol(SMTP)或者互联网消息访问协议Internet Message Access Protocol(IMAP)或邮局协议Post Office Protocol(POP)发送或者接受邮件,邮件服务默认都是以无保护的明文来传输数据。近来随着数据加密成为越来越多程序的共识,你需要安全套接层Secure Sockets Layer/传输层安全性Transport Layer Security(SSL/TLS)的安全证书来保护你的邮件服务。 -以上服务已经添加了安全功能来保护邮件内容和验证信息,使它们可以利用SSL/TLS证书包裹和加密数据流。SSL/TLS如何加密数据的细节不在本文讨论范围,有兴趣的话可以阅读[布莱恩特关于网络安全的文章][2]。概括的说,SSL/TLS 加密本质是一种基于公钥和私钥的算法。 +首先,快速回顾一下邮件服务和协议的基本流程。邮件通过 SMTP 从 TCP 端口 25 发出。这个协议依靠 DNS 邮件交换服务器Mail eXchanger(MX)记录的地址信息来传输邮件。当邮件到达邮件服务器后,可以被以下两种服务中的任意一种检索:使用 TCP 端口 143 的 IMAP,或者使用 TCP 端口 110 的 POP3(邮局协议第 3 版)。然而,以上服务都默认使用明文传输邮件和认证信息。这非常的不安全! -通过加入新的安全功能后,这些服务可以监听新的TCP端口: +为了保护电子邮件数据和认证,这些服务都增加了一个安全功能,使它们可以利用 SSL/TLS 证书对数据流和通讯进行加密封装。SSL/TLS 是如何加密数据的细节不在本文讨论范围,有兴趣的话可以阅读 [Bryant Son 关于互联网安全的文章][2]了解更多细节。概括的说,SSL/TLS 加密是一种基于公钥和私钥的算法。 -服务 | 默认TCP端口 | SSL/TLS 端口 +通过加入这些安全功能后,这些服务将监听在新的 TCP 端口: + +服务 | 默认 TCP 端口 | SSL/TLS 端口 ---|---|--- SMTP | 25 | 587 IMAP | 143 | 993 @@ -29,63 +30,61 @@ POP3 | 110 | 995 ### 生成 SSL/TLS 证书 -[OpenSSL][3] 可以生成免费的 SSL/TLS 证书,或者你也可以从根证书颁发机构购买。过去,生成自签发证书十分简单而且通用,但是由于安全被日益重视,大部分的邮箱客户端是不信任自签发证书的,除非手动设置。 +[OpenSSL][3] 可以生成免费的 SSL/TLS 证书,或者你也可以从公共证书颁发机构Certificate Authoritie(CA)购买。过去,生成自签发证书十分简单而且通用,但是由于安全被日益重视,大部分的邮件客户端是不信任自签发证书的,除非手动设置。 -如果你只是自己使用或者做做测试,那就使用自签发证书省点钱吧。但是如果很多人或者客户也需要使用的话,那最好还是从受信任的根证书颁发机构购买。 +如果你只是自己使用或者做做测试,那就使用自签发证书省点钱吧。但是如果很多人或者客户也需要使用的话,那最好还是从受信任的证书颁发机构购买。 -总之,Linux 系统里的 OpenSSL 工具需要一个证书来生成凭证签发请求文件(CSR): +不管是哪种情况,开始请求新证书的过程是使用 Linux 系统上的 OpenSSL 工具来创建一个证书签发请求Certificate Signing Request完全合规域名Fully Qualified Domain Name(FQDN)、邮件联系信息等等。当你输入完这些信息后,私钥和 CSR 文件就生成完毕了。 #### 如果你想生成自签发证书 -如果你想要生成自签发证书的话,在运行以上 CSR 命令之前,你必须先创建一个[自签发证书机构][4]。 +如果你想要生成自签发证书的话,在运行以上 CSR 命令之前,你必须先创建一个[自己的根 CA][4]。你可以通过以下方法创建自己的根 CA。 ``` -`$ openssl genrsa -des3 -out myCA.key 2048` +$ openssl genrsa -des3 -out myCA.key 2048 ``` -命令行会提示你输入密码。请输入一个复杂点的密码而且不要弄丢了,因为这将会是自签发证书机构的密码,并且决定了其签发证书的受信任度。 +命令行会提示你输入一个密码。请输入一个复杂点的密码而且不要弄丢了,因为这将会是根 CA 私钥的密码,正如其名称所示,它是你的证书中所有信任关系的根。 -接下来,生成自签发证书机构: +接下来,生成根 CA 证书: ``` -`$ openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem` +$ openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem ``` -在回答完一些问题后,你就拥有一个有效期为5年的自签发证书机构了。 +在回答完一些问题后,你就拥有一个有效期为 5 年的根 CA 证书了。 -用之前生成的 CSR 文件,你可以向刚生成的自签发证书机构请求生成一个新的证书。 +用之前生成的 CSR 文件,你可以请求生成一个新证书,并由您刚才创建的根 CA 签名。 ``` -`$ openssl x509 -req -in mail.mydomain.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial -out mail.mydomain.pem -days 1825 -sha256` +$ openssl x509 -req -in mail.mydomain.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial -out mail.mydomain.pem -days 1825 -sha256 ``` -输入自签发证书机构的密码来生成和签发证书。 +输入你的根 CA 私钥的密码来创建和签署证书。 -现在你还需要两个文件来设置你的邮箱服务安全:私匙文件 **mail.mydomain.key**, 和证书文件 **mail.mydomain.pem**。 +现在你有了配置电子邮件服务以增强安全性所需的两个文件:私匙文件 `mail.mydomain.key` 和公开证书文件 `mail.mydomain.pem`。 #### 如果你愿意购买证书 -If you purchase a certificate from a vendor, it will ask you to upload that CSR to its system, as it is used as the input to generate the SSL/TLS certificate. The certificate will be accessible as a file (such as **mail.mydomain.pem**). Many SSL vendors also require you to download an intermediate certificate. If this is the case, you must combine the two certificate files into one, so the email service can process them both in combination. You can combine your certificate with a third-party intermediate certificate with: -如果你愿意从机构购买证书,则需要上传 CSR 文件到机构的系统中,它将会被用于生成 SSL/TLS 证书。证书可作为文件下载,比如 **mail.mydomain.pem**。很多SSL机构也需要你下载一个中间证书。这样的话,你必须把这个两个证书合并称一个,邮件服务才能够正常运行。可以使用以下命令把你的证书和第三方中间证书合并在一起: +如果你愿意从机构购买证书,则需要上传 CSR 文件到证书颁发机构的系统中,它将会被用于生成 SSL/TLS 证书。证书可作为文件下载,比如 `mail.mydomain.pem`。很多 SSL 机构也需要你下载一个中间证书。如果是这样的话,你必须把这个两个证书合并成一个,这样电子邮件服务就可以将这两个证书结合起来处理。可以使用以下命令把你的证书和第三方中间证书合并在一起: ``` -`$ cat mail.mydomain.pem gd_bundle-g2-g1.crt > mail.mydomain.pem` +$ cat mail.mydomain.pem gd_bundle-g2-g1.crt > mail.mydomain.pem ``` -值得一提的是 **.pem** 文件后缀代表隐私增强邮件。 +值得一提的是 `.pem` 文件后缀代表隐私增强邮件Privacy-Enhanced Mail。 -Now you have the two files you need to configure your email services for enhanced security: the private key file, **mail.mydomain.key**, and the public combined certificate file, **mail.mydomain.pem**. -现在你就有全部的设置邮箱服务安全所需文件了:私匙文件 **mail.mydomain.key**, 和证书文件 **mail.mydomain.pem**。 +现在你就有全部的设置邮件服务安全所需文件了:私匙文件 `mail.mydomain.key` 和组合的公开证书文件 `mail.mydomain.pem`。 ### 为你的文件生成一个安全的文件夹 -不管你是的证书是自签发的或者从机构购买,你都需要生成一个安全的,管理员权限级别的文件夹用于保存这两个文件。可以使用以下命令来生成: +不管你是的证书是自签发的或者从机构购买,你都需要生成一个安全的,管理员拥有的文件夹用于保存这两个文件。可以使用以下命令来生成: ``` $ mkdir /etc/pki/tls @@ -93,18 +92,17 @@ $ chown root:root /etc/pki/tls $ chmod 700 /etc/pki/tls ``` -在复制文件到 **/etc/pki/tls** 后,再次设置这些文件的权限: +在复制文件到 `/etc/pki/tls` 后,再次设置这些文件的权限: ``` -`$ chmod 600 /etc/pki/tls/*` +$ chmod 600 /etc/pki/tls/* ``` ### 配置你的 SMTP 和 IMAP 服务 -接下来,让 SMTP 和 IMAP 服务使用新的安全证书。我们用 **postfix** and **dovecot** 来作为例子。 +接下来,让 SMTP 和 IMAP 服务使用新的安全证书。我们用 `postfix` 和 `dovecot` 来作为例子。 -Edit ***/_****etc****_/*****postfix/main.cf** in your preferred text editor. Add the following lines: -用你顺手的编辑器来编辑 ***/_etc_/postfix/main.cf** 文件。添加以下几行: +用你顺手的编辑器来编辑 `/etc/postfix/main.cf` 文件。添加以下几行: ``` smtpd_use_tls = yes @@ -130,7 +128,7 @@ smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 ``` -**/etc/dovecot/dovecot.conf** 文件添加以下三行: +编辑 `/etc/dovecot/dovecot.conf` 文件,添加以下三行: ``` ssl = required @@ -138,7 +136,7 @@ ssl_cert = </etc/pki/tls/mail.mydomain.pem ssl_key = </etc/pki/tls/mail.mydomain.key ``` -添加更多选项来启用或禁用各种加密算法,协议等等(可选): +添加下列更多选项来启用或禁用各种加密算法、协议等等(我把这些留给你来理解): ``` ssl_cipher_list = EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:ALL:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SSLv2 @@ -147,28 +145,27 @@ ssl_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1 ssl_min_protocol = TLSv1.2 ``` -### 安全增强式Linux上下文设置 +### 设置 SELinux 上下文 -如果使用安全增强式Linux发行版,你需要给新证书文件配置正确的安全上下文。 +如果你的 Linux 发行版启用了 SELinux,请为你的新证书文件设置正确的 SELinux 上下文。 -Postfix SELinux 用户: +对于 Postfix 设置 SELinux: ``` -`$ chcon -u system_u -t cert_t mail.mydomain.*` +$ chcon -u system_u -t cert_t mail.mydomain.* ``` -Dovecot SELinux 用户: +对于 Dovecot 设置 SELinux: ``` -`$ chcon -u system_u -t dovecot_cert_t mail.mydomain.*` +$ chcon -u system_u -t dovecot_cert_t mail.mydomain.* ``` -Restart both services and connect with your updated email client configurations. Some email clients will auto-detect the new port numbers; others will require you to update them. -重启这些服务,然后联接上更新后的邮箱客户端。有些邮箱客户端会自动探测到新的端口,有些则需要你手动升级。 +重启这些服务,并与你相应更新过的电子邮件客户端配置连接。有些电子邮件客户端会自动探测到新的端口,有些则需要你手动更新。 -### 测试 +### 测试配置 -用 **openssl** 命令行和 **s_client** 插件来简单测试一下: +用 `openssl` 命令行和 `s_client` 插件来简单测试一下: ``` $ openssl s_client -connect mail.mydomain.com:993 @@ -176,10 +173,8 @@ $ openssl s_client -starttls imap -connect mail.mydomain.com:143 $ openssl s_client -starttls smtp -connect mail.mydomain.com:587 ``` -These test commands will show a plethora of data about the connection, certificate, cipher, session, and protocol you're using. This is not only a good way to validate that the new configuration is working but also to confirm you're using the appropriate certificate and security settings you defined in the **postfix** or **dovecot** configuration files. -这些测试命令会打印出很多信息,关于你使用的联接,证书,加密算法,会话和协议。这不仅是一个验证新设置的好方法,也可以检查你是否使用了适当的证书,以及 **postfix** 或者 **dovecot** 配置文件里的安全设置是否生效。 +这些测试命令会打印出很多信息,关于你使用的连接、证书、加密算法、会话和协议。这不仅是一个验证新设置的好方法,也可以确认你使用了适当的证书,以及在 postfix 或 dovecot 配置文件中定义的安全设置正确。 -Stay secure! 保持安全! -------------------------------------------------------------------------------- @@ -189,13 +184,13 @@ via: https://opensource.com/article/20/4/securing-linux-email 作者:[Marc Skinner][a] 选题:[lujun9972][b] 译者:[Acceleratorrrr](https://github.com/Acceleratorrrr) -校对:[校对者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/marc-skinner [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) -[2]: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority +[2]: https://linux.cn/article-11699-1.html [3]: https://www.openssl.org/ [4]: https://en.wikipedia.org/wiki/Root_certificate From ec783a97084d1b86d7da26a1841812d534c6142a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 May 2020 21:59:15 +0800 Subject: [PATCH 2065/3057] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Acceleratorrrr 本文首发地址:https://linux.cn/article-12217-1.html 你的 LCTT 专页地址: https://linux.cn/lctt/Acceleratorrrr 请注册以领取 LCCN: https://lctt.linux.cn/ --- ...27 How to secure your Linux email services with SSL-TLS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200427 How to secure your Linux email services with SSL-TLS.md (99%) diff --git a/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md b/published/20200427 How to secure your Linux email services with SSL-TLS.md similarity index 99% rename from translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md rename to published/20200427 How to secure your Linux email services with SSL-TLS.md index 7f2da93436..48c2138c7a 100644 --- a/translated/tech/20200427 How to secure your Linux email services with SSL-TLS.md +++ b/published/20200427 How to secure your Linux email services with SSL-TLS.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Acceleratorrrr) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12217-1.html) [#]: subject: (How to secure your Linux email services with SSL/TLS) [#]: via: (https://opensource.com/article/20/4/securing-linux-email) [#]: author: (Marc Skinner https://opensource.com/users/marc-skinner) From 6ff2bee0376978c4caf528c1320c4c8f46893484 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 14 May 2020 03:53:08 +0800 Subject: [PATCH 2066/3057] =?UTF-8?q?Revert=20"=E7=94=B3=E8=AF=B7=E7=BF=BB?= =?UTF-8?q?=E8=AF=91:=2020200410=20Get=20started=20with=20Bash=20programmi?= =?UTF-8?q?ng.md"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4835064a97994bd2ec46166b1f8bedaaf1cc4838. --- sources/tech/20200410 Get started with Bash programming.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200410 Get started with Bash programming.md b/sources/tech/20200410 Get started with Bash programming.md index cadcef4c71..875adb9876 100644 --- a/sources/tech/20200410 Get started with Bash programming.md +++ b/sources/tech/20200410 Get started with Bash programming.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (mr-ping) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9dcc10f409448c416622e36ceefd8d1a040d5810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 14 May 2020 08:03:35 +0800 Subject: [PATCH 2067/3057] Translating --- ...odify a disk image to create a Raspberry Pi-based homelab.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md b/sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md index fd73137fea..025d3a5f1c 100644 --- a/sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md +++ b/sources/tech/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 160f45ae52f2220b87e3edda9e86e2da398e33e6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 14 May 2020 08:41:14 +0800 Subject: [PATCH 2068/3057] translated --- ...buntu 20.04- Here-s What You Need to do.md | 77 ------------------- ...buntu 20.04- Here-s What You Need to do.md | 77 +++++++++++++++++++ 2 files changed, 77 insertions(+), 77 deletions(-) delete mode 100644 sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md create mode 100644 translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md diff --git a/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md b/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md deleted file mode 100644 index 3aee14cf14..0000000000 --- a/sources/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do!) -[#]: via: (https://itsfoss.com/cant-install-deb-file-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do! -====== - -_**Brief: Double clicking on the deb file doesn’t install it via the software center in Ubuntu 20.04? You are not the only one facing this issue. This tutorial shows how to fix it.**_ - -On the “[things to do after installing Ubuntu 20.04][1]” article, a few readers mentioned that they had trouble [installing software from the Deb file][2]. - -I found that strange because installing a program using the deb file is one of the simplest methods. All you have to do is to double click the downloaded file and it opens (by default) with the Software Center program. You click on install, it asks for your password and within a few seconds/minute, the software is installed. - -I had [upgraded to Ubuntu 20.04 from 19.10][3] and hadn’t faced this issue with it until today. - -I downloaded the .deb file for installing [Rocket Chat messenger][4] and when I double clicked on it to install this software, the file was opened with the archive manager. This is not what I expected. - -![DEB files opened with Archive Manager instead of Software Center][5] - -The “fix” is simple and I am going to show it to you in this quick tutorial. - -### Installing deb files in Ubuntu 20.04 - -For some reasons, the default software to open the deb file has been set to Archive Manager tool in Ubuntu 20.04. The Archive Manager tool is used for [extract zip][6] and other compressed files. - -The solution for this problem is pretty simple. You [change the default application in Ubuntu][7] for opening DEB files from Archive Manager to Software Install. Let me show you the steps. - -**Step 1:** Right click on the downloaded DEB file and select **Properties**: - -![][8] - -**Step 2:** Go to “**Open With**” tab, select “**Software Install**” app and click on “**Set as default**“. - -![][9] - -This way, all the deb files in the future will be opened with Software Install i.e. the software center applications. - -Confirm it by double clicking the DEB file and see if it open with the software center application or not. - -#### Ignorant bug or stupid feature? - -Why is deb files are supposed to be opened with Archive Manager is beyond comprehension. I do hope that this is a bug, not a weird feature like [not allowing drag and drop files on the desktop in Ubuntu 20.04][10]. - -Since we are discussing deb file installation, let me tell you about a nifty tool [gdebi][11]. It’s a lightweight application with the sole purpose of installing DEB file. Not always but some times, it can also handle the dependencies. - -You can learn more about [using gdebi and making it default for installing deb files here][12]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/cant-install-deb-file-ubuntu/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/ -[2]: https://itsfoss.com/install-deb-files-ubuntu/ -[3]: https://itsfoss.com/upgrade-ubuntu-version/ -[4]: https://rocket.chat/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/error-opening-deb-file.png?ssl=1 -[6]: https://itsfoss.com/unzip-linux/ -[7]: https://itsfoss.com/change-default-applications-ubuntu/ -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/open-deb-files.png?ssl=1 -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/deb-file-install-fix-ubuntu.png?fit=800%2C454&ssl=1 -[10]: https://itsfoss.com/add-files-on-desktop-ubuntu/ -[11]: https://launchpad.net/gdebi -[12]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ diff --git a/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md b/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md new file mode 100644 index 0000000000..40630a5829 --- /dev/null +++ b/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do!) +[#]: via: (https://itsfoss.com/cant-install-deb-file-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +无法在 Ubuntu 20.04 上安装 Deb 文件?这是你需要做的! +====== + +_**简介:双击 deb 文件后无法通过 Ubuntu 20.04 的软件中心安装?你不是唯一遇到此问题的人。本教程展示了解决方法**_ + +在“[安装 Ubuntu 20.04 之后要做的事][1]”一文中,一些读者提到他们[用 Deb 文件安装软件][2]遇到了麻烦。 + +我发现这很奇怪,因为使用 deb 文件安装程序是最简单的方法之一。你要做的就是双击下载的文件,它会在软件中心中打开(默认情况下)。单击安装,它要求你输入密码,并在几秒钟/分钟内安装了该软件。 + +我[从 19.10 升级到 Ubuntu 20.04] [3]直到今天都没有遇到这个问题。 + +我下载了 .deb 文件来安装 [Rocket Chat Messenger][4],然后双击该文件安装时,文件用存档管理器打开。这不是我所期望的。 + +![DEB files opened with Archive Manager instead of Software Center][5] + +“修复”很简单,我将在本教程中向你展示。 + +### 在 Ubuntu 20.04 中安装 deb 文件 + +由于某些原因,在 Ubuntu 20.04 中 deb 文件的默认打开程序被设置为存档管理器。存档管理器是用于[解压 zip][6] 和其他压缩文件。 + +解决此问题的方法非常简单。[在 Ubuntu 中更改默认应用][7],将打开 DEB 文件从“存档管理器”改到“软件安装”。让我告诉你步骤。 + +**步骤 1:**右键单击下载的 DEB 文件,然后选择**属性**: + +![][8] + +**步骤 2:**进入“**打开方式**”标签,选择“**软件安装**”,然后点击“**设置为默认**”。 + +![][9] + +这样,以后所有的 deb 文件都将通过“软件安装”即软件中心打开。 + +双击 DEB 文件确认,看看是否在软件中心中打开。 + +#### 忽视的 bug 还是愚蠢的功能? + +为什么会用存档管理器打开 deb 文件让人无法理解。我确实希望这是一个 bug,而不是像[在 Ubuntu 20.04 中不允许在桌面上拖放文件][10]这样的怪异功能。 + +既然我们在讨论 deb 文件的安装,就让我告诉你一个不错的工具 [gdebi][11]。它是一个轻量级应用,其唯一目的是安装 DEB 文件。有时它也可以处理依赖关系。 + +你可以了解更多有关[使用 gdebi 并默认设为安装 deb 文件的工具][12]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cant-install-deb-file-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/ +[2]: https://itsfoss.com/install-deb-files-ubuntu/ +[3]: https://itsfoss.com/upgrade-ubuntu-version/ +[4]: https://rocket.chat/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/error-opening-deb-file.png?ssl=1 +[6]: https://itsfoss.com/unzip-linux/ +[7]: https://itsfoss.com/change-default-applications-ubuntu/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/open-deb-files.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/deb-file-install-fix-ubuntu.png?fit=800%2C454&ssl=1 +[10]: https://itsfoss.com/add-files-on-desktop-ubuntu/ +[11]: https://launchpad.net/gdebi +[12]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ From 791752c478da8abe89b53d4f27d2239e25f4c866 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 14 May 2020 08:45:49 +0800 Subject: [PATCH 2069/3057] translating --- .../20200504 4 cool new projects to try in COPR for May 2020.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200504 4 cool new projects to try in COPR for May 2020.md b/sources/tech/20200504 4 cool new projects to try in COPR for May 2020.md index d1b4801083..f9db0a9f81 100644 --- a/sources/tech/20200504 4 cool new projects to try in COPR for May 2020.md +++ b/sources/tech/20200504 4 cool new projects to try in COPR for May 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d1a56652f49eea8a2bf7842b4b9ea54e33775a5f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 15 May 2020 03:51:01 +0800 Subject: [PATCH 2070/3057] Revert "request translation" This reverts commit d3f8a3daa4173a8346747cb74b137fcf554b3a53. --- ...8 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md b/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md index b777bbe74e..569981ebea 100644 --- a/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md +++ b/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (bingzxy) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,7 +7,6 @@ [#]: via: (https://opensource.com/article/20/4/linux-story) [#]: author: (James Farrell https://opensource.com/users/jamesf) -bingzxy is translating My Linux Story: From 8-bit enthusiast to Unix sysadmin ====== How my early interest in computers got me hooked on a career as a From 22f8d383ad2382b5a94362a1b18c00d954d72902 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 May 2020 08:45:02 +0800 Subject: [PATCH 2071/3057] translated --- ...ource PHP framework for web development.md | 85 ------------------- ...ource PHP framework for web development.md | 83 ++++++++++++++++++ 2 files changed, 83 insertions(+), 85 deletions(-) delete mode 100644 sources/tech/20200506 Customizing my open source PHP framework for web development.md create mode 100644 translated/tech/20200506 Customizing my open source PHP framework for web development.md diff --git a/sources/tech/20200506 Customizing my open source PHP framework for web development.md b/sources/tech/20200506 Customizing my open source PHP framework for web development.md deleted file mode 100644 index 241f31754f..0000000000 --- a/sources/tech/20200506 Customizing my open source PHP framework for web development.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Customizing my open source PHP framework for web development) -[#]: via: (https://opensource.com/article/20/5/codeigniter) -[#]: author: (Wee Ben Sen https://opensource.com/users/bswee14) - -Customizing my open source PHP framework for web development -====== -Codeigniter is a PHP framework that empowers companies to develop -high-performance websites with flexibility and ease. -![Business woman on laptop sitting in front of window][1] - -PHP Codeigniter is an open source framework providing business applications with the easy-to-use PHP programming language and powerful tools for coding. It also provides business intelligence, server monitoring, development, and application integration facilities. It's a relatively quiet project that you don't hear much about, but it's got a lot going for it that many developers new to it find surprising and refreshing. - -I use [Codeigniter][2] at my job working for an online tuition service provider in Singapore. We offer services that aren't common enough to be the default feature set for templates or existing back-ends, so I need something that provides good, solid, raw materials I can build upon. Initially, I was considering other platforms such as Wordpress for our website; however, I arrived at Codeigniter due to its flexibility and integration of functions needed in the tuition-matching process. - -Here are the points that sold me on Codeigniter: - - * Database integration with MySQL—A major functionality is allowing clients to browse the tutor database and add tutors like a "shopping cart" similar to an e-commerce platform. - * Client interface system—Users can log in to manage preferences and edit their particulars, modify subject taught, areas traveled, mobile number, address, etc. - * Customized administrator panel—The administrator can access the client's submission with a customized admin panel, which is integrated with a customer service feature so the administrator can follow up individually. - * Payment system—The admin panel comes with an invoice and payments gateway, which is integrated with Paypal. - * CMS editor interface—The administrator is able to edit text and images in the blog and subject pages, as well as add new pages. - - - -The project took around six months to complete and another two months of debugging work. If I'd had to build all of it from scratch or try to rework an existing framework to suit our needs, it would have taken longer, and I probably wouldn't have ended up with what I needed for the demands of our customers. - -### Features and benefits - -There are many more features that draw developers to PHP Codeigniter, including error handling and code formatting, which are useful in every coding situation. It supports templates, which can be used to add functionality to an existing website or to generate new ones. There are many features available for a business that needs to use a web-based system, including the ability to use custom tags. Most can be used by even an average developer who does not have any prior experience in programming. - -The key features of Codeigniter are: - - * XML core services, - * HTTP/FTP core services - * AppData and PHP sandbox features - * XSLT and HTML templates - * Encrypted information transfer - * PCM Codeigniter server monitoring - * Application integration - * File Transfer Protocol (FTP) - * Help desk support - * Apache POI (content management infrastructure used for hosting a website) - - - -#### Compatibility - -Codeigniter is compatible with many leading software applications like PHP, MySQL, [MariaDB][3], [phpMyAdmin][4], [Apache][5], OpenBSD, XSLT, [SQLite][6], and more. A number of companies prefer to use Codeigniter products for their website requirements because they are easy to work with and integrate. If you're not comfortable creating your own website, you can find many developers and design agencies that provide custom web development services. - -#### Security - -Codeigniter also provides data security through SSL encryption. The encryption protects the data from external threats such as intruders and firewalls. The data storage facility also allows for security audits of the company's website. - -#### Other features - -A good PHP web development company uses several advanced and third-party technologies such as XML and PHP. It provides organizations with a complete platform to develop professional-looking, useful websites with a business application. Codeigniter makes it easy to use third party technology, and works with common web development software. This allows web agencies to easily create websites with their chosen modules. Most PHP developers offer support and training services for individuals, as well. - -### Using PHP framework Codeigniter - -Codeigniter allows businesses to have a complete package for PHP development that will offer the right combination of power, flexibility, and performance. So far, I am very pleased with our website and I have continuously upgraded and added new features along the way. I look forward to discovering what else I can do with our website using Codeigniter. Could it be right for you too? - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/5/codeigniter - -作者:[Wee Ben Sen][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bswee14 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) -[2]: https://codeigniter.com/ -[3]: http://mariadb.org/ -[4]: https://www.phpmyadmin.net/ -[5]: http://apache.org/ -[6]: http://sqlite.org/ diff --git a/translated/tech/20200506 Customizing my open source PHP framework for web development.md b/translated/tech/20200506 Customizing my open source PHP framework for web development.md new file mode 100644 index 0000000000..59573c643d --- /dev/null +++ b/translated/tech/20200506 Customizing my open source PHP framework for web development.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Customizing my open source PHP framework for web development) +[#]: via: (https://opensource.com/article/20/5/codeigniter) +[#]: author: (Wee Ben Sen https://opensource.com/users/bswee14) + +自定义用于 Web 开发的开源 PHP 框架 +====== +Codeigniter 是一个 PHP 框架,可以使公司进行开发具有灵活性和便捷性的高性能网站。 +![Business woman on laptop sitting in front of window][1] + +PHP Codeigniter 是一个开源框架,为商业应用提供易于使用的 PHP 编程语言和强大的编码工具。它还提供商务智能、服务器监视、开发和应用集成功能。这是一个相对安静的项目,你很少听到它,但它功能强大,许多刚接触的开发人员都对此感到惊讶和耳目一新。 + +我在新加坡的一家在线学习服务提供商处使用 [Codeigniter][2]。我们提供的服务不够普遍,无法成为模板或现有后端的默认功能集,因此我需要提供可以依靠的良好,坚实,原始的东西。最初,我考虑用其他平台(如 Wordpress)用于我们的网站。但是,我决定使用 Codeigniter,因为它的灵活性,以及在学费匹配过程中需要的整合功能。 + +以下是让我使用 Codeigniter 的原因: + + * 与 MySQL 的数据库集成—一种主要功能是允许客户端浏览导师数据库并添加导师,例如类似于电子商务平台的“购物车”。 +  * 客户端界面系统—用户可以登录管理首选项并编辑详细信息,修改所教的科目、地区、手机号码、地址等。 +  * 定制的管理员面板—管理员可以使用定制的管理面板访问客户提交的内容,它与客户服务功能集成在一起,因此管理员可以单独跟进。 +  * 付款系统—管理面板带有与 Paypal 集成的发票和付款网关。 +  * CMS 编辑器界面—管理员能够编辑博客和文章中的文本和图像,以及添加新页面。 + + +该项目花费了大约六个月的时间来完成,另外花了两个月的调试时间。如果我需要从头开始构建所有,或者尝试重新设计现有的框架以满足我们的需求,那将花费更长的时间,而且可能最终无法满足客户需求。 + +### 功能和优点 + +还有许多吸引开发人员使用 PHP Codeigniter 的功能,包括错误处理和代码格式化,这些功能在每种编码情景下都非常有用。它支持模板,可用于向现有网站添加功能或生成新网站。有许多基于 web 系统商业需要的功能,包括使用自定义标签。即使没有编程经验的普通开发人员也可以使用大多数工具。 + +Codeigniter 的主要功能是: + + * XML 核心服务, +  * HTTP/FTP 核心服务 +  * AppData 和 PHP 沙箱功能 +  * XSLT 和 HTML 模板 +  * 加密的信息传输 +  * PCM Codeigniter 服务器监控 +  * 应用集成 +  * 文件传输协议(FTP) +  * 服务台支持 +  * Apache POI(用于托管网站的内容管理基础架构) + + + +#### 兼容性 + +Codeigniter 与许多领先的软件程序兼容,例如 PHP、MySQL、[MariaDB][3]、[phpMyAdmin][4]、[Apache][5]、OpenBSD、XSLT、[SQLite][6] 等。许多公司更喜欢使用 Codeigniter 产品来满足网站要求,因为它们易于使用和集成。如果你不想创建自己的网站,你可以找到许多提供自定义 Web 开发服务的开发人员和设计机构。 + +#### 安全 + +Codeigniter 还通过 SSL 加密提供数据安全性。加密可以保护数据免受入侵者和防火墙等外部威胁的侵害。数据存储功能还允许对公司网站进行安全审核。 + +#### 其它功能 + +一家优秀的 PHP Web 开发公司使用几种高级和第三方技术,例如 XML 和 PHP。它提供组织一个完整的平台来开发具有专业外观、有用的商业网站。Codeigniter 让使用第三方技术变得容易,并可以与常见的 Web 开发软件一起使用。这使得 web 公司可以轻松地使用所选模块创建网站。大多数 PHP 开发者也为个人提供支持和培训服务。 + +### 使用 PHP 框架 Codeigniter + +Codeigniter 给企业提供完整的 PHP 开发包,它将提供功能,灵活性和性能的正确组合。到目前为止,我很满意我们的网站,一直以来,我不断升级和添加新的功能。我期待用 Codeigniter 对我们的网站做些其他什么。你也是这样么? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/codeigniter + +作者:[Wee Ben Sen][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/bswee14 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://codeigniter.com/ +[3]: http://mariadb.org/ +[4]: https://www.phpmyadmin.net/ +[5]: http://apache.org/ +[6]: http://sqlite.org/ From 836a09433ab2ba234605bcc7eceab32231f28a54 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 May 2020 08:50:00 +0800 Subject: [PATCH 2072/3057] translating --- ... to use pyenv to run multiple versions of Python on a Mac.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md b/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md index 4d15072b90..34a7802f28 100644 --- a/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md +++ b/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9e9d2098d8418d1979bd41625f4fc690d07e042e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 15 May 2020 10:53:22 +0800 Subject: [PATCH 2073/3057] PRF @lxbwolf --- ... Operating Systems for Various Purposes.md | 229 +++++++++++------- 1 file changed, 143 insertions(+), 86 deletions(-) diff --git a/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md b/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md index f5fcff875b..b52d656850 100644 --- a/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md +++ b/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md @@ -1,232 +1,278 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Best Raspberry Pi Operating Systems for Various Purposes) [#]: via: (https://itsfoss.com/raspberry-pi-os/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -不同需求下各自最适合的树莓派操作系统 +用于各种用途的最佳树莓派操作系统 ====== -[树莓派][1] 是一种具有很多功能且使用便捷的不可或缺的卡片式计算机。不相信?那就[浏览下这个树莓派项目列表][2],来领会下这个小设备能做什么。 +![](https://img.linux.net.cn/data/attachment/album/202005/15/105040b17d6v7gdmj63k3k.jpg) -考虑到树莓派用途这么多,为它选择一个合适的操作系统就极其重要。当然,你可以用 Linux 做很多事,但是一个为某个目的特意配置的操作系统可以节省你大量的时间和精力。 +[树莓派][1] 是一款不可缺少的单板电脑,在很多工作中都能派上用场。不相信?只要[看看这个树莓派项目列表][2],就能了解这个小小的设备能做什么。 -因此,本文中我要介绍一些专门为树莓派量身定制的流行和有用的操作系统。 +考虑到树莓派用途这么多,为它选择一个合适的操作系统就极其重要。当然,你可以用 Linux 做很多事,但专门为特定目的配置的操作系统可以为你节省大量的时间和精力。 + +因此,本文中我要介绍一些专门为树莓派量身定制的流行且实用的操作系统。 ### 由于有树莓派镜像工具,安装任何操作系统到树莓派上都很容易 -[把树莓派操作系统安装到 SD 卡上][3] 比以前容易得多。你可以很容易地下载[树莓派镜像][4]和很快地安装树莓派操作系统。看一下官方视频,你就知道有多简单。 +[在 SD 卡上安装树莓派操作系统][3]比以前容易得多。你只需下载[树莓派镜像][4]就可以快速地安装任何树莓派操作系统。请看下面的官方视频,你就知道有多简单。 -你也可以使用 [NOOBS][5](New Out Of the Box Software)来很容易地安装不同的操作系统到树莓派上。你还可以从 [NOOBS官方下载页面][5] 提及的他们支持的零售商那里获取预先安装好系统的 SD 卡。 +- [HOW TO INSTALL RASPBIAN OS to your Raspberry Pi with ease - Raspberry Pi Imager](https://youtu.be/J024soVgEeM) -尽情去他们的[官方文档][6]里找更多关于安装操作系统的信息吧。 +你也可以使用 [NOOBS][5](新开箱即用软件New Out Of the Box Software)在树莓派上轻松安装各种的操作系统。你还可以从他们的 [NOOBS 官方下载页面][5]提到的支持的零售商列表中获得预装 SD 卡。 -[下载树莓派操作系统][4] +欢迎在他们的[官方文档][6]中了解更多关于安装操作系统的信息。 -现在你知道了怎么安装它(以及从哪儿获取),让我来重点介绍下几个有用的树莓派操作系统来帮助你。 +- [下载树莓派操作系统][4] -### 适用于树莓派的不同操作系统 +现在你知道了怎么安装它(以及从哪儿获取),让我来重点介绍几个有用的树莓派操作系统,希望对你有所帮助。 -请注意,我花了一些精力来筛选出那些被积极维护的树莓派操作系统项目。如果某个项目在不久的将来会停止维护,请在评论区告诉我,我会更新本文。 +### 适用于树莓派的各种操作系统 -另一件事是,我关注到现在最新的版本是 Raspberry 4,但是下面的列表不应被认为是适 Raspberry 4 的操作系统列表。这些系统应该能用于树莓派 3、3B+ 和其他各种版本,但是请参照项目的官方网站核对详细信息。 +请注意,我花了一些精力筛选出了那些被积极维护的树莓派操作系统项目。如果某个项目在不久的将来会停止维护,请在评论区告诉我,我会更新本文。 + +另一件事是,我关注到现在最新的版本是树莓派 4,但是下面的列表不应被认为是树莓派 4 的操作系统列表,这些系统应该也能用于树莓派 3、3B+ 和其他变种,但是请参照项目的官方网站了解详细信息。 **注意:** 排名不分先后。 -#### 1\. Raspbian OS:官方的树莓派操作系统 +#### 1、Raspbian OS:官方的树莓派操作系统 ![][7] -Raspbian 是官方支持的树莓派板操作系统。它集成了很多工具,用于教育、编程以及其他广泛的用途。特别地,它包含 Python、Scratch、Sonic Pi、Java和一些其他的很重要的包。 +Raspbian OS 是官方支持的树莓派板卡操作系统。它集成了很多工具,用于教育、编程以及其他广泛的用途。具体来说,它包含了 Python、Scratch、Sonic Pi、Java 和其他一些重要的包。 -最初,Raspbian 是基于 Debian 的,系统中预安装了很多有用的包。因此,当你安装 Raspbian 后,你可能就不需要特意安装基本工具了 — 你会发现大部分工具已经提前安装好了。 +最初,Raspbian OS 是基于 Debian 的,并预装了大量有用的包。因此,当你安装 Raspbian OS 后,你可能就不需要特意安装基本工具了 — 你会发现大部分工具已经提前安装好了。 Raspbian OS 是被积极地维护着的,它也是最流行的树莓派操作系统之一。你可以使用 [NOOBS][5] 或参照[官方文档][6]来安装它。 -[Raspbian OS][8] +- [Raspbian OS][8] -#### 2\. Ubuntu MATE:适合通用计算需求 +#### 2、Ubuntu MATE:适合通用计算需求 ![][9] -虽然 Raspbian 是官方支持的操作系统,但是对于最新和最好的包它往往不能及时支持。因此,如果你想更新得更快并且在将来想用最新的包,你可以试试树莓派版本的 Ubuntu MATE。 +尽管 Raspbian 是官方支持的操作系统,但它的特点不是最新、最大的软件包。因此,如果你想更快的更新,想用最新的包,你可以试试 Ubuntu MATE 的树莓派版本。 -树莓派定制版的 Ubuntu MATE 是很适合安装的不可思议的轻量级发行版本。它还被广泛用于 [NVIDIA 的 Jetson Nano][10]。换言之,你可以在树莓派的很多场景下使用它。 +Ubuntu MATE 的树莓派定制版是值得安装的非常不错的轻量级发行版。它还被广泛用于 [NVIDIA 的 Jetson Nano][10]。换言之,你可以在树莓派的很多场景下使用它。 为了更好地帮助你,我们还有一份详细的教程:[怎样在树莓派上安装 Ubuntu MATE][11]。 -[Ubuntu MATE for Raspberry Pi][12] +- [Ubuntu MATE for Raspberry Pi][12] -#### 3\. Ubuntu Server:把树莓派作为一台 Linux 服务器来使用 +#### 3、Ubuntu Server:把树莓派作为一台 Linux 服务器来使用 ![][13] -如果你计划把你的树莓派当作你项目的服务器来使用,那么安装 Ubuntu Server 会是一个不错的选择。 +如果你计划把你的树莓派当作项目的某个服务器来使用,那么安装 Ubuntu Server 会是一个不错的选择。 -Ubuntu Server 有 32 位和 64 位的镜像。你可以根据你的板的类型(是否支持 64 位)来选择对应的操作系统。 +Ubuntu Server 有 32 位和 64 位的镜像。你可以根据你的板卡类型(是否支持 64 位)来选择对应的操作系统。 然而,值得注意的一点是 Ubuntu Server 不是为桌面用户定制的。因此,你需要留意 Ubuntu Server 默认不会安装图形用户界面。 -[Ubuntu Server][14] +- [Ubuntu Server][14] -#### 4\. LibreELEC:适合做媒体服务器 +#### 4、LibreELEC:适合做媒体服务器 ![][15] 我们已经有一个 [Linux 下可用的媒体服务器软件][16],LibreELEC 在列表中。 -它是一个伟大的轻量级操作系统,让你可以在树莓派上安装 [KODI][17]。你可以尝试使用 Raspberry Pi Imager 来安装它。 +它是一个很棒的轻量级操作系统,让你可以在树莓派上安装 [KODI][17]。你可以尝试使用树莓派镜像工具来安装它。 -你可以很容易地找到他们的[官方下载页面][18],并找到适合你板子的安装镜像。 +你可以很容易地找到他们的[官方下载页面][18],并找到适合你板卡的安装镜像。 -[LibreELEC][19] +- [LibreELEC][19] -#### 5\. OSMC:适合做媒体服务器 +#### 5、OSMC:适合做媒体服务器 ![][20] OSMC 是另一个 Linux 下[流行的媒体服务器软件][16]。如果要把树莓派板作为媒体中心设备,那么 OSMC 是你可以向他人推荐的操作系统之一。 -类似 LibreELEC,OSMC 也运行 KODI 来帮助你管理你的媒体文件和享受你已有的素材中。 +类似 LibreELEC,OSMC 也运行 KODI,可以帮助你管理你的媒体文件和欣赏你已有的素材。 -OSMC 官方没有提及对 **Raspberry Pi 4** 的支持。因此,如果你的树莓派是 Raspberry Pi 3 或更早的版本,那么应该没有问题。 +OSMC 没有正式提及对树莓派 4 的支持。因此,如果你的树莓派是树莓派 3 或更早的版本,那么应该没有问题。 -[OSMC][21] +- [OSMC][21] -#### 6\. RISC OS:传统的 ARM 操作系统 +#### 6、RISC OS:最初的 ARM 操作系统 ![][22] -ARM 设备的原始草稿版,RISC 已经存在了差不多 30 年了。 +RISC OS 最初是为 ARM 设备打造的,至今已有近 30 年左右的历史。 -如果你想了解,我们也有篇详细介绍 [RISC OS][23] 的文章。简而言之,RISC OS 也是为诸如树莓派的现代基于 ARM 的卡片式计算机定制的。它的用于界面很简单,更专注于性能。 +如果你想了解,我们也有篇详细介绍 [RISC OS][23] 的文章。简而言之,RISC OS 也是为诸如树莓派的现代基于 ARM 的单板计算机定制的。它的用户界面很简单,更专注于性能。 -同样的,这个系统也不支持 Raspberry Pi 4。因此,如果你的树莓派是 Raspberry Pi 3 或更早的版本,你可以试一下。 +同样的,这并不是为树莓派 4 量身定做的。因此,如果你的树莓派是 3 或更早的版本,你可以试一下。 -[RISC OS][24] +- [RISC OS][24] -#### 7\. Mozilla WebThings Gateway:适合 IoT 项目 +#### 7、Mozilla WebThings Gateway:适合 IoT 项目 ![][25] -作为 Mozilla 的 [IoT 设备的开源实现][26] 的一部分,WebThings Gateway 让你可以监控和控制连接的 IoT 设备。 +作为 Mozilla 的 [IoT 设备的开源实现][26]的一部分,WebThings Gateway 让你可以监控和控制所有连接的 IoT 设备。 你可以参考[官方文档][27]来检查所需的环境,遵照指导把安装到树莓派上。它确实是适合 IoT 应用的最有用的树莓派操作系统之一。 -[WebThings Gateway][28] +- [WebThings Gateway][28] -#### 8\. Ubuntu Core:适合 IoT 项目 +#### 8、Ubuntu Core:适合 IoT 项目 -另一个适合 [IoT][29] 应用的树莓派操作系统,或者仅仅用来测试一下 — Ubuntu Core。 +Ubuntu Core 是又一个树莓派操作系统,适用于潜在的 [IoT][29] 应用,或者只是测试一下 Snap。 -Ubuntu Core 是为 IoT 设备或特定的树莓派特意定制。我不会刻意主张大家使用它 — 但是 Ubuntu Core 是适合树莓派板的安全的操作系统。你可以自己尝试一下! +Ubuntu Core 是专门为 IoT 设备或者具体来说是树莓派定制的。我不会刻意宣传它 —— 但是 Ubuntu Core 是一款适合树莓派板卡的安全操作系统。你可以自己尝试一下! -[Ubuntu Core][30] +- [Ubuntu Core][30] -#### 9\. DietPi:轻量级树莓派操作系统 +#### 9、DietPi:轻量级树莓派操作系统 -![DietPi Screenshot via Distrowatch][31] +![][31] DietPi 是一款轻量级的 [Debian][32] 操作系统,它还宣称比 “Raspbian Lite” 操作系统更轻量。 -考虑到它是一款轻量级的树莓派操作系统,它在很多使用场景下以很便捷的方式提供了大量的功能。从简单的软件安装包到备份解决方案,还有很多功能等待发掘。 +虽然它被视作一款轻量级的树莓派操作系统,但它提供了很多功能,可以在多个使用场景中派上用场。从简单的软件安装包到备份解决方案,还有很多功能值得探索。 如果你想安装一个低内存占用而性能相对更好的操作系统,你可以尝试一下 DietPi。 -[DietPi][33] +- [DietPi][33] -#### 10\. Lakka Linux:打造复古的游戏控制台 +#### 10、Lakka Linux:打造复古的游戏主机 ![][34] -想让你的树莓派变成一个复古的游戏控制台? +想让你的树莓派变成一个复古的游戏主机? -Lakka Linux 发行版本最初是在 RetroArch 模拟器中构建的。因此,你可以立刻在树莓派上获得所有的复古游戏。 +Lakka Linux 发行版本最初是建立在 RetroArch 模拟器上的。因此,你可以立刻在树莓派上获得所有的复古游戏。 如果你想了解,我们也有一篇介绍 [Lakka Linux][35] 的文章。或者直接上手吧! -[Lakka][36] +- [Lakka][36] -#### 11\. RetroPie:适合复古游戏 +#### 11、RetroPie:适合复古游戏 -![ ][37] +![][37] -RetroPie 是另一款可以让树莓派变成复古游戏控制台的树莓派操作系统。它提供了很多配置工具,因此你可以自定义主题,或者调整模拟器来找到最好的复古游戏。 +RetroPie 是另一款可以让树莓派变成复古游戏主机的树莓派操作系统。它提供了几个配置工具,让你可以自定义主题,或者调整模拟器即可拥有最好的复古游戏。 值得注意的是它不包含任何有版权的游戏。你可以试一下,看看它是怎么工作的! -[RetroPie][38] +- [RetroPie][38] -#### 12\. Kali Linux:适合低成本入侵 +#### 12、Kali Linux:适合低成本渗透 ![][39] -想要在你的树莓派上尝试和学习一些渗透测试技巧?Kali Linux 会是最佳选择。是的,Kali Linux 通常会支持最新的树莓派。 +想要在你的树莓派上尝试和学习一些道德黑客技巧吗?[Kali Linux][64] 会是最佳选择。是的,Kali Linux 通常在最新的树莓派一发布就会支持它。 Kali Linux 不仅适合树莓派,它也支持很多其他设备。尝试一下,玩得愉快! -[Kali Linux][40] +- [Kali Linux][40] -#### 13\. OpenMediaVault:适合网络附加存储Network Attached Storage +#### 13、OpenMediaVault:适合网络附加存储(NAS) ![][41] -如果你想在最小的硬件上搭建 [NAS][42] 解决方案,树莓派可以帮助你。 +如果你想在极简的硬件上搭建 [NAS][42] 解决方案,树莓派可以帮助你。 -OpenMediaVault 最初是基于 Debian Linux 的,提供了大量功能,如基于 web 的管理员能力、插件支持,等等。它支持大多数树莓派模块,因此你可以尝试下载并安装它! +OpenMediaVault 最初是基于 Debian Linux 的,提供了大量功能,如基于 Web 的管理能力、插件支持,等等。它支持大多数树莓派型号,因此你可以尝试下载并安装它! -[OpenMediaVault][43] +- [OpenMediaVault][43] -#### 14\. ROKOS:适合加密挖矿 +#### 14、ROKOS:适合加密挖矿 ![][44] 如果你对加密货币和比特币很感兴趣,那么 ROKOS 会吸引你。 -ROKOS 是基于 Debian 的操作系统,预安装的驱动和包基本可以让你的树莓派变成一个节点。当然,在安装之前你需要了解它是怎么工作的。因此,如果你对此不太了解,我建议你先调研下。 +ROKOS 是基于 Debian 的操作系统,基本上可以让你把你的树莓派变成一个节点,同时预装了相应的驱动程序和软件包。当然,在安装之前你需要了解它是怎么工作的。因此,如果你对此不太了解,我建议你先调研下。 -[ROKOS][45] +- [ROKOS][45] -#### 15\. Alpine Linux:专注于安全的轻量级 Linux +#### 15、Alpine Linux:专注于安全的轻量级 Linux 当今年代,很多用户都在寻找专注于安全和[隐私的发行版本][46]。如果你也是其中一员,你可以试试在树莓派上安装 Alpine Linux。 -如果你是个树莓派新手,它可能不像你想象的那样对用户友好(或对新手友好)。但是,如果你想尝试一些不一样的东西,那么你可以试试 Alpine Linux 这个专注于安全的 Linux 发行版本。 +如果你是个树莓派新手,它可能不像你想象的那样对用户友好(或者说对初学者来说容易上手)。但是,如果你想尝试一些不一样的东西,那么你可以试试 Alpine Linux 这个专注于安全的 Linux 发行版本。 -[Alpine Linux][47] +- [Alpine Linux][47] -#### 16\. Kano OS:适合儿童教育的操作系统 +#### 16、Kano OS:适合儿童教育的操作系统 ![][48] 如果你在寻找一款能让学习变得有趣还能教育儿童的树莓派操作系统,那么 Kano OS 是个不错的选择。 -它是被积极地维护着的,Kano 操作系统上的桌面对于儿童玩和学习的用户体验都是很简单的。 +它正在积极维护中,而且 Kano OS 上的桌面集成的用户体验相当简单,玩起来也很有趣,可以让孩子们从中学习。 -[Kano OS][49] +- [Kano OS][49] -#### 17\. KDE Plasma Bigscreen:适合把普通 TV 转换为智能 TV +#### 17、KDE Plasma Bigscreen:把普通电视转换为智能电视 ![][50] -这是 KDE 的子开发项目。在树莓派上安装 [KDE Plasma Bigscreen OS][51] 后,你可以把普通 TV 变成智能 TV。 +这是 KDE 一个正在开发中的项目。在树莓派上安装 [KDE “等离子大屏”][51] 后,你可以把普通电视变成智能电视。 -你不需要特殊的远程服务器来控制 TV。你可以使用普通的远程控制。 +你不需要特殊的遥控器来控制电视,你可以使用普通的遥控器。 -Plasma Bigscreen 也集成了 [MyCroft open source AI][52] 作为声控。 +“等离子大屏”也集成了 [MyCroft 开源 AI][52] 作为声控。 -这个项目还在内测阶段,所以如果你想尝试,可能会有一些 bug 和问题。 +这个项目还在测试阶段,所以如果你想尝试,可能会有一些错误和问题。 -[Plasma Bigscreen][53] +- [Plasma Bigscreen][53] -#### 结语 +#### 18、Manjaro Linux:为你提供多功能的桌面体验 -我知道还有很多为树莓派定制的操作系统 — 但是我尽力列出了被积极维护的最流行的或最有用的操作系统。 +![][54] -如果你觉得我遗漏了最合适的树莓派操作系统,尽情在下面的评论去告诉我吧! +如果你想在树莓派上寻找一个基于 Arch 的 Linux 发行版,那么 Manjaro Linux 应该是一个很好的补充,它可以做很多事情,适合一般的计算任务。 + +Manjaro Linux ARM 版也支持最新的树莓派 4。它为你的树莓派或任何[树莓派替代品][55]提供了 XFCE 和 KDE Plasma 变体。 + +此外,它似乎还提供了树莓派设备上最快/最好的体验之一。如果你还没试过,那就试试吧! + +- [Manjaro ARM][56] + +#### 19、Volumio:作为一个开源音乐播放器使用 + +![][57] + +想做一个廉价的音乐发烧友系统?Volumio 应该可以帮到你。 + +它是一个自由而开源的操作系统([GitHub][58]),还支持集成多个设备的能力。你可以通过一个简单的 Web 控制界面,对所有连接的设备进行管理。除了免费版之外,它还提供了一个高级版,可以让你获得独家功能。 + +它也确实支持最新的树莓派 4。所以,如果你对调整已有的家庭立体声系统有一定的兴趣,想要获得最佳的音质,不妨试试这个。 + +- [Volumio][59] + +#### 20、FreeBSD + +不想使用 Linux 发行版?不用担心,你也可以用 FreeBSD 在树莓派上安装一个类 UNIX 操作系统。 + +如果你不知道的话,我们有一篇关于 [FreeBSD 项目][60]的详细文章。 + +一旦你按照他们的[官方说明][61]安装好之后,你可以利用它来进行任何 DIY 实验,或者只是把它作为一个轻量级的桌面系统来完成特定的任务。 + +- [FreeBSD][62] + +#### 21、NetBSD + +NetBSD 是另一个令人印象深刻的类 UNIX 操作系统,你可以在树莓派上安装。它的目标是成为一个跨多个系统的便携式操作系统。 + +如果你在其他系统中使用过它,你可能已经知道它的好处了。然而,它不仅仅是一个轻量级的便携式操作系统,它的特点是拥有一套有用的功能,可以完成各种任务。 + +- [NetBSD][63] + +### 结语 + +我相信还有很多为树莓派定制的操作系统 — 但是我尽力列出了被积极维护的最流行的或最有用的操作系统。 + +如果你觉得我遗漏了最合适树莓派的操作系统,尽情在下面的评论去告诉我吧! -------------------------------------------------------------------------------- @@ -235,7 +281,7 @@ via: https://itsfoss.com/raspberry-pi-os/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -243,7 +289,7 @@ via: https://itsfoss.com/raspberry-pi-os/ [b]: https://github.com/lujun9972 [1]: https://www.raspberrypi.org/ [2]: https://itsfoss.com/raspberry-pi-projects/ -[3]: https://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/ +[3]: https://linux.cn/article-12136-1.html [4]: https://www.raspberrypi.org/downloads/ [5]: https://www.raspberrypi.org/downloads/noobs/ [6]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md @@ -251,7 +297,7 @@ via: https://itsfoss.com/raspberry-pi-os/ [8]: https://www.raspbian.org/ [9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/04/Desktop-ubuntu.jpg?resize=800%2C600&ssl=1 [10]: https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/ -[11]: https://itsfoss.com/ubuntu-mate-raspberry-pi/ +[11]: https://linux.cn/article-10817-1.html [12]: https://ubuntu-mate.org/raspberry-pi/ [13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubunt-server.png?ssl=1 [14]: https://ubuntu.com/download/raspberry-pi @@ -275,7 +321,7 @@ via: https://itsfoss.com/raspberry-pi-os/ [32]: https://www.debian.org/ [33]: https://dietpi.com/ [34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/08/lakkaos.jpg?resize=1024%2C640&ssl=1 -[35]: https://itsfoss.com/lakka-retrogaming-linux/ +[35]: https://linux.cn/article-10158-1.html [36]: http://www.lakka.tv/ [37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/retro-pie.png?ssl=1 [38]: https://retropie.org.uk/ @@ -294,3 +340,14 @@ via: https://itsfoss.com/raspberry-pi-os/ [51]: https://itsfoss.com/kde-plasma-bigscreen/ [52]: https://itsfoss.com/mycroft-mark-2/ [53]: https://plasma-bigscreen.org/#download-jumpto +[54]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/manjaro-arm.jpg?w=800&ssl=1 +[55]: https://linux.cn/article-10823-1.html +[56]: https://manjaro.org/download/#raspberry-pi-4 +[57]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/volumio.jpg?w=800&ssl=1 +[58]: https://github.com/volumio +[59]: https://volumio.org/ +[60]: https://itsfoss.com/freebsd-interview-deb-goodkin/ +[61]: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-freebsd-for-raspberry-pi/ +[62]: https://www.freebsd.org/ +[63]: https://www.netbsd.org/ +[64]: https://linux.cn/article-10690-1.html From 705953932104d1946cb90ce7326b476b153ad818 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 15 May 2020 10:56:55 +0800 Subject: [PATCH 2074/3057] PUB @lxbwolf https://linux.cn/article-12219-1.html --- ...est Raspberry Pi Operating Systems for Various Purposes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md (99%) diff --git a/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md b/published/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md similarity index 99% rename from translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md rename to published/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md index b52d656850..25ebd65fcd 100644 --- a/translated/tech/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md +++ b/published/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12219-1.html) [#]: subject: (Best Raspberry Pi Operating Systems for Various Purposes) [#]: via: (https://itsfoss.com/raspberry-pi-os/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From a8a6cac14a768e215324407f10783791fffa8cc9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 15 May 2020 11:22:31 +0800 Subject: [PATCH 2075/3057] PRF @geekpi --- ...buntu 20.04- Here-s What You Need to do.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md b/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md index 40630a5829..e5accd88eb 100644 --- a/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md +++ b/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do!) @@ -10,13 +10,15 @@ 无法在 Ubuntu 20.04 上安装 Deb 文件?这是你需要做的! ====== -_**简介:双击 deb 文件后无法通过 Ubuntu 20.04 的软件中心安装?你不是唯一遇到此问题的人。本教程展示了解决方法**_ +> 双击 deb 文件后无法通过 Ubuntu 20.04 的软件中心安装?你不是唯一遇到此问题的人。本教程展示了解决方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/15/112149cfdyg556upv6vd66.jpg) 在“[安装 Ubuntu 20.04 之后要做的事][1]”一文中,一些读者提到他们[用 Deb 文件安装软件][2]遇到了麻烦。 我发现这很奇怪,因为使用 deb 文件安装程序是最简单的方法之一。你要做的就是双击下载的文件,它会在软件中心中打开(默认情况下)。单击安装,它要求你输入密码,并在几秒钟/分钟内安装了该软件。 -我[从 19.10 升级到 Ubuntu 20.04] [3]直到今天都没有遇到这个问题。 +我[从 19.10 升级到 Ubuntu 20.04][3]直到今天都没有遇到这个问题。 我下载了 .deb 文件来安装 [Rocket Chat Messenger][4],然后双击该文件安装时,文件用存档管理器打开。这不是我所期望的。 @@ -30,7 +32,7 @@ _**简介:双击 deb 文件后无法通过 Ubuntu 20.04 的软件中心安装 解决此问题的方法非常简单。[在 Ubuntu 中更改默认应用][7],将打开 DEB 文件从“存档管理器”改到“软件安装”。让我告诉你步骤。 -**步骤 1:**右键单击下载的 DEB 文件,然后选择**属性**: +**步骤 1:**右键单击下载的 .deb 文件,然后选择**属性**: ![][8] @@ -38,11 +40,11 @@ _**简介:双击 deb 文件后无法通过 Ubuntu 20.04 的软件中心安装 ![][9] -这样,以后所有的 deb 文件都将通过“软件安装”即软件中心打开。 +这样,以后所有的 .deb 文件都将通过“软件安装”即软件中心打开。 -双击 DEB 文件确认,看看是否在软件中心中打开。 +双击 .deb 文件确认,看看是否在软件中心中打开。 -#### 忽视的 bug 还是愚蠢的功能? +### 忽视的 bug 还是愚蠢的功能? 为什么会用存档管理器打开 deb 文件让人无法理解。我确实希望这是一个 bug,而不是像[在 Ubuntu 20.04 中不允许在桌面上拖放文件][10]这样的怪异功能。 @@ -57,13 +59,13 @@ via: https://itsfoss.com/cant-install-deb-file-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://itsfoss.com/author/abhishek/ [b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/ +[1]: https://linux.cn/article-12183-1.html [2]: https://itsfoss.com/install-deb-files-ubuntu/ [3]: https://itsfoss.com/upgrade-ubuntu-version/ [4]: https://rocket.chat/ From a0120f08376399cc2402e52faafb351b0c2b71e4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 15 May 2020 11:23:07 +0800 Subject: [PATCH 2076/3057] PUB @geekpi https://linux.cn/article-12220-1.html --- ...ll Deb File on Ubuntu 20.04- Here-s What You Need to do.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md (98%) diff --git a/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md b/published/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md similarity index 98% rename from translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md rename to published/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md index e5accd88eb..bc6bc1aec8 100644 --- a/translated/tech/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md +++ b/published/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12220-1.html) [#]: subject: (Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do!) [#]: via: (https://itsfoss.com/cant-install-deb-file-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From b85efc1a50298b1395a1a76840c9390f2fdefcda Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 May 2020 11:37:10 +0800 Subject: [PATCH 2077/3057] PRF @geekpi --- ...fce With KDE Plasma Desktop Environment.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md b/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md index 1b9d4bb57a..9084834ad7 100644 --- a/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md +++ b/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment) @@ -10,7 +10,7 @@ Ubuntu Studio 将用 KDE Plasma 桌面环境替换 Xfce ====== -[Ubuntu Studio][1] 是一个流行的 [Ubuntu 官方变种][2],它是为从事音频制作、视频、图形、摄影和书籍出版的创意内容创建者量身定制的。它提供了许多拥有良好体验的开箱即用的多媒体内容创建应用。 +[Ubuntu Studio][1] 是一个流行的 [Ubuntu 官方变种][2],它是为从事音频制作、视频、图形、摄影和书籍出版的创意内容创建者量身定制的。它提供了许多多媒体内容创建应用,开箱即用,体验极佳。 在最近的 20.04 LTS 版本发布之后,Ubuntu Studio 团队在其[官方公告][3]中强调了一些非常重要的内容。而且,也许不是每个人都注意到关键信息,即 Ubuntu Studio 的未来。 @@ -20,31 +20,31 @@ Ubuntu Studio 20.04 将是带有 [Xfce 桌面环境][4]的最后一个版本。 ![][6] -据他们的澄清,Ubuntu Studio 并不致力于任何特定的外观,而是致力于提供最佳的用户体验。同时,KDE 被证明是一个更好的选择。 +据他们的澄清,Ubuntu Studio 并不专注于任何特定的外观/感受,而是旨在提供最佳的用户体验。同时,KDE 被证明是一个更好的选择。 -> Plasma 已被证明为图形艺术家和摄影师提供了更好的工具,例如在 Gwenview、Krita 甚至文件管理器 Dolphin 中都可以看到。此外,它对 Wacom 平板的支持比其他任何桌面环境都更好。 +> 事实证明,Plasma 为图形艺术家和摄影师提供了更好的工具,例如在 Gwenview、Krita 甚至文件管理器 Dolphin 中都可以看出。此外,它对 Wacom 平板的支持比其他任何桌面环境都更好。 -> 它已经变得不错,以至于大多数 Ubuntu Studio 团队现在都使用 Kubuntu,并通过 Ubuntu Studio Installer 将 Ubuntu Studio 作为日常附加驱动使用。由于我们中的许多人都在使用 Plasma,因此在我们的下一个版本中过渡到 Plasma 的时机似乎是正确的。 +> 它已经变得如此之好,以至于现在大部分 Ubuntu Studio 团队成员都在使用通过 Ubuntu Studio 安装程序添加了 Ubuntu Studio 的 Kubuntu 作为日常工作使用。既然我们中的这么多人都在使用 Plasma,因此在我们的下一个版本中过渡到 Plasma 似乎是个好时机。 -当然,每个桌面环境都针对不同的内容进行了量身定制。他们认为 KDE Plasma 将是取代 XFCE 的最适合的桌面环境,从而为所有用户提供更好的用户体验。 +当然,每一个桌面环境都是针对不同的用户量身定制的。在此,他们认为 KDE Plasma 是最适合取代 XFCE 的桌面环境,可以为所有用户提供更好的用户体验。 -尽管我不确定用户对此会有何反应,因为每个用户都有不同的偏好。如果现有用户对 KDE 没有问题,那就没什么大不了的。 +尽管我不确定用户对此会有何反应,因为每个用户都有不同的偏好。如果现有用户对 KDE 没有问题,那就没什么大问题。 值得注意的是,Ubuntu Studio 还提到了为什么 KDE 可能是它们的更好选择: ->在没有 Akonadi 的情况下,Plasma 桌面环境的资源使用与 Xfce 一样轻,甚至更轻。Fedora Jam 和 KXStudio 等其他以音频为重点的 Linux 发行版在历史上一直使用 KDE Plasma 桌面环境,并且在音频方面做得很好。 +> 在没有 Akonadi 的情况下,Plasma 桌面环境的资源使用与 Xfce 一样轻量级,甚至更轻。Fedora Jam 和 KXStudio 等其他以音频为重点的 Linux 发行版在历史上一直使用 KDE Plasma 桌面环境,并且在音频方面做得很好。 -此外,他们还强调了[福布斯杂志中 Jason Evangelho 的文章][7],其中一些基准测试表明 KDE 几乎与 Xfce 一样轻。即使这是一个好征兆,我们仍然必须等待用户测试 KDE 驱动的 Ubuntu Studio。只有这样,我们才能观察 Ubuntu Studio 放弃 XFCE 桌面环境的决定是否正确。 +此外,他们还强调了 [Jason Evangelho 在福布斯杂志上的一篇文章][7],其中一些基准测试表明 KDE 几乎与 Xfce 一样轻量级。尽管这是一个好的迹象,我们仍然需要等待用户试驾 KDE 驱动的 Ubuntu Studio。只有这样,我们才能观察到 Ubuntu Studio 放弃 XFCE 桌面环境的决定是否正确。 ### 更改后,Ubuntu Studio 用户将发生什么变化? -在带 KDE 的 Ubuntu Studio 20.10 及更高版本上可能会影响(或改进)整个工作流程。 +在带有 KDE 的 Ubuntu Studio 20.10 及更高版本上的整体工作流程可能会受到影响(或改善)。 -但是,升级过程(从 20.04 到 20.10)将导致系统损坏。因此,全新安装 Ubuntu Studio 20.10 或更高版本将是唯一的方法。 +但是,升级过程(从 20.04 到 20.10)会导致系统损坏。因此,全新安装 Ubuntu Studio 20.10 或更高版本将是唯一的方法。 -他们还提到,他们将不断评估与预安装的应用是否存在重复。因此,我相信在接下来的几天中将会有更多细节。 +他们还提到,他们还会不断评估与预安装的应用是否存在重复。所以,相信在未来的日子里,更多的细节也会随之而来。 -Ubuntu Studio 是最近第二个切换它主要桌面环境的发行版。先前,[Lubuntu] [8] 从 LXDE 切换到 LXQt。 +Ubuntu Studio 是最近一段时间内第二个改变了主桌面环境的发行版。先前,[Lubuntu][8] 从 LXDE 切换到 LXQt。 你如何看待这种变化?欢迎在下面的评论中分享你的想法。 @@ -55,7 +55,7 @@ via: https://itsfoss.com/ubuntu-studio-opts-for-kde/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 09830a985a037ed69c1db7c046f56bb9ebd5ef29 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 May 2020 11:37:37 +0800 Subject: [PATCH 2078/3057] PUB @geekpi https://linux.cn/article-12223-1.html --- ...dio To Replace Xfce With KDE Plasma Desktop Environment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md (98%) diff --git a/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md b/published/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md similarity index 98% rename from translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md rename to published/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md index 9084834ad7..d349c73567 100644 --- a/translated/tech/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md +++ b/published/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12223-1.html) [#]: subject: (Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment) [#]: via: (https://itsfoss.com/ubuntu-studio-opts-for-kde/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 7237d17d242f02278e711696ef71a50261d8bde5 Mon Sep 17 00:00:00 2001 From: Acceleratorrrr <542383480@qq.com> Date: Sat, 16 May 2020 12:22:31 +0100 Subject: [PATCH 2079/3057] Translate request 20200408 --- ...08 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md b/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md index 569981ebea..ba7cfef720 100644 --- a/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md +++ b/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Acceleratorrrr) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c9e270c96c269f320109f5fd5c152a9c7a4e739b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 May 2020 11:02:32 +0800 Subject: [PATCH 2080/3057] PRF @geekpi --- ...h FreeBSD as a desktop operating system.md | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md b/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md index ceebbcfa81..a8a049554b 100644 --- a/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md +++ b/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md @@ -1,44 +1,46 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with FreeBSD as a desktop operating system) [#]: via: (https://opensource.com/article/20/5/furybsd-linux) [#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) -开始用 FreeBSD 作为桌面操作系统 +使用 FreeBSD 作为桌面操作系统 ====== -FuryBSD 的 live 桌面环境能让你在实际使用之前先尝试。 -![web development and design, desktop and browser][1] -[FreeBSD][2] 是一个很棒的操作系统,但是从设计上讲,它没有桌面环境。如果不从 FreeBSD 的 [ports 和软件包集][3]安装其他软件,那么 FreeBSD 仅能体验命令行。下面的截图显示了在安装过程中选择了每个“可选系统组件”后,登录 FreeBSD 12.1 的样子。 - -![FreeBSD][4] - -可以将 FreeBSD 变成包含各种桌面环境的操作系统,但是这需要时间、精力和[遵循大量书面说明][5]。使用使用 **desktop-installer** 包(为用户提供基于文本的菜单并帮助自动执行大部分过程)仍然非常耗时。这两种方法的最大问题是,用户在花了很多时间进行设置之后,可能会发现他们的系统与 FreeBSD 不完全兼容。 - -[FuryBSD][6] 通过提供 live 桌面镜像来解决此问题,用户可以在安装之前对其进行评估。目前,FuryBSD 提供 Xfce 镜像和 KDE 镜像。每个镜像都提供已预安装桌面环境的 FreeBSD。如果用户试用镜像并发现其硬件工作正常,那么他们可以安装 FuryBSD,并拥有由 FreeBSD 提供支持的即用桌面操作系统。在本文中,我将使用 Xfce 镜像,但 KDE 镜像的使用完全一样。 - -对于任何安装过 Linux 发行版、BSD 或任何其他类 Unix 的开源操作系统的人,开始用 FuryBSD 都应该是一个熟悉的过程。从 FuryBSD 网站下载 ISO,将它复制到闪存,然后从闪存启动计算机。如果从闪存引导失败,请确保安全引导已禁用。 - -![FuryBSD Live XFCE Desktop][7] - -从闪存启动后,桌面环境将自动加载。除了“家”、“文件系统”和“回收站”图标外,live 桌面还有用于配置 Xorg 的工具、入门指南、FuryBSD 安装程序和系统信息程序的图标。除了这些额外功能以及一些自定义的 Xfce 设置和墙纸外,桌面环境除了基本的 Xfce 应用和 Firefox 之外并没有其他功能。 - -![FuryBSD Xorg Tool][8] - -此时仅加载基本的图形驱动,但足以检查 FuryBSD 是否支持系统的有线和无线网络接口。如果没有网络接口自动工作,那么 **Getting Started.txt** 文件包含有关尝试配置网络接口和其他配置任务的说明。如果至少有一个网络接口有效,那么可以使用 **Configure Xorg** 应用安装 Intel、NVidia 或 VirtualBox 图形驱动。它将下载并安装驱动,并且需要重新启动 Xorg。如果系统未自动重新登录到 live 用户,那么密码为 **furybsd**。配置后,图形驱动将转移到已安装的系统中。 - -![FuryBSD Installer - ZFS Configuration][9] - -如果一切都可以在 live 环境中正常运行,那么 FuryBSD 安装程序可以将 FuryBSD 配置并安装到计算机上。该安装程序在终端中运行,但提供与大多数其他 BSD 和 Linux 安装程序相同的选项。系统将要求用户设置系统的主机名、配置 ZFS 存储,设置 root 密码,添加至少一个非 root 用户以及配置时间和日期。完成后,系统可以引导到预装有 Xfce (或 KDE)的 FreeBSD 中。FuryBSD 完成了所有困难的工作,甚至还花了很多精力使桌面看起来更漂亮。 +> FuryBSD 的实时桌面环境能让你在实际使用之前先尝试。 ![FuryBSD Post-Install XFCE Desktop][10] -如上所述,桌面环境没有大量预装软件,因此几乎肯定要安装额外的软件包。最快的方法是在终端中使用 **pkg** 命令。该命令的行为很像 dnf 和 apt,因此来自 Linux 发行版的用户(使用其中之一)在查找和安装软件包时应该感到很熟悉。 FreeBSD的软件包集合很大,因此大多数知名的开源软件包都可用。 +[FreeBSD][2] 是一个很棒的操作系统,但是从设计上讲,它并没有自带桌面环境。如果不从 FreeBSD 的 [ports 和软件包集][3]安装其他软件,那么 FreeBSD 仅能体验命令行。下面的截图显示了在安装过程中选择了每个“可选系统组件”后,登录 FreeBSD 12.1 的样子。 -在没有太多 FreeBSD 经验的情况下尝试 FuryBSD 的用户应查阅 [FreeBSD 手册][11],以了解有关如何以 FreeBSD 的方式做事。有任何 Linux 发行版或其他 BSD 使用经验的用户应该能弄清很多事情,但是手册可以帮助你弄清一些差异。进一步了解 FreeBSD 的一个很好的资源是 Michael W. Lucas 的 _[Absolute FreeBSD,第三版][12]_。 +![FreeBSD][4] + +FreeBSD 可以用各种桌面环境中的任何一种来变成桌面操作系统,但是这需要时间、精力和[遵循大量书面说明][5]。使用使用 desktop-installer 包(为用户提供基于文本的菜单并帮助自动执行大部分过程)仍然非常耗时。这两种方法的最大问题是,用户可能在花了很多时间进行设置之后,可能会发现他们的硬件系统与 FreeBSD 不完全兼容。 + +[FuryBSD][6] 通过提供实时桌面镜像来解决此问题,用户可以在安装之前对其进行评估。目前,FuryBSD 提供 Xfce 镜像和 KDE 镜像。每个镜像都提供了一个已预安装桌面环境的 FreeBSD。如果用户试用该镜像并发现其硬件工作正常,那么他们可以安装 FuryBSD,并拥有一个由 FreeBSD 驱动的即用桌面操作系统。在本文中,我会使用 Xfce 镜像,但 KDE 镜像的工作原理完全一样。 + +对于安装过 Linux 发行版、BSD 或任何其他类 Unix 的开源操作系统的人,FuryBSD 的上手过程应该很熟悉。从 FuryBSD 网站下载 ISO,将它复制到闪存盘,然后从闪存盘启动计算机。如果从闪存盘引导失败,请确保“安全引导”已禁用。 + +![FuryBSD Live XFCE Desktop][7] + +从闪存盘启动后,桌面环境将自动加载。除了“家”、“文件系统”和“回收站”图标外,实时桌面还有用于配置 Xorg 的工具、入门指南、FuryBSD 安装程序和系统信息程序的图标。除了这些额外功能以及一些自定义的 Xfce 设置和壁纸外,桌面环境除了基本的 Xfce 应用和 Firefox 之外并没有其他功能。 + +![FuryBSD Xorg Tool][8] + +此时仅加载基本的图形驱动,但足以检查 FuryBSD 是否支持系统的有线和无线网络接口。如果网络接口没有一个能自动工作,那么 `Getting Started.txt` 文件包含有关尝试配置网络接口和其他配置任务的说明。如果至少有一个网络接口有效,那么可以使用 Configure Xorg 应用安装 Intel、NVidia 或 VirtualBox 图形驱动。它将下载并安装驱动,并且需要重新启动 Xorg。如果系统未自动重新登录到实时镜像用户,那么密码为 `furybsd`(你可以使用它来登录)。配置后,图形驱动将转移到已安装的系统中。 + +![FuryBSD Installer - ZFS Configuration][9] + +如果一切都可以在实时环境中正常运行,那么 FuryBSD 安装程序可以将 FuryBSD 配置并安装到计算机上。该安装程序在终端中运行,但提供与大多数其他 BSD 和 Linux 安装程序相同的选项。系统将要求用户设置系统的主机名、配置 ZFS 存储、设置 root 密码,添加至少一个非 root 用户以及配置时间和日期。完成后,系统可以引导到预装有 Xfce (或 KDE)的 FreeBSD 中。FuryBSD 完成了所有困难的工作,甚至还花了很多精力使桌面看起来更漂亮。 + + + +如上所述,桌面环境没有大量预装软件,因此几乎肯定要安装额外的软件包。最快的方法是在终端中使用 `pkg` 命令。该命令的行为很像 `dnf` 和 `apt`,因此使用过其中之一的来自 Linux 发行版的用户在查找和安装软件包时应该感到很熟悉。FreeBSD 的软件包集合非常多,因此大多数知名的开源软件包都可用。 + +如果用户在没有太多 FreeBSD 经验的情况下尝试 FuryBSD,应查阅 [FreeBSD 手册][11],以了解有关如何以 FreeBSD 的方式操作。有任何 Linux 发行版或其他 BSD 使用经验的用户应该能弄清很多事情,但是手册可以帮助你弄清一些差异。进一步了解 FreeBSD 的一个很好的资源是 Michael W. Lucas 的 《[Absolute FreeBSD,第三版][12]》。 -------------------------------------------------------------------------------- @@ -47,7 +49,7 @@ via: https://opensource.com/article/20/5/furybsd-linux 作者:[Joshua Allen Holm][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8df76ff5cc31d6a7cb54d079a2f25567133b2be2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 May 2020 11:04:30 +0800 Subject: [PATCH 2081/3057] PUB @geekpi https://linux.cn/article-12225-1.html --- ...ting started with FreeBSD as a desktop operating system.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200508 Getting started with FreeBSD as a desktop operating system.md (98%) diff --git a/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md b/published/20200508 Getting started with FreeBSD as a desktop operating system.md similarity index 98% rename from translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md rename to published/20200508 Getting started with FreeBSD as a desktop operating system.md index a8a049554b..ef63e7b696 100644 --- a/translated/tech/20200508 Getting started with FreeBSD as a desktop operating system.md +++ b/published/20200508 Getting started with FreeBSD as a desktop operating system.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12225-1.html) [#]: subject: (Getting started with FreeBSD as a desktop operating system) [#]: via: (https://opensource.com/article/20/5/furybsd-linux) [#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) From 80f720e7768bc7fca07e7905de92c67f4a427e8e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 May 2020 19:23:16 +0800 Subject: [PATCH 2082/3057] APL --- sources/tech/20200429 Why strace doesn-t work in Docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200429 Why strace doesn-t work in Docker.md b/sources/tech/20200429 Why strace doesn-t work in Docker.md index 42414ad377..8085f90251 100644 --- a/sources/tech/20200429 Why strace doesn-t work in Docker.md +++ b/sources/tech/20200429 Why strace doesn-t work in Docker.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6dc1834b49d5102596e35b717af6c70e0e8eecec Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 May 2020 20:59:54 +0800 Subject: [PATCH 2083/3057] TSL&PRF @wxy --- ...00429 Why strace doesn-t work in Docker.md | 161 ------------------ ...00429 Why strace doesn-t work in Docker.md | 161 ++++++++++++++++++ 2 files changed, 161 insertions(+), 161 deletions(-) delete mode 100644 sources/tech/20200429 Why strace doesn-t work in Docker.md create mode 100644 translated/tech/20200429 Why strace doesn-t work in Docker.md diff --git a/sources/tech/20200429 Why strace doesn-t work in Docker.md b/sources/tech/20200429 Why strace doesn-t work in Docker.md deleted file mode 100644 index 8085f90251..0000000000 --- a/sources/tech/20200429 Why strace doesn-t work in Docker.md +++ /dev/null @@ -1,161 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why strace doesn't work in Docker) -[#]: via: (https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/) -[#]: author: (Julia Evans https://jvns.ca/) - -Why strace doesn't work in Docker -====== - -While editing the capabilities page of the [how containers work][1] zine, I found myself trying to explain why `strace` doesn’t work in a Docker container. - -The problem here is – if you run `strace` in a Docker container, this happens: - -``` -$ docker run -it ubuntu:18.04 /bin/bash -$ # ... install strace ... -[email protected]:/# strace ls -strace: ptrace(PTRACE_TRACEME, ...): Operation not permitted -``` - -strace works using the `ptrace` system call, so if `ptrace` isn’t allowed, it’s definitely not gonna work! This is pretty easy to fix – on my machine, this fixes it: - -``` -docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash -``` - -But I wasn’t interested in fixing it, I wanted to know why it happens. So why does strace not work, and why does `--cap-add=SYS_PTRACE` fix it? - -### hypothesis 1: container processes are missing the `CAP_SYS_PTRACE` capability - -I always thought the reason was that Docker container processes by default didn’t have the `CAP_SYS_PTRACE` capability. This is consistent with it being fixed by `--cap-add=SYS_PTRACE`, right? - -But this actually doesn’t make sense for 2 reasons. - -**Reason 1**: Experimentally, as a regular user, I can strace on any process run by my user. But if I check if my current process has the `CAP_SYS_PTRACE` capability, I don’t: - -``` -$ getpcaps $$ -Capabilities for `11589': = -``` - -**Reason 2**: `man capabilities` says this about `CAP_SYS_PTRACE`: - -``` -CAP_SYS_PTRACE - * Trace arbitrary processes using ptrace(2); -``` - -So the point of `CAP_SYS_PTRACE` is to let you ptrace **arbitrary** processes owned by any user, the way that root usually can. You shouldn’t need it to just ptrace a regular process owned by your user. - -And I tested this a third way – I ran a Docker container with `docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash`, dropped the `CAP_SYS_PTRACE` capability, and I could still strace processes even though I didn’t have that capability anymore. What? Why? - -### hypothesis 2: something about user namespaces??? - -My next (much less well-founded) hypothesis was something along the lines of “um, maybe the process is in a different user namespace and strace doesn’t work because of… reasons?” This isn’t really coherent but here’s what happened when I looked into it. - -Is the container process in a different user namespace? Well, in the container: - -``` -[email protected]:/# ls /proc/$$/ns/user -l -... /proc/1/ns/user -> 'user:[4026531837]' -``` - -On the host: - -``` -[email protected]:~$ ls /proc/$$/ns/user -l -... /proc/12177/ns/user -> 'user:[4026531837]' -``` - -Because the user namespace ID (`4026531837`) is the same, the root user in the container is the exact same user as the root user on the host. So there’s definitely no reason it shouldn’t be able to strace processes that it created! - -This hypothesis doesn’t make much sense but I hadn’t realized that the root user in a Docker container is the same as the root user on the host, so I thought that was interesting. - -### hypothesis 3: the ptrace system call is being blocked by a seccomp-bpf rule - -I also knew that Docker uses seccomp-bpf to stop container processes from running a lot of system calls. And ptrace is in the [list of system calls blocked by Docker’s default seccomp profile][2]! (actually the list of allowed system calls is a whitelist, so it’s just that ptrace is not in the default whitelist. But it comes out to the same thing.) - -That easily explains why strace wouldn’t work in a Docker container – if the `ptrace` system call is totally blocked, then of course you can’t call it at all and strace would fail. - -Let’s verify this hypothesis – if we disable all seccomp rules, can we strace in a Docker container? - -``` -$ docker run --security-opt seccomp=unconfined -it ubuntu:18.04 /bin/bash -$ strace ls -execve("/bin/ls", ["ls"], 0x7ffc69a65580 /* 8 vars */) = 0 -... it works fine ... -``` - -Yes! It works! Great. Mystery solved, except… - -### why does `--cap-add=SYS_PTRACE` fix the problem? - -What we still haven’t explained is: why does `--cap-add=SYS_PTRACE` would fix the problem? - -The man page for `docker run` explains the `--cap-add` argument this way: - -``` ---cap-add=[] - Add Linux capabilities -``` - -That doesn’t have anything to do with seccomp rules! What’s going on? - -### let’s look at the Docker source code. - -When the documentation doesn’t help, the only thing to do is go look at the source. - -The nice thing about Go is, because dependencies are often vendored in a Go repository, you can just grep the repository to figure out where the code that does a thing is. So I cloned `github.com/moby/moby` and grepped for some things, like `rg CAP_SYS_PTRACE`. - -Here’s what I think is going on. In containerd’s seccomp implementation, in [contrib/seccomp/seccomp_default.go][3], there’s a bunch of code that makes sure that if a process has a capability, then it’s also given access (through a seccomp rule) to use the system calls that go with that capability. - -``` -case "CAP_SYS_PTRACE": - s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{ - Names: []string{ - "kcmp", - "process_vm_readv", - "process_vm_writev", - "ptrace", - }, - Action: specs.ActAllow, - Args: []specs.LinuxSeccompArg{}, - }) -``` - -There’s some other code that seems to do something very similar in [profiles/seccomp/seccomp.go][4] in moby and the [default seccomp profile][5], so it’s possible that that’s what’s doing it instead. - -So I think we have our answer! - -### `--cap-add` in Docker does a little more than what it says - -The upshot seems to be that `--cap-add` doesn’t do exactly what it says it does in the man page, it’s more like `--cap-add-and-also-whitelist-some-extra-system-calls-if-required`. Which makes sense! If you have a capability like `CAP_SYS_PTRACE` which is supposed to let you use the `process_vm_readv` system call but that system call is blocked by a seccomp profile, that’s not going to help you much! - -So allowing the `process_vm_readv` and `ptrace` system calls when you give the container `CAP_SYS_PTRACE` seems like a reasonable choice. - -### that’s all! - -This was a fun small thing to investigate, and I think it’s a nice example of how containers are made of lots of moving pieces that work together in not-completely-obvious ways. - --------------------------------------------------------------------------------- - -via: https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/ - -作者:[Julia Evans][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://jvns.ca/ -[b]: https://github.com/lujun9972 -[1]: https://wizardzines.com/zines/containers -[2]: https://docs.docker.com/engine/security/seccomp/ -[3]: https://github.com/containerd/containerd/blob/4be98fa28b62e8a012491d655a4d6818ef87b080/contrib/seccomp/seccomp_default.go#L527-L537 -[4]: https://github.com/moby/moby/blob/cc0dfb6e7b22ad120c60a9ce770ea15415767cf9/profiles/seccomp/seccomp.go#L126-L132 -[5]: https://github.com/moby/moby/blob/master/profiles/seccomp/default.json#L723-L739 diff --git a/translated/tech/20200429 Why strace doesn-t work in Docker.md b/translated/tech/20200429 Why strace doesn-t work in Docker.md new file mode 100644 index 0000000000..dfd17d0fca --- /dev/null +++ b/translated/tech/20200429 Why strace doesn-t work in Docker.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why strace doesn't work in Docker) +[#]: via: (https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/) +[#]: author: (Julia Evans https://jvns.ca/) + +为什么 strace 在 Docker 中不起作用? +====== + +在编辑“容器如何工作”杂志的能力页面时,我想试着解释一下为什么 `strace` 在 Docker 容器中无法工作。 + +这里的问题是 —— 如果我在笔记本上的 Docker 容器中运行 `strace`,就会出现这种情况: + +``` +$ docker run -it ubuntu:18.04 /bin/bash +$ # ... install strace ... +[email protected]:/# strace ls +strace: ptrace(PTRACE_TRACEME, ...): Operation not permitted +``` + +`strace` 通过 `ptrace` 系统调用起作用,所以如果不允许使用 `ptrace`,它肯定是不能工作的! 这个问题很容易解决 —— 在我的机器上,是这样解决的: + +``` +docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash +``` + +但我对如何修复它不感兴趣,我想知道为什么会出现这种情况。那么,为什么 `strace` 不能工作,为什么`--cap-add=SYS_PTRACE` 可以解决这个问题? + +### 假设 1:容器进程缺少 `CAP_SYS_PTRACE` 能力。 + +我一直以为原因是 Docker 容器进程默认不具备 `CAP_SYS_PTRACE` 能力。这和它可以被 `--cap-add=SYS_PTRACE` 修复是一回事,是吧? + +但这实际上是不合理的,原因有两个。 + +原因 1:在实验中,作为一个普通用户,我可以对我的用户运行的任何进程进行 `strace`。但如果我检查我的当前进程是否有 `CAP_SYS_PTRACE` 能力,则没有: + +``` +$ getpcaps $$ +Capabilities for `11589': = +``` + +原因 2:`capabilities` 的手册页对 `CAP_SYS_PTRACE` 的介绍是: + +``` +CAP_SYS_PTRACE + * Trace arbitrary processes using ptrace(2); +``` + +所以,`CAP_SYS_PTRACE` 的作用是让你像 root 一样,可以对任何用户拥有的**任意**进程进行 `ptrace` 。你不需要用它来只是对一个由你的用户拥有的普通进程进行 `ptrace ` 。 + +我用第三种方法测试了一下 —— 我用 `docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash` 运行了一个 Docker 容器,去掉了 `CAP_SYS_PTRACE` 能力,但我仍然可以跟踪进程,虽然我已经没有这个能力了。什么?为什么? + +### 假设 2:关于用户命名空间的事情? + +我的下一个(没有那么充分的依据的)假设是“嗯,也许这个过程是在不同的用户命名空间里,而 `strace` 不能工作,因为某种原因而行不通?”这个问题其实并不连贯,但这是我观察时想到的。 + +容器进程是否在不同的用户命名空间中?嗯,在容器中: + +``` +root@e27f594da870:/# ls /proc/$$/ns/user -l +... /proc/1/ns/user -> 'user:[4026531837]' +``` + +在宿主机: + +``` +bork@kiwi:~$ ls /proc/$$/ns/user -l +... /proc/12177/ns/user -> 'user:[4026531837]' +``` + +因为用户命名空间 ID(`4026531837`)是相同的,所以容器中的 root 用户和主机上的 root 用户是完全相同的用户。所以,绝对没有理由不能够对它创建的进程进行 `strace`! + +这个假设并没有什么意义,但我(之前)没有意识到 Docker 容器中的 root 用户和主机上的 root 用户同一个,所以我觉得这很有意思。 + +### 假设 3:ptrace 系统的调用被 seccomp-bpf 规则阻止了 + +我也知道 Docker 使用 seccomp-bpf 来阻止容器进程运行许多系统调用。而 `ptrace` 在[被 Docker 默认的 seccomp 配置文件阻止的系统调用列表][2]中!(实际上,允许的系统调用列表是一个白名单,所以只是`ptrace` 不在默认的白名单中。但得出的结果是一样的。) + +这很容易解释为什么 `strace` 在 Docker 容器中不能工作 —— 如果 `ptrace` 系统调用完全被屏蔽了,那么你当然不能调用它,`strace` 就会失败。 + +让我们来验证一下这个假设 —— 如果我们禁用了所有的 seccomp 规则,`strace` 能在 Docker 容器中工作吗? + +``` +$ docker run --security-opt seccomp=unconfined -it ubuntu:18.04 /bin/bash +$ strace ls +execve("/bin/ls", ["ls"], 0x7ffc69a65580 /* 8 vars */) = 0 +... it works fine ... +``` + +是的,很好用!很好。谜底解开了,除了..... + +### 为什么 `--cap-add=SYS_PTRACE` 能解决问题? + +我们还没有解释的是:为什么 `--cap-add=SYS_PTRACE` 可以解决这个问题? + +`docker run` 的手册页是这样解释 `--cap-add` 参数的。 + +``` +--cap-add=[] + Add Linux capabilities +``` + +这跟 seccomp 规则没有任何关系! 怎么回事? + +### 我们来看看 Docker 源码 + +当文档没有帮助的时候,唯一要做的就是去看源码。 + +Go 语言的好处是,因为依赖关系通常是在一个 Go 仓库里,你可以通过 `grep` 来找出做某件事的代码在哪里。所以我克隆了 `github.com/moby/moby`,然后对一些东西进行 `grep`,比如 `rg CAP_SYS_PTRACE`。 + +我认为是这样的。在 `containerd` 的 seccomp 实现中,在 [contrib/seccomp/seccomp/seccomp_default.go][3] 中,有一堆代码确保如果一个进程有一个能力,那么它也会(通过 seccomp 规则)获得访问权限,以使用与该能力相关的系统调用。 + +``` +case "CAP_SYS_PTRACE": + s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{ + Names: []string{ + "kcmp", + "process_vm_readv", + "process_vm_writev", + "ptrace", + }, + Action: specs.ActAllow, + Args: []specs.LinuxSeccompArg{}, + }) +``` + +在 moby 中的 [profile/seccomp/seccomp.go][4] 和 [默认的 seccomp 配置文件][5]中,也有一些其他的代码似乎做了一些非常类似的事情,所以有可能就是这个代码在做这个事情。 + +所以我想我们有答案了! + +### Docker 中的 `--cap-add` 做的事情比它说的要多 + +结果似乎是,`--cap-add` 并不像手册页里说的那样,它更像是 `--cap-add-and-also-whiteelist-some-extra-system-calls-if-required`。这很有意义! 如果你具有一个像 `--CAP_SYS_PTRACE` 这样的能力,可以让你使用 `process_vm_readv` 系统调用,但是该系统调用被 seccomp 配置文件阻止了,那对你没有什么帮助! + +所以当你给容器 `CAP_SYS_PTRACE` 能力时,允许使用 `process_vm_readv` 和 `ptrace` 系统调用似乎是一个合理的选择。 + +### 就这样! + +这是个有趣的小事情,我认为这是一个很好的例子,说明了容器是由许多移动的部件组成的,它们以不完全显而易见的方式一起工作。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://wizardzines.com/zines/containers +[2]: https://docs.docker.com/engine/security/seccomp/ +[3]: https://github.com/containerd/containerd/blob/4be98fa28b62e8a012491d655a4d6818ef87b080/contrib/seccomp/seccomp_default.go#L527-L537 +[4]: https://github.com/moby/moby/blob/cc0dfb6e7b22ad120c60a9ce770ea15415767cf9/profiles/seccomp/seccomp.go#L126-L132 +[5]: https://github.com/moby/moby/blob/master/profiles/seccomp/default.json#L723-L739 From bcaf11f79acae482402f031cca6526630ecd34d6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 May 2020 21:45:07 +0800 Subject: [PATCH 2084/3057] APL --- ...9 open source CSS frameworks for frontend web development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200413 9 open source CSS frameworks for frontend web development.md b/sources/tech/20200413 9 open source CSS frameworks for frontend web development.md index 0d2bd7ddc1..8ec2135449 100644 --- a/sources/tech/20200413 9 open source CSS frameworks for frontend web development.md +++ b/sources/tech/20200413 9 open source CSS frameworks for frontend web development.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1dbd625a5e4b51b65f474e5b12e5036ec83e4856 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 May 2020 23:19:36 +0800 Subject: [PATCH 2085/3057] TSL --- ...frameworks for frontend web development.md | 254 ------------------ ...frameworks for frontend web development.md | 250 +++++++++++++++++ 2 files changed, 250 insertions(+), 254 deletions(-) delete mode 100644 sources/tech/20200413 9 open source CSS frameworks for frontend web development.md create mode 100644 translated/tech/20200413 9 open source CSS frameworks for frontend web development.md diff --git a/sources/tech/20200413 9 open source CSS frameworks for frontend web development.md b/sources/tech/20200413 9 open source CSS frameworks for frontend web development.md deleted file mode 100644 index 8ec2135449..0000000000 --- a/sources/tech/20200413 9 open source CSS frameworks for frontend web development.md +++ /dev/null @@ -1,254 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 open source CSS frameworks for frontend web development) -[#]: via: (https://opensource.com/article/20/4/open-source-css-frameworks) -[#]: author: (Bryant Son https://opensource.com/users/brson) - -9 open source CSS frameworks for frontend web development -====== -Explore open source CSS frameworks and find the right one for your -project. -![Digital creative of a browser on the internet][1] - -When most people think about web development, HTML or JavaScript usually come to mind. They usually forget about the technology that has far more impact on the ability to enjoy a website: [cascading style sheets (CSS)][2]. CSS is both one of the most important and the most often forgotten parts of any webpage, even though it's one of the three cornerstone technologies of the World Wide Web, according to Wikipedia. - -This article explores nine popular, powerful, and open source frameworks that make CSS development straightforward for building beautiful website frontends. - -Name | What It Is | License ----|---|--- -[Bootstrap][3] | The most popular CSS framework; by Twitter | MIT -[PatternFly][4] | Open source framework; by Red Hat | MIT -[Material Components for the web][5] | Open source framework; by Google | MIT -[Pure][6] | Open source framework; by Yahoo | BSD -[Foundation][7] | Frontend framework; by Zurb Foundation | MIT -[Bulma][8] | Modern CSS framework based on Flexbox | MIT -[Skeleton][9] | Lightweight CSS framework | MIT -[Materialize][10] | CSS framework based on Material Design | MIT -[Bootflat][11] | Open source Flat UI kit based on Bootstrap 3.3.0 | MIT - -  - -If you prefer to follow along as I explore this live, you can watch my video. - -### Bootstrap - -[Bootstrap][12] is easily the most popular CSS framework, and it is the one that started all frontend web design. Developed by Twitter, Bootstrap offers usability, functionality, and extensibility. - -![Bootstrap homepage][13] - -Bootstrap also offers plenty of [examples][14] to get you started. - -![Bootstrap examples][15] - -With Bootstrap, you can stitch together different components and layouts to create an interesting page design. It also offers plenty of detailed documentation. - -![Bootstrap documentation][16] - -Bootstrap's [GitHub][3] repository lists more than 19,000 commits and 1,100 contributors. It is based on the MIT License, so (as with all of the frameworks on this list) you can jump in and contribute as well. - -![Bootstrap GitHub][17] - -### PatternFly - -[PatternFly][18] is an open source (under the MIT License) CSS framework by Red Hat. PatternFly takes a different approach than Bootstrap: While Bootstrap is meant for anyone interested in creating a beautiful website, PatternFly is primarily focused on enterprise application developers and provides components, such as bars, charts, and navigations, that are very appealing for creating powerful, metrics-driven dashboards. In fact, Red Hat uses this CSS framework for the design of its products, such as OpenShift. - -![PatternFly homepage][19] - -In addition to static HTML, PatternFly also supports the ReactJS framework, a popular JavaScript framework developed by Facebook. - -![PatternFly ReactJS support][20] - -PatternFly has many advanced components, such as bars, charts, [modals][21], and layouts, that are suitable for enterprise-level applications. - -![PatternFly chart component][22] - -PatternFly's [GitHub][4] page lists more than 1,050 commits and 44 contributors. PatternFly is getting a lot of attention, and you are more than welcome to contribute. - -![PatternFly GitHub][23] - -### Material Components for the web - -With its highly successful Android platform, Google set its own standard design guidelines with a concept called [Material Design][24]. The Material Design standards are intended to be reflected across all Google products, and they are also available to the general public and open source under the MIT License. - -![Material Design homepage][25] - -Material Design has a number of [Components][26], "interactive building blocks for creating a user interface." These buttons, cards, backdrops, and more can be used to create any type of user interface for a website or mobile application. - -![Material Components webpage][27] - -The maintainers provide thorough documentation for different platforms. - -![Material Design documentation][28] - -There are also step-by-step tutorials with exercises for accomplishing different goals. - -![Material Design tutorial][29] - -The Material Components GitHub page hosts repos for different platforms, including [Material Components for the web (MDC Web)][5] for website development. MDC Web has more than 5,700 commits and 349 contributors. - -![MDC Web GitHub][30] - -### Pure - -Bootstrap, Patternfly, and MDC Web are very powerful CSS frameworks, yet they can be quite heavy and complex. If you want a lightweight CSS framework that it is closer to coding CSS yourself yet helps you build a nice web page, try [Pure.css][31]. Pure is a lightweight CSS framework with a minimal footprint. It was developed by Yahoo and is open source under the BSD License. - -![Pure.css homepage][32] - -Despite its small size, Pure offers plenty of the components necessary to build a good-looking webpage. - -![Pure.css components][33] - -Pure's [GitHub][6] page shows more than 565 commits and 59 contributors. - -![Pure.css GitHub][34] - -### Foundation - -[Foundation][35] claims to be the most advanced responsive frontend framework in the world. It provides advanced features and tutorials for building professional websites. - -![Foundation homepage][36] - -The framework is [used][37] by many companies, organizations, and even politicians, and it has plenty of documentation available. - -![Foundation documentation][38] - -Foundation's [GitHub][7] page shows nearly 17,000 commits and 1,000 contributors. Like most of the other frameworks on this list, it's available under the MIT License. - -![Foundation GitHub][39] - -### Bulma - -[Bulma][40] is an open source framework based on Flexbox and available under the MIT License. Bulma is a pretty lightweight framework, as it requires only one CSS file. - -![Bulma homepage][41] - -Bulma has clean and simple docs that make it easy to choose the topics you want to explore. It also has a number of web components you can just pick up and use in your design. - -![Bulma documentation][42] - -Bulma's [GitHub][8] page lists more than 1,400 commits and 300 contributors. - -![Bulma GitHub][43] - -### Skeleton - -If even Pure is too heavy for you, there is an even lighter-weight framework called [Skeleton][44]. The Skeleton library is only about 400 lines long, and the framework provides only the essential components to start your CSS framework journey. - -![Skeleton homepage][45] - -Despite its simplicity, Skeleton offers detailed docs to help you get started right away. - -![Skeleton documentation][46] - -Skeleton's [GitHub][9] lists 167 commits and 22 contributors. However, it's not the most active project; its last update was in 2014, so it may need some maintenance before using it. Since it is released under the MIT License, feel free to do that yourself. - -![Skeleton GitHub][47] - -### Materialize - -[Materialize][48] is a responsive frontend framework based on Google's Material Design with additional themes and components developed by Materialize's contributors. - -![Materialize homepage][49] - -Materialize's documentation page is comprehensive and pretty easy to follow. Its components page includes buttons, cards, navigations, and more. - -![Materialize documentation][50] - -Materialize is an open source project under the MIT License, and its [GitHub][10] lists more than 3,800 commits and 250 contributors. - -![Materialize GitHub][51] - -### Bootflat - -[Bootflat][52] is an open source CSS framework derived from Twitter's Bootstrap. Compared to Bootstrap, Bootflat is simpler, with lighter-weight framework components. - -![Bootflat homepage][53] - -Bootflat's [documentation][54] almost seems inspired by IKEA—it shows an image of each component without much text. - -![Bootflat docs][55] - -Bootflat is available under the MIT License, and its [GitHub][11] page includes 159 commits and eight contributors, as of this writing. - -![Bootflat GitHub][56] - -### Which CSS framework should you choose? - -You have many options for open source CSS frameworks, depending on how feature-rich or simple you want the tooling to be. Like all technology decisions, there is no single right answer for everything or everyone; there is only the right choice for the given time and the given project. - -Give a few of these a spin and see which one you want to use in your next project. Also, did I miss any interesting open source CSS frameworks? Please share your feedback and ideas in the comments below. - -Which frontend framework should you pick for your next web app? Pam Selle will address this... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/4/open-source-css-frameworks - -作者:[Bryant Son][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/brson -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) -[2]: https://en.wikipedia.org/wiki/Cascading_Style_Sheets -[3]: https://github.com/twbs/bootstrap -[4]: https://github.com/patternfly/patternfly -[5]: https://github.com/material-components/material-components-web -[6]: https://github.com/pure-css/pure -[7]: https://github.com/foundation/foundation-sites -[8]: https://github.com/jgthms/bulma -[9]: https://github.com/dhg/Skeleton -[10]: https://github.com/Dogfalo/materialize -[11]: https://github.com/bootflat/bootflat.github.io -[12]: https://getbootstrap.com -[13]: https://opensource.com/sites/default/files/uploads/2_bootstrapscreenshot.jpg (Bootstrap homepage) -[14]: https://getbootstrap.com/docs/4.4/examples/ -[15]: https://opensource.com/sites/default/files/uploads/3_bootstrapsamples.jpg (Bootstrap examples) -[16]: https://opensource.com/sites/default/files/uploads/4_bootstrapdocs.jpg (Bootstrap documentation) -[17]: https://opensource.com/sites/default/files/uploads/5_bootstrapgithub.jpg (Bootstrap GitHub) -[18]: https://www.patternfly.org -[19]: https://opensource.com/sites/default/files/uploads/6_patternflyhomepage.jpg (PatternFly homepage) -[20]: https://opensource.com/sites/default/files/uploads/7_patternflyreactjs.jpg (PatternFly ReactJS support) -[21]: https://en.wikipedia.org/wiki/Modal_window -[22]: https://opensource.com/sites/default/files/uploads/8_patternflycomponents.jpg (PatternFly chart component) -[23]: https://opensource.com/sites/default/files/uploads/9_patternflygithub.jpg (PatternFly GitHub) -[24]: https://material.io -[25]: https://opensource.com/sites/default/files/uploads/10_materialhome.jpg (Material Design homepage) -[26]: https://material.io/components/ -[27]: https://opensource.com/sites/default/files/uploads/11_materialcomponents.jpg (Material Components webpage) -[28]: https://opensource.com/sites/default/files/uploads/12_materialdocs.jpg (Material Design documentation) -[29]: https://opensource.com/sites/default/files/uploads/13_materialtutorial.jpg (Material Design tutorial) -[30]: https://opensource.com/sites/default/files/uploads/15_materialgithub.jpg (MDC Web GitHub) -[31]: https://purecss.io -[32]: https://opensource.com/sites/default/files/uploads/16_purehome.jpg (Pure.css homepage) -[33]: https://opensource.com/sites/default/files/uploads/17_purecomponents.jpg (Pure.css components) -[34]: https://opensource.com/sites/default/files/uploads/18_puregithub.jpg (Pure.css GitHub) -[35]: https://get.foundation -[36]: https://opensource.com/sites/default/files/uploads/19_foundationhome.jpg (Foundation homepage) -[37]: https://zurb.com/responsive -[38]: https://opensource.com/sites/default/files/uploads/21_foundationdocs.jpg (Foundation documentation) -[39]: https://opensource.com/sites/default/files/uploads/22_foundationgithub.jpg (Foundation GitHub) -[40]: https://bulma.io -[41]: https://opensource.com/sites/default/files/uploads/23_bulmahome.jpg (Bulma homepage) -[42]: https://opensource.com/sites/default/files/uploads/24_bulmadoc.jpg (Bulma documentation) -[43]: https://opensource.com/sites/default/files/uploads/25_bulmagithub.jpg (Bulma GitHub) -[44]: http://getskeleton.com -[45]: https://opensource.com/sites/default/files/uploads/26_skeletonhome.jpg (Skeleton homepage) -[46]: https://opensource.com/sites/default/files/uploads/27_skeletondocs.jpg (Skeleton documentation) -[47]: https://opensource.com/sites/default/files/uploads/28_skeletongithub.jpg (Skeleton GitHub) -[48]: https://materializecss.com -[49]: https://opensource.com/sites/default/files/uploads/29_materializehome.jpg (Materialize homepage) -[50]: https://opensource.com/sites/default/files/uploads/30_materializedocs.jpg (Materialize documentation) -[51]: https://opensource.com/sites/default/files/uploads/31_materializegithub.jpg (Materialize GitHub) -[52]: http://bootflat.github.io -[53]: https://opensource.com/sites/default/files/uploads/32_bootflathome.jpg (Bootflat homepage) -[54]: http://bootflat.github.io/documentation.html -[55]: https://opensource.com/sites/default/files/uploads/33_bootflatdocs.jpg (Bootflat docs) -[56]: https://opensource.com/sites/default/files/uploads/34_bootflatgithub.jpg (Bootflat GitHub) diff --git a/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md b/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md new file mode 100644 index 0000000000..115b1aa911 --- /dev/null +++ b/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md @@ -0,0 +1,250 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (9 open source CSS frameworks for frontend web development) +[#]: via: (https://opensource.com/article/20/4/open-source-css-frameworks) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +9 个用于前端 Web 开发的开源 CSS 框架 +====== +> 探索开源 CSS 框架,找到适合你的项目的框架。 + +![Digital creative of a browser on the internet][1] + +当大多数人想到 Web 开发时,通常会想到 HTML 或 JavaScript。他们通常会忘记对网站的欣赏能力有更大影响的技术:[级联样式表][2]cascading style sheets(简称CSS)。据维基百科的说法,CSS 既是任何网页中最重要的部分,也是最常被遗忘的部分,尽管它是万维网的三大基石技术之一。 + +本文将探讨九种流行的、强大的、开源的框架,是这些框架让构建漂亮的网站前端的 CSS 开发变得简单明了。 + +名称 | 介绍| 许可证 +---|---|--- +[Bootstrap][3] | 最流行的 CSS 框架,来自 Twitter | MIT +[PatternFly][4] | 开源框架,来自 Red Hat | MIT +[MDC Web][5] | 开源框架;来自 Google | MIT +[Pure][6] | 开源框架;来自 Yahoo | BSD +[Foundation][7] | 前端框架了;来自 Zurb 基金会 | MIT +[Bulma][8] | 现代 CSS 框架,基于 Flexbox | MIT +[Skeleton][9] | 轻量级 CSS 框架 | MIT +[Materialize][10] | 基于 Material Design 的 CSS 框架 | MIT +[Bootflat][11] | 开源 Flat UI 工具,基于 Bootstrap 3.3.0 | MIT + +如果你更愿意跟着我一起探索这段直播,你可以看我的视频。  + +### Bootstrap + +[Bootstrap][2] 无疑是最流行的 CSS 框架,它是所有前端 Web 设计的开端。Bootstrap 由 Twitter 开发,提供了可用性、功能性和可扩展性。 + +![Bootstrap homepage][13] + +Bootstrap 还提供了大量的[例子][14]来帮助你入门。 + +![Bootstrap examples][15] + +使用 Bootstrap,你可以将不同的组件和布局拼接在一起,创造出一个有趣的页面设计。它还提供了大量详细的文档。 + +![Bootstrap documentation][16] + +Bootstrap 的 [GitHub][3] 仓库列出了超过 19000 个提交和 1100 个贡献者。它基于 MIT 许可证,所以(和这个列表中的所有框架一样)你也可以加入并贡献。 + +![Bootstrap GitHub][17] + +### PatternFly + +[PatternFly][18] 是由 Red Hat 开发的一个开源的(MIT 许可证)CSS 框架。PatternFly 采取了与 Bootstrap 不同的方法:Bootstrap 是为任何对创建一个漂亮网站感兴趣的人而设计的,而 PatternFly 主要针对企业级应用开发者,它提供的组件,如条形图、图表和导航,对于创建强大的、指标驱动的仪表盘非常有吸引力。事实上,Red Hat 在其产品(如 OpenShift)的设计中也使用了这个 CSS 框架。 + +![PatternFly homepage][19] + +除了静态 HTML 之外,PatternFly 还支持 ReactJS 框架,ReactJS 是 Facebook 开发的一个流行的 JavaScript 框架。 + +![PatternFly ReactJS support][20] + +PatternFly 有许多高级组件,如条形图、图表、[模态窗口][21]和布局等,适用于企业级应用。 + +![PatternFly chart component][22] + +PatternFly 的 [GitHub][4] 页面列出了超过 1050 个提交者和 44 个贡献者。PatternFly 得到了很多人的关注,欢迎大家踊跃贡献。 + +![PatternFly GitHub][23] + +### MDC Web + +凭借其大获成功的 Android 平台,谷歌以一个名为 [Material Design][24] 的概念制定了自己的标准设计准则。Material Design 标准旨在体现在所有谷歌的产品中,并且在 MIT 许可证下,这些标准也可以向大众和开放源代码。 + +![Material Design homepage][25] + +Material Design 有许多“用于创建用户界面的交互式构建块”的[组件][26]。这些按钮、卡片、背景等可用于创建网站或移动应用程序的任何类型的用户界面。 + +![Material Components webpage][27] + +维护人员为不同的平台提供了详尽的文档。 + +![Material Design documentation][28] + +还有分步教程,其中包含用于实现不同目标的练习。 + +![Material Design tutorial][29] + +Material 组件的 GitHub 页面承载了不同平台的版本库,包括用于网站开发的 [Material Web 组件(MDC Web)][5]。MDC Web 有超过 5700 个提交和 349 个贡献者。 + +![MDC Web GitHub][30] + +### Pure + +Bootstrap、Patternfly 和 MDC Web 都是非常强大的 CSS 框架,但是它们可能相当的笨重和复杂。如果你想要一个轻量级的 CSS 框架,它更接近于自己编写 CSS,但又能帮助你建立一个漂亮的网页,可以试试 [Pure.css][31]。Pure 是一个轻量级的 CSS 框架,它的体积很小。它是由 Yahoo 开发的,在 BSD 许可证下开源。 + +![Pure.css homepage][32] + +尽管体积小,但 Pure 提供了建立一个漂亮网页的很多必要的组件。 + +![Pure.css components][33] + +Pure 的 [GitHub][6] 页面显示它有超过 565 个提交和 59 个贡献者。 + +![Pure.css GitHub][34] + +### Foundation + +[Foundation][35] 号称是世界上最先进的响应式前端框架。它提供了先进的功能和教程,用于构建专业网站。 + +![Foundation homepage][36] + +该框架被许多公司、组织甚至政客[使用][37],并且有大量的文档可用。 + +![Foundation documentation][38] + +Foundation 的 [GitHub][7] 页面显示有近 17000 个提交和 1000 个贡献者。和这个列表中的大多数其他框架一样,它也是在 MIT 许可证下提供的。 + +![Foundation GitHub][39] + +### Bulma + +[Bulma][40] 是一个基于 Flexbox 的开源框架,在 MIT 许可证下提供。Bulma 是一个相当轻量级的框架,因为它只需要一个 CSS 文件。 + +![Bulma homepage][41] + +Bulma 有简洁明快的文档,让你可以很容易地选择你想要探索的主题。它也有很多的网页组件,你可以直接拿起来在设计中使用。 + +![Bulma documentation][42] + +Bulma 的 [GitHub][8] 页面列出了 1400 多个提交和 300 多个贡献者。 + +![Bulma GitHub][43] + +### Skeleton + +如果连 Pure 都觉得太重了,那么还有一个更轻量级的框架叫 [Skeleton][44]。Skeleton 库只有 400 行左右的长度,而且这个框架只提供了开始你的 CSS 框架之旅的基本组件。 + +![Skeleton homepage][45] + +尽管它很简单,但Skeleton提供了详细的文档,可以帮助你马上上手。 + +![Skeleton documentation][46] + +Skeleton 的 [GitHub][9] 列出了 167 个提交者和 22 个贡献者。然而,它不是很活跃,它的最后一次更新是在 2014 年,所以在使用之前可能需要一些维护。由于它是在 MIT 许可证下发布的,你可以自行维护。 + +![Skeleton GitHub][47] + +### Materialize + +[Materialize][48] 是一个基于 Google 的 Material Design 的响应式前端框架,带有由 Materialize 的贡献者开发的附加主题和组件。 + +![Materialize homepage][49] + +Materialize 的文档页面非常全面,而且相当容易理解。它的组件页面包括按钮、卡片、导航等等。 + +![Materialize documentation][50] + +Materialize 是 MIT 许可证下的开源项目,它的 [GitHub][10] 列出了超过 3800 个提交和 250 个贡献者。 + +![Materialize GitHub][51] + +### Bootflat + +[Bootflat][52] 是由 Twitter 的 Bootstrap 衍生出来的一个开源 CSS 框架。与 Bootstrap 相比, Bootflat 更简单,框架组件更轻量级。 + +![Bootflat homepage][53] + +Bootflat 的[文档][54]几乎像是受到了宜家的启发 —— 它显示的是每个组件的图片,没有太多的文字。 + +![Bootflat docs][55] + +Bootflat 是在 MIT 许可下提供的,其 [GitHub][11] 页面包括 159 个提交和 8 个贡献者。 + +![Bootflat GitHub][56] + +### 你应该选择哪个 CSS 框架? + +对于开源的 CSS 框架,你有很多选择,这取决于你想要的工具功能有多丰富或简单。就像所有的技术决定一样,没有任何一个正确的答案,只有在给定的时间和项目中才有正确的选择。 + +尝试一下其中的一些,看看要在下一个项目中使用哪个。另外,我有没有错过任何有趣的开源 CSS 框架?请在下面的评论中分享你的反馈和想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-css-frameworks + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://en.wikipedia.org/wiki/Cascading_Style_Sheets +[3]: https://github.com/twbs/bootstrap +[4]: https://github.com/patternfly/patternfly +[5]: https://github.com/material-components/material-components-web +[6]: https://github.com/pure-css/pure +[7]: https://github.com/foundation/foundation-sites +[8]: https://github.com/jgthms/bulma +[9]: https://github.com/dhg/Skeleton +[10]: https://github.com/Dogfalo/materialize +[11]: https://github.com/bootflat/bootflat.github.io +[12]: https://getbootstrap.com +[13]: https://opensource.com/sites/default/files/uploads/2_bootstrapscreenshot.jpg (Bootstrap homepage) +[14]: https://getbootstrap.com/docs/4.4/examples/ +[15]: https://opensource.com/sites/default/files/uploads/3_bootstrapsamples.jpg (Bootstrap examples) +[16]: https://opensource.com/sites/default/files/uploads/4_bootstrapdocs.jpg (Bootstrap documentation) +[17]: https://opensource.com/sites/default/files/uploads/5_bootstrapgithub.jpg (Bootstrap GitHub) +[18]: https://www.patternfly.org +[19]: https://opensource.com/sites/default/files/uploads/6_patternflyhomepage.jpg (PatternFly homepage) +[20]: https://opensource.com/sites/default/files/uploads/7_patternflyreactjs.jpg (PatternFly ReactJS support) +[21]: https://en.wikipedia.org/wiki/Modal_window +[22]: https://opensource.com/sites/default/files/uploads/8_patternflycomponents.jpg (PatternFly chart component) +[23]: https://opensource.com/sites/default/files/uploads/9_patternflygithub.jpg (PatternFly GitHub) +[24]: https://material.io +[25]: https://opensource.com/sites/default/files/uploads/10_materialhome.jpg (Material Design homepage) +[26]: https://material.io/components/ +[27]: https://opensource.com/sites/default/files/uploads/11_materialcomponents.jpg (Material Components webpage) +[28]: https://opensource.com/sites/default/files/uploads/12_materialdocs.jpg (Material Design documentation) +[29]: https://opensource.com/sites/default/files/uploads/13_materialtutorial.jpg (Material Design tutorial) +[30]: https://opensource.com/sites/default/files/uploads/15_materialgithub.jpg (MDC Web GitHub) +[31]: https://purecss.io +[32]: https://opensource.com/sites/default/files/uploads/16_purehome.jpg (Pure.css homepage) +[33]: https://opensource.com/sites/default/files/uploads/17_purecomponents.jpg (Pure.css components) +[34]: https://opensource.com/sites/default/files/uploads/18_puregithub.jpg (Pure.css GitHub) +[35]: https://get.foundation +[36]: https://opensource.com/sites/default/files/uploads/19_foundationhome.jpg (Foundation homepage) +[37]: https://zurb.com/responsive +[38]: https://opensource.com/sites/default/files/uploads/21_foundationdocs.jpg (Foundation documentation) +[39]: https://opensource.com/sites/default/files/uploads/22_foundationgithub.jpg (Foundation GitHub) +[40]: https://bulma.io +[41]: https://opensource.com/sites/default/files/uploads/23_bulmahome.jpg (Bulma homepage) +[42]: https://opensource.com/sites/default/files/uploads/24_bulmadoc.jpg (Bulma documentation) +[43]: https://opensource.com/sites/default/files/uploads/25_bulmagithub.jpg (Bulma GitHub) +[44]: http://getskeleton.com +[45]: https://opensource.com/sites/default/files/uploads/26_skeletonhome.jpg (Skeleton homepage) +[46]: https://opensource.com/sites/default/files/uploads/27_skeletondocs.jpg (Skeleton documentation) +[47]: https://opensource.com/sites/default/files/uploads/28_skeletongithub.jpg (Skeleton GitHub) +[48]: https://materializecss.com +[49]: https://opensource.com/sites/default/files/uploads/29_materializehome.jpg (Materialize homepage) +[50]: https://opensource.com/sites/default/files/uploads/30_materializedocs.jpg (Materialize documentation) +[51]: https://opensource.com/sites/default/files/uploads/31_materializegithub.jpg (Materialize GitHub) +[52]: http://bootflat.github.io +[53]: https://opensource.com/sites/default/files/uploads/32_bootflathome.jpg (Bootflat homepage) +[54]: http://bootflat.github.io/documentation.html +[55]: https://opensource.com/sites/default/files/uploads/33_bootflatdocs.jpg (Bootflat docs) +[56]: https://opensource.com/sites/default/files/uploads/34_bootflatgithub.jpg (Bootflat GitHub) From 70e1f934bfc672717e0e6c45d6920889c5c5bf37 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Mon, 18 May 2020 00:35:05 +0800 Subject: [PATCH 2086/3057] APL --- ...23 How to create a personal file server with SSH on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200323 How to create a personal file server with SSH on Linux.md b/sources/tech/20200323 How to create a personal file server with SSH on Linux.md index f758123bb1..5ccabcab09 100644 --- a/sources/tech/20200323 How to create a personal file server with SSH on Linux.md +++ b/sources/tech/20200323 How to create a personal file server with SSH on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f859e549d69db44bf1f87efeaff5fd738d71cedd Mon Sep 17 00:00:00 2001 From: Acceleratorrrr <542383480@qq.com> Date: Sun, 17 May 2020 21:58:31 +0100 Subject: [PATCH 2087/3057] translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md --- ... From 8-bit enthusiast to Unix sysadmin.md | 77 ------------------- ... From 8-bit enthusiast to Unix sysadmin.md | 76 ++++++++++++++++++ 2 files changed, 76 insertions(+), 77 deletions(-) delete mode 100644 sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md create mode 100644 translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md diff --git a/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md b/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md deleted file mode 100644 index 569981ebea..0000000000 --- a/sources/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (My Linux Story: From 8-bit enthusiast to Unix sysadmin) -[#]: via: (https://opensource.com/article/20/4/linux-story) -[#]: author: (James Farrell https://opensource.com/users/jamesf) - -My Linux Story: From 8-bit enthusiast to Unix sysadmin -====== -How my early interest in computers got me hooked on a career as a -sysadmin and Linux fan. -![Person typing on a 1980's computer][1] - -It all started in the mid-1980s with an [Apple ][c][2] that my parents purchased for our family. Although I enjoyed playing games, I quickly became fascinated with BASIC programming and how useful it could be for work and fun. This was an era when computers were viewed as little more than typewriters, so people with "advanced computer skills" could easily use them to their advantage. - -One example was using BASIC and a dot matrix printer to auto-generate punishment assignments. When I was assigned to write out 200 times some apologetic statements, I asked my teacher if it could be typed out. On confirmation, I wrote a 5 line BASIC program to generate it for me. Another example of subtle trickery was using non-WYSIWYG word processors, such as AppleWorks for micro-manipulation of fonts, line spacing, and margins to "stretch" term papers out to the required length. - -My obsession with computers quickly lead to an Apple ][gs with a RAM drive card and an x86 PC co-processor card. Modems and BBSs were getting hot, and having a dual-hardware system like this gave me all sorts of options for software. However, modem speeds of 2400bps put a real damper on getting anything more than a few KBs of fun downloads per day. I stuck with Apple as a hobby for some time, but that was soon to change. - -### Venturing into Unix - -My undergraduate program was BS in Computer Information Systems (CIS) and my graduate degree was MS in Computer Science. My undergraduate education program put me mostly into PCs and a little into timeshare mainframes. The real fun began in my graduate programs, where dial-in access to Unix machines with internet connections opened a whole new world of exploration. Although I still used my dual-processor ][gs for modem work and writing and printing papers, Unix systems really grabbed my attention with their general-access Telnet-based games, FTP archives, online email, and C programming. Gopher was popular and growing with people like me who were bound to plain terminal interfaces. - -My graduate program took a fateful turn for the better when I was assigned to the academic computing department, which was charged with running computer services for the school. The students had access to [Ultrix][3]-based systems with X Window terminals. Most were grayscale, as color processing was then a CPU intensive task and really affected system performance. The few color systems were nice, but those machines just dragged. - -This was a really fun time for me, as I was given root access to systems and assigned to system and network maintenance. I had some excellent mentors, and this strongly influenced my decision to get into system administration rather than programming (although I still really love programming to this day). - -### From Unix to Linux - -Scarcity is the mother of invention, and we students often got creative when we had to share the scant resources of the school's computer systems. We had three to five times more students than we had Ultrix workstations, so finding resources (especially at project delivery time) was often a challenge. There was a bank of 56k [PPP][4] modems available for remote system access when graphical displays were not needed. However, finding a machine with spare resources and sharing the system for source compilation often resulted in slow progress. Like most, I found working at night often helped, but I needed something else to let me iterate more quickly. - -Then one of the school's sysadmins suggested I check out a Unix system that was freely available. This was Linux, made available as 3.5" floppy images. Given our school's blazing fast T1 line, it was easy for me to search newsgroups and other sources to learn how to download it. It was all 32-bit Intel PC-based, a class of equipment that I did not own. - -Luckily, my work at the school gave me access to junk piles of old computers, so the wheels started turning. - -I found enough discarded PCs to build a solid 80386 PC with some decent RAM (I am sure well under 1GB), a workable graphic display, a thin-net (coax) Ethernet card, and a hard disk. The images I had were Linux kernel 0.98, and I don't recall it being part of an official distribution (it might have been SLS). What I do remember is that it came on a series of floppy images—the first booted the kernel and a minimal installer, next it formatted the drive, and then it asked for each successive floppy image to install the core GNU utilities. After the core was installed and the system bootable, you would download and install other package images, like compilers and such. - -This was a serious boon to me in my academic career. With no X Window server display running, this PC seriously outperformed the Ultrix workstations I had access to at school. I was allowed to connect this machine to the academic network, mount the school's student Network File System (NFS) shares, and access the internet directly. Since my graduate program used [GCC][5] (and sometimes Perl 4) for most student work, I could do my development work locally. This gave me exclusive access to a key resource that enabled me to iterate more quickly on my projects. - -All was not perfect, however. The hardware was a tiny bit unstable (likely why it was discarded), but I could deal with that. What really got me was how much Linux and Ultrix differed at the OS and system library level. I began to appreciate what it meant to port software to other platforms; I was free to develop wherever I wanted, but I had to deliver my projects as Ultrix compiled binaries. The C code that ran perfectly on one platform would crash on the other. This was very frustrating, but probably my rudest awakening was early Linux's handling of null-pointer dereferencing. Linux seemed happy to pass over these as a virtual no-op, but Ultrix promptly dumped core on [SIGSEGV][6]. This was quite a thing to find out when my first port to the target platform happened days before my project was due! This also made my exploration of C++ quite challenging, as my careless use of malloc()/free() along with automatic [constructor and destructor][7] processing peppered my projects with null pointer bombs all over the place. - -Toward the end of my graduate program, I upgraded to a complete beast of a workstation—an Intel 486DX2 66MHz with SCSI hard drives, a CD-ROM drive, a 1024x768 RGB monitor, and a 16550 UART serial card perfectly matched to my new US Robotics V.Everything modem. It could dual-boot Windows and Linux, but more importantly, the graphics card and processor allowed a much more pleasant (and faster) development environment. The old 386 was still in service back at the school, but most of my heavy work and hacking now happened at home. - -Similar to [Mike Harris' story][8] about Linux in the '90s, I really got into those CD bundles that were popular at the time. There was a new Micro Center computer store close to where I lived, and it was a goldmine of hobby PC parts, phenomenal technical books, and every conceivable Linux (and free Unix) CD archive. I remember [Yggdrasil][9] and [Slackware][10] being some of my favorite distributions. What was really incredible was the enormous size of CD storage—650MB! This was an essential resource for getting access to software. Yes, you could download the bits at 56k, but that was quite limiting. Not to mention the fact that most people could not afford to archive that much idle data for later perusal. - -### And on to today - -This is what kicked off my more than 25 years of system administration and open source software fun. Linux has been an important part of both my career and personal development. Nowadays, I am still heavily into Linux (mostly CentOS, RedHat, and Ubuntu), but often have fun with the likes of [FreeBSD][11] and other cool open source offerings. - -My forays into Linux led me to Opensource.com, where I hope to give back a little and help bootstrap new generations of hands-on computer fun. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/4/linux-story - -作者:[James Farrell][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jamesf -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) -[2]: https://en.wikipedia.org/wiki/Apple_IIc -[3]: https://en.wikipedia.org/wiki/Ultrix -[4]: https://en.wikipedia.org/wiki/Point-to-Point_Protocol -[5]: https://en.wikipedia.org/wiki/GNU_Compiler_Collection -[6]: https://en.wikipedia.org/wiki/Segmentation_fault -[7]: https://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm -[8]: https://opensource.com/article/19/11/learning-linux-90s -[9]: https://en.wikipedia.org/wiki/Yggdrasil_Linux/GNU/X -[10]: http://slackware.com -[11]: https://www.freebsd.org/ diff --git a/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md b/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md new file mode 100644 index 0000000000..75f6ba217b --- /dev/null +++ b/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (Acceleratorrrr) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Linux Story: From 8-bit enthusiast to Unix sysadmin) +[#]: via: (https://opensource.com/article/20/4/linux-story) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +我的 Linux 故事:从8比特爱好者到 Unix 系统管理员 +====== +我是如何从一个电脑爱好者成为职业系统管理员和 Linux 粉丝的 +![Person typing on a 1980's computer][1] + +故事得从1980年中期爸妈给家里购买[苹果 \]\[c][2] 开始。尽管很喜欢打游戏,但我还是很快被实用又好玩的 BASIC 编程迷住了。那个年代的人们还是把电脑当作打字机对待,所以懂电脑的人可以轻松使用他们的魔法。 + +用 BASIC 和点阵打印机自动生成惩罚作业来举个例子。被罚写两百遍道歉时,我问老师我可不可以打字代替手写。经过同意后,我写了5行 BASIC 语句来自动生成作业。另外一个小技巧是用非可视化文本编辑器,比如用 AppleWorks 微调字体,行距和边距,把学期报告扩充到要求的长度。 + +对电脑对喜爱很快让我接触到有 RAM 驱动和 x86 协处理器的苹果 ][gs。调制解调器和网络论坛刚开始火起来,它的双核处理器系统让我可以游刃有余的选择软件。但是由于调制解调器2400比特每秒的速度限制,下载任何超过几 KB 的东西都需要一天。我玩了不久之后就腻了。 + +### 探索 Unix + +我的本科专业是计算机信息系统,硕士专业是计算机科学。本科教育主要是学习硬件和一些分时系统。研究生的时候才开始真正有意思起来,拨号上网简直打开了新世界的大门。尽管我依然用着我的双核 ][gs 来进行调制解调还有写写作业,不过Unix 系统让我真的热爱上方便的远程登录类游戏,文件传输协议,在线邮箱和 C 语言。当时 Gopher 非常受欢迎,特别是在我们这群终端用户中。 + +被分到学院计算机部门是我本科命运般的转折点,这个部门主管学校的计算机服务。学生们必须要用 X 视窗终端来登陆 [Ultrix][3] 系统。大部分都是黑白界面,彩色处理在当时非常占 CPU 也很影响系统性能。也有一些做的不错的彩色系统,但是这些机器都很慢。 + +我很喜欢那个时候,我有系统管理员权限而且工作是维护系统和网络。有一些出色的同事教我,他们对我选择从事系统管理员而不是程序员起了关键作用(尽管我至今热爱编程)。 + +### 从 Unix 到 Linux + +稀缺是创造之母,当需要分享匮乏的学校电脑系统资源的时候,我们经常突发奇想。需要用电脑的学生是 Ultrix 工作站承受量的四到五倍,所以很难找到资源(特别是要交项目的时候)。虽然有一堆56k点对点协议的调制解调器处理远程系统访问,而且那时还不需要图像显示。但是发现一个有空余资源的机器然后分享出来的过程依然十分缓慢。和大部分人一样,我发现晚上加班很有效率,但我需要另外一些东西让我的项目迭代快一点。 + +后来学校但一个系统管理员建议我了解一个免费的 Unix 系统。那就是 Linux,被装在一个 3.5 英寸的软盘里。多亏我们学校超快的 T1 载波,让我很方便的查询到这个新群体和一些下载教程。这是一个我之前不曾接触过的32位网络计算机工具。 + +幸运的是,我的工作让我有机会使用一些淘汰的旧电脑,所以命运的齿轮又开始旋转起来。 + +我用一些报废的主机组装了一个可靠的,有足够 RAM 的80386台机(我确定不到 1GB),它有一个能用的显卡,一个细缆(同轴)以太网卡和一个硬盘。镜像用的是 Linux 内核0.98,不记得它是不是正式发行版的一部分了(可能是 SLS)。可我还能记得安装的一系列过程 - 首先启动内核和安装程序,然后格式化硬盘,接着要求每一个软盘安装 GNU 工具核心。核心装好之后,系统就可以启动了,你可以下载和安装其他的镜像包,比如编译器之类的。 + +这是我学术道路上巨大的福利。没有了 X 视窗显示,这台电脑性能比学校的 Ultrix 工作站强很多。学校允许我把这台机器连到校园网络,连接到学生网络文件系统,并且能直接接入内网。因为我研究生时主要用 [GNU 编译器套装][5] (还有 Perl 4)写作业,所以我可以进行本地开发。我可以使用这台主机作为独占资源来让我的项目更快迭代。 + +但是,这个方案不是完美的。硬件有时会有点不稳定(这可能就是放弃使用它的原因),但我都能搞定。操作系统和系统自带库层面才真正让我感受到 Linux 和 Ultrix 的不同。我开始领会到移植软件到其他操作系统的意义,我可以开发任何我想要的软件,但是我必须要把项目转换成 Ultrix 编译的二进制文件来传输。在一个平台上能运行的 C 语言可能在另一个平台出错。这让我非常沮丧,但是我可能本能的察觉到了早期 Linux 废弃空指针的方法。Linux 倾向于把它作为无操作处理,但是 Ultrix 会立即触发核心转储和段错误 [SIGSEGV][6]。这是正好在要交作业的几天之前,我第一次程序移植时的重大发现。这同时对我研究 C++ 造成了一些麻烦,因为我不小心使用同时使用 malloc()/free() 和自动[构造函数和析构函数]处理项目,结果空指针被炸得到处都是。 + +研究生快结束的时候,我用一颗英特尔 486DX2 66赫兹芯片和一块小型计算机系统接口硬盘,一块光驱和 一个1024x768 RGB 显示器将主机升级成了性能野兽。还把一个 16550 通用异步收发器完美组合到新的 US Robotics V.Everything 牌的调制解调器上。它可以跑 Windows 和 Linux 双系统,但最重要的是显卡和 CPU 的速度让开发环境幸福感倍增。那台旧的386依然在学校服役,不过我主要的工作都转移到了家里。 + +和 [麦克.哈里斯的故事][8] 里关于90年代的 Linux 类似,我真的对当时流行的光驱很着迷。我住的地方附近有小型电脑器材店,这个宝库充满了电脑配件,高级专业书籍和你能想到的任何 Linux (还有免费的 Unix)CD。我还记得[Yggdrasil][9]和[Slackware][10]是我最喜欢的发行版之一。更惊人的是 CD 650MB 巨大的存储量!使它成为软件必不可少载体。是的,你可以用56k 的速度下载,但是真的很慢。更别提大部分人负担不起将这么多闲置的数据存档供以后使用。 + +### 直到今天 + +就是这些开启了我长达25年的系统管理员和开源软件粉丝生涯。Linux 是我事业和个人开发中重要的一部分。最近我依旧醉心于 Linux (主要是 CentOS, RedHat, and Ubuntu),但也经常从[FreeBSD][11]和其他炫酷开源系统中体验乐趣。 + +Linux 领导了我涉足 Opensource.com,我希望能回馈社区同时为下一代电脑出一份力。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/linux-story + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[Accelerator](https://github.com/Acceleratorrrr) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://en.wikipedia.org/wiki/Apple_IIc +[3]: https://en.wikipedia.org/wiki/Ultrix +[4]: https://en.wikipedia.org/wiki/Point-to-Point_Protocol +[5]: https://en.wikipedia.org/wiki/GNU_Compiler_Collection +[6]: https://en.wikipedia.org/wiki/Segmentation_fault +[7]: https://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm +[8]: https://opensource.com/article/19/11/learning-linux-90s +[9]: https://en.wikipedia.org/wiki/Yggdrasil_Linux/GNU/X +[10]: http://slackware.com +[11]: https://www.freebsd.org/ From abffa4a760f6534f50768eae68f61d472cfed02c Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 May 2020 08:52:33 +0800 Subject: [PATCH 2088/3057] translated --- ...ew projects to try in COPR for May 2020.md | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 sources/tech/20200504 4 cool new projects to try in COPR for May 2020.md diff --git a/sources/tech/20200504 4 cool new projects to try in COPR for May 2020.md b/sources/tech/20200504 4 cool new projects to try in COPR for May 2020.md deleted file mode 100644 index f9db0a9f81..0000000000 --- a/sources/tech/20200504 4 cool new projects to try in COPR for May 2020.md +++ /dev/null @@ -1,108 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 cool new projects to try in COPR for May 2020) -[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/) -[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) - -4 cool new projects to try in COPR for May 2020 -====== - -![][1] - -COPR is a [collection][2] 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. - -This article presents a few new and interesting projects in COPR. If you’re new to using COPR, see the [COPR User Documentation][3] for how to get started. - -### Ytop - -[Ytop][4] is a command-line system monitor similar to _htop_. The main difference between them is that _ytop_, on top of showing processes and their CPU and memory usage, shows graphs of system CPU, memory, and network usage over time. Additionally, _ytop_ shows disk usage and temperatures of the machine. Finally, _ytop_ supports multiple color schemes as well as an option to create new ones. - -![][5] - -#### Installation instructions - -The [repo][6] currently provides _ytop_ for Fedora 30, 31, 32, and Rawhide, as well as EPEL 7. To install _ytop_, use these commands [with _sudo_][7]: - -``` -sudo dnf copr enable atim/ytop -sudo dnf install ytop -``` - -### Ctop - -[Ctop][8] is yet another command-line system monitor. However, unlike _htop_ and _ytop_, _ctop_ focuses on showing resource usage of containers. _Ctop_ shows both an overview of CPU, memory, network and disk usage of all containers running on your machine, and more comprehensive information about a single container, including graphs of resource usage over time. Currently, _ctop_ has support for Docker and runc containers. - -![][9] - -#### Installation instructions - -The [repo][10] currently provides _ctop_ for Fedora 31, 32 and Rawhide, EPEL 7, as well as for other distributions. To install _ctop_, use these commands: - -``` -sudo dnf copr enable fuhrmann/ctop -sudo dnf install ctop -``` - -### Shortwave - -[Shortwave][11] is a program for listening to radio stations. Shortwave uses a community database of radio stations [www.radio-browser.info][12]. In this database, you can discover or search for radio stations, add them to your library, and listen to them. Additionally, Shortwave provides information about currently playing song and can record the songs as well. - -![][13] - -#### Installation instructions - -The [repo][14] currently provides Shortwave for Fedora 31, 32, and Rawhide. To install Shortwave, use these commands: - -``` -sudo dnf copr enable atim/shortwave -sudo dnf install shortwave -``` - -### Setzer - -[Setzer][15] is a LaTeX editor that can build pdf documents and view them as well. It provides templates for various types of documents, such as articles or presentation slides. Additionally, Setzer has buttons for a lot of special symbols, math symbols and greek letters. - -![][16] - -#### Installation instructions - -The [repo][17] currently provides Setzer for Fedora 30, 31, 32, and Rawhide. To install Setzer, use these commands: - -``` -sudo dnf copr enable lyessaadi/setzer -sudo dnf install setzer -``` - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/ - -作者:[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/author/dturecek/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg -[2]: https://copr.fedorainfracloud.org/ -[3]: https://docs.pagure.org/copr.copr/user_documentation.html# -[4]: https://github.com/cjbassi/ytop -[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/ytop.png -[6]: https://copr.fedorainfracloud.org/coprs/atim/ytop/ -[7]: https://fedoramagazine.org/howto-use-sudo/ -[8]: https://github.com/bcicen/ctop -[9]: https://fedoramagazine.org/wp-content/uploads/2020/04/ctop.png -[10]: https://copr.fedorainfracloud.org/coprs/fuhrmann/ctop/ -[11]: https://github.com/ranfdev/shortwave -[12]: http://www.radio-browser.info/gui/#!/ -[13]: https://fedoramagazine.org/wp-content/uploads/2020/04/shortwave.png -[14]: https://copr.fedorainfracloud.org/coprs/atim/shortwave/ -[15]: https://www.cvfosammmm.org/setzer/ -[16]: https://fedoramagazine.org/wp-content/uploads/2020/04/setzer.png -[17]: https://copr.fedorainfracloud.org/coprs/lyessaadi/setzer/ From 9c52171d8a60f01dfbe51c8e5de5a18bc4a7b590 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 May 2020 08:53:27 +0800 Subject: [PATCH 2089/3057] translated --- ...ew projects to try in COPR for May 2020.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md diff --git a/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md b/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md new file mode 100644 index 0000000000..12486623e9 --- /dev/null +++ b/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for May 2020) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/) +[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) + +COPR 仓库中 4 个很酷的新项目(2020.05) +====== + +![][1] + +COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 + +本文介绍了 COPR 中一些有趣的新项目。如果你第一次使用 COPR,请参阅 [COPR 用户文档][3]。 + +### Ytop + +[ytop][4] 是类似于 _htop_ 的命令行系统监视器。它们之间的主要区别是 _ytop_ 在显示进程及 CPU 和内存使用率的顶部,还显示了系统 CPU、内存和网络使用率随时间变化的图表。此外,_ytop_ 显示磁盘使用情况和计算机温度。最后,_ytop_ 支持多种配色方案以及创建新配色的选项。 + +![][5] + +#### 安装说明 + +[仓库][6]当前为 Fedora 30、31、32 和 Rawhide 以及 EPEL 7 提供 _ytop_。要安装 _ytop_,请[带上 _sudo_][7] 使用以下命令: + +``` +sudo dnf copr enable atim/ytop +sudo dnf install ytop +``` + +### Ctop + +[ctop][8] 是另一个命令行系统监视器。但是,与 _htop_ 和 _ytop_ 不同,_ctop_ 专注于显示容器的资源使用情况。_ctop_ 同时显示计算机上运行的所有容器的CPU、内存、网络和磁盘使用情况的概要,以及单个容器的更全面的信息,包括一段时间内资源使用情况的图表。当前,_ctop_ 支持 Docker 和 runc 容器。 + +![][9] + +#### 安装说明 + +[仓库][10]当前为 Fedora 31、32 和 Rawhide 以及 EPEL 7 还有其他发行版提供安装包。要安装 _ctop_,请使用以下命令: + +``` +sudo dnf copr enable fuhrmann/ctop +sudo dnf install ctop +``` + +### Shortwave + +[shortwave][11] 是用于收听广播电台的程序。shortwave 使用广播电台的社区数据库 [www.radio-browser.info][12]。在此数据库中,你可以发现或搜索广播电台,将它们添加到库中,然后收听。此外,shortwave 还提供有关当前播放歌曲的信息,并且还可以记录这些歌曲。 + +![][13] + +#### 安装说明 + +[仓库][14] 当前为 Fedora 31、32 和 Rawhide 提供 shortwave。要安装 shortwave,请使用以下命令: + +``` +sudo dnf copr enable atim/shortwave +sudo dnf install shortwave +``` + +### Setzer + +[setzer][15] 是 LaTeX 编辑器,它可以构建 pdf 文档并查看它们。它提供了各种类型文档(例如文章或幻灯片)的模板。此外,setzer 还有许多特殊符号,数学符号和希腊字母的按钮。 + +![][16] + +#### 安装说明 + +[仓库][17] 当前为Fedora 30、31、32 和 Rawhide 提供 setzer。要安装 setzer,请使用以下命令: + +``` +sudo dnf copr enable lyessaadi/setzer +sudo dnf install setzer +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/ + +作者:[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/author/dturecek/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://docs.pagure.org/copr.copr/user_documentation.html# +[4]: https://github.com/cjbassi/ytop +[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/ytop.png +[6]: https://copr.fedorainfracloud.org/coprs/atim/ytop/ +[7]: https://fedoramagazine.org/howto-use-sudo/ +[8]: https://github.com/bcicen/ctop +[9]: https://fedoramagazine.org/wp-content/uploads/2020/04/ctop.png +[10]: https://copr.fedorainfracloud.org/coprs/fuhrmann/ctop/ +[11]: https://github.com/ranfdev/shortwave +[12]: http://www.radio-browser.info/gui/#!/ +[13]: https://fedoramagazine.org/wp-content/uploads/2020/04/shortwave.png +[14]: https://copr.fedorainfracloud.org/coprs/atim/shortwave/ +[15]: https://www.cvfosammmm.org/setzer/ +[16]: https://fedoramagazine.org/wp-content/uploads/2020/04/setzer.png +[17]: https://copr.fedorainfracloud.org/coprs/lyessaadi/setzer/ \ No newline at end of file From ef0549578d51c854f86bd3cb0b7205426dc76b62 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 May 2020 08:58:09 +0800 Subject: [PATCH 2090/3057] translating --- .../tech/20200501 How to Handle Automatic Updates in Ubuntu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200501 How to Handle Automatic Updates in Ubuntu.md b/sources/tech/20200501 How to Handle Automatic Updates in Ubuntu.md index b62af6da74..7a973664ce 100644 --- a/sources/tech/20200501 How to Handle Automatic Updates in Ubuntu.md +++ b/sources/tech/20200501 How to Handle Automatic Updates in Ubuntu.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6bb18e06b06e5cb84ed8af9be74311daa8c942b9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 May 2020 09:50:02 +0800 Subject: [PATCH 2091/3057] PRF @wxy --- ...frameworks for frontend web development.md | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md b/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md index 115b1aa911..539b361992 100644 --- a/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md +++ b/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (9 open source CSS frameworks for frontend web development) @@ -9,11 +9,12 @@ 9 个用于前端 Web 开发的开源 CSS 框架 ====== + > 探索开源 CSS 框架,找到适合你的项目的框架。 -![Digital creative of a browser on the internet][1] +![](https://img.linux.net.cn/data/attachment/album/202005/18/094922of81rqfiei8x78xi.jpg) -当大多数人想到 Web 开发时,通常会想到 HTML 或 JavaScript。他们通常会忘记对网站的欣赏能力有更大影响的技术:[级联样式表][2]cascading style sheets(简称CSS)。据维基百科的说法,CSS 既是任何网页中最重要的部分,也是最常被遗忘的部分,尽管它是万维网的三大基石技术之一。 +当大多数人想到 Web 开发时,通常会想到 HTML 或 JavaScript。他们通常会忘记对网站的欣赏能力有更大影响的技术:[级联样式表][2]cascading style sheets(简称 CSS)。据维基百科的说法,CSS 既是网页中最重要的部分,也是最常被遗忘的部分,尽管它是万维网的三大基石技术之一。 本文将探讨九种流行的、强大的、开源的框架,是这些框架让构建漂亮的网站前端的 CSS 开发变得简单明了。 @@ -21,16 +22,14 @@ ---|---|--- [Bootstrap][3] | 最流行的 CSS 框架,来自 Twitter | MIT [PatternFly][4] | 开源框架,来自 Red Hat | MIT -[MDC Web][5] | 开源框架;来自 Google | MIT -[Pure][6] | 开源框架;来自 Yahoo | BSD -[Foundation][7] | 前端框架了;来自 Zurb 基金会 | MIT +[MDC Web][5] | Material Design 组件开源框架,来自 Google | MIT +[Pure][6] | 开源框架,来自 Yahoo | BSD +[Foundation][7] | 前端框架,来自 Zurb 基金会 | MIT [Bulma][8] | 现代 CSS 框架,基于 Flexbox | MIT [Skeleton][9] | 轻量级 CSS 框架 | MIT [Materialize][10] | 基于 Material Design 的 CSS 框架 | MIT [Bootflat][11] | 开源 Flat UI 工具,基于 Bootstrap 3.3.0 | MIT -如果你更愿意跟着我一起探索这段直播,你可以看我的视频。  - ### Bootstrap [Bootstrap][2] 无疑是最流行的 CSS 框架,它是所有前端 Web 设计的开端。Bootstrap 由 Twitter 开发,提供了可用性、功能性和可扩展性。 @@ -41,11 +40,11 @@ Bootstrap 还提供了大量的[例子][14]来帮助你入门。 ![Bootstrap examples][15] -使用 Bootstrap,你可以将不同的组件和布局拼接在一起,创造出一个有趣的页面设计。它还提供了大量详细的文档。 +使用 Bootstrap,你可以将不同的组件和布局拼接在一起,创造出有趣的页面设计。它还提供了大量详细的文档。 ![Bootstrap documentation][16] -Bootstrap 的 [GitHub][3] 仓库列出了超过 19000 个提交和 1100 个贡献者。它基于 MIT 许可证,所以(和这个列表中的所有框架一样)你也可以加入并贡献。 +Bootstrap 的 [GitHub][3] 仓库有超过 19000 个提交和 1100 个贡献者。它基于 MIT 许可证,所以(和这个列表中的所有框架一样)你也可以加入并贡献。 ![Bootstrap GitHub][17] @@ -63,13 +62,13 @@ PatternFly 有许多高级组件,如条形图、图表、[模态窗口][21]和 ![PatternFly chart component][22] -PatternFly 的 [GitHub][4] 页面列出了超过 1050 个提交者和 44 个贡献者。PatternFly 得到了很多人的关注,欢迎大家踊跃贡献。 +PatternFly 的 [GitHub][4] 页面列出了超过 1050 个提交和 44 个贡献者。PatternFly 得到了很多人的关注,欢迎大家踊跃贡献。 ![PatternFly GitHub][23] ### MDC Web -凭借其大获成功的 Android 平台,谷歌以一个名为 [Material Design][24] 的概念制定了自己的标准设计准则。Material Design 标准旨在体现在所有谷歌的产品中,并且在 MIT 许可证下,这些标准也可以向大众和开放源代码。 +凭借其大获成功的安卓平台,谷歌以一个名为 [Material Design][24] 的概念制定了自己的标准设计准则。Material Design 标准旨在体现在所有谷歌的产品中,这些标准也可以面向大众,并且在 MIT 许可证下开源。 ![Material Design homepage][25] @@ -85,7 +84,7 @@ Material Design 有许多“用于创建用户界面的交互式构建块”的[ ![Material Design tutorial][29] -Material 组件的 GitHub 页面承载了不同平台的版本库,包括用于网站开发的 [Material Web 组件(MDC Web)][5]。MDC Web 有超过 5700 个提交和 349 个贡献者。 +Material 组件的 GitHub 页面承载了面向不同平台的存储库,包括用于网站开发的 [Material Web 组件(MDC Web)][5]。MDC Web 有超过 5700 个提交和 349 个贡献者。 ![MDC Web GitHub][30] @@ -123,7 +122,7 @@ Foundation 的 [GitHub][7] 页面显示有近 17000 个提交和 1000 个贡献 ![Bulma homepage][41] -Bulma 有简洁明快的文档,让你可以很容易地选择你想要探索的主题。它也有很多的网页组件,你可以直接拿起来在设计中使用。 +Bulma 有简洁明快的文档,让你可以很容易地选择你想要探索的主题。它也有很多网页组件,你可以直接拿起来在设计中使用。 ![Bulma documentation][42] @@ -133,15 +132,15 @@ Bulma 的 [GitHub][8] 页面列出了 1400 多个提交和 300 多个贡献者 ### Skeleton -如果连 Pure 都觉得太重了,那么还有一个更轻量级的框架叫 [Skeleton][44]。Skeleton 库只有 400 行左右的长度,而且这个框架只提供了开始你的 CSS 框架之旅的基本组件。 +如果连 Pure 都觉得太重了,那么还有一个叫 [Skeleton][44] 的更轻量级框架。Skeleton 库只有 400 行左右的长度,而且这个框架只提供了开始你的 CSS 框架之旅的基本组件。 ![Skeleton homepage][45] -尽管它很简单,但Skeleton提供了详细的文档,可以帮助你马上上手。 +尽管它很简单,但 Skeleton 提供了详细的文档,可以帮助你马上上手。 ![Skeleton documentation][46] -Skeleton 的 [GitHub][9] 列出了 167 个提交者和 22 个贡献者。然而,它不是很活跃,它的最后一次更新是在 2014 年,所以在使用之前可能需要一些维护。由于它是在 MIT 许可证下发布的,你可以自行维护。 +Skeleton 的 [GitHub][9] 列出了 167 个提交和 22 个贡献者。然而,它不是很活跃,它的最后一次更新是在 2014 年,所以在使用之前可能需要一些维护。由于它是在 MIT 许可证下发布的,你可以自行维护。 ![Skeleton GitHub][47] @@ -169,13 +168,13 @@ Bootflat 的[文档][54]几乎像是受到了宜家的启发 —— 它显示的 ![Bootflat docs][55] -Bootflat 是在 MIT 许可下提供的,其 [GitHub][11] 页面包括 159 个提交和 8 个贡献者。 +Bootflat 是在 MIT 许可证下提供的,其 [GitHub][11] 页面包括 159 个提交和 8 个贡献者。 ![Bootflat GitHub][56] ### 你应该选择哪个 CSS 框架? -对于开源的 CSS 框架,你有很多选择,这取决于你想要的工具功能有多丰富或简单。就像所有的技术决定一样,没有任何一个正确的答案,只有在给定的时间和项目中才有正确的选择。 +对于开源的 CSS 框架,你有很多选择,这取决于你想要的工具功能有多丰富或简单。就像所有的技术决定一样,没有一个正确的答案,只有在给定的时间和项目中才有正确的选择。 尝试一下其中的一些,看看要在下一个项目中使用哪个。另外,我有没有错过任何有趣的开源 CSS 框架?请在下面的评论中分享你的反馈和想法。 @@ -186,7 +185,7 @@ via: https://opensource.com/article/20/4/open-source-css-frameworks 作者:[Bryant Son][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 46c0639d570fbefd12e4e7428a945f56526f5fee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 May 2020 09:51:25 +0800 Subject: [PATCH 2092/3057] PUB @wxy https://linux.cn/article-12227-1.html --- ...open source CSS frameworks for frontend web development.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200413 9 open source CSS frameworks for frontend web development.md (99%) diff --git a/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md b/published/20200413 9 open source CSS frameworks for frontend web development.md similarity index 99% rename from translated/tech/20200413 9 open source CSS frameworks for frontend web development.md rename to published/20200413 9 open source CSS frameworks for frontend web development.md index 539b361992..00ab65d520 100644 --- a/translated/tech/20200413 9 open source CSS frameworks for frontend web development.md +++ b/published/20200413 9 open source CSS frameworks for frontend web development.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12227-1.html) [#]: subject: (9 open source CSS frameworks for frontend web development) [#]: via: (https://opensource.com/article/20/4/open-source-css-frameworks) [#]: author: (Bryant Son https://opensource.com/users/brson) From c311a662172c4de7f2e1c1c35c05b88a4449a2a6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 May 2020 13:28:15 +0800 Subject: [PATCH 2093/3057] PRF @Acceleratorrrr --- ... From 8-bit enthusiast to Unix sysadmin.md | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md b/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md index 75f6ba217b..7822b37055 100644 --- a/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md +++ b/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md @@ -1,54 +1,56 @@ [#]: collector: (lujun9972) [#]: translator: (Acceleratorrrr) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (My Linux Story: From 8-bit enthusiast to Unix sysadmin) [#]: via: (https://opensource.com/article/20/4/linux-story) [#]: author: (James Farrell https://opensource.com/users/jamesf) -我的 Linux 故事:从8比特爱好者到 Unix 系统管理员 +我的 Linux 故事:从 8 位发烧友到 Unix 系统管理员 ====== -我是如何从一个电脑爱好者成为职业系统管理员和 Linux 粉丝的 -![Person typing on a 1980's computer][1] -故事得从1980年中期爸妈给家里购买[苹果 \]\[c][2] 开始。尽管很喜欢打游戏,但我还是很快被实用又好玩的 BASIC 编程迷住了。那个年代的人们还是把电脑当作打字机对待,所以懂电脑的人可以轻松使用他们的魔法。 +> 我是如何从一个电脑爱好者成为职业系统管理员和 Linux 粉丝的。 -用 BASIC 和点阵打印机自动生成惩罚作业来举个例子。被罚写两百遍道歉时,我问老师我可不可以打字代替手写。经过同意后,我写了5行 BASIC 语句来自动生成作业。另外一个小技巧是用非可视化文本编辑器,比如用 AppleWorks 微调字体,行距和边距,把学期报告扩充到要求的长度。 +![](https://img.linux.net.cn/data/attachment/album/202005/18/132731pnnzy7t5tz7hvc6z.jpg) -对电脑对喜爱很快让我接触到有 RAM 驱动和 x86 协处理器的苹果 ][gs。调制解调器和网络论坛刚开始火起来,它的双核处理器系统让我可以游刃有余的选择软件。但是由于调制解调器2400比特每秒的速度限制,下载任何超过几 KB 的东西都需要一天。我玩了不久之后就腻了。 +故事得从 1980 年中期我父母给家里购买[苹果 \]\[c][2] 开始。尽管很喜欢打游戏,但我还是很快被实用又好玩的 BASIC 编程迷住了。那个年代的人们还是把电脑当作小一点的打字机对待,所以拥有“高级电脑技能”的人可以轻松使用他们的魔法。 + +以用 BASIC 和点阵打印机自动生成惩罚作业来举个例子。被罚写两百遍道歉时,我问老师我可不可以用打字代替手写。经过同意后,我写了 5 行 BASIC 语句来自动生成作业。另外一个小技巧是用非可视化文本编辑器,比如用 AppleWorks 微调字体、行距和边距,把学期论文“拉长”到要求的篇幅。 + +对电脑的痴迷很快让我得到了带有内存驱动卡和 x86 协处理器的苹果 ][gs。那时候,调制解调器和 BBS 刚开始火起来,有了这样的双处理器系统后,我就可以安装各种琳琅满目的软件。但是由于调制解调器 2400bps 的速度限制,对我每天都要下载几 KB 的有趣东西形成了阻碍。我对苹果痴迷一段时间,不久之后就换了。 ### 探索 Unix -我的本科专业是计算机信息系统,硕士专业是计算机科学。本科教育主要是学习硬件和一些分时系统。研究生的时候才开始真正有意思起来,拨号上网简直打开了新世界的大门。尽管我依然用着我的双核 ][gs 来进行调制解调还有写写作业,不过Unix 系统让我真的热爱上方便的远程登录类游戏,文件传输协议,在线邮箱和 C 语言。当时 Gopher 非常受欢迎,特别是在我们这群终端用户中。 +我的本科专业是计算机信息系统,研究生专业是计算机科学。本科教育主要使用个人电脑,很少涉及大型分时系统。研究生的时候才开始真正有意思起来,拨号进入带有互联网连接的 Unix 简直打开了新世界的大门。尽管我依然用着我的双处理器 ][gs 来使用调制解调器还有写写论文,不过 Unix 系统真正吸引了我的注意力,因为它可以访问通用的 Telnet 游戏、文件传输协议(FTP)、在线邮箱和进行 C 语言编程。当时 Gopher 非常受欢迎,特别是在我们这群终端用户当中。 -被分到学院计算机部门是我本科命运般的转折点,这个部门主管学校的计算机服务。学生们必须要用 X 视窗终端来登陆 [Ultrix][3] 系统。大部分都是黑白界面,彩色处理在当时非常占 CPU 也很影响系统性能。也有一些做的不错的彩色系统,但是这些机器都很慢。 +被分到学院计算机部门是我研究生命运的转折点,这个部门主管学校的计算机服务。学生们可以使用 X Window 终端来登录基于 [Ultrix][3] 的系统。大部分都是灰度的黑白界面,彩色处理在当时非常占用 CPU,也很影响系统性能。也有一些彩色系统还不错,但是这些机器都很慢。 -我很喜欢那个时候,我有系统管理员权限而且工作是维护系统和网络。有一些出色的同事教我,他们对我选择从事系统管理员而不是程序员起了关键作用(尽管我至今热爱编程)。 +我很喜欢那个时候,我有系统管理员权限而且工作是维护系统和网络。我有一些很好的导师,他们对我选择从事系统管理员而不是程序员起了关键作用(尽管我至今仍然热爱编程)。 ### 从 Unix 到 Linux -稀缺是创造之母,当需要分享匮乏的学校电脑系统资源的时候,我们经常突发奇想。需要用电脑的学生是 Ultrix 工作站承受量的四到五倍,所以很难找到资源(特别是要交项目的时候)。虽然有一堆56k点对点协议的调制解调器处理远程系统访问,而且那时还不需要图像显示。但是发现一个有空余资源的机器然后分享出来的过程依然十分缓慢。和大部分人一样,我发现晚上加班很有效率,但我需要另外一些东西让我的项目迭代快一点。 +稀缺是创造之母,当需要分享匮乏的学校电脑系统资源的时候,我们学生们变得富有创造力。需要用电脑的学生是 Ultrix 工作站承受量的三到五倍,所以寻找资源往往是个难题(特别是要交付项目的时候)。在不需要图形化显示的时候,我们有一个 56k 的点对点协议的调制解调器池可供远程系统访问接入。但是找到一个有空余资源的机器并共享系统进行源码编译通常会导致进度缓慢。和大部分人一样,我发现晚上工作通常会有所帮助,但我还需要其它一些东西让我的项目迭代快一点。 -后来学校但一个系统管理员建议我了解一个免费的 Unix 系统。那就是 Linux,被装在一个 3.5 英寸的软盘里。多亏我们学校超快的 T1 载波,让我很方便的查询到这个新群体和一些下载教程。这是一个我之前不曾接触过的32位网络计算机工具。 +后来学校的一个系统管理员建议我去看一个免费提供的 Unix 系统。那就是 Linux,它被装在 3.5 英寸的软盘里。多亏我们学校超快的 T1 线路,我很容易就搜索到新闻组和其他资源来学习如何下载它。它全是基于 32 位的英特尔 PC 机的,而我并没有这一类的设备。 -幸运的是,我的工作让我有机会使用一些淘汰的旧电脑,所以命运的齿轮又开始旋转起来。 +幸运的是,我在学校的工作让我有机会接触到堆积如山的废旧电脑,所以命运的齿轮又开始旋转起来。 -我用一些报废的主机组装了一个可靠的,有足够 RAM 的80386台机(我确定不到 1GB),它有一个能用的显卡,一个细缆(同轴)以太网卡和一个硬盘。镜像用的是 Linux 内核0.98,不记得它是不是正式发行版的一部分了(可能是 SLS)。可我还能记得安装的一系列过程 - 首先启动内核和安装程序,然后格式化硬盘,接着要求每一个软盘安装 GNU 工具核心。核心装好之后,系统就可以启动了,你可以下载和安装其他的镜像包,比如编译器之类的。 +我找到了足够多的废旧 PC 组装了一个可靠的 80386 PC,带有足够内存(我确定不到 1GB),它有一个能用的显卡、一个细缆(同轴)以太网卡和一个硬盘。我所用的镜像是 Linux 内核 0.98,我不记得它是不是正式发行版的一部分了(可能是 SLS)。我所记得的是,它有一系列的软盘镜像,第一张软盘启动内核和一个最小安装程序,然后格式化硬盘,接着要求插入每个后续的软盘来安装 GNU 核心实用程序。在核心实用程序装好并引导系统之后,你可以下载和安装其他的软件包镜像,比如编译器之类的。 -这是我学术道路上巨大的福利。没有了 X 视窗显示,这台电脑性能比学校的 Ultrix 工作站强很多。学校允许我把这台机器连到校园网络,连接到学生网络文件系统,并且能直接接入内网。因为我研究生时主要用 [GNU 编译器套装][5] (还有 Perl 4)写作业,所以我可以进行本地开发。我可以使用这台主机作为独占资源来让我的项目更快迭代。 +这是我学术道路上巨大的福音。在没有运行 X Window 显示服务器的情况下,这台电脑性能比学校的 Ultrix 工作站强很多。学校允许我把这台机器连到校园网络,挂载学校的学生网络文件系统(NFS)共享,并且能直接访问互联网。因为我的研究生课程用 [GCC][5](还有 Perl 4)来完成大部分学生作业,所以我可以在本地进行开发工作。这使得我可以独享关键资源,从而使我能够更快速地迭代我的项目。 -但是,这个方案不是完美的。硬件有时会有点不稳定(这可能就是放弃使用它的原因),但我都能搞定。操作系统和系统自带库层面才真正让我感受到 Linux 和 Ultrix 的不同。我开始领会到移植软件到其他操作系统的意义,我可以开发任何我想要的软件,但是我必须要把项目转换成 Ultrix 编译的二进制文件来传输。在一个平台上能运行的 C 语言可能在另一个平台出错。这让我非常沮丧,但是我可能本能的察觉到了早期 Linux 废弃空指针的方法。Linux 倾向于把它作为无操作处理,但是 Ultrix 会立即触发核心转储和段错误 [SIGSEGV][6]。这是正好在要交作业的几天之前,我第一次程序移植时的重大发现。这同时对我研究 C++ 造成了一些麻烦,因为我不小心使用同时使用 malloc()/free() 和自动[构造函数和析构函数]处理项目,结果空指针被炸得到处都是。 +但是,这个方案不是完美的。硬件有时会有点不稳定(这可能就是它们被丢弃的原因),但我都能搞定。真正让我感受到的是 Linux 和 Ultrix 在操作系统和系统库层面的差异。我开始理解移植软件到其他操作系统的意义,我可以自由地在任何地方开发,但是我必须以 Ultrix 编译的二进制文件交付项目。在一个平台上完美运行的 C 语言代码可能在另一个平台出错。这非常令人沮丧,但是我可能本能的察觉到了早期 Linux 解引用空指针的方法。Linux 倾向于把它作为空操作处理,但是 Ultrix 会立即触发核心转储和段错误 [SIGSEGV][6]。这是我第一次程序移植时的重大发现,正好在要交作业的几天之前。这同时对我研究 C++ 造成了一些麻烦,因为我粗心地同时使用了 `malloc()`/`free()` 和自动[构造函数和析构函数][7]处理,让我的项目到处都是空指针炸弹。 -研究生快结束的时候,我用一颗英特尔 486DX2 66赫兹芯片和一块小型计算机系统接口硬盘,一块光驱和 一个1024x768 RGB 显示器将主机升级成了性能野兽。还把一个 16550 通用异步收发器完美组合到新的 US Robotics V.Everything 牌的调制解调器上。它可以跑 Windows 和 Linux 双系统,但最重要的是显卡和 CPU 的速度让开发环境幸福感倍增。那台旧的386依然在学校服役,不过我主要的工作都转移到了家里。 +研究生课程快结束的时候,我升级到了一台性能野兽工作站:一颗英特尔 486DX2 66MHz 芯片、一块 SCSI 硬盘、一块光驱和一个 1024x768 RGB 显示器,并且还用一个 16550 UART 串口卡完美地匹配了我的新 US Robotics V.Everything 牌调制解调器。它可以双启动 Windows 和 Linux 系统,但更重要的是显卡和 CPU 的速度让我的开发环境幸福感倍增。那台旧的 386 依然在学校服役,不过我我现在大部分繁重的功课和钻研都转移到了家里。 -和 [麦克.哈里斯的故事][8] 里关于90年代的 Linux 类似,我真的对当时流行的光驱很着迷。我住的地方附近有小型电脑器材店,这个宝库充满了电脑配件,高级专业书籍和你能想到的任何 Linux (还有免费的 Unix)CD。我还记得[Yggdrasil][9]和[Slackware][10]是我最喜欢的发行版之一。更惊人的是 CD 650MB 巨大的存储量!使它成为软件必不可少载体。是的,你可以用56k 的速度下载,但是真的很慢。更别提大部分人负担不起将这么多闲置的数据存档供以后使用。 +和 [Mike Harris][8] 关于 90 年代的 Linux 故事类似,我真的对当时流行的 CD 集合很着迷。我住的附近有家新开的 Micro Center 计算机商店,这个宝库充满了电脑配件、高级专业书籍和你能想到的各种 Linux(以及免费的 Unix)CD。我还记得 [Yggdrasil][9] 和 [Slackware][10] 是我最喜欢的发行版。真正让人难以置信的是 CD 存储空间的巨大容量 —— 650MB!使它成为获得软件的必不可少的载体。是的,你可以用 56k 的速度下载,但是真的很慢。更别提大部分人负担不起存档这么多供以后使用的闲置数据。 -### 直到今天 +### 而到了今天 -就是这些开启了我长达25年的系统管理员和开源软件粉丝生涯。Linux 是我事业和个人开发中重要的一部分。最近我依旧醉心于 Linux (主要是 CentOS, RedHat, and Ubuntu),但也经常从[FreeBSD][11]和其他炫酷开源系统中体验乐趣。 +就是这些开启了我长达 25 年的系统管理员的职业生涯和开源软件的乐趣。Linux 一直是我事业和个人开发中的重要组成部分。最近我依旧醉心于 Linux(主要是 CentOS、RedHat 和 Ubuntu),但也经常从 [FreeBSD][11] 和其他炫酷开源软件中得到乐趣。 -Linux 领导了我涉足 Opensource.com,我希望能回馈社区同时为下一代电脑出一份力。 +Linux 让我来到了 Opensource.com,我希望在这里能回馈社区,为新一代电脑爱好者出一份力。 -------------------------------------------------------------------------------- @@ -57,7 +59,7 @@ via: https://opensource.com/article/20/4/linux-story 作者:[James Farrell][a] 选题:[lujun9972][b] 译者:[Accelerator](https://github.com/Acceleratorrrr) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -70,7 +72,7 @@ via: https://opensource.com/article/20/4/linux-story [5]: https://en.wikipedia.org/wiki/GNU_Compiler_Collection [6]: https://en.wikipedia.org/wiki/Segmentation_fault [7]: https://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm -[8]: https://opensource.com/article/19/11/learning-linux-90s +[8]: https://linux.cn/article-11831-1.html [9]: https://en.wikipedia.org/wiki/Yggdrasil_Linux/GNU/X [10]: http://slackware.com [11]: https://www.freebsd.org/ From ca3fd63ce5b6757f2de6d2657c1eb784cdb3a74e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 May 2020 13:29:01 +0800 Subject: [PATCH 2094/3057] PUB @Acceleratorrrr https://linux.cn/article-12228-1.html --- ... My Linux Story- From 8-bit enthusiast to Unix sysadmin.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md (99%) diff --git a/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md b/published/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md similarity index 99% rename from translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md rename to published/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md index 7822b37055..60ab428ad3 100644 --- a/translated/tech/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md +++ b/published/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Acceleratorrrr) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12228-1.html) [#]: subject: (My Linux Story: From 8-bit enthusiast to Unix sysadmin) [#]: via: (https://opensource.com/article/20/4/linux-story) [#]: author: (James Farrell https://opensource.com/users/jamesf) From 07ac39b15ea3f514b0b4fb625f7edf21455ba11e Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 May 2020 17:42:33 +0800 Subject: [PATCH 2095/3057] remove useless articles --- ...epeat a Linux command until it succeeds.md | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 sources/tech/20200507 How to repeat a Linux command until it succeeds.md diff --git a/sources/tech/20200507 How to repeat a Linux command until it succeeds.md b/sources/tech/20200507 How to repeat a Linux command until it succeeds.md deleted file mode 100644 index 1eb586b267..0000000000 --- a/sources/tech/20200507 How to repeat a Linux command until it succeeds.md +++ /dev/null @@ -1,30 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to repeat a Linux command until it succeeds) -[#]: via: (https://www.linux.com/news/how-to-repeat-a-linux-command-until-it-succeeds/) -[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/) - -How to repeat a Linux command until it succeeds -====== - -If you want to run a command on a Linux system until it succeeds, there are some really easy ways to do it that don’t require you to retype the command repeatedly or sit in front of your screen pressing !! Let’s look at the two options available with bash. - -Read More at [Network World][1] - --------------------------------------------------------------------------------- - -via: https://www.linux.com/news/how-to-repeat-a-linux-command-until-it-succeeds/ - -作者:[Linux.com Editorial Staff][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/author/linuxdotcom/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/article/3541298/how-to-repeat-a-linux-command-until-it-succeeds.html From 82c5da5883c64d7c66364c89a244034090f3cd35 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 May 2020 17:49:21 +0800 Subject: [PATCH 2096/3057] PRF @geekpi --- ...ew projects to try in COPR for May 2020.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md b/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md index 12486623e9..e83f84b166 100644 --- a/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md +++ b/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 cool new projects to try in COPR for May 2020) @@ -18,13 +18,13 @@ COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某 ### Ytop -[ytop][4] 是类似于 _htop_ 的命令行系统监视器。它们之间的主要区别是 _ytop_ 在显示进程及 CPU 和内存使用率的顶部,还显示了系统 CPU、内存和网络使用率随时间变化的图表。此外,_ytop_ 显示磁盘使用情况和计算机温度。最后,_ytop_ 支持多种配色方案以及创建新配色的选项。 +[ytop][4] 是类似于 `htop` 的命令行系统监视器。它们之间的主要区别是,`ytop` 在显示进程及其 CPU 和内存使用率的顶部显示了系统的 CPU、内存和网络使用率随时间变化的图表。此外,`ytop` 还显示磁盘使用情况和计算机温度。最后,`ytop` 支持多种配色方案以及创建新配色的选项。 ![][5] #### 安装说明 -[仓库][6]当前为 Fedora 30、31、32 和 Rawhide 以及 EPEL 7 提供 _ytop_。要安装 _ytop_,请[带上 _sudo_][7] 使用以下命令: +[该仓库][6]当前为 Fedora 30、31、32 和 Rawhide 以及 EPEL 7 提供了 `ytop`。要安装 `ytop`,请[带上 sudo][7] 使用以下命令: ``` sudo dnf copr enable atim/ytop @@ -33,13 +33,13 @@ sudo dnf install ytop ### Ctop -[ctop][8] 是另一个命令行系统监视器。但是,与 _htop_ 和 _ytop_ 不同,_ctop_ 专注于显示容器的资源使用情况。_ctop_ 同时显示计算机上运行的所有容器的CPU、内存、网络和磁盘使用情况的概要,以及单个容器的更全面的信息,包括一段时间内资源使用情况的图表。当前,_ctop_ 支持 Docker 和 runc 容器。 +[ctop][8] 是另一个命令行系统监视器。但是,与 `htop` 和 `ytop` 不同,`ctop` 专注于显示容器的资源使用情况。`ctop` 同时显示计算机上运行的所有容器的 CPU、内存、网络和磁盘使用情况的概要,以及单个容器的更全面的信息,包括一段时间内资源使用情况的图表。当前,`ctop` 支持 Docker 和 runc 容器。 ![][9] #### 安装说明 -[仓库][10]当前为 Fedora 31、32 和 Rawhide 以及 EPEL 7 还有其他发行版提供安装包。要安装 _ctop_,请使用以下命令: +[该仓库][10]当前为 Fedora 31、32 和 Rawhide 以及 EPEL 7 还有其他发行版提供了安装包。要安装 `ctop`,请使用以下命令: ``` sudo dnf copr enable fuhrmann/ctop @@ -48,13 +48,13 @@ sudo dnf install ctop ### Shortwave -[shortwave][11] 是用于收听广播电台的程序。shortwave 使用广播电台的社区数据库 [www.radio-browser.info][12]。在此数据库中,你可以发现或搜索广播电台,将它们添加到库中,然后收听。此外,shortwave 还提供有关当前播放歌曲的信息,并且还可以记录这些歌曲。 +[shortwave][11] 是用于收听广播电台的程序。`shortwave` 使用广播电台的社区数据库 [www.radio-browser.info][12]。在此数据库中,你可以发现或搜索广播电台,将它们添加到库中,然后收听。此外,`shortwave` 还提供有关当前播放歌曲的信息,并且还可以记录这些歌曲。 ![][13] #### 安装说明 -[仓库][14] 当前为 Fedora 31、32 和 Rawhide 提供 shortwave。要安装 shortwave,请使用以下命令: +[该仓库][14] 当前为 Fedora 31、32 和 Rawhide 提供了 shortwave。要安装 `shortwave`,请使用以下命令: ``` sudo dnf copr enable atim/shortwave @@ -63,13 +63,13 @@ sudo dnf install shortwave ### Setzer -[setzer][15] 是 LaTeX 编辑器,它可以构建 pdf 文档并查看它们。它提供了各种类型文档(例如文章或幻灯片)的模板。此外,setzer 还有许多特殊符号,数学符号和希腊字母的按钮。 +[setzer][15] 是 LaTeX 编辑器,它可以构建 pdf 文档并查看它们。它提供了各种类型文档(例如文章或幻灯片)的模板。此外,`setzer` 还有许多特殊符号、数学符号和希腊字母的按钮。 ![][16] #### 安装说明 -[仓库][17] 当前为Fedora 30、31、32 和 Rawhide 提供 setzer。要安装 setzer,请使用以下命令: +[该仓库][17] 当前为 Fedora 30、31、32 和 Rawhide 提供了 `setzer`。要安装 `setzer`,请使用以下命令: ``` sudo dnf copr enable lyessaadi/setzer @@ -83,7 +83,7 @@ via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-202 作者:[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/) 荣誉推出 @@ -105,4 +105,4 @@ via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-202 [14]: https://copr.fedorainfracloud.org/coprs/atim/shortwave/ [15]: https://www.cvfosammmm.org/setzer/ [16]: https://fedoramagazine.org/wp-content/uploads/2020/04/setzer.png -[17]: https://copr.fedorainfracloud.org/coprs/lyessaadi/setzer/ \ No newline at end of file +[17]: https://copr.fedorainfracloud.org/coprs/lyessaadi/setzer/ From f8d772de7abe160ba132eff26cc68a314ad9cee5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 May 2020 17:50:05 +0800 Subject: [PATCH 2097/3057] PUB @geekpi https://linux.cn/article-12230-1.html --- ...0200504 4 cool new projects to try in COPR for May 2020.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200504 4 cool new projects to try in COPR for May 2020.md (98%) diff --git a/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md b/published/20200504 4 cool new projects to try in COPR for May 2020.md similarity index 98% rename from translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md rename to published/20200504 4 cool new projects to try in COPR for May 2020.md index e83f84b166..9a63887910 100644 --- a/translated/tech/20200504 4 cool new projects to try in COPR for May 2020.md +++ b/published/20200504 4 cool new projects to try in COPR for May 2020.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12230-1.html) [#]: subject: (4 cool new projects to try in COPR for May 2020) [#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/) [#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) From 3ab640e83c51a06e2e0fdc978585cd021b8c332b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 May 2020 18:59:24 +0800 Subject: [PATCH 2098/3057] PRF @wxy --- ...he life-changing magic of git rebase -i.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/translated/tech/20200429 The life-changing magic of git rebase -i.md b/translated/tech/20200429 The life-changing magic of git rebase -i.md index 91739d2789..4536691b6b 100644 --- a/translated/tech/20200429 The life-changing magic of git rebase -i.md +++ b/translated/tech/20200429 The life-changing magic of git rebase -i.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The life-changing magic of git rebase -i) @@ -12,53 +12,53 @@ > 让大家觉得你一次就能写出完美的代码,并让你的补丁更容易审核和合并。 -![Hands programming][1] +![](https://img.linux.net.cn/data/attachment/album/202005/18/185911fvwztwyp4lvbzkw4.jpg) -软件开发是混乱的。有很多错误的转折、有需要修复的错别字、有需要修正的错误、有需要稍后纠正临时和粗陋的代码,还有在开发过程中以后发现的错位问题。有了版本控制,在创建“完美”的最终产品(即准备提交给上游的补丁)的过程中,你会有一个记录着每一个错误的转折和修正的原始记录。就像电影中的片段一样,它们有些尴尬,有时还很有趣。就像电影中的花絮一样,它们会让人有点尴尬,有时也会让人觉得好笑。 +软件开发是混乱的。有很多错误的转折、有需要修复的错别字、有需要修正的错误、有需要稍后纠正的临时和粗陋的代码,还有在以后的开发过程中发现一次又一次的问题。有了版本控制,在创建“完美”的最终产品(即准备提交给上游的补丁)的过程中,你会有一个记录着每一个错误转折和修正的原始记录。就像电影中的花絮一样,它们会让人有点尴尬,有时也会让人觉得好笑。 -如果你能使用版本控制来定期保存你的工作线索,然后当你准备提交审核的东西时,可以隐藏所有这些私人草稿工作,只需提交一份单一的、完美的补丁就可以了,那不是很好吗?`git rebase -i`,是重写历史记录的完美方法,可以让大家觉得你一次就写出了完美的代码。 +如果你使用版本控制来定期保存你的工作线索,然后当你准备提交审核的东西时,又可以隐藏所有这些私人草稿工作,并只提交一份单一的、完美的补丁,那不是很好吗?`git rebase -i`,是重写历史记录的完美方法,可以让大家觉得你一次就写出了完美的代码! ### git rebase 的作用是什么? -如果你不熟悉 Git 的复杂性,这里简单介绍一下。在幕后,Git 将项目的不同版本与唯一标识符关联起来,这个标识符由父节点的唯一标识符的哈希以及新版本与其父节点的差异组成。这样就形成了一棵修订树,每个检出项目的人都会得到自己的副本。不同的人可以把项目往不同的方向发展,每个人的出发点都可能是不同的分支点。 +如果你不熟悉 Git 的复杂性,这里简单介绍一下。在幕后,Git 将项目的不同版本与唯一标识符关联起来,这个标识符由父节点的唯一标识符的哈希以及新版本与其父节点的差异组成。这样就形成了一棵修订树,每个签出项目的人都会得到自己的副本。不同的人可以把项目往不同的方向发展,每个方向都可能从不同的分支点开始。 ![Master branch vs. private branch][2] -*左边是 `origin` 版本库中的主分支,右边是你个人副本中的私有分支。* +*左边是 origin 版本库中的主分支,右边是你个人副本中的私有分支。* -有两种方法可以将你的工作与原始版本库中的主分支整合起来:一种是使用 合并:`git merge`,另一种是使用变基:`git rebase`。它们的工作方式非常不同。 +有两种方法可以将你的工作与原始版本库中的主分支整合起来:一种是使用合并:`git merge`,另一种是使用变基:`git rebase`。它们的工作方式非常不同。 -当你使用 `git merge` 时,会在主分支上创建一个新的提交,其中包括所有来自 `origin` 的修改和所有本地的修改。如果有任何冲突(例如,如果别人修改了你也在修改的文件),则将这些冲突标记出来,并且你有机会在将该“合并提交”提交到本地版本库之前解决这些冲突。当你将更改推送回父版本库时,所有的本地工作都会以分支的形式出现在 Git 仓库的其他用户面前。 +当你使用 `git merge` 时,会在主分支(`master`)上创建一个新的提交,其中包括所有来自原始位置(`origin`)的修改和所有本地的修改。如果有任何冲突(例如,如果别人修改了你也在修改的文件),则将这些冲突标记出来,并且你有机会在将这个“合并提交”提交到本地版本库之前解决这些冲突。当你将更改推送回父版本库时,所有的本地工作都会以分支的形式出现在 Git 版本库的其他用户面前。 -但是 `git rebase` 的工作方式不同。它回滚你的提交,并从主分支的顶端再次重放这些提交。这导致了两个主要的变化。首先,由于你的提交现在从一个不同的父节点分支出来,它们的哈希值会被重新计算,并且任何克隆了你的仓库的人都可能会有一个残破的仓库副本。第二,你没有一个合并提交,所以在将更改重放到主分支上时会识别出任何合并冲突,所以任何合并冲突都会被识别出来,因此,你需要在进行变基rebase之前修复它们。当你现在推送你的修改时,你的工作不会出现在分支上,并且看起来像是你把所有的修改都写到了主分支的最新的提交上。 +但是 `git rebase` 的工作方式不同。它会回滚你的提交,并从主分支(`master`)的顶端再次重放这些提交。这导致了两个主要的变化。首先,由于你的提交现在从一个不同的父节点分支出来,它们的哈希值会被重新计算,并且任何克隆了你的版本库的人都可能得到该版本库的一个残破副本。第二,你没有“合并提交”,所以在将更改重放到主分支上时会识别出任何合并冲突,因此,你需要在进行变基rebase之前先修复它们。现在,当你现在推送你的修改时,你的工作不会出现在分支上,并且看起来像是你是在主分支的最新的提交上写入了所有的修改。 ![Merge commits preserve history, and rebase rewrites history.][3] *合并提交(左)保留了历史,而变基(右)重写历史。* -然而,这两种方式都有一个坏处:在你准备好分享代码之前,每个人都可以看到你在本地处理问题时的所有涂鸦和编辑。这就是 `git rebase` 的 `--interactive`(或简写 `-i`)标志的作用。 +然而,这两种方式都有一个缺点:在你准备好分享代码之前,每个人都可以看到你在本地处理问题时的所有涂鸦和编辑。这就是 `git rebase` 的 `--interactive`(或简写 `-i`)标志发挥作用的地方。 -### 介绍 git rebase -i +### git rebase -i 登场 -`git rebase` 的最大优点是它重写了历史。但是,为什么仅止于假装你从后面的点分支出来呢?有一种更进一步方法可以重写你是如何准备就绪这些代码的:`git rebase -i`,交互式的 `git rebase`。 +`git rebase` 的最大优点是它可以重写历史。但是,为什么仅止于假装你从后面的点分支出来呢?有一种更进一步方法可以重写你是如何准备就绪这些代码的:`git rebase -i`,即交互式的 `git rebase`。 -这个功能就是 Git 中的 "神奇的时间机器” 功能。这个标志允许你在做变基时对修订历史记录进行复杂的修改。你可以隐藏你的错误! 将许多小的修改合并到一个原始的功能补丁中! 重新排序修改历史记录中的内容 +这个功能就是 Git 中的 “魔术时光机” 功能。这个标志允许你在做变基时对修订历史记录进行复杂的修改。你可以隐藏你的错误! 将许多小的修改合并到一个崭新的功能补丁中! 重新排列修改历史记录中的显示顺序! ![output of git rebase -i][4] -当你运行 `git rebase -i` 时,你会得到一个编辑器会话,其中列出了所有正在被变基的提交,并有一些选项可以对它们做什么。默认的选择是 `pick`。 +当你运行 `git rebase -i` 时,你会进入一个编辑器会话,其中列出了所有正在被变基的提交,以及可以对其执行的操作的多个选项。默认的选择是选择(`Pick`)。 - * `Pick`:会在你的历史记录中保留该提交。 - * `Reword`:允许你修改提交信息,可能是修复一个错别字或添加额外的注释。 - * `Edit`:允许你在重放分支的过程中对提交进行修改。 - * `Squash`:可以将多个提交合并为一个。 - * 你可以通过移动文件中的提交来重新排序。 +* `Pick`:会在你的历史记录中保留该提交。 +* `Reword`:允许你修改提交信息,可能是修复一个错别字或添加其它注释。 +* `Edit`:允许你在重放分支的过程中对提交进行修改。 +* `Squash`:可以将多个提交合并为一个。 +* 你可以通过在文件中移动来重新排序提交。 -当你完成后,只需保存最终结果,变基就会执行。在每个阶段,当你选择了修改提交(无论是用 `reword`、`edit`、`squash` 还是有冲突时),变基会停止,并允许你在继续提交之前进行适当的修改。 +当你完成后,只需保存最终结果,变基操作就会执行。在你选择修改提交的每个阶段(无论是用 `reword`、`edit`、`squash` 还是发生冲突时),变基都会停止,并允许你在继续提交之前进行适当的修改。 -上面这个例子的结果是 “One-liner bug fix” 和 “Integate new header everywhere” 被合并到一个提交中,而 “New header for docs website” 和 “D'oh - typo. Fixed” 合并到另一个提交中。就像变魔术一样,其他提交的工作还在你的分支中,但相关的提交已经从你的历史记录中消失了!这样一来,你就可以很容易地提交干净的提交。 +上面这个例子的结果是 “One-liner bug fix” 和 “Integate new header everywhere” 被合并到一个提交中,而 “New header for docs website” 和 “D'oh - typo. Fixed” 合并到另一个提交中。就像变魔术一样,其他提交的工作还在你的分支中,但相关的提交已经从你的历史记录中消失了! -这使得使用 `git send-email` 或者用你新整理好的补丁集在父版本库中创建一个拉取请求来提交一个干净的补丁给上游项目变得很容易。这有很多好处,包括让你的代码更容易审核,更容易接受,也更容易合并。 +这使得使用 `git send-email` 或者用你新整理好的补丁集在父版本库中创建一个拉取请求,然后来提交一个干净的补丁给上游项目变得很容易。这有很多好处,包括让你的代码更容易审核,更容易接受,也更容易合并。 -------------------------------------------------------------------------------- @@ -67,7 +67,7 @@ via: https://opensource.com/article/20/4/git-rebase-i 作者:[Dave Neary][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9e95e8ab91940fe240bb30a7b69972d4ee744676 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 May 2020 19:00:32 +0800 Subject: [PATCH 2099/3057] PUB @wxy https://linux.cn/article-12231-1.html --- .../20200429 The life-changing magic of git rebase -i.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200429 The life-changing magic of git rebase -i.md (98%) diff --git a/translated/tech/20200429 The life-changing magic of git rebase -i.md b/published/20200429 The life-changing magic of git rebase -i.md similarity index 98% rename from translated/tech/20200429 The life-changing magic of git rebase -i.md rename to published/20200429 The life-changing magic of git rebase -i.md index 4536691b6b..54665c70fe 100644 --- a/translated/tech/20200429 The life-changing magic of git rebase -i.md +++ b/published/20200429 The life-changing magic of git rebase -i.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12231-1.html) [#]: subject: (The life-changing magic of git rebase -i) [#]: via: (https://opensource.com/article/20/4/git-rebase-i) [#]: author: (Dave Neary https://opensource.com/users/dneary) From b046f4ff32363680c7ffe88ab720db3e2fbfe8ab Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 19 May 2020 08:36:15 +0800 Subject: [PATCH 2100/3057] translated --- ...un multiple versions of Python on a Mac.md | 186 ------------------ ...un multiple versions of Python on a Mac.md | 180 +++++++++++++++++ 2 files changed, 180 insertions(+), 186 deletions(-) delete mode 100644 sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md create mode 100644 translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md diff --git a/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md b/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md deleted file mode 100644 index 34a7802f28..0000000000 --- a/sources/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md +++ /dev/null @@ -1,186 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use pyenv to run multiple versions of Python on a Mac) -[#]: via: (https://opensource.com/article/20/4/pyenv) -[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) - -How to use pyenv to run multiple versions of Python on a Mac -====== -If you need to run a project that uses a Python version you don't have -installed on macOS, try pyenv. -![Searching for code][1] - -Managing a local Python development environment continues to be a challenge, even for experienced developers. While there are well-documented [strategies for package management][2], there is another step necessary to ensure you are running the version of Python you need when you need it. - -### Why does the version of Python matter? - -It's a strange concept at first, but programming languages change like any other software. They have bugs, fixes, and updates like any of your favorite [APIs][3] and any other software. Similarly again, different releases are identified by a three-digit number known as a [semantic version][4]. - -> 😭😭😭 [pic.twitter.com/yt1Z2439W8][5] -> -> — Denny Perez (@dennyperez18) [May 28, 2019][6] - -For many years, Python 2 was the commonly used major version of the programming language. In January 2020, Python 2 [reached end of life][7], and only Python 3 will be supported by the language's core maintainers from then forward. Python 3 is developing steadily, and releasing new updates regularly. That makes it important for me to regularly get those updates. - -Recently, I tried to run a project on macOS that depended on Python 3.5.9, a version that I did not have installed on my system. It might seem logical to think the Python package manager **pip** could install it*, but that wasn't the case: - - -``` -$ pip install python3.5.9 -Collecting python3.5.9 -  ERROR: Could not find a version that satisfies the requirement python3.5.9 (from versions: none) -ERROR: No matching distribution found for python3.5.9 -``` - -Alternatively, I could have downloaded that version from the official Python website, but how would I run it in on my Mac alongside my existing version of Python? Specifying the version of Python I intend to use every time I run the interpreter (python3.7 or python3.5 for example) seems error-prone at best. There has to be a better way. - -_(A note on the above: I know this makes no sense to seasoned Python developer, but it made sense to me at the time. I would happily talk about why I still think it should.)_ - -### Installing and setting up pyenv - -Thankfully, **pyenv** exists to work around this series of complexities. To start, I needed to install pyenv. I could clone and compile it myself [from source][8], but I prefer to manage packages like this through the Homebrew package manager: - - -``` -`$ brew install pyenv` -``` - -In order to use the version of Python through pyenv, it's essential to understand the shell's PATH variable. PATH determines where the shell searches for files by the name of the command. You must ensure the shell will find the version of Python run by pyenv, not the one installed by default (which is often called the _system version_). If you don't change the path, here is the result: - - -``` -$ which python -/usr/bin/python -``` - -That's the system version of Python. - -To set up pyenv correctly, you can run the following in Bash or zsh: - - -``` -`$ PATH=$(pyenv root)/shims:$PATH` -``` - -Now, if you check the version of Python, you'll see it is the one managed by pyenv: - - -``` -$ which python -/Users/my_username/.pyenv/shims/python -``` - -That export statement (PATH=) will only change for this shell instance, so make it a permanent change, you need to add it to your dotfiles. Since zsh is officially macOS's default shell, I'll focus on it. Append that same syntax to the **~/.zshrc** file: - - -``` -`$ echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc` -``` - -Now every time we run a command in zsh, it will use the pyenv version of Python. Note that I used single quotes with **echo** so it does not evaluate and expand the commands. - -The .zshrc file only manages zsh instances, so be sure to check what your shell is and edit the associated dotfiles. If you need to double-check what your default shell is, you can run **echo $SHELL**. If it's zsh, use the command above. If you use Bash, change **~/.zshrc** to **~/.bashrc**. You can dive deep into [path setting][9] in pyenv's README if you would like to learn more. - -### Using pyenv to manage Python versions - -Now that pyenv is in control, we can see it only has the system Python available to it: - - -``` -$ pyenv versions -system -``` - -As mentioned above, you absolutely do not want to use this version ([read more on why][10]). Now that pyenv is set up correctly, I want it to have a few different versions of Python that I regularly use. - -There is a way to see all Python versions available from all the different repositories pyenv has access to by running **pyenv install --list**. It's a long, overwhelming list that may be helpful to review in the future. For now, I stick with the latest of each dot-release (3.5.x or 3.6.x where x is the latest) found on the [Python download page][11]. With that in mind, I'll install 3.5.9 and 3.8.0: - - -``` -$ pyenv install 3.5.9 -$ pyenv install 3.8.0 -``` - -This will take a while, so get some tea (or read one of the links above). It's interesting to note that the output walks through the download and building of that version of Python. For example, the output shows that the file comes directly from [Python.org][12]. - -Once everything is installed, you can set up your defaults. I like to live at the cutting edge, so I set my global default Python version to the latest: - - -``` -`$ pyenv global 3.8.0` -``` - -And that version is immediately set in my shell. To confirm: - - -``` -$ python -V -Python 3.8.0 -``` - -The project I want to run works only with Python 3.5, so I'll set the version locally and confirm it's in use: - - -``` -$ pyenv local 3.5.9 -$ python -V -Python 3.5.9 -``` - -Because I used the **local** option with pyenv, it added a file to my current directory to track that information.  - - -``` -$ cat .python-version -3.5.9 -``` - -Now, I can finally set up a virtual environment for the project I want and be sure I'm running the right version of Python. - - -``` -$ python -m venv venv -$ source ./venv/bin/activate -(venv) $ which python -/Users/mbbroberg/Develop/my_project/venv/bin/python -``` - -To learn more, check out this tutorial about [managing virtual environments on a Mac][13]. - -### Wrapping up - -By default, running multiple Python versions can be a challenge. I find starting with pyenv ensures I have the versions of Python I need set up to run when I need them. - -Do you have other beginner or intermediate Python questions? Leave a comment, and we will consider them for a future article. - -Newcomers to python-ideas occasionally make reference to the idea of "Python 4000" when proposing... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/4/pyenv - -作者:[Matthew Broberg][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mbbroberg -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) -[2]: https://opensource.com/article/19/4/managing-python-packages -[3]: https://opensource.com/article/19/5/api-evolution-right-way -[4]: https://semver.org/ -[5]: https://t.co/yt1Z2439W8 -[6]: https://twitter.com/dennyperez18/status/1133505310516232203?ref_src=twsrc%5Etfw -[7]: https://opensource.com/article/19/11/end-of-life-python-2 -[8]: https://github.com/pyenv/pyenv -[9]: https://github.com/pyenv/pyenv#understanding-path -[10]: https://opensource.com/article/19/5/python-3-default-mac -[11]: https://www.python.org/downloads/ -[12]: http://python.org -[13]: https://opensource.com/article/19/6/python-virtual-environments-mac diff --git a/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md b/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md new file mode 100644 index 0000000000..def57f9a21 --- /dev/null +++ b/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md @@ -0,0 +1,180 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use pyenv to run multiple versions of Python on a Mac) +[#]: via: (https://opensource.com/article/20/4/pyenv) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +如何在 Mac 上使用 pyenv 运行多个版本的 Python +====== +如果你需要运行 macOS 上没有安装的 Python 版本,请试试 pyenv。 +![Searching for code][1] + +即使对于有经验的开发人员,管理本地 Python 开发环境仍然是一个挑战。尽管有详细的[软件包管理策略][2],但仍需要采取另外的步骤来确保你在需要时运行所需的 Python 版本。 + +### 为什么 Python 版本重要? + +起初这是一个奇怪的概念,但是编程语言会像其他任何软件一样发生变化。它们有 bug,修复和更新,就像你喜欢的 [API][3] 和任何其他软件一样。同样,不同的发行版由称为[语义版本][4]的三位数标识。 + +> 😭😭😭 [pic.twitter.com/yt1Z2439W8][5] +> +> — Denny Perez (@dennyperez18) [May 28, 2019][6] + +多年来,Python 2 是该语言的常用主要版本。在 2020 年 1 月,Python 2 [到达最后寿命][7],此后,Python 的核心维护者将仅支持 Python 3。Python 3 稳步发展,并定期发布新更新。对我来说定期获取这些更新很重要。 + +最近,我尝试在依赖于 Python 3.5.9 的 macOS 上运行一个项目,但该版本尚未安装在系统上。我认为 Python 包管理器 **pip** 可以安装它,但事实并非如此: + + +``` +$ pip install python3.5.9 +Collecting python3.5.9 +  ERROR: Could not find a version that satisfies the requirement python3.5.9 (from versions: none) +ERROR: No matching distribution found for python3.5.9 +``` + +或者,我可以从官方 Python 网站下载该版本,但是除了现有的 Python 版本外,如何在 Mac 上运行它?每次运行指定 Python 解释器版本(例如 python3.7 或 python3.5)似乎很容易出错。一定会有更好的方法。 + +_(说明:我知道这对经验丰富的 Python 开发人员没有意义,但对当时的我来说是有意义的。我很乐意谈论为什么我仍然认为应该如此。)_ + +### 安装和设置 pyenv + +值得庆幸的是,**pyenv** 可以解决这一系列复杂性。首先,我需要安装 pyenv。我可以[从源码][8]自己克隆并编译它,但是我更喜欢通过 Homebrew 包管理器来管理软件包: + +``` +`$ brew install pyenv` +``` + +为了通过 pyenv 使用 Python 版本,必须了解 shell 的 PATH 变量。PATH 通过命令名称确定 shell 在哪里搜索文件。你必须确保 shell 程序能够找到 pyenv 运行的 Python 版本,而不是默认安装的版本(通常称为_系统版本_)。如果不更改路径,那么结果如下: + + +``` +$ which python +/usr/bin/python +``` + +这是 Python 的系统版本。 + +要正确设置 pyenv,可以在 Bash 或 zsh 中运行以下命令: + +``` +`$ PATH=$(pyenv root)/shims:$PATH` +``` + +现在,如果你检查 Python 的版本,你会看到它是 pyenv 管理的版本: + + +``` +$ which python +/Users/my_username/.pyenv/shims/python +``` + +该 export 语句(PATH=)仅会对该 shell 实例进行更改,为了永久更改,你需要将它添加到 dotfile 中。由于 zsh 是 macOS 的默认 shell,因此我将重点介绍它。将相同的语法添加到 **~/.zshrc** 文件中: + + +``` +`$ echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc` +``` + +现在,每次我们在 zsh 中运行命令时,它将使用 pyenv 版本的 Python。请注意,我在 **echo** 中使用了单引号,因此它不会评估和扩展命令。 + +.zshrc 文件仅管理 zsh 实例,因此请确保检查你的 shell 程序并编辑关联的 dotfile。如果需要再次检查默认 shell 程序,可以运行 **echo $SHELL**。如果是 zsh,请使用上面的命令。如果你使用 Bash,请将 **~/.zshrc** 更改为 **~/.bashrc**。如果您想了解更多信息,可以在pyenv的自述文件中深入研究[path setting] [9]。 + +### 使用 pyenv 管理 Python 版本 + +现在 pyenv 已经可用,我们可以看到它只有系统 Python 可用: + +``` +$ pyenv versions +system +``` + +如上所述,你绝对不想使用此版本([阅读更多有关信息][10])。现在 pyenv 已正确设置,我希望它有我经常使用的几个不同版本的 Python。 + +有一种方法可以通过运行 **pyenv install --list** 来查看 pyenv 可以访问的所有不同仓库中的所有 Python 版本。这是一个很长的列表,将来可能会有所帮助。目前,我决定在 [Python 下载页面][11]找到的每个最新的“点版本”(3.5.x 或 3.6.x,其中 x 是最新的)。因此,我将安装 3.5.9 和 3.8.0: + + +``` +$ pyenv install 3.5.9 +$ pyenv install 3.8.0 +``` + +这将需要一段时间,因此休息一会(或阅读上面的链接之一)。有趣的是,输出遍历了该版本的 Python 的下载和构建。例如,输出显示文件直接来自 [Python.org][12]。 + +安装完成后,你可以设置默认值。我喜欢最新的,因此将全局默认 Python 版本设置为最新版本: + + +``` +`$ pyenv global 3.8.0` +``` + +该版本立即在我的 shell 中设置完成。要确认: + + +``` +$ python -V +Python 3.8.0 +``` + +我要运行的项目仅适于 Python 3.5,因此我将在本地设置该版本并确认: + + +``` +$ pyenv local 3.5.9 +$ python -V +Python 3.5.9 +``` + +因为我在 pyenv 中使用了 **local** 选项,所以它向当前目录添加了一个文件来跟踪该信息。 + + +``` +$ cat .python-version +3.5.9 +``` + +现在,我终于可以为想要的项目设置虚拟环境,并确保运行正确版本的 Python。 + + +``` +$ python -m venv venv +$ source ./venv/bin/activate +(venv) $ which python +/Users/mbbroberg/Develop/my_project/venv/bin/python +``` + +要了解更多信息,请查看有关[在 Mac 上管理虚拟环境][13]的教程。 + +### 总结 + +默认情况下,运行多个 Python 版本可能是一个挑战。我发现 pyenv 可以确保在我需要时可以有我需要的 Python 版本。 + +你还有其他初学者或中级 Python 问题吗? 请发表评论,我们将在以后的文章中考虑它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/pyenv + +作者:[Matthew Broberg][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/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://opensource.com/article/19/4/managing-python-packages +[3]: https://opensource.com/article/19/5/api-evolution-right-way +[4]: https://semver.org/ +[5]: https://t.co/yt1Z2439W8 +[6]: https://twitter.com/dennyperez18/status/1133505310516232203?ref_src=twsrc%5Etfw +[7]: https://opensource.com/article/19/11/end-of-life-python-2 +[8]: https://github.com/pyenv/pyenv +[9]: https://github.com/pyenv/pyenv#understanding-path +[10]: https://opensource.com/article/19/5/python-3-default-mac +[11]: https://www.python.org/downloads/ +[12]: http://python.org +[13]: https://opensource.com/article/19/6/python-virtual-environments-mac From 327892064ad3d5d1ab9224b5577cc529c513419a Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 19 May 2020 08:48:12 +0800 Subject: [PATCH 2101/3057] translating --- ...20200326 Tricks for getting around your Linux file system.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200326 Tricks for getting around your Linux file system.md b/sources/tech/20200326 Tricks for getting around your Linux file system.md index e8ed2b3869..bda5e2100c 100644 --- a/sources/tech/20200326 Tricks for getting around your Linux file system.md +++ b/sources/tech/20200326 Tricks for getting around your Linux file system.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 80407fb6d530994a3dfd172fb909d9ad2a9ffbe0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 May 2020 08:53:07 +0800 Subject: [PATCH 2102/3057] PRF @LazyWolfLin --- ...00414 How I containerize a build system.md | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/translated/tech/20200414 How I containerize a build system.md b/translated/tech/20200414 How I containerize a build system.md index b7bc3f252c..f1590ef480 100644 --- a/translated/tech/20200414 How I containerize a build system.md +++ b/translated/tech/20200414 How I containerize a build system.md @@ -1,69 +1,71 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How I containerize a build system) [#]: via: (https://opensource.com/article/20/4/how-containerize-build-system) [#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) -构建系统容器化指南 +对构建系统进行容器化的指南 ====== -搭建一个通过容器分发应用的可复用系统可能很复杂,但这儿有个好方法。 -![Containers on a ship on the ocean][1] -一个用于将源代码编译成可运行的应用的构建系统是由工具和流程共同组成。在编译过程中还涉及到代码从软件开发者流转到最终用户,无论最终用户是运维的同事还是部署的同事。 +> 搭建一个通过容器分发应用的可复用系统可能很复杂,但这儿有个好方法。 -在使用容器搭建了一些构建系统后,我觉得有一个不错的可复用的方法值得分享。虽然这些构建系统被用于编译机器学习算法和为嵌入式硬件生成可加载的软件镜像上,但这个方法足够抽象,可用于任何基于容器的构建系统。 +![](https://img.linux.net.cn/data/attachment/album/202005/19/085248ausakkjfu05akqr2.jpg) -这个方法是关于通过简单和可维护的方式搭建或组织构建系统,但并不涉及处理特定编译器或工具容器化的技巧。它适用于软件开发人员构建软件并将可维护镜像交给其他技术人员(无论是系统管理员,运维工程师或者其他头衔)的常见情况。由于构建系统对于最终用户是透明的,因此他们能够专注于软件本身。 +一个用于将源代码转换成可运行的应用的构建系统是由工具和流程共同组成。在转换过程中还涉及到代码的受众从软件开发者转变为最终用户,无论最终用户是运维的同事还是部署的同事。 + +在使用容器搭建了一些构建系统后,我觉得有一个不错的可复用的方法值得分享。虽然这些构建系统被用于编译机器学习算法和为嵌入式硬件生成可加载的软件镜像,但这个方法足够抽象,可用于任何基于容器的构建系统。 + +这个方法是以一种易于使用和维护的方式搭建或组织构建系统,但并不涉及处理特定编译器或工具容器化的技巧。它适用于软件开发人员构建软件,并将可维护镜像交给其他技术人员(无论是系统管理员、运维工程师或者其他一些头衔)的常见情况。该构建系统被从终端用户中抽象出来,这样他们就可以专注于软件。 ### 为什么要容器化构建系统? 搭建基于容器的可复用构建系统可以为软件团队带来诸多好处: - * **专注**:我希望专注于应用的开发。当我调用一个名为“build”的工具时,我希望这个工具集能生成一个随时可用的二进制文件。我不想浪费时间在构建系统的查错上。实际上,我宁愿不了解也不关心构建系统。 + * **专注**:我希望专注于应用的开发。当我调用一个工具进行“构建”时,我希望这个工具集能生成一个随时可用的二进制文件。我不想浪费时间在构建系统的查错上。实际上,我宁愿不了解,或者说不关心构建系统。 * **一致的构建行为**:无论在哪种使用情况下,我都想确保整个团队使用相同版本的工具集并在构建时得到相同的结果。否则,我就得不断地处理“我这咋就是好的”的麻烦。在团队项目中,使用相同版本的工具集并对给定的输入源文件集产生一致的输出是非常重要。 - * **易于部署和升级**:即使向每个人都提供一套详细说明来为项目安装工具集,也可能会有人翻车。问题可能是由于每个人对自己的 Linux 环境的个性化修改导致的。在团队中使用不同的 Linux 发行版(或者其他操作系统),情况可能还会变得更复杂。当需要将工具集升级到下一版本时,问题很快就会变得更糟糕。使用容器和本指南将使得新版本升级非常简单。 + * **易于部署和升级**:即使向每个人都提供一套详细说明来安装一个项目的工具集,也可能会有人翻车。问题也可能是由于每个人对自己的 Linux 环境的个性化修改导致的。在团队中使用不同的 Linux 发行版(或者其他操作系统),情况可能还会变得更复杂。当需要将工具集升级到下一版本时,问题很快就会变得更糟糕。使用容器和本指南将使得新版本升级非常简单。 -我在项目中容器化构建系统的经验显然很有价值,因为它可以缓解上述问题。我倾向于使用 Docker 作为容器工具,虽然在相对特殊的环境中安装和网络配置仍可能出现问题,尤其是当你在一个使用复杂代理的企业环境中工作时。但至少现在我需要解决的构建系统问题已经很少了。 +对我在项目中使用的构建系统进行容器化的这些经验显然很有价值,因为它可以缓解上述问题。我倾向于使用 Docker 作为容器工具,虽然在相对特殊的环境中安装和网络配置仍可能出现问题,尤其是当你在一个使用复杂代理的企业环境中工作时。但至少现在我需要解决的构建系统问题已经很少了。 ### 漫步容器化的构建系统 -我创建了一个[教程存储库][2],随后你可以 clone 并检查它,或者按照本文内容进行操作。我将逐个介绍存储库中的文件。这个构建系统非常简单(它使用**gcc**)从而可以专注于构建系统结构上。 +我创建了一个[教程存储库][2],随后你可以克隆并检查它,或者按照本文内容进行操作。我将逐个介绍存储库中的文件。这个构建系统非常简单(它运行 `gcc`),从而可以让你专注于这个构建系统结构上。 ### 构建系统需求 我认为构建系统中有两个关键点: - * **标准化构建调用**:我希望能够指定一些形如 **/path/to/workdir** 的工作目录来构建代码。我希望以如下形式调用构建: + * **标准化构建调用**:我希望能够指定一些形如 `/path/to/workdir` 的工作目录来构建代码。我希望以如下形式调用构建: ./build.sh /path/to/workdir - 为了使得示例的结构足够简单(以便说明),我将假定输出也在 **/path/to/workdir** 路径下的某处生成。(否则,将增加容器中显示的卷的数量,虽然这并不困难,但解释起来比较麻烦。) - * **通过 shell 自定义构建调用**:有时,工具集会以出乎意料的方式被调用。除了标准的工具集调用 **build.sh** 之外,如果需要还可以为 **build.sh** 添加一些选项。但我一直希望能够有一个可以直接调用工具集命令的 shell。在这个简单的示例中,有时我想尝试不同的 **gcc** 优化选项并查看效果。为此,我希望调用: + 为了使得示例的结构足够简单(以便说明),我将假定输出也在 `/path/to/workdir` 路径下的某处生成。(否则,将增加容器中显示的卷的数量,虽然这并不困难,但解释起来比较麻烦。) + * **通过 shell 自定义构建调用**:有时,工具集会以出乎意料的方式被调用。除了标准的工具集调用 `build.sh` 之外,如果需要还可以为 `build.sh` 添加一些选项。但我一直希望能够有一个可以直接调用工具集命令的 shell。在这个简单的示例中,有时我想尝试不同的 `gcc` 优化选项并查看效果。为此,我希望调用: ./shell.sh /path/to/workdir - 这将让我得到一个容器内部的 Bash shell,并且可以调用工具集和访问我的**工作目录 workdir**,从而我可以根据需要尝试使用这个工具集。 + 这将让我得到一个容器内部的 Bash shell,并且可以调用工具集和访问我的工作目录(`workdir`),从而我可以根据需要尝试使用这个工具集。 -### 构建系统架构 +### 构建系统的架构 为了满足上述基本需求,这是我的构架系统架构: ![Container build system architecture][3] -在底部的 **workdir** 代表软件开发者用于构建的任意软件源码。通常,这个 **workdir** 是一个源代码的存储库。在构建之前,最终用户可以通过任何方式来操纵这个存储库。例如,如果他们使用 **git** 作为版本控制工具的话,可以使用 **git checkout** 切换到他们正在工作的功能分支上并添加或修改文件。这样可以使得构建系统独立于 **workdir** 之外。 +在底部的 `workdir` 代表软件开发者用于构建的任意软件源码。通常,这个 `workdir` 是一个源代码的存储库。在构建之前,最终用户可以通过任何方式来操纵这个存储库。例如,如果他们使用 `git` 作为版本控制工具的话,可以使用 `git checkout` 切换到他们正在工作的功能分支上并添加或修改文件。这样可以使得构建系统独立于 `workdir` 之外。 -顶部的三个模块共同代表了容器化的构建系统。最左边的黄色模块代表最终用户与构建系统交互的脚本(**build.sh** 和 **shell.sh**)。 +顶部的三个模块共同代表了容器化的构建系统。最左边的黄色模块代表最终用户与构建系统交互的脚本(`build.sh` 和 `shell.sh`)。 -在中间的红色模块是 Dockerfile 和相关的脚本 **build_docker_image.sh**。开发者(在这个例子中指我)通常将执行这个脚本并生成容器镜像(事实上我多次执行它直到一切正常为止,但这是另一个故事)。然后我将镜像分发给最终用户,例如通过 container trusted registry 进行分发。最终用户将需要这个镜像。另外,他们将 clone 构建系统存储库(即一个与[教程存储库][2]等效的存储库)。 +在中间的红色模块是 Dockerfile 和相关的脚本 `build_docker_image.sh`。开发运营者(在这个例子中指我)通常将执行这个脚本并生成容器镜像(事实上我多次执行它直到一切正常为止,但这是另一回事)。然后我将镜像分发给最终用户,例如通过容器信任注册库container trusted registry进行分发。最终用户将需要这个镜像。另外,他们将克隆构建系统的存储库(即一个与[教程存储库][2]等效的存储库)。 -当最终用户调用 **build.sh** 或者 **shell.sh** 时,容器内将执行右边的 **run_build.sh** 脚本。接下来我将详细解释这些脚本。这里的关键是最终用户不需要为了使用而去了解任何关于红色或者蓝色模块或者容器工作原理的知识。 +当最终用户调用 `build.sh` 或者 `shell.sh` 时,容器内将执行右边的 `run_build.sh` 脚本。接下来我将详细解释这些脚本。这里的关键是最终用户不需要为了使用而去了解任何关于红色或者蓝色模块或者容器工作原理的知识。 ### 构建系统细节 -把教程存储库的文件结构映射到这个系统结构上。我曾将这个原型结构用于相对复杂构建系统,因此它的简单并不会造成任何限制。下面我列出存储库中相关文件的树结构。文件夹 **dockerize-tutorial** 能用构建系统的其他任何名称代替。在这个文件夹下,我用 **workdir** 的路径作参数调用 **build.sh** 或 **shell.sh**。 +把教程存储库的文件结构映射到这个系统结构上。我曾将这个原型结构用于相对复杂构建系统,因此它的简单并不会造成任何限制。下面我列出存储库中相关文件的树结构。文件夹 `dockerize-tutorial` 能用构建系统的其他任何名称代替。在这个文件夹下,我用 `workdir` 的路径作参数调用 `build.sh` 或 `shell.sh`。 ``` dockerize-tutorial/ @@ -76,9 +78,9 @@ dockerize-tutorial/         └── run_build.sh ``` -请注意,我上面特意没列出 **example_workdir**,你能在教程存储库中找到。实际的源码通常存放在单独的存储库中,而不是构建工具库中的一部分;本教程为了不必处理两个存储库,所以我将它包含在这个存储库中。 +请注意,我上面特意没列出 `example_workdir`,但你能在教程存储库中找到它。实际的源码通常存放在单独的存储库中,而不是构建工具库中的一部分;本教程为了不必处理两个存储库,所以我将它包含在这个存储库中。 -如果你只对概念感兴趣,本教程并非必须的,因为我将解释所有文件。但是如果你继续本教程(并且已经安装 Docker),首先使用以下命令来构建容器镜像 **swbuilder:v1**: +如果你只对概念感兴趣,本教程并非必须的,因为我将解释所有文件。但是如果你继续本教程(并且已经安装 Docker),首先使用以下命令来构建容器镜像 `swbuilder:v1`: ``` cd dockerize-tutorial/swbuilder/ @@ -86,14 +88,14 @@ cd dockerize-tutorial/swbuilder/ docker image ls  # resulting image will be swbuilder:v1 ``` -然后调用 **build.sh**: +然后调用 `build.sh`: ``` cd dockerize-tutorial ./build.sh ~/repos/dockerize-tutorial/example_workdir ``` -下面是 [build.sh][4] 的代码。这个脚本从容器镜像 **swbuilder:v1** 实例化一个容器。而这个容器实例映射了两个卷:一个将文件夹 **example_workdir** 挂载到容器内部路径 **/workdir** 上,第二个则将容器外的文件夹 **dockerize-tutorial/swbuilder/scripts** 挂载到容器内部路径 **/scripts** 上。 +下面是 [build.sh][4] 的代码。这个脚本从容器镜像 `swbuilder:v1` 实例化一个容器。而这个容器实例映射了两个卷:一个将文件夹 `example_workdir` 挂载到容器内部路径 `/workdir` 上,第二个则将容器外的文件夹 `dockerize-tutorial/swbuilder/scripts` 挂载到容器内部路径 `/scripts` 上。 ``` docker container run                              \ @@ -104,18 +106,18 @@ docker container run                              \     build ``` -另外,**build.sh** 还会用你的用户名(以及组,本教程假设两者一致)去运行容器,以便在访问构建输出时不出现文件权限问题。 +另外,`build.sh` 还会用你的用户名(以及组,本教程假设两者一致)去运行容器,以便在访问构建输出时不出现文件权限问题。 -请注意,[**shell.sh**][5] 和 **build.sh** 大体上是一致的,除了两点不同:**build.sh** 会创建一个名为 **build_swbuilder** 的容器,而 **shell.sh** 则会创建一个名为 **shell_swbuilder** 的容器。这样一来,当其中一个脚本运行时另一个脚本被调用也不会产生冲突。 +请注意,[shell.sh][5] 和 `build.sh` 大体上是一致的,除了两点不同:`build.sh` 会创建一个名为 `build_swbuilder` 的容器,而 `shell.sh` 则会创建一个名为 `shell_swbuilder` 的容器。这样一来,当其中一个脚本运行时另一个脚本被调用也不会产生冲突。 -两个脚本之间的另一处关键不同则在于最后一个参数:**build.sh** 传入参数 **build** 而 **shell.sh** 则传入 **shell**。如果你看了用于构建容器镜像的 [Dockerfile][6],就会发现最后一行包含了下面的 **ENTRYPOINT** 语句。这意味着上面的 **docker container run** 调用将使用 **build** 或 **shell** 作为唯一的输入参数来执行 **run_build.sh** 脚本。 +两个脚本之间的另一处关键不同则在于最后一个参数:`build.sh` 传入参数 `build` 而 `shell.sh` 则传入 `shell`。如果你看了用于构建容器镜像的 [Dockerfile][6],就会发现最后一行包含了下面的 `ENTRYPOINT` 语句。这意味着上面的 `docker container run` 调用将使用 `build` 或 `shell` 作为唯一的输入参数来执行 `run_build.sh` 脚本。 ``` # run bash script and process the input command ENTRYPOINT [ "/bin/bash", "/scripts/run_build.sh"] ``` -[**run_build.sh**][7] 使用这个输入参数来选择启动 Bash shell 还是调用 **gcc** 来构建 **helloworld.c** 项目。一个真正的构建系统通常会使用 Makefile 而非直接运行 **gcc**。 +[run_build.sh][7] 使用这个输入参数来选择启动 Bash shell 还是调用 `gcc` 来构建 `helloworld.c` 项目。一个真正的构建系统通常会使用 Makefile 而非直接运行 `gcc`。 ``` cd /workdir @@ -129,17 +131,15 @@ elif [ $1 = "build" ]; then fi ``` -在使用时,如果你需要传入多个参数,当然也是可以的。我处理过的构建系统,构建通常是对给定的项目调用 **make**。如果一个构建系统有非常复杂的构建调用,则你可以让 **run_build.sh** 调用 **workdir** 下最终用户编写的特定脚本。 +在使用时,如果你需要传入多个参数,当然也是可以的。我处理过的构建系统,构建通常是对给定的项目调用 `make`。如果一个构建系统有非常复杂的构建调用,则你可以让 `run_build.sh` 调用 `workdir` 下最终用户编写的特定脚本。 ### 关于 scripts 文件夹的说明 -你可能想知道为什么 **scripts** 文件夹位于目录树深处而不是位于存储库的顶层。两种方法都是可行的,但我不想鼓励最终用户到处乱翻并修改里面的脚本。将它放到更深的地方是一个让他们更难乱翻的方法。另外,我也可以添加一个 **.dockerignore** 文件去忽略 **scripts** 文件夹,因为它不是容器必需的部分。但因为它很小,所以我没有这样做。 +你可能想知道为什么 `scripts` 文件夹位于目录树深处而不是位于存储库的顶层。两种方法都是可行的,但我不想鼓励最终用户到处乱翻并修改里面的脚本。将它放到更深的地方是一个让他们更难乱翻的方法。另外,我也可以添加一个 `.dockerignore` 文件去忽略 `scripts` 文件夹,因为它不是容器必需的部分。但因为它很小,所以我没有这样做。 ### 简单而灵活 -尽管这一方法很简单,但我将其用于某些非常特殊的构建系统时,发现它其实非常灵活。相对稳定的部分(例如,一年仅修改数次的给定工具集)被固定在容器镜像内。较为灵活的部分则以脚本的形式放在镜像外。这使我能够简单地通过修改脚本并将更改推送到构建系统存储库来修改调用工具集的方式。用户所需要做的是将更改拉到本地的构建系统存储库中,这通常是非常快的(与更新 Docker 镜像不同)。这种结构使其能够拥有尽可能多的卷和脚本,同时使最终用户摆脱复杂性。 - -你将如何修改你的应用来针对容器化环境进行优化呢? +尽管这一方法很简单,但我在几个相当不同的构建系统中使用过,发现它相当灵活。相对稳定的部分(例如,一年仅修改数次的给定工具集)被固定在容器镜像内。较为灵活的部分则以脚本的形式放在镜像外。这使我能够通过修改脚本并将更改推送到构建系统存储库中,轻松修改调用工具集的方式。用户所需要做的是将更改拉到本地的构建系统存储库中,这通常是非常快的(与更新 Docker 镜像不同)。这种结构使其能够拥有尽可能多的卷和脚本,同时使最终用户摆脱复杂性。 -------------------------------------------------------------------------------- @@ -147,8 +147,8 @@ via: https://opensource.com/article/20/4/how-containerize-build-system 作者:[Ravi Chandran][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/LazyWolfLin) -校对:[校对者ID](https://github.com/校对者ID) +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 89fa2de22af8fdfe08b9749bbf8e992c34c9e352 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 May 2020 08:57:32 +0800 Subject: [PATCH 2103/3057] PUB @LazyWolfLin https://linux.cn/article-12232-1.html --- .../20200414 How I containerize a build system.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200414 How I containerize a build system.md (99%) diff --git a/translated/tech/20200414 How I containerize a build system.md b/published/20200414 How I containerize a build system.md similarity index 99% rename from translated/tech/20200414 How I containerize a build system.md rename to published/20200414 How I containerize a build system.md index f1590ef480..e268f779ff 100644 --- a/translated/tech/20200414 How I containerize a build system.md +++ b/published/20200414 How I containerize a build system.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12232-1.html) [#]: subject: (How I containerize a build system) [#]: via: (https://opensource.com/article/20/4/how-containerize-build-system) [#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) From 1b60803cda0c08558054138a6c72d71d9fe5fe12 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 19 May 2020 23:14:18 +0800 Subject: [PATCH 2104/3057] hankchow translated --- ...508 5 ways to split your Linux terminal.md | 169 ------------------ ...508 5 ways to split your Linux terminal.md | 159 ++++++++++++++++ 2 files changed, 159 insertions(+), 169 deletions(-) delete mode 100644 sources/tech/20200508 5 ways to split your Linux terminal.md create mode 100644 translated/tech/20200508 5 ways to split your Linux terminal.md diff --git a/sources/tech/20200508 5 ways to split your Linux terminal.md b/sources/tech/20200508 5 ways to split your Linux terminal.md deleted file mode 100644 index 1809296e6a..0000000000 --- a/sources/tech/20200508 5 ways to split your Linux terminal.md +++ /dev/null @@ -1,169 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 ways to split your Linux terminal) -[#]: via: (https://opensource.com/article/20/5/split-terminal) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -5 ways to split your Linux terminal -====== -What's your favorite terminal multiplexer? Take our poll. Then read -about how Linux offers plenty of ways for you to split your terminal so -you can multitask. -![4 different color terminal windows with code][1] - -Is there anything better than a warmly flickering Linux terminal? - -Sure there is: two warmly flickering Linux terminals. In fact, the more, the better. - -Long ago, [terminals were physical devices][2], but of course, today, they're just emulated as an application on your computer. If you prefer the terminal as your interface, you probably know that one terminal is rarely enough. Inevitably, you're going to open a new terminal or a new tab so you can work in it while your first is busy compiling or converting or otherwise processing data. - -If you're a sysadmin, then you know you're going to need at least four open windows while you work on several systems at the same time. - -Terminal applications with tabs have existed on Linux for a long time, and luckily, that trend seems to have caught on such that it's an expected feature of a modern terminal. And yet, sometimes it's distracting or inconvenient to flip back and forth between tabs. - -The only answer is a split screen so that two or more terminals can exist at the same time within just one application window. There are many tools in your Linux kit to help you slice and dice your consoles. - -### Shells, terminals, and consoles - -Before you slice and dice screens, you should know the difference between a terminal, a shell, and a "console." To get the full picture, read my article on the subject over on the [Enable Sysadmin][2] blog. - -The short version: - - * A shell is an input and output screen with a prompt. There's technically a shell running somewhere underneath your [POSIX][3] desktop, even when it's not visible (because it's a shell that launched your user session). - * A terminal is an application running within a graphics server (such as X11 or Wayland) with a shell loaded into it. A terminal is only running when you have a terminal window launched. It's more or less a "portal" into your shell. - * "Console" or "virtual console" is a term usually used to imply a shell running outside of your desktop. You can get to a virtual console by pressing **Alt-Ctrl-F2** (more are usually available from **F3** up to **F7**, with **F1** or **F7** representing your desktop, depending on your distribution). - - - -Some applications let you split your shell or console, while others let you split your terminal. - -### tmux - -![tmux terminal][4] - -Arguably the most flexible and capable of screen splitters, [tmux][5] is a keyboard-centric terminal multiplexer, meaning that you can "layer" one console on top of another and then switch between the two. You can also split a console view in half (or thirds or fourths, and so on) so you can see other consoles next to it. - -All controls center around the keyboard, which means you never have to take your hand off the keys in search of a mouse, but also that you must learn some new keyboard combos. - -If you're using tmux primarily for screen splitting, then the only commands you really need are these: - - * **Ctrl-B %** for a vertical split (one shell on the left, one shell on the right) - * **Ctrl-B"** for a horizontal split (one shell at the top, one shell at the bottom) - * **Ctrl-B O** to make the other shell active - * **Ctrl-B ?** for help - * **Ctrl-B d** detach from Tmux, leaving it running in the background (use **tmux attach** to reenter) - - - -There are many benefits to tmux, including the ability to start a tmux session on one computer, and then join that same session from another computer remotely. It essentially daemonizes your shell. - -It's with tmux running on a Pi, for example, that I can stay logged into IRC on a permanent basis—I start tmux on the Pi, and then log in from whatever computer I happen to be on. When I log out, tmux continues to run, patiently waiting for me to reattach to the session from a different computer. - -### GNU Screen - -![GNU Screen terminal][6] - -Similar to tmux, [GNU Screen][7] is a shell multiplexer. You can detach and reattach from a running session, and you can split the screen both horizontally and vertically. - -Screen is a little clunkier than tmux. Its default key binding is **Ctrl-A**, which also happens to be Bash's keyboard shortcut to go to the beginning of a line. This means that if you have Screen running, you must press **Ctrl-A** twice instead of just once to go to the beginning of the line. Personally, I redefine the trigger key to **Ctrl-J** with this line in **$HOME/.screenrc**: - - -``` -`escape ^jJ` -``` - -Screen's split function works well, but it leaves out a few pleasantries that tmux lacks. For instance, when you split your shell, a new shell does not start in the other panel. You have to navigate to the other space with **Ctrl-A Tab** (or **Ctrl-J** if you redefine your keyboard shortcut as I do) and create a new shell manually with **Ctrl-A C**. - -Unlike tmux, a split doesn't go away when you exit a shell, which is a design feature that's quite nice in some instances but can also sometimes be cumbersome because it forces you to manage your splits manually. - -Still, Screen is a reliable and flexible application that you can run should you find that **tmux** is unavailable to you. - -Here are the basic split commands, using the default keyboard shortcuts: - - * **Ctrl-A |** for a vertical split (one shell on the left, one shell on the right) - * **Ctrl-A S** for a horizontal split (one shell at the top, one shell at the bottom) - * **Ctrl-A Tab** to make the other shell active - * **Ctrl-A ?** for help - * **Ctrl-A d** detach from Screen, leaving it running in the background (use **screen -r** to reenter) - - - -### Konsole - -![Konsole screen][8] - -[Konsole][9] is the terminal bundled along with the KDE Plasma desktop. Like KDE itself, Konsole is famous for being highly customizable and powerful. - -Among its many features is the ability to split its window, similar to both tmux and GNU Screen. Because Konsole is a graphical terminal, you can control its split-screen feature with your mouse instead of your keyboard. - -Splitting is found in the **View** menu of Konsole. You can split your window horizontally or vertically. To change which panel is active, just click on it. Each panel is a unique terminal, so it can have its own theme and tabs. - -Unlike tmux and GNU Screen, you can't detach and reattach from Konsole. Like most graphical applications, you use Konsole while you're physically in front of it, and you lose access to it when you're away (unless you use remote desktop software). - -### Emacs - -![Emacs rpg][10] - -Emacs isn't exactly a terminal multiplexer, but its interface supports splitting and resizing, and it has a built-in terminal. - -If you're in Emacs on a daily basis anyway, the ability to split your window between essentially different applications means you never have to leave the familiarity and comfort of your favorite text editor. Furthermore, because the Emacs **eshell** module is implemented in eLISP, you can interact with it using the same commands you use in Emacs itself, making it trivial to copy and yank long file paths or command output. - -If you're using Emacs in a graphical window, you can perform some actions with your mouse. It's faster to use keyboard shortcuts, and some are more or less required. For instance, you can change which panel is the active one by clicking into it, and you can resize the proportions of your split screen with your mouse. - -These are the important keyboard shortcuts: - - * **Ctrl-X 3** for a vertical split (one shell on the left, one shell on the right) - * **Ctrl-X 2** for a horizontal split (one shell at the top, one shell at the bottom) - * **Ctrl-X O** to make the other shell active (you can also do this with the mouse) - * **Ctrl-X 0** (that’s a zero) close the current panel - - - -Similar to tmux and GNU Screen, you can detach and reattach from Emacs as long as you run **emacs-client**. - -### Window manager - -![Ratpoison split screen][11] - -Should you think a text editor that can split its screen and load a terminal is amazing, imagine your desktop serving the same purpose. There are Linux desktops, like [Ratpoison][12], [Herbsluftwm][13], i3, Awesome, and even the KDE Plasma desktop with specific settings enabled, that present each application window to you as a fixed tile in a desktop grid. - -Instead of windows floating "above" your desktop, they remain in a predictable place so you can change from one to the other. You can open any number of terminals within your grid, emulating a terminal multiplexer. In fact, you could even load a terminal multiplexer in your desktop multiplexer. - -And there's nothing stopping you from loading Emacs with split buffers inside of that. No one knows what happens if you take it further than that, and most Linux users agree it's best not to find out. - -Unlike tmux and GNU Screen, you can't detach and reattach from your desktop unless you count using remote desktop software. - -### Other options - -Believe it or not, these aren't the only options you have to split your screen on Linux. There are other terminal emulators, like [Tilix][14] and Terminator before it, that can split into sections, and applications with embedded terminal components, and much more. Tell us your favorite way of splitting up your workspace in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/5/split-terminal - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/freedos.png?itok=aOBLy7Ky (4 different color terminal windows with code) -[2]: https://www.redhat.com/sysadmin/terminals-shells-consoles -[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains -[4]: https://opensource.com/sites/default/files/uploads/terminal-split-tmux2.png (tmux terminal) -[5]: https://github.com/tmux/tmux -[6]: https://opensource.com/sites/default/files/uploads/terminal-split-screen.png (GNU Screen terminal) -[7]: https://www.gnu.org/software/screen/ -[8]: https://opensource.com/sites/default/files/uploads/konsole.jpg (Konsole screen) -[9]: https://konsole.kde.org -[10]: https://opensource.com/sites/default/files/uploads/emacs-rpg_0.jpg (Emacs rpg) -[11]: https://opensource.com/sites/default/files/uploads/advent-ratpoison-split_0.jpg (Ratpoison split screen) -[12]: https://opensource.com/article/19/12/ratpoison-linux-desktop -[13]: https://opensource.com/article/19/12/herbstluftwm-linux-desktop -[14]: https://gnunn1.github.io/tilix-web/ diff --git a/translated/tech/20200508 5 ways to split your Linux terminal.md b/translated/tech/20200508 5 ways to split your Linux terminal.md new file mode 100644 index 0000000000..63783e1be2 --- /dev/null +++ b/translated/tech/20200508 5 ways to split your Linux terminal.md @@ -0,0 +1,159 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to split your Linux terminal) +[#]: via: (https://opensource.com/article/20/5/split-terminal) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 种拆分 Linux 终端的方法 +====== +> 本文介绍了 Linux 提供的拆分终端的方法,它能够帮助你完成多任务工作。那么,你最喜欢哪一款终端复用工具呢? + +![4 different color terminal windows with code][1] + +没有什么问题是不能用一个 Linux 终端解决的,如果不行,那就用两个。 + +很早以前,[终端其实是一个物理设备][2],而现在的终端实际上是在计算机上被模拟出来的一个应用程序。当你使用终端和计算机进行交互的时候,就会发现,只打开一个终端是不够用的。在进行编译、数据处理等长时间任务的时候,你不得不打开一个新终端或新选项卡tab来同时进行其它工作。 + +如果你是系统管理员,你就需要更多的终端窗口,以便连接到多个不同的主机上并行工作了。 + +在 Linux 系统中,终端应用程序在很久之前已经开始带有选项卡功能了。而现在的终端应用程序里,选项卡已经是标配功能了,这是非常流行的趋势。尽管如此,工作的时候在多个选项卡之间来回切换,或多或少也会分散我们的注意力,甚至带来不便。 + +而最好的解决方案就是将整个屏幕划分为多个部分,这样多个终端就可以在同一个终端应用程序窗口中同时存在。Linux 套件中也有很多相关的工具可以实现这一功能。 + +### Shell、终端和控制台 + +在此之前,我们首先要明确 Shell、终端terminal控制台console这三个概念。想要详细了解的话,请参阅 [Enable Sysadmin][2] 博客上的相关文章。 + +太长不看版: + + * Shell 是带有命令提示符prompt的用于输入、输出的界面。准确地说,[POSIX][3] 桌面底层也运行着一个 Shell,无论这个 Shell 是否对用户可见,因为用户会话就是由这个 Shell 启动的。 + * 终端是在图形界面服务器(例如 X11 或 Wayland)中运行的应用程序,其中加载了一个 Shell。只有在终端窗口启动之后,才算是运行了一个终端。终端可以认为是操作 Shell 的一个入口。 + * 控制台(或称“虚拟控制台”)通常表示在桌面环境以外使用的 Shell,你可以通过 `Alt+Ctrl+F2` 进入控制台,通常情况下从 `F3` 到 `F7` 都是不同的控制台,其中桌面环境有可能是 `F1` 或者 `F7`,这在不同的发行版中可能会有所不同。 + +因此,一些应用程序提供的功能是拆分 Shell 或者控制台,一些应用程序的功能则是拆分终端。 + +### tmux + +![tmux terminal][4] + +[tmux][5] 可以说是最灵活最强大的屏幕拆分工具了,它通过键盘控制对多个终端的复用,因此你可以将一个控制台叠放在另一个控制台上面,并在两个控制台之间切换。你还可以将整个屏幕等分为多个控制台,以便同时观察不同控制台上的状况。 + +tmux 的所有操作都是通过键盘完成的,这就意味着你的手不需要离开键盘去寻找鼠标。为此,你需要记住一些按键组合。 + +如果你只用 tmux 来做屏幕拆分,那你只需要记住一下这些命令: + + * `Ctrl-B %` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-B "` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-B O` 切换到另一个 Shell + * `Ctrl-B ?` 查看帮助 + * `Ctrl-B d` 断开 tmux 并让其在后台运行(可以使用 `tmux attach` 重新进入) + +tmux 的一大好处是,在一台计算机上启动 tmux 会话之后,也可以从另一台计算机上进入到这个会话,由此可以看出,tmux 对 Shell 进行了守护daemonize。 + +例如,当我在树莓派上运行 tmux,我就可以从计算机上连接到树莓派并登录 IRC,当我断开连接时,树莓派上的 tmux 会继续运行,并等待我的下一次连接,在此期间 IRC 是处于持续登录状态的。 + +### GNU Screen + +![GNU Screen terminal][6] + +[GNU Screen][7] 也是一个 Shell 复用工具,类似于 tmux,你可以在断开一个活动会话后重连到其中,它也支持竖直或水平拆分屏幕。 + +Screen 的灵活性比 tmux 要弱一些。它默认的绑定按键组合是 `Ctrl-A`,和 Bash 中光标移动到行首的快捷键是一样的。因此,当你正在运行 Screen 的时候,如果想要将光标移动到行首,就需要多按一次 `Ctrl-A`。而我自己的做法是,在 `$HOME/.screenrc` 文件中将绑定按键组合重新设置为 `Ctrl-J`。 + + +``` +`escape ^jJ` +``` + +尽管 Screen 在屏幕拆分功能上做得很好,但 tmux 上的一些缺点在 Screen 上也同样存在。例如在拆分 Shell 时,新的 Shell 不会在一个新的面板中启动,而是需要使用 `Ctrl-A Tab` 导航到另一个空间(如果你按照我的方式重新设置了按键组合,需要对应地把 `Ctrl-A` 改为 `Ctrl-J`),然后通过 `Ctrl-A C` 手动创建一个新的 Shell。 + +和 tmux 不同的是,Screen 在推出一个 Shell 的时候,屏幕拆分状态不会改变,这样的设计在某些情况下是比较适合的,但麻烦之处在于需要手动管理屏幕拆分状态。 + +尽管如此,Screen 还是一个相当可靠灵活的应用程序,在无法使用 tmux 的时候,你可以选择 Screen 作为备选方案。 + +在默认按键方案下,Screen 常用的基本命令包括: + + * `Ctrl-A |` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-A S` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-A Tab` 切换到另一个 Shell + * `Ctrl-A ?` 查看帮助 + * `Ctrl-A d` 断开 Screen 并让其在后台运行(可以使用 `screen -r` 重新进入) + +### Konsole + +![Konsole screen][8] + +[Konsole][9] 是 KDE Plasma 桌面使用的终端应用程序。和 KDE 一样,Konsole 也以高度可定制、功能强大的特点而著称。 + +和 tmux、GNU Screen 类似,Konsole 也具有拆分屏幕的功能。由于 Konsole 是图形界面的终端,因此还可以用鼠标来控制它的屏幕拆分。 + +Konsole 的屏幕拆分功能在“查看View”菜单中。它也支持竖直和水平方向的拆分,只要点击鼠标就可以切换到另一个面板上。每个面板都是一个独立的终端,因此都可以拥有独立的主题和标签页。 + +Konsole 和 tmux、GNU Screen 最大的不同之处在于不能断开和重新连接 Konsole。除非使用远程桌面软件,否则只能在打开 Konsole 时使用,这一点和大多数图形界面应用程序是一样的。 + +### Emacs + +![Emacs rpg][10] + +严格来说,Emacs 并不算是一个终端复用工具,但它的使用界面支持拆分和调整大小,同时还带有一个内建的终端。 + +如果 Emacs 是你日常使用的文本编辑器,你就可以在不关闭编辑器的情况下,在不同的应用程序之间轻松互相切换。由于 Emacs eshell 模块是通过 eLISP 实现的,因此你可以在 Emacs 中使用相同的命令进行交互,让一些繁琐的操作变得更为简单。 + +如果你是在图形界面中使用 Emacs,还可以使用鼠标进行操作。例如通过点击切换面板、用鼠标调整拆分屏幕的的大小等等。尽管如此,键盘的操作速度还是更快,因此记住一些键盘快捷键还是很有必要的。 + +Emacs 的一些重要快捷键包括: + + * `Ctrl-X 3` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-X 2` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-X O` 切换到另一个 Shell(你也可以使用鼠标操作) + * `Ctrl-X 0` 关闭当前面板 + +如果你运行了 emacs-client 的话,就可以像 tmux 和 GNU Screen 一样断开和重新连接到 Emacs 了。 + +### Window manager + +![Ratpoison split screen][11] + +除了文本编辑器之外,一些 Linux 桌面也同样具有拆分屏幕、加载终端这样的功能。例如 [Ratpoison][12]、[Herbsluftwm][13]、i3、Awesome,甚至是启用了特定设置的 KDE Plasma 桌面,都可以将多个应用程序在桌面上分块显示。 + +这些桌面可以让各个应用程序占据屏幕的固定位置,而不是逐个叠放在一起,因此你可以在多个应用程序窗口之间轻松切换。你还可以打开多个终端,以达到终端复用的目的。更进一步,你还可以在桌面复用工具中加载终端复用工具。 + +And there's nothing stopping you from loading Emacs with split buffers inside of that. No one knows what happens if you take it further than that, and most Linux users agree it's best not to find out. + +和 tmux、GNU Screen 不同,你在断开与桌面的连接后无法重新连接到同一个桌面会话,除非你使用了远程桌面软件进行连接。 + +### 更多选择 + +除了上面介绍到的工具以外,还有诸如 [Tilix][14]、Terminator 这样的终端模拟器,它们同样可以实现屏幕拆分、嵌入终端组件等功能。欢迎在评论区分享你喜欢的终端拆分工具。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/split-terminal + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/freedos.png?itok=aOBLy7Ky (4 different color terminal windows with code) +[2]: https://www.redhat.com/sysadmin/terminals-shells-consoles +[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[4]: https://opensource.com/sites/default/files/uploads/terminal-split-tmux2.png (tmux terminal) +[5]: https://github.com/tmux/tmux +[6]: https://opensource.com/sites/default/files/uploads/terminal-split-screen.png (GNU Screen terminal) +[7]: https://www.gnu.org/software/screen/ +[8]: https://opensource.com/sites/default/files/uploads/konsole.jpg (Konsole screen) +[9]: https://konsole.kde.org +[10]: https://opensource.com/sites/default/files/uploads/emacs-rpg_0.jpg (Emacs rpg) +[11]: https://opensource.com/sites/default/files/uploads/advent-ratpoison-split_0.jpg (Ratpoison split screen) +[12]: https://opensource.com/article/19/12/ratpoison-linux-desktop +[13]: https://opensource.com/article/19/12/herbstluftwm-linux-desktop +[14]: https://gnunn1.github.io/tilix-web/ From 89d9cdc7080dd9badf31861bf6f2b0e12adef68c Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 20 May 2020 08:44:30 +0800 Subject: [PATCH 2105/3057] translated --- ...w to Handle Automatic Updates in Ubuntu.md | 125 ------------------ ...w to Handle Automatic Updates in Ubuntu.md | 125 ++++++++++++++++++ 2 files changed, 125 insertions(+), 125 deletions(-) delete mode 100644 sources/tech/20200501 How to Handle Automatic Updates in Ubuntu.md create mode 100644 translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md diff --git a/sources/tech/20200501 How to Handle Automatic Updates in Ubuntu.md b/sources/tech/20200501 How to Handle Automatic Updates in Ubuntu.md deleted file mode 100644 index 7a973664ce..0000000000 --- a/sources/tech/20200501 How to Handle Automatic Updates in Ubuntu.md +++ /dev/null @@ -1,125 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Handle Automatic Updates in Ubuntu) -[#]: via: (https://itsfoss.com/auto-updates-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Handle Automatic Updates in Ubuntu -====== - -_**Brief: This tutorial teaches you how to handle the unattended upgrade i.e. the automatic system updates in Ubuntu Linux.**_ - -Sometimes, when you try to [shutdown your Ubuntu system][1], you may come across this screen that stops you from shutting down: - -**Unattended-upgrade in progress during shutdown, please don’t turn off the computer.** - -![Unattended Upgrade In Progress In Ubuntu][2] - -You might wonder what is this “unattended upgrade” and how come it is running without your knowledge. - -The reason is that [Ubuntu][3] takes your system’s security very seriously. By default, it automatically checks for system updates daily and if it finds any security updates, it downloads those updates and install them on its own. For normal system and application updates, it notifies you via the Software Updater tool. - -Since all this happens in the background, you don’t even realize it until you try to shutdown your system or try to install applications on your own. - -Trying to install a new software when these unattended upgrades are in progress leads to the famous [could not get lock error][4]. - -![][5] - -As you can see, the automatic updates present a couple of minor annoyance. You may choose to disable the auto updates but that would mean that you’ll have to check and [update your Ubuntu system][6] manually all the time. - -Do you really need to disable auto updates? - -Please note that this is a security feature. Linux allows you to do practically everything in your system even disabling these security features. -But in my opinion, as a regular user, _**you should not disable the automatic updates**_. It keeps your system safe after all. -For the sake of your system’s security, you may tolerate the minor annoyances that come with the automatic updates. - -Now that you have been warned and you think it is better to take up the additional task of manually updating your system, let’s see how to handle the auto updates. - -As always, there are two ways to do it: GUI and command line. I’ll show you both methods. - -I have used Ubuntu 20.04 here but the steps are valid for Ubuntu 18.04 and any other Ubuntu version. - -### Method 1: Disable automatic updates in Ubuntu graphically - -Go to the menu and look for ‘software & updates’ tool. - -![Software & Updates Settings][7] - -In here, go to Updates tab. Now look for the “Automatically check for updates”. By default it is set to Daily. - -You can change it to Never and your system will never check for updates on its own again. And if it won’t check for updates, it won’t find new updates to install. - -![Disable Auto Updates in Ubuntu Completely][8] - -If you do this, you must manually update your system from time to time. But that’s an additional chore to do and you may not remember it all the time. - -#### Slightly better way to handle auto updates in Ubuntu - -Personally, I would suggest to let it check for updates on its own. If you don’t want it installing the updates automatically, you can change that behavior to get notified about the availability of security updates. - -Keep “Automatically check for updates” to Daily and change “When there are security updates” option to “Display immediately” instead of “Download and install automatically”. - -![Get notified for security updates instead of automatically installing them][9] - -This way, it checks for updates and if there are updates, instead of installing them automatically in the background, the Software Updater tool notifies you that updates are available for your system. Your system already does that for normal system and software updates. - -![Get notified about security updates][10] - -With this setup, you won’t see the “unattended upgrades in progress” when you shutdown your system However, you may still encounter the ‘could not get lock’ error because two separate processes cannot use apt package manager at the same time. - -I believe this is a better solution, don’t you you think? - -As I promised both GUI and command line methods, let me show you how to disable unattended upgrades in the terminal. - -### How to disable automatic updates in Ubuntu using command line - -You’ll find the auto-upgrades settings in the **/etc/apt/apt.conf.d/20auto-upgrades** file. The default text editor in Ubuntu terminal is Nano so you can use this command to edit this configuration file: - -``` -sudo nano /etc/apt/apt.conf.d/20auto-upgrades -``` - -Now, if you don’t want your system to check for updates automatically, you can change the value of APT::Periodic::Update-Package-Lists to 0. - -``` -APT::Periodic::Update-Package-Lists "0"; -APT::Periodic::Unattended-Upgrade "0"; -``` - -If you want it to check for updates but don’t install the unattended-upgrades automatically, you can choose to set it like this: - -``` -APT::Periodic::Update-Package-Lists "1"; -APT::Periodic::Unattended-Upgrade "0"; -``` - -**In the end…** - -The automatic security updates are enabled automatically for a reason and I recommend you keep it like this. A couple of minor annoyances are not really worth risking the security of your system. What do you think? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/auto-updates-ubuntu/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/schedule-shutdown-ubuntu/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/unattended-upgrade-in-progress-in-ubuntu.png?ssl=1 -[3]: https://ubuntu.com/ -[4]: https://itsfoss.com/could-not-get-lock-error/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/Could_not_get_lock.jpg?ssl=1 -[6]: https://itsfoss.com/update-ubuntu/ -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/disable-auto-updates-ubuntu.jpg?ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/handle-auto-updates-ubuntu.jpg?ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/updates-available-ubuntu.png?ssl=1 diff --git a/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md b/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md new file mode 100644 index 0000000000..f86886d82c --- /dev/null +++ b/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Handle Automatic Updates in Ubuntu) +[#]: via: (https://itsfoss.com/auto-updates-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 中处理自动更新 +====== + +_**简介:本教程教你如何处理无人值守的升级,即 Ubuntu Linux 的自动系统更新。**_ + +有时,当你尝试[关闭 Ubuntu 系统][1]时,可能看到这个阻止你关闭的页面: + +**关机正在进行无人值守升级,请不要关闭计算机。** + +![Unattended Upgrade In Progress In Ubuntu][2] + +你可能想知道什么是“无人值守的升级”,以及它是如何在你不知情的情况下运行的。 + +因为 [Ubuntu][3] 非常重视系统的安全性。默认情况下,它会每天自动检查系统更新,如果发现任何安全更新,那么会下载这些更新并自行安装。对于正常的系统和应用更新,它会通过软件更新程序通知你。 + +由于所有这些都是在后台发生的,因此你会直到关机或者尝试自己安装应用时才会意识到。 + +在进行这些无人值守的升级时尝试安装新软件会发生[无法获得锁的错误][4]。 + +![][5] + +如你所见,自动更新带来了一些小麻烦。你可以选择禁用自动更新,但这意味着你必须一直手动检查并[更新你的 Ubuntu 系统][6]。 + +你真的需要禁用自动更新吗? + +请注意,这是一项安全功能。Linux 实际上允许你禁用系统中的所有功能,甚至禁用这些安全功能。 +但是我认为,作为普通用户,_**你不应禁用自动更新**_。毕竟,它可以确保你的系统安全。 +为了确保系统的安全性,你可以忍受自动更新所带来的小麻烦。 + +现在,你已经收到警告,并认为最好承担手动更新系统的额外任务,让我们看看如何处理自动更新。 + +与往常一样,有两种方法可以做到:GUI 和命令行。 我将向您=你展示两种方法。 + +我在这里使用 Ubuntu 20.04,但是这些步骤对 Ubuntu 18.04 和任何其他 Ubuntu 版本均有效。 + +### 方法 1:以图形方式禁用 Ubuntu 中的自动更新 + +进入菜单并查找“软件和更新”工具。 + +![Software & Updates Settings][7] + +在此处,进入“更新”选项卡。查找“自动检查更新”。默认情况下,它设置为“每日”。 + +你可以将其更改为“从不”,你的系统将永远不会检查更新。如果不检查更新,它将不会找到要安装的新更新。 + +![Disable Auto Updates in Ubuntu Completely][8] + +如果这样做,那么必须不时手动更新系统。但是,这是额外的工作,你可能不会一直记得。 + +#### 在 Ubuntu 中处理自动更新的更好方法 + +就个人而言,我建议让它自己检查更新。如果你不希望它自动安装更新,那么可以更改该行为以通知有关安全更新的可用性。 + +保持“自动检查更新”为“每日”,然后将“有安全更新时”选项更改为“立即显示”,而不是“自动下载并安装”。 + +![Get notified for security updates instead of automatically installing them][9] + +这样,它会检查是否有更新,而不是在后台自动安装更新,软件更新程序会通知你更新可用于系统。你的系统已经完成正常的系统和软件更新。 + +![Get notified about security updates][10] + +使用此设置,关闭系统时将不会看到“正在进行的无人值守升级”。但是,由于两个不同的进程无法同时使用 apt 包管理器,因此你仍然可能会遇到“无法锁定”错误。 + +我相信这是一个更好的解决方案,你不认为是么? + +如我承诺的同时有 GUI 和命令行方法一样,让我向你展示如何在终端中禁用无人值守的升级。 + +### 如何在 Ubuntu 中使用命令行禁用自动更新 + +你可以在 **/etc/apt/apt.conf.d/20auto-upgrades** 中找到自动升级设置。Ubuntu 终端中的默认文本编辑器是 Nano,因此你可以使用以下命令来编辑此文件: + +``` +sudo nano /etc/apt/apt.conf.d/20auto-upgrades +``` + +现在,如果你不希望系统自动检查更新,那么可以将 APT::Periodic::Update-Package-Lists 的值更改为 0。 + +``` +APT::Periodic::Update-Package-Lists "0"; +APT::Periodic::Unattended-Upgrade "0"; +``` + +如果你希望它检查更新但不自动安装无人值守的升级,那么可以选择将其设置为: + +``` +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Unattended-Upgrade "0"; +``` + +**最后** + +由于某种原因,启用了自动安全更新,建议你保持这种状态。小的烦恼实际上并不值得冒险损害系统安全性。你怎么看? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/auto-updates-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/unattended-upgrade-in-progress-in-ubuntu.png?ssl=1 +[3]: https://ubuntu.com/ +[4]: https://itsfoss.com/could-not-get-lock-error/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/Could_not_get_lock.jpg?ssl=1 +[6]: https://itsfoss.com/update-ubuntu/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/disable-auto-updates-ubuntu.jpg?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/handle-auto-updates-ubuntu.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/updates-available-ubuntu.png?ssl=1 From 6c5fb3b3e545fb92239f2571725f041513310633 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 20 May 2020 08:50:16 +0800 Subject: [PATCH 2106/3057] translated --- ...to Check Uptime of MySQL-MariaDB Database Server on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md b/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md index be88629967..a2070192d0 100644 --- a/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md +++ b/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3d60c1724cf2d17a06a2c51ee78abb22a7252c91 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Wed, 20 May 2020 22:37:27 +0800 Subject: [PATCH 2107/3057] TSL 20200323 How to create a personal file server with SSH on Linux --- ... personal file server with SSH on Linux.md | 137 ------------------ ... personal file server with SSH on Linux.md | 136 +++++++++++++++++ 2 files changed, 136 insertions(+), 137 deletions(-) delete mode 100644 sources/tech/20200323 How to create a personal file server with SSH on Linux.md create mode 100644 translated/tech/20200323 How to create a personal file server with SSH on Linux.md diff --git a/sources/tech/20200323 How to create a personal file server with SSH on Linux.md b/sources/tech/20200323 How to create a personal file server with SSH on Linux.md deleted file mode 100644 index 5ccabcab09..0000000000 --- a/sources/tech/20200323 How to create a personal file server with SSH on Linux.md +++ /dev/null @@ -1,137 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to create a personal file server with SSH on Linux) -[#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh) -[#]: author: (Jim Hall https://opensource.com/users/jim-hall) - -How to create a personal file server with SSH on Linux -====== -Connecting to a remote Linux system over SSH is just plain easy. Here's -how to do it. -![Hand putting a Linux file folder into a drawer][1] - -The Raspberry Pi makes for a useful and inexpensive home server for lots of things. I most often use the [Raspberry Pi as a print server][2] to share a laser printer with other devices in our home or as a personal file server to store copies of projects and other data. - -I use this file server in various ways. Let's say I'm working on a project, such as a new book, and I want to make a snapshot copy of my work and all my associated files. In that case, I simply copy my **BookProject** folder to a **BookBackup** folder on the file server. - -Or if I'm cleaning up my local files, and I discover some files that I don't really need but I'm not yet ready to delete, I'll copy them to a **KeepForLater** folder on the file server. That's a convenient way to remove clutter from my everyday Linux system and offload infrequently used files to my personal file server. - -Setting up a Raspberry Pi—or any Linux system—as a personal file server doesn't require configuring Network File System (NFS) or Common Internet File System (CIFS) or tinkering with other file-sharing systems such as WebDAV. You can easily set up a remote file server using SSH. And here's how. - -### Set up SSHD on the remote system - -Your Linux system probably has the SSH daemon (sshd) installed. It may even be running by default. If not, you can easily set up SSH through whatever control panel you prefer on your Linux distribution. I run [Fedora ARM][3] on my Raspberry Pi, and I can access the control panel remotely by pointing my Pi's web browser to port 9090. (On my home network, the Raspberry Pi's IP address is **10.0.0.11**, so I connect to **10.0.0.11:9090**.) If the SSH daemon isn't running by default, you can set it to start automatically in Services in the control panel. - -![sshd in the list of system services][4] - -You can find sshd in the list of system services. - -![slider to activate sshd][5] - -Click the slider to activate **sshd** if it isn't already. - -### Do you have an account? - -Make sure you have an account on the remote system. It might be the same as the username you use on your local system, or it could be something different. - -On the popular Raspbian distribution, the default account username is **pi**. But other Linux distributions may require you to set up a unique new user when you install it. If you don't know your username, you can use your distribution's control panel to create one. On my Raspberry Pi, I set up a **jhall** account that matches the username on my everyday Linux desktop machine. - -![Set up a new account on Fedora Server][6] - -If you use Fedora Server, click the **Create New Account** button to set up a new account. - -![Set password or SSH key][7] - -Don't forget to set a password or add a public SSH key. - -### Optional: Share your SSH public key - -If you exchange your public SSH key with the remote Linux system, you can log in without having to enter a password. This step is optional; you can use a password if you prefer. - -You can learn more about SSH keys in these Opensource.com articles: - - * [Tools for SSH key management][8] - * [Graphically manage SSH keys with Seahorse][9] - * [How to manage multiple SSH keys][10] - * [How to enable SSH access using a GPG key for authentication][11] - - - -### Make a file manager shortcut - -Since you've started the SSH daemon on the remote system and set up your account username and password, all that's left is to map a shortcut to the other Linux system from your file manager. I use GNOME as my desktop, but the steps are basically the same for any Linux desktop. - -#### Make the initial connection - -In the GNOME file manager, look for the **+Other Locations** button in the left-hand navigation. Click that to open a **Connect to Server** prompt. Enter the address of the remote Linux server here, starting with the SSH connection protocol. - -![Creating a shortcut in GNOME file manager][12] - -The GNOME file manager supports a variety of connection protocols. To make a connection over SSH, start your server address with **sftp://** or **ssh://**. - -If your username is the same on your local Linux system and your remote Linux system, you can just enter the server's address and the folder location. To make my connection to the **/home/jhall** directory on my Raspberry Pi, I use: - - -``` -`sftp://10.0.0.11/home/jhall` -``` - -![GNOME file manager Connect to Server][13] - -If your username is different, you can specify your remote system's username with an **@** sign before the remote system's address. To connect to a Raspbian system on the other end, you might use: - - -``` -`sftp://pi@10.0.0.11/home/pi` -``` - -![GNOME file manager Connect to Server][14] - -If you didn't share your public SSH key, you may need to enter a password. Otherwise, the GNOME file manager should automatically open the folder on the remote system and let you navigate. - -![GNOME file manager connection][15] - -#### Create a shortcut so you can easily connect to the server later - -This is easy in the GNOME file manager. Right-click on the remote system's name in the navigation list, and select **Add Bookmark**. This creates a shortcut to the remote location. - -![GNOME file manager - adding bookmark][16] - -If you want to give the bookmark a more memorable name, you can right-click on the shortcut and choose **Rename**. - -### That's it! - -Connecting to a remote Linux system over SSH is just plain easy. And you can use the same method to connect to systems other than home file servers. I also have a shortcut that allows me to instantly access files on my provider's web server and another that lets me open a folder on my project server. SSH makes it a secure connection; all of my traffic is encrypted. Once I've opened the remote system over SSH, I can use the GNOME file manager to manage my remote files as easily as I'd manage my local folders. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/personal-file-server-ssh - -作者:[Jim Hall][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jim-hall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) -[2]: https://opensource.com/article/18/3/print-server-raspberry-pi -[3]: https://arm.fedoraproject.org/ -[4]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd.png (sshd in the list of system services) -[5]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd-service.png (slider to activate sshd) -[6]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts_create-user.png (Set up a new account on Fedora Server) -[7]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts.png (Set password or SSH key) -[8]: https://opensource.com/article/20/2/ssh-tools -[9]: https://opensource.com/article/19/4/ssh-keys-seahorse -[10]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage -[11]: https://opensource.com/article/19/4/gpg-subkeys-ssh -[12]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-locations.png (Creating a shortcut in GNOME file manager) -[13]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp.png (GNOME file manager Connect to Server) -[14]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp-username.png (GNOME file manager Connect to Server) -[15]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall.png (GNOME file manager connection) -[16]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall-add-bookmark.png (GNOME file manager - adding bookmark) diff --git a/translated/tech/20200323 How to create a personal file server with SSH on Linux.md b/translated/tech/20200323 How to create a personal file server with SSH on Linux.md new file mode 100644 index 0000000000..82049848e6 --- /dev/null +++ b/translated/tech/20200323 How to create a personal file server with SSH on Linux.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create a personal file server with SSH on Linux) +[#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +怎样在 Linux 下用 SSH 搭建私人文件服务器 +====== +通过 SSH 连接远程 Linux 系统很简单。下面是教程。 +![Hand putting a Linux file folder into a drawer][1] + +使用树莓派可以搭建对很多事物有用的廉价家庭服务器。我的树莓派最常用来做[打印服务器][2],可以在我的家庭网络中共享激光打印机,或作为私人文件服务器保存项目副本和其他数据。 + +我的文件服务器有很多用途。假设我现在有一个项目,比如一本新书,我想备份我的工作的快照和所有关联的文件。这种场景下,我只需要把 **BookProject** 文件夹复制到文件服务器的 **BookBackup** 文件夹。 + +或者我现在正在清理我的本地文件,我发现有些文件现在不需要,但是我不确定是否要删除,我会把它们复制到文件服务器的 **KeepForLater** 文件夹。对于清理我日常用的 Linux 系统上杂乱的文件,以及把不常用的文件备份到私人文件服务器,这是一种很方便的方法。 + +用树莓派或其他 Linux 系统搭建私人文件服务器不需要配置 NFS(网络文件系统Network File System>)或 CIFS(通用互联网文件系统Common Internet File System)或改造其他的文件共享系统如 WebDAV。你可以很轻松的使用 SSH 来搭建远程文件服务器。下面是教程。 + +### 在远程服务器上配置 SSHD + +你的 Linux 系统可能已经安装了 SSH daemon(sshd),甚至它是默认执行的。如果没有运行,你可以使用你 Linux 发行版本上你想要的任何控制面板来轻松配置 SSH。我在树莓派上运行了 [Fedora ARM][3],通过把树莓派的 web 浏览器指向 9090 端口,我可以远程访问控制面板。(在我的家庭网络中,树莓派的 IP 地址是 **10.0.0.11**,因此我连接的是 **10.0.0.11:9090**。)如果 SSH daemon 默认没有运行,你可以在控制面板的 Services 里把它设置为开机启动。 + +![sshd in the list of system services][4] + +你可以在系统服务列表里找到 sshd。 + +![slider to activate sshd][5] + +如果 **sshd** 没有开启,点击切换按钮打开它。 + +### 你有账号吗? + +你需要有个远程系统的账号。它可以与你本地系统的账号相同,也可以不同。 + +在流行的 Raspbian 发行版本上,默认的账号名是 **pi**。但是其他的 Linux 发行版本可能需要你在安装系统时就设置一个独一无二的新用户。如果你不知道你的用户名,你可以用系统的控制面板创建一个。在我的树莓派上,我创建了一个 **jhall** 账号,与我日常用的 Linux 桌面机器的用户名相同。 + +![Set up a new account on Fedora Server][6] + +如果你用的是 Fedora 服务器,你可以点击 **Create New Account** 按钮来创建新账号。 + +![Set password or SSH key][7] + +不要忘记设置密码或添加公钥。 + +### 可选:添加公钥 + +如果你把公钥添加到远程 Linux 系统上,你就可以不使用密码登录。这一步是可选的;如果你愿意,你仍可以用密码登录。 + +你可以在下面 Opensource.com 的文章中学到更多关于 SSH key 的信息: + + * [SSH key 管理工具][8] + * [用 Seahorse 对 SSH key 进行图形化管理][9] + * [如何管理多个 SSH key][10] + * [使用 GPG key 作为鉴权依据开启 SSH 访问][11] + + + +### 创建文件管理器快捷方式 + +现在你已经在远程系统上启动 SSH daemon 了,也设置了用户名和密码,最后一步就是在你本地的文件管理器中创建一个快捷方式,地址映射到远程 Linux 系统。我的桌面是 GNOME,但是在其他的 Linux 桌面上的基本操作步骤都是一样的。 + +#### 建立初始连接 + +在 GNOME 的文件管理器中,在左边导航栏找到 **+Other Locations** 按钮。点击它会出现一个 **Connect to Server** 提示框。在框中输入远程 Linux 服务器的地址,地址以 SSH 连接协议开头。 + +![Creating a shortcut in GNOME file manager][12] + +GNOME 文件管理器支持多种连接协议。以 **sftp://** 或 **ssh://** 开头的服务器地址,会创建 SSH 连接。 + +如果你远程 Linux 系统的用户名与本地的相同,那么你只需要输入服务器的地址和文件夹路径就可以了。比如要连接到我的树莓派的 **/home/jhall** 目录,我输入: + + +``` +`sftp://10.0.0.11/home/jhall` +``` + +![GNOME file manager Connect to Server][13] + +如果你远程 Linux 系统的用户名与本地的不同,你可以在远程系统地址前加 **@** 符号来指定远程系统的用户名。要连接到远程的 Raspbian 系统,你可能要输入: + + +``` +`sftp://pi@10.0.0.11/home/pi` +``` + +![GNOME file manager Connect to Server][14] + +如果你没有把公钥添加到远程服务器,那么你需要输入密码。如果你已经添加,GNOME 文件管理器应该会自动打开远程系统上的文件夹来让你跳转到不同的目录。 + +![GNOME file manager connection][15] + +#### 创建一个快捷方式,之后就可以轻松连接服务器 + +在 GNOME 文件管理器中,这很简单。右击导航栏中远程系统的名字,选择 **Add Bookmark** 。这一步操作就创建了连接到远程路径的快捷方式。 + +![GNOME file manager - adding bookmark][16] + +如果你想把标签中的快捷方式改成一个更容易记的名字,你可以右击快捷方式选择 **Rename**。 + +### 总结! + +通过 SSH 连接到远程 Linux 系统是很简单的事。你可以用相同的方式连接到家庭文件服务器以外的其他系统。我还创建了一个能让我立即访问我的提供商的 web 服务器上的文件的快捷方式和另一个能迅速打开我的项目服务器的文件夹的快捷方式。SSH 保证了它们是安全的连接;所有的传输都是加密的。当我通过 SSH 打开远程的文件时,我可以像在本地操作一样使用 GNOME 文件管理器轻松打开远程文件。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/personal-file-server-ssh + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://opensource.com/article/18/3/print-server-raspberry-pi +[3]: https://arm.fedoraproject.org/ +[4]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd.png (sshd in the list of system services) +[5]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd-service.png (slider to activate sshd) +[6]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts_create-user.png (Set up a new account on Fedora Server) +[7]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts.png (Set password or SSH key) +[8]: https://opensource.com/article/20/2/ssh-tools +[9]: https://opensource.com/article/19/4/ssh-keys-seahorse +[10]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage +[11]: https://opensource.com/article/19/4/gpg-subkeys-ssh +[12]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-locations.png (Creating a shortcut in GNOME file manager) +[13]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp.png (GNOME file manager Connect to Server) +[14]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp-username.png (GNOME file manager Connect to Server) +[15]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall.png (GNOME file manager connection) +[16]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall-add-bookmark.png (GNOME file manager - adding bookmark) From 164bc75ed5f7c7d3350fafacb849389160c63fc8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 20 May 2020 23:11:37 +0800 Subject: [PATCH 2108/3057] TSL --- ...tration of Kubernetes clusters with k9s.md | 311 ------------------ ...tration of Kubernetes clusters with k9s.md | 232 +++++++++++++ 2 files changed, 232 insertions(+), 311 deletions(-) delete mode 100644 sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md create mode 100644 translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md diff --git a/sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md b/sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md deleted file mode 100644 index 03f563a952..0000000000 --- a/sources/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md +++ /dev/null @@ -1,311 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Speed up administration of Kubernetes clusters with k9s) -[#]: via: (https://opensource.com/article/20/5/kubernetes-administration) -[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) - -Speed up administration of Kubernetes clusters with k9s -====== -Check out this cool terminal UI for Kubernetes administration. -![Dogs playing chess][1] - -Usually, my articles about Kubernetes administration are full of kubectl commands for administration for your clusters. Recently, however, someone pointed me to the [k9s][2] project for a fast way to review and resolve day-to-day issues in Kubernetes. It's been a huge improvement to my workflow and I'll show you how to get started in this tutorial.  - -Installation can be done on a Mac, in Windows, and Linux. Instructions for each operating system can be found [here][2]. Be sure to complete installation to be able to follow along. - -I will be using Linux and Minikube, which is a lightweight way to run Kubernetes on a personal computer. Install it following [this tutorial][3] or by using the [documentation][4]. - -### Setting the k9s configuration file - -Once you've installed the k9s app, it's always good to start with the help command. - - -``` -$ k9s help -K9s is a CLI to view and manage your Kubernetes clusters. - -Usage: -  k9s [flags] -  k9s [command] - -Available Commands: -  help        Help about any command -  info        Print configuration info -  version     Print version/build info - -Flags: -  -A, --all-namespaces                 Launch K9s in all namespaces -      --as string                      Username to impersonate for the operation -      --as-group stringArray           Group to impersonate for the operation -      --certificate-authority string   Path to a cert file for the certificate authority -      --client-certificate string      Path to a client certificate file for TLS -      --client-key string              Path to a client key file for TLS -      --cluster string                 The name of the kubeconfig cluster to use -  -c, --command string                 Specify the default command to view when the application launches -      --context string                 The name of the kubeconfig context to use -      --demo                           Enable demo mode to show keyboard commands -      --headless                       Turn K9s header off -  -h, --help                           help for k9s -      --insecure-skip-tls-verify       If true, the server's caCertFile will not be checked for validity -      --kubeconfig string              Path to the kubeconfig file to use for CLI requests -  -l, --logLevel string                Specify a log level (info, warn, debug, error, fatal, panic, trace) (default "info") -  -n, --namespace string               If present, the namespace scope for this CLI request -      --readonly                       Disable all commands that modify the cluster -  -r, --refresh int                    Specify the default refresh rate as an integer (sec) (default 2) -      --request-timeout string         The length of time to wait before giving up on a single server request -      --token string                   Bearer token for authentication to the API server -      --user string                    The name of the kubeconfig user to use - -Use "k9s [command] --help" for more information about a command. -``` - -As you can see, there is a lot of functionality we can configure with k9s. The only step we need to take place to get off the ground is to write a configuration file. The **info** command will point us to where the application is looking for it. - - -``` -$ k9s info - ____  __.________ -|    |/ _/   __   \\______ -|      < \\____    /  ___/ -|    |  \   /    /\\___ \ -|____|__ \ /____//____  > -        \/            \/ - -Configuration:   /Users/jess/.k9s/config.yml -Logs:            /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log -Screen Dumps:    /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess -``` - - By default, k9s expects a configuration file and will fail to run without one. The command will return without any message, but if we look at the log file we see an error. - - -``` -$ tail -1 /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-mbbroberg.log -10:56AM FTL Unable to connect to api server error="Missing or incomplete configuration info.  Please point to an existing, complete config file:\n\n  1. Via the command-line flag --kubeconfig\n  2. Via the KUBECONFIG environment variable\n  3. In your home directory as ~/.kube/config\n\nTo view or setup config directly use the 'config' command." -``` - -To add a file, make the directory if it doesn't already exist and then add one. - - -``` -$ mkdir -p ~/.k9s/ -$ touch ~/.k9s/config.yml -``` - -For this introduction, we will use the default config.yml recommendations from the k9s repository. The maintainers note that this format is subject to change, so we can [check here][5] for the latest version. - - -``` -k9s: -  refreshRate: 2 -  headless: false -  readOnly: false -  noIcons: false -  logger: -    tail: 200 -    buffer: 500 -    sinceSeconds: 300 -    fullScreenLogs: false -    textWrap: false -    showTime: false -  currentContext: minikube -  currentCluster: minikube -  clusters: -    minikube: -      namespace: -        active: "" -        favorites: -       - all -        - kube-system -        - default -      view: -        active: dp -  thresholds: -    cpu: -      critical: 90 -      warn: 70 -    memory: -      critical: 90 -      warn: 70 -``` - -We set k9s to look for a local minikube configuration, so I'm going to confirm minikube is online and ready to go.  - - -``` -$ minikube status -host: Running -kubelet: Running -apiserver: Running -kubeconfig: Configured -``` - -### Running k9s to explore a Kubernetes cluster - -### With a configuration file set and pointing at our local cluster, we can now run the **k9s** command. - - -``` -`$ k9s` -``` - -Once you start it up, the k9s text-based user interface (UI) will pop up. With no flag for a namespace, it will show you the pods in the default namespace. - -![K9s screenshot][6] - -If you run in an environment with a lot of pods, the default view can be overwhelming. Alternatively, we can focus on a given namespace. Exit the application and run **k9s -n <namespace>** where _<namespace>_ is an existing namespace. In the picture below, I ran **k9s -n minecraft,** and it shows my broken pod - -![K9s screenshot][7] - -So once you have k9s up and running, there are a bunch of things you can do quickly.  - -Navigating k9s happens through shortcut keys. We can always use arrow keys and the enter key to choose items listed. There are quite a few other universal keystrokes to navigate to different views: - - * **0**—Show all pods in all namespaces - - - -![K9s screenshot][8] - - * **d**—Describe the selected pod - - - -![K9s screenshot][9] - - * **l**—Show logs for the selected pod pod - - - -![Using k9s to show Kubernetes pod logs][10] - -You may notice that k9s is set to use [Vim command keys][11], including moving up and down using **J** and **K** keys. Good luck exiting, emacs users :) - -### Viewing different Kubernetes resources quickly - -Need to get to something that's not a pod? Yea I do too. There are a number of shortcuts that are available when we enter a colon (":") key. From there, you can use the following commands to navigate around there. - - * **:svc**—Jump to a services view. - - - -![K9s screenshot][12] - - * **:deploy**—Jump to a deployment view. - - - -![K9s screenshot][13] - - * **:rb**—Jump to a Rolebindings view for [role-based access control (RBAC)][14] management. - - - -![K9s screenshot][15] - - * **:namespace**—Jump back to the namespaces view. - - - -![K9s screenshot][16] - - * **:cj**—Jump to the cronjobs view to see what jobs are scheduled in the cluster. - - - -![K9s screenshot][17] - -The most used tool for this application will be the keyboard; to go up or down on any page, use the arrow keys. If you need to quit, remember to use Vim keybindings. Type **:q** and hit enter to leave. - -### Example of troubleshooting Kubernetes with k9s - -How does k9s help when something goes wrong? To walk through an example, I let several pods die due to misconfiguration. Below you can see my terrible hello deployment that's crashing. Once we highlight it, we press **d** to run a _describe_ command to see what is causing the failure. - -![K9s screenshot][18] - -![K9s screenshot][19] - -Skimming the events does not tell us a reason for the failure. Next, I hit the **esc** key and go check the logs by highlighting the pod and entering **<shift-l>**. - -![K9s screenshot][20] - -Unfortunately, the logs don't offer anything helpful either (probably because the deployment was never correctly configured), and the pod will not come up. - -I then **esc** to step back out, and I will see if deleting the pod will take care of this issue. To do so, I highlight the pod and use **<ctrl-d>**. Thankfully, k9s prompts users before deletion.  - -![K9s screenshot][21] - -While I did delete the pod, the deployment resource still exists, so a new pod will come back up. It will also continue to restart and crash for whatever reason (we don't know yet). - -Here is the point where I would repeat reviewing logs, describing resources, and use the **e** shortcut to even edit a running pod to troubleshoot the behavior. In this particular case, the failing pod is not configured to run in this environment. So let's delete the deployment to stop crash-then-reboot loop we are in. - -We can get to deployments by typing **:deploy** and clicking enter. From there we highlight and press **<ctrl-d>** to delete. - -![K9s screenshot][22] - -![K9s screenshot][23] - -And poof the deployment is gone! It only took a few keystrokes to clean up this failed deployment. - -### k9s is incredibly customizable - -So this application has a ton of customization options, down to the color scheme of the UI. Here are a few editable options you may be interested in: - - * Adjust where you put the config.yml file (so you can store it in [version control][24]) - * Add [custom aliases][25] to an **alias.yml** file - * Create [custom hotkeys][26] in a **hotkey.yml** file - * Explore available [plugins][27] or write your own - - - -The entire application is configured in YAML files, so customization will feel familiar to any Kubernetes administrator. - -### Simplify your life with k9s - -I'm prone to administrating over my team's systems in a very manual way, more for brain training than anything else. When I first heard about k9s, I thought, "This is just lazy Kubernetes," so I dismissed it and went back to doing my manual intervention everywhere. I actually started using it daily while working through my backlog, and I was blown away at how much faster it was to use than kubectl alone. Now I'm a convert.  - -It's important to know your tools and master the "hard way" of doing something. It is also important to remember, as far as administration goes, it's important to work smarter, not harder. Using k9s is the way I live up to that objective. I guess we can call it lazy Kubernetes administration, and that's okay. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/5/kubernetes-administration - -作者:[Jessica Cherry][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/cherrybomb -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z (Dogs playing chess) -[2]: https://github.com/derailed/k9s -[3]: https://opensource.com/article/18/10/getting-started-minikube -[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/ -[5]: https://github.com/derailed/k9s#k9s-configuration -[6]: https://opensource.com/sites/default/files/uploads/k9s_1.png (K9s screenshot) -[7]: https://opensource.com/sites/default/files/uploads/k9s_2.png (K9s screenshot) -[8]: https://opensource.com/sites/default/files/uploads/k9s_3.png (K9s screenshot) -[9]: https://opensource.com/sites/default/files/uploads/k9s_5_0.png (K9s screenshot) -[10]: https://opensource.com/sites/default/files/uploads/k9s-show-logs-opensourcedotcom.png (Using k9s to show Kubernetes pod logs) -[11]: https://opensource.com/article/19/3/getting-started-vim -[12]: https://opensource.com/sites/default/files/uploads/k9s_5.png (K9s screenshot) -[13]: https://opensource.com/sites/default/files/uploads/k9s_6.png (K9s screenshot) -[14]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/ -[15]: https://opensource.com/sites/default/files/uploads/k9s_7.png (K9s screenshot) -[16]: https://opensource.com/sites/default/files/uploads/k9s_8.png (K9s screenshot) -[17]: https://opensource.com/sites/default/files/uploads/k9s_9.png (K9s screenshot) -[18]: https://opensource.com/sites/default/files/uploads/k9s_10.png (K9s screenshot) -[19]: https://opensource.com/sites/default/files/uploads/k9s_11.png (K9s screenshot) -[20]: https://opensource.com/sites/default/files/uploads/k9s_12.png (K9s screenshot) -[21]: https://opensource.com/sites/default/files/uploads/k9s_13.png (K9s screenshot) -[22]: https://opensource.com/sites/default/files/uploads/k9s_14.png (K9s screenshot) -[23]: https://opensource.com/sites/default/files/uploads/k9s_15.png (K9s screenshot) -[24]: https://opensource.com/article/19/3/move-your-dotfiles-version-control -[25]: https://k9scli.io/topics/aliases/ -[26]: https://k9scli.io/topics/hotkeys/ -[27]: https://github.com/derailed/k9s/tree/master/plugins diff --git a/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md b/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md new file mode 100644 index 0000000000..811278a001 --- /dev/null +++ b/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Speed up administration of Kubernetes clusters with k9s) +[#]: via: (https://opensource.com/article/20/5/kubernetes-administration) +[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) + +用 k9s 加速 Kubernetes 集群管理 +====== + +> 看看这个很酷的 Kubernetes 管理的终端 UI。 + +![Dogs playing chess][1] + +通常情况下,我写的关于 Kubernetes 管理的文章中,都是做集群管理的 `kubectl` 命令。然而最近,有人给我介绍了 [k9s][2] 项目,可以让我快速查看和解决 Kubernetes 中的日常问题。这对我的工作流程有了很大的改善,我将在本教程中告诉你如何上手。  + +它的安装可以在 Mac、Windows 和 Linux 中进行。每种操作系统的说明可以在这里找到[这里][2]。请务必完成安装,以便能够跟上本教程。 + +我将使用 Linux 和 Minikube,这是一种在个人电脑上运行 Kubernetes 的轻量级方式。按照[此教程][3]或使用[该文档][4]来安装它。 + +### 设置 k9s 配置文件 + +安装好 `k9s` 应用后,从帮助命令开始总是很好的。 + +``` +$ k9s help +``` + +正如你所看到的,我们可以用 `k9s` 来配置很多功能。我们唯一需要进行的步骤就是写一个配置文件。而`info` 命令会告诉我们应用程序要在哪里找该配置文件。 + +``` +$ k9s info + ____  __.________ +|    |/ _/   __   \\______ +|      < \\____    /  ___/ +|    |  \   /    /\\___ \ +|____|__ \ /____//____  > +        \/            \/ + +Configuration:   /Users/jess/.k9s/config.yml +Logs:            /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log +Screen Dumps:    /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess +``` + +如果要添加一个配置文件,该目录不存在的话就创建一个目录,然后添加一个配置文件。 + +``` +$ mkdir -p ~/.k9s/ +$ touch ~/.k9s/config.yml +``` + +在这篇介绍中,我们将使用 k9s 版本库中推荐的默认 `config.yml`。维护者注意,这种格式可能会有变化,所以我们可以[在这里查看][5]最新版本。 + +``` +k9s: +  refreshRate: 2 +  headless: false +  readOnly: false +  noIcons: false +  logger: +    tail: 200 +    buffer: 500 +    sinceSeconds: 300 +    fullScreenLogs: false +    textWrap: false +    showTime: false +  currentContext: minikube +  currentCluster: minikube +  clusters: +    minikube: +      namespace: +        active: "" +        favorites: +       - all +        - kube-system +        - default +      view: +        active: dp +  thresholds: +    cpu: +      critical: 90 +      warn: 70 +    memory: +      critical: 90 +      warn: 70 +``` + +我们设置了 `k9s` 寻找本地的 minikube 配置,所以我要确认 minikube 已经上线了,就可以使用了。 + +``` +$ minikube status +host: Running +kubelet: Running +apiserver: Running +kubeconfig: Configured +``` + +### 运行 k9s 来探索一个 Kubernetes 集群 + +有了配置文件,并指向我们的本地集群,我们现在可以运行 `k9s` 命令了。 + +``` +$ k9s +``` + +启动后,会弹出 `k9s` 基于文本的用户界面。在没有命名空间标志的情况下,它会向你显示默认命名空间中的 Pod。 + +![K9s screenshot][6] + +如果你运行在一个有很多 Pod 的环境中,默认的视图可能会让人不知所措。或者,我们可以将注意力集中在给定的命名空间上。退出应用程序,运行 `k9s -n `,其中 ``` 是已有的命名空间。在下图中,我运行了 `k9s -n minecraft`,它显示了我的损坏的 Pod: + +![K9s screenshot][7] + +所以,一旦你有了 `k9s` 后,有很多事情你可以更快地完成。  + +通过快捷键来导航 `k9s`,我们可以随时使用方向键和回车键来选择列出的项目。还有不少其他的通用快捷键来导航到不同的视图。 + +* `0`:显示在所有命名空间中的所有 Pod + ![K9s screenshot][8] +* `d`:描述所选的 Pod + ![K9s screenshot][9] +* `l`:显示所选的 Pod 的日志 + ![Using k9s to show Kubernetes pod logs][10] + +你可能会注意到 `k9s` 被设置为使用 [Vim 命令键][11],包括使用 `J` 和 `K` 键上下移动。Emacs 用户们,败退吧 :) + +### 快速查看不同的 Kubernetes 资源 + +需要去找一个不在 Pod 里的东西吗?是的,我也需要。当我们输入冒号(`:`)键时,可以使用很多快捷方式。从那里,你可以使用下面的命令来导航。 + +* `:svc`:跳转到服务视图 + ![K9s screenshot][12] +* `:deploy`:跳转到部署视图 + ![K9s screenshot][13] +* `:rb`:跳转到角色绑定视图,用于 [基于角色的访问控制(RBAC)][14]管理 + ![K9s screenshot][15] +* `:namespace`:跳转到命名空间视图 + ![K9s screenshot][16] +* `:cj`:跳转到 cronjob 视图,查看集群中计划了哪些作业。 + ![K9s screenshot][17] + +这个应用最常用的工具是键盘;要在任何页面上往上或往下翻页,请使用方向键。如果你需要退出,记得使用 Vim 键绑定。键入 `:q`,然后按回车键离开。 + +### 用 k9s 排除 Kubernetes 的故障示例 + +当出现故障的时候,`k9s` 怎么帮忙?举个例子,我让几个 Pod 由于配置错误而死机。下面你可以看到我那个可怜的 “hello” 部署死了。当我们将其高亮显示出来,可以按 `d` 运行 `describe` 命令,看看是什么原因导致了故障。 + +![K9s screenshot][18] + +![K9s screenshot][19] + +草草掠过那些事件并不能告诉我们故障原因。接下来,我按了 `esc` 键,然后通过高亮显示 Pod 并输入`shift-l` 来检查日志。 + +![K9s screenshot][20] + +不幸的是,日志也没有提供任何有用的信息(可能是因为部署从未正确配置过),而且 Pod也不会出现。 + +然后我使用 `esc` 退了出来,我看看删除 Pod 是否能解决这个问题。要做到这一点,我高亮显示 Pod,然后使用 `ctrl-d`。幸好 `k9s` 在删除前会提示用户。  + +![K9s screenshot][21] + +虽然我确实删除了这个 Pod,但部署资源仍然存在,所以新的 Pod 会重新出现。它还会继续重启并死掉,无论什么原因(我们还不知道)。 + +在这里,我会重复查看日志,描述资源,甚至使用 `e` 快捷方式来编辑运行中的 Pod 以排除故障行为。在这个特殊情况下,失败的 Pod 没有配置在这个环境下运行。因此,让我们删除部署来停止崩溃接着重启的循环。 + +我们可以通过键入 `:deploy` 并点击回车进入部署。从那里我们高亮显示并按 `ctrl-d` 来删除。 + +![K9s screenshot][22] + +![K9s screenshot][23] + +部署失败了! 只用了几个按键就把这个失败的部署给清理掉了。 + +### k9s 是极其可定制的 + +这个应用有很多自定义选项,乃至于 UI 的配色方案。这里有几个可编辑的选项,你可能会感兴趣。 + +* 调整你把 `config.yml` 文件放置的位置(这样你就可以把它存储在[版本控制][24]中)。 +* 在 `alias.yml` 文件中添加[自定义别名][25]。 +* 在 `hotkey.yml` 文件中创建[自定义热键][26]。 +* 探索现有的[插件][27]或编写自己的插件。 + +整个应用是在 YAML 文件中配置的,所以定制化对于任何 Kubernetes 管理员来说都会觉得很熟悉。 + +### 用 k9s 简化你的生活 + +我很容易在团队的系统上用非常人工的方式进行管理,更多的是为了锻炼脑力,而不是别的。当我第一次听说 `k9s` 的时候,我想,“这只是懒惰的 Kubernetes 而已。”于是我否定了它,回到了到处进行人工干预的状态。实际上,我在处理我的积压工作时就开始每天使用它,我觉得它的使用速度比单独使用 `kubectl` 快得多,这让我大吃一惊。现在,我已经皈依了。  + +了解你的工具并掌握做事情的“硬道理”很重要。还有一点很重要的是要记住,就管理而言,重要的是要更聪明地工作,而不是更努力。使用 `k9s`,就是我践行这个目标的方法。我想,我们可以把它叫做懒惰的 Kubernetes 管理,也没关系。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/kubernetes-administration + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cherrybomb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z (Dogs playing chess) +[2]: https://github.com/derailed/k9s +[3]: https://opensource.com/article/18/10/getting-started-minikube +[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/ +[5]: https://github.com/derailed/k9s#k9s-configuration +[6]: https://opensource.com/sites/default/files/uploads/k9s_1.png (K9s screenshot) +[7]: https://opensource.com/sites/default/files/uploads/k9s_2.png (K9s screenshot) +[8]: https://opensource.com/sites/default/files/uploads/k9s_3.png (K9s screenshot) +[9]: https://opensource.com/sites/default/files/uploads/k9s_5_0.png (K9s screenshot) +[10]: https://opensource.com/sites/default/files/uploads/k9s-show-logs-opensourcedotcom.png (Using k9s to show Kubernetes pod logs) +[11]: https://opensource.com/article/19/3/getting-started-vim +[12]: https://opensource.com/sites/default/files/uploads/k9s_5.png (K9s screenshot) +[13]: https://opensource.com/sites/default/files/uploads/k9s_6.png (K9s screenshot) +[14]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/ +[15]: https://opensource.com/sites/default/files/uploads/k9s_7.png (K9s screenshot) +[16]: https://opensource.com/sites/default/files/uploads/k9s_8.png (K9s screenshot) +[17]: https://opensource.com/sites/default/files/uploads/k9s_9.png (K9s screenshot) +[18]: https://opensource.com/sites/default/files/uploads/k9s_10.png (K9s screenshot) +[19]: https://opensource.com/sites/default/files/uploads/k9s_11.png (K9s screenshot) +[20]: https://opensource.com/sites/default/files/uploads/k9s_12.png (K9s screenshot) +[21]: https://opensource.com/sites/default/files/uploads/k9s_13.png (K9s screenshot) +[22]: https://opensource.com/sites/default/files/uploads/k9s_14.png (K9s screenshot) +[23]: https://opensource.com/sites/default/files/uploads/k9s_15.png (K9s screenshot) +[24]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[25]: https://k9scli.io/topics/aliases/ +[26]: https://k9scli.io/topics/hotkeys/ +[27]: https://github.com/derailed/k9s/tree/master/plugins From 37349e4c597d34be907d03d885343f49398bd497 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 21 May 2020 08:45:59 +0800 Subject: [PATCH 2109/3057] translated --- ...r getting around your Linux file system.md | 146 ------------------ ...r getting around your Linux file system.md | 143 +++++++++++++++++ 2 files changed, 143 insertions(+), 146 deletions(-) delete mode 100644 sources/tech/20200326 Tricks for getting around your Linux file system.md create mode 100644 translated/tech/20200326 Tricks for getting around your Linux file system.md diff --git a/sources/tech/20200326 Tricks for getting around your Linux file system.md b/sources/tech/20200326 Tricks for getting around your Linux file system.md deleted file mode 100644 index bda5e2100c..0000000000 --- a/sources/tech/20200326 Tricks for getting around your Linux file system.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Tricks for getting around your Linux file system) -[#]: via: (https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Tricks for getting around your Linux file system -====== -The cd command is probably one of the first 10 that any Linux user learns, but it's not the only way to navigate the Linux file system.Here are some other ways. -Thinkstock - -Whether you're moving around the file system, looking for files or trying to move into important directories, Linux can provide a lot of help. In this post, we'll look at a number of tricks to make moving around the file system and both finding and using commands that you need a little easier. - -### Adding to your $PATH - -One of the easiest and most useful ways to ensure that you don't have to invest a lot of time into finding commands on a Linux system is to add the proper directories to your $PATH variable. The order of directories that you add to your $PATH variable is, however, very important. They determine the order in which the system will look through the directories to find the command to run -- stopping when it finds the first match. - -You might, for example, want to put your home directory first so that, if you create a script that has the same name as some other executable, it will be the one that you end up running whenever you type its name. - -[RELATED: Linux hardening: a 15-step checklist for a secure Linux server][1] - -To add your home directory to your $PATH variable, you could do this: - -``` -$ export PATH=~:$PATH -``` - -The **~** character represents your home directory. - -If you keep your scripts in your bin directory, this would work for you: - -``` -$ export PATH=~/bin:$PATH -``` - -You can then run a script located in your home directory like this: - -[][2] - -``` -$ myscript -Good morning, you just ran /home/myacct/bin/myscript -``` - -**IMPORTANT:** The commands shown above _add_ to your search path because $PATH (the current path) is included. They don't override it. Your search path should be configured in your **.bashrc** file, and any changes you intend to be permanent should be added there as well. - -### Using symbolic links - -Symbolic links provide an easy and obvious way to record the location of directories that you might need to use often. If you manage content for a web site, for example, you might want to get your account to "remember" where the web files are located by creating a link like this: - -``` -ln -s /var/www/html www -``` - -The order of the arguments is critical. The first (/var/www/html) is the target and the second is the name of the link that you will be creating. If you're not currently located in your home directory, the following command would do the same thing: - -``` -ln -s /var/www/html ~/www -``` - -After setting this up, you can use "cd www" to get to **/var/www/html**. - -### Using shopt - -The **shopt** command also provides a way to make moving to a different directory a bit easier. When you employ **shopt'**s **autocd** option, you can go to a directory simply by typing its name. For example: - -``` -$ shopt -s autocd -$ www -cd -- www -/home/myacct/www -$ pwd -P -/var/www/html - -$ ~/bin -cd -- /home/myacct/bin -$ pwd -/home/myacct/bin -``` - -In the first set of commands above, the **shopt** command's **autocd** option is enabled. Typing **www** then invokes a "cd www" command. Because this symbolic link was created in one of the **ln** command examples above, this moves us to **/var/www/html**. The **pwd -P** command displays the actual location. - -In the second set, typing **~/bin** invokes a **cd** into the **bin** directory in the user's home. - -Note that the **autocd** behavior will _not_ kick in when what you type is a command –  even if it's also the name of a directory. - -The **shopt** command is a bash builtin and has a lot of options. This one just means that you don't have to type "cd" before the name of each directory you want to move into. - -To see **shopt**'s other options, just type "shopt". - -### Using $CDPATH - -Probably one of the most useful tricks for moving into particular directories is adding the paths that you want to be able to move into easily to your **$CDPATH**. This creates a list of directories that will be moved into by typing only a portion of the full path names. - -There is one aspect of this that may be just a little tricky. Your **$CDPATH** needs to include the directories that _contain_ the directories that you want to move into, not the directories themselves. - -For example, say that you want to be able to move into the **/var/www/html** directory simply by typing "cd html" and into subdirectories in /var/log using only "cd" and the simple directory names. In this case, this **$CDPATH** would work: - -``` -$ CDPATH=.:/var/log:/var/www -``` - -Here's what you would see: - -``` -$ cd journal -/var/log/journal -$ cd html -/var/www/html -``` - -Your **$CDPATH** kicks in when what you type is _not_ a full path. Then it looks down its list of directories in order to see if the directory you identified exists in one of them. Once it finds a match, it takes you there. - -Keeping the "." at the beginning of your **$CDPATH** means that you can move into local directories without having to have them defined in the **$CDPATH**. - -``` -$ export CDPATH=".:$CDPATH" -$ Videos -cd -- Videos -/home/myacct/Videos -``` - -It's not hard to move around the Linux file system, but you can save a few brain cells if you use some handy tricks for getting to various locations easily. - -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.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/3143050/linux/linux-hardening-a-15-step-checklist-for-a-secure-linux-server.html#tk.nww-fsb -[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200326 Tricks for getting around your Linux file system.md b/translated/tech/20200326 Tricks for getting around your Linux file system.md new file mode 100644 index 0000000000..3883ab5c8d --- /dev/null +++ b/translated/tech/20200326 Tricks for getting around your Linux file system.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tricks for getting around your Linux file system) +[#]: via: (https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 Linux 文件系统的技巧 +====== +cd 命令可能是任何 Linux 用户学习的前 10 个命令之一,但这并不是在 Linux 文件系统中切换的唯一方法,这里还有其他一些方法。 + +无论你是在文件系统中四处查看、寻找文件还是尝试进入重要目录,Linux 都可以提供很多帮助。在本文中,我们将介绍一些技巧,使你可以在文件系统中移动,查找和使用所需的命令也更加轻松。 + +### 添加到 $PATH + +确保你不必花费大量时间在 Linux 系统上查找命令的最简单、最有用的方法之一就是在 $PATH 变量中添加适当的目录。但是,添加到 $PATH 变量中的目录顺序非常重要。它们确定系统在目录中查找要运行命令的目录顺序--在找到第一个匹配项时停止。 + +例如,你可能希望将家目录放在第一个,这样,如果你创建的脚本与其他可执行文件有相同的名称,那么只要输入该脚本的名称,它便会运行。 + +要将家目录添加到 $PATH 变量中,可以执行以下操作: + +``` +$ export PATH=~:$PATH +``` + +**~** 字符代表家目录。 + +如果将脚本保存在 bin 目录中,下面的会有效: + + +``` +$ export PATH=~/bin:$PATH +``` + +然后,你可以运行位于家目录中的脚本,如下所示: + +[][2] + +``` +$ myscript +Good morning, you just ran /home/myacct/bin/myscript +``` + +**重要提示:**上面的命令_添加_搜索路径因为 $PATH (当前路径)包含了。它们不会覆盖它。你的搜索路径应该在 **.bashrc** 文件中配置,任何持久更改也需要在这里添加。 + +### 使用符号链接 + +符号链接提供了一种简单而明显的方式来记录可能经常需要使用的目录的位置。例如,如果你管理网站的内容,那么可能需要通过创建如下链接来使你的帐户“记住”网页文件的位置: + +``` +ln -s /var/www/html www +``` + +参数的顺序很重要。第一个(/var/www/html)是目标,第二个是你创建的链接的名称。如果你当前不在家目录中,那么以下命令将执行相同的操作: + +``` +ln -s /var/www/html ~/www +``` + +设置好之后,您可以使用 “cd www” 进入 **/var/www/html**。 + +### 使用 shopt + +**shopt** 命令还提供了一种让移动到其他目录更加容易的方法。当你使用 **shopt** 的 **autocd** 选项时,只需输入名称即可转到目录。例如: + +``` +$ shopt -s autocd +$ www +cd -- www +/home/myacct/www +$ pwd -P +/var/www/html + +$ ~/bin +cd -- /home/myacct/bin +$ pwd +/home/myacct/bin +``` + +在上面的第一组命令中,启用了 shopt 命令的 autocd 选项。输入 **www**,然后调用 “cd www” 命令。由于此符号链接是在上面的 **ln** 命令示例之一中创建的,因此将我们移至 **/var/www/html**。 **pwd -P** 命令显示实际位置。 + +在第二组中,键入 **~/bin** 会在用户家目录调用 **cd** 进入 **bin** 目录。 + +请注意,当你输入的是命令时,**autocd** 行为将_不会_生效,即使它也是目录的名称。 + +**shopt** 是 bash 内置,它有很多选项。这只是意味着你不必在要进入每个目录的名称之前输入 “cd”。 + +要查看 **shopt** 的其他选项,只需输入 “shopt”。 + +### 使用 $CDPATH + +进入特定目录的最有用技巧之一可能是将你希望能够轻松进入的路径添加到 **$CDPATH** 中。这将创建一个只需输入完整路径名的一部分即可进入的目录列表。 + +一方面,这可能有点棘手。你的 **$CDPATH** 需要包含要移动到的目录的目录,而不是目录本身。 + +例如,假设你希望仅通过输入 “cd html” 就可以移至 **/var/www/html** 目录,并仅使用 “cd” 和简单目录名即可移至 /var/log 中的子目录。在这种情况下,此 **$CDPATH** 将起作用: + +``` +$ CDPATH=.:/var/log:/var/www +``` + +你将看到: + +``` +$ cd journal +/var/log/journal +$ cd html +/var/www/html +``` + +当你输入的不是完整路径时,**$CDPATH** 就会生效。它向下查看其目录列表,以查看指定的目录是否存在于其中一个目录中。找到匹配项后,它将带你到那里。 + +保持 “.” 在 **$CDPATH** 开头意味着你可以进入本地目录,而不必在 **$CDPATH** 中定义它们。 + +``` +$ export CDPATH=".:$CDPATH" +$ Videos +cd -- Videos +/home/myacct/Videos +``` + +在 Linux 文件系统键切换并不难,但是如果你使用一些方便的技巧轻松地到达各个位置,那你可以节省一些大脑细胞。 + +加入 [Facebook][3] 和 [LinkedIn][4] 上的 Network World 社区,评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.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 +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From fd8c410f4e9c279b469e37380d1ccae1cc67a7bf Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 21 May 2020 08:53:24 +0800 Subject: [PATCH 2110/3057] translating --- ....0 Released With Qt 5- Here-s How to Install it on Ubuntu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md b/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md index 53e7ea3fa6..666c57c8ff 100644 --- a/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md +++ b/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8e1729ef37655b59ebf594e96647f9253fc5a9b6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 May 2020 10:28:23 +0800 Subject: [PATCH 2111/3057] PRF @geekpi --- ...ource PHP framework for web development.md | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/translated/tech/20200506 Customizing my open source PHP framework for web development.md b/translated/tech/20200506 Customizing my open source PHP framework for web development.md index 59573c643d..ea2a0c8886 100644 --- a/translated/tech/20200506 Customizing my open source PHP framework for web development.md +++ b/translated/tech/20200506 Customizing my open source PHP framework for web development.md @@ -1,50 +1,49 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Customizing my open source PHP framework for web development) [#]: via: (https://opensource.com/article/20/5/codeigniter) [#]: author: (Wee Ben Sen https://opensource.com/users/bswee14) -自定义用于 Web 开发的开源 PHP 框架 +自定义用于 Web 开发的开源 PHP 框架 Codeigniter ====== -Codeigniter 是一个 PHP 框架,可以使公司进行开发具有灵活性和便捷性的高性能网站。 -![Business woman on laptop sitting in front of window][1] -PHP Codeigniter 是一个开源框架,为商业应用提供易于使用的 PHP 编程语言和强大的编码工具。它还提供商务智能、服务器监视、开发和应用集成功能。这是一个相对安静的项目,你很少听到它,但它功能强大,许多刚接触的开发人员都对此感到惊讶和耳目一新。 +> Codeigniter 是一个 PHP 框架,可以使公司进行开发具有灵活性和便捷性的高性能网站。 -我在新加坡的一家在线学习服务提供商处使用 [Codeigniter][2]。我们提供的服务不够普遍,无法成为模板或现有后端的默认功能集,因此我需要提供可以依靠的良好,坚实,原始的东西。最初,我考虑用其他平台(如 Wordpress)用于我们的网站。但是,我决定使用 Codeigniter,因为它的灵活性,以及在学费匹配过程中需要的整合功能。 +![](https://img.linux.net.cn/data/attachment/album/202005/21/102637vslj5zqk52x98a52.jpg) -以下是让我使用 Codeigniter 的原因: +PHP Codeigniter 是一个开源框架,为商业应用提供易于使用的 PHP 编程语言和强大的编码工具。它还提供商务智能、服务器监视、开发和应用集成功能。这是一个相对冷清的项目,你很少听到它,但它功能强大,许多刚接触的开发人员都对此感到惊讶和耳目一新。 - * 与 MySQL 的数据库集成—一种主要功能是允许客户端浏览导师数据库并添加导师,例如类似于电子商务平台的“购物车”。 -  * 客户端界面系统—用户可以登录管理首选项并编辑详细信息,修改所教的科目、地区、手机号码、地址等。 -  * 定制的管理员面板—管理员可以使用定制的管理面板访问客户提交的内容,它与客户服务功能集成在一起,因此管理员可以单独跟进。 -  * 付款系统—管理面板带有与 Paypal 集成的发票和付款网关。 -  * CMS 编辑器界面—管理员能够编辑博客和文章中的文本和图像,以及添加新页面。 +我在新加坡的一家在线学习服务提供商处使用 [Codeigniter][2]。我们提供的服务并不算常见,没有可以作为模板的默认功能集或现有后台管理系统,所以我需要一个能提供良好的、可靠的、可以建立在此基础上的原始材料。最初,我考虑用其他平台(如 Wordpress)用于我们的网站。但是,我决定使用 Codeigniter,因为它的灵活性,以及集成了在我们的补课匹配过程中需要的功能。 +以下是打动我使用 Codeigniter 的原因: + +* 与 MySQL 数据库的集成 —— 主要功能是允许客户端浏览导师的数据库并添加导师,例如类似于电子商务平台的“购物车”。 +* 客户端界面系统 —— 用户可以登录来管理偏好并编辑详细信息,修改所教的科目、旅游的地区、手机号码、地址等。 +* 定制的管理员面板 —— 管理员可以使用定制的管理面板访问客户提交的资料,它与客户服务功能集成在一起,因此管理员可以单独跟进。 +* 付款系统 —— 管理面板带有与 Paypal 集成的发票和付款网关。 +* CMS 编辑器界面 —— 管理员能够编辑博客和文章中的文本和图像,以及添加新页面。 该项目花费了大约六个月的时间来完成,另外花了两个月的调试时间。如果我需要从头开始构建所有,或者尝试重新设计现有的框架以满足我们的需求,那将花费更长的时间,而且可能最终无法满足客户需求。 ### 功能和优点 -还有许多吸引开发人员使用 PHP Codeigniter 的功能,包括错误处理和代码格式化,这些功能在每种编码情景下都非常有用。它支持模板,可用于向现有网站添加功能或生成新网站。有许多基于 web 系统商业需要的功能,包括使用自定义标签。即使没有编程经验的普通开发人员也可以使用大多数工具。 +PHP Codeigniter还有很多吸引开发者的功能,包括错误处理和代码格式化,这些功能在各种编码情景下都非常有用。它支持模板,可用于向现有网站添加功能或生成新网站。有许多基于 web 系统商业需要的功能,包括使用自定义标签。即使没有编程经验的普通开发人员也可以使用大多数工具。 Codeigniter 的主要功能是: - * XML 核心服务, -  * HTTP/FTP 核心服务 -  * AppData 和 PHP 沙箱功能 -  * XSLT 和 HTML 模板 -  * 加密的信息传输 -  * PCM Codeigniter 服务器监控 -  * 应用集成 -  * 文件传输协议(FTP) -  * 服务台支持 -  * Apache POI(用于托管网站的内容管理基础架构) - - +* XML 核心服务, +* HTTP/FTP 核心服务 +* AppData 和 PHP 沙箱功能 +* XSLT 和 HTML 模板 +* 加密的信息传输 +* PCM Codeigniter 服务器监控 +* 应用集成 +* 文件传输协议(FTP) +* 服务台支持 +* Apache POI(用于托管网站的内容管理基础架构) #### 兼容性 @@ -52,15 +51,15 @@ Codeigniter 与许多领先的软件程序兼容,例如 PHP、MySQL、[MariaDB #### 安全 -Codeigniter 还通过 SSL 加密提供数据安全性。加密可以保护数据免受入侵者和防火墙等外部威胁的侵害。数据存储功能还允许对公司网站进行安全审核。 +Codeigniter 还通过 SSL 加密提供数据安全性。加密可以保护数据免受入侵者和防火墙外部威胁的侵害。数据存储功能还允许对公司网站进行安全审核。 #### 其它功能 -一家优秀的 PHP Web 开发公司使用几种高级和第三方技术,例如 XML 和 PHP。它提供组织一个完整的平台来开发具有专业外观、有用的商业网站。Codeigniter 让使用第三方技术变得容易,并可以与常见的 Web 开发软件一起使用。这使得 web 公司可以轻松地使用所选模块创建网站。大多数 PHP 开发者也为个人提供支持和培训服务。 +一家优秀的 PHP Web 开发公司会使用几种高级技术和第三方技术,例如 XML 和 PHP。它为企业提供了一个完整的平台,可以开发出具有看起来专业的、好用的商业网站。Codeigniter 使得第三方技术的使用变得容易,并可以与常见的 Web 开发软件一起使用。这使得 Web 公司可以轻松地使用所选模块创建网站。大多数 PHP 开发者也为个人提供支持和培训服务。 ### 使用 PHP 框架 Codeigniter -Codeigniter 给企业提供完整的 PHP 开发包,它将提供功能,灵活性和性能的正确组合。到目前为止,我很满意我们的网站,一直以来,我不断升级和添加新的功能。我期待用 Codeigniter 对我们的网站做些其他什么。你也是这样么? +Codeigniter 给企业提供了完整的 PHP 开发包,它将提供强大的功能、灵活性和性能完美结合在一起。到目前为止,我很满意我们的网站,并不断地升级和添加新的功能。并不断升级和增加新的功能。我期待着发现我们的网站还能用 Codeigniter 做些什么。你也是这样么? -------------------------------------------------------------------------------- @@ -69,7 +68,7 @@ via: https://opensource.com/article/20/5/codeigniter 作者:[Wee Ben Sen][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4604990f1f8cdb16d7b6e9938880b9e481d73bbd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 May 2020 10:29:05 +0800 Subject: [PATCH 2112/3057] PUB @geekpi https://linux.cn/article-12235-1.html --- ...mizing my open source PHP framework for web development.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200506 Customizing my open source PHP framework for web development.md (98%) diff --git a/translated/tech/20200506 Customizing my open source PHP framework for web development.md b/published/20200506 Customizing my open source PHP framework for web development.md similarity index 98% rename from translated/tech/20200506 Customizing my open source PHP framework for web development.md rename to published/20200506 Customizing my open source PHP framework for web development.md index ea2a0c8886..de6b46f8b7 100644 --- a/translated/tech/20200506 Customizing my open source PHP framework for web development.md +++ b/published/20200506 Customizing my open source PHP framework for web development.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12235-1.html) [#]: subject: (Customizing my open source PHP framework for web development) [#]: via: (https://opensource.com/article/20/5/codeigniter) [#]: author: (Wee Ben Sen https://opensource.com/users/bswee14) From f98e265f66798b393972f5751b237bac7e878193 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 May 2020 13:24:46 +0800 Subject: [PATCH 2113/3057] PRF @HankChow --- ...508 5 ways to split your Linux terminal.md | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/translated/tech/20200508 5 ways to split your Linux terminal.md b/translated/tech/20200508 5 ways to split your Linux terminal.md index 63783e1be2..acb8f405ff 100644 --- a/translated/tech/20200508 5 ways to split your Linux terminal.md +++ b/translated/tech/20200508 5 ways to split your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 ways to split your Linux terminal) @@ -9,9 +9,10 @@ 5 种拆分 Linux 终端的方法 ====== + > 本文介绍了 Linux 提供的拆分终端的方法,它能够帮助你完成多任务工作。那么,你最喜欢哪一款终端复用工具呢? -![4 different color terminal windows with code][1] +![](https://img.linux.net.cn/data/attachment/album/202005/21/132437ypzpqqppqh1qfznh.jpg) 没有什么问题是不能用一个 Linux 终端解决的,如果不行,那就用两个。 @@ -19,68 +20,67 @@ 如果你是系统管理员,你就需要更多的终端窗口,以便连接到多个不同的主机上并行工作了。 -在 Linux 系统中,终端应用程序在很久之前已经开始带有选项卡功能了。而现在的终端应用程序里,选项卡已经是标配功能了,这是非常流行的趋势。尽管如此,工作的时候在多个选项卡之间来回切换,或多或少也会分散我们的注意力,甚至带来不便。 +在 Linux 系统中,终端应用程序在很久之前就已经开始带有选项卡功能了。而现在的终端应用程序里,选项卡已经是标配功能了,这是非常流行的趋势。尽管如此,工作的时候在多个选项卡之间来回切换,或多或少也会分散我们的注意力,甚至带来不便。 -而最好的解决方案就是将整个屏幕划分为多个部分,这样多个终端就可以在同一个终端应用程序窗口中同时存在。Linux 套件中也有很多相关的工具可以实现这一功能。 +而最好的解决方案就是将整个屏幕划分为多个部分,这样多个终端就可以在同一个终端应用程序窗口中同时存在。Linux 发行版中也有很多相关的工具可以实现这一功能。 ### Shell、终端和控制台 在此之前,我们首先要明确 Shell、终端terminal控制台console这三个概念。想要详细了解的话,请参阅 [Enable Sysadmin][2] 博客上的相关文章。 -太长不看版: +简而言之: - * Shell 是带有命令提示符prompt的用于输入、输出的界面。准确地说,[POSIX][3] 桌面底层也运行着一个 Shell,无论这个 Shell 是否对用户可见,因为用户会话就是由这个 Shell 启动的。 - * 终端是在图形界面服务器(例如 X11 或 Wayland)中运行的应用程序,其中加载了一个 Shell。只有在终端窗口启动之后,才算是运行了一个终端。终端可以认为是操作 Shell 的一个入口。 - * 控制台(或称“虚拟控制台”)通常表示在桌面环境以外使用的 Shell,你可以通过 `Alt+Ctrl+F2` 进入控制台,通常情况下从 `F3` 到 `F7` 都是不同的控制台,其中桌面环境有可能是 `F1` 或者 `F7`,这在不同的发行版中可能会有所不同。 +* **Shell** 是带有命令提示符prompt的用于输入、输出的界面。准确地说,[POSIX][3] 桌面底层也运行着一个 Shell,即使这个 Shell 对用户不可见,因为用户会话就是由这个 Shell 启动的。 +* **终端**是在图形界面服务器(例如 X11 或 Wayland)中运行的应用程序,其中加载了一个 Shell。只有在终端窗口启动之后,才算是运行了一个终端。终端可以认为是操作 Shell 的一个入口。 +* **控制台**(或称“虚拟控制台”)通常表示在桌面环境以外使用的 Shell,你可以通过 `Alt+Ctrl+F2` 进入控制台,通常情况下从 `F3` 到 `F7` 都是不同的控制台,其中桌面环境有可能是 `F1` 或者 `F7`,这在不同的发行版中可能会有所不同。 -因此,一些应用程序提供的功能是拆分 Shell 或者控制台,一些应用程序的功能则是拆分终端。 +因此,有些应用程序提供的功能是拆分 Shell 或者控制台,有些应用程序的功能则是拆分终端。 ### tmux ![tmux terminal][4] -[tmux][5] 可以说是最灵活最强大的屏幕拆分工具了,它通过键盘控制对多个终端的复用,因此你可以将一个控制台叠放在另一个控制台上面,并在两个控制台之间切换。你还可以将整个屏幕等分为多个控制台,以便同时观察不同控制台上的状况。 +[tmux][5] 可以说是最灵活、最强大的屏幕拆分工具了,它通过键盘控制对多个终端的复用,因此你可以将一个控制台叠放在另一个控制台上面,并在两个控制台之间切换。你还可以将整个屏幕等分为多个控制台,以便同时观察不同控制台上的状况。 -tmux 的所有操作都是通过键盘完成的,这就意味着你的手不需要离开键盘去寻找鼠标。为此,你需要记住一些按键组合。 +`tmux` 的所有操作都是通过键盘完成的,这就意味着你的手不需要离开键盘去寻找鼠标。为此,你需要记住一些按键组合。 -如果你只用 tmux 来做屏幕拆分,那你只需要记住一下这些命令: +如果你只用 `tmux` 来做屏幕拆分,那你只需要记住一下这些命令: * `Ctrl-B %` 竖直拆分屏幕(两个 Shell 分别位于左右) * `Ctrl-B "` 水平拆分屏幕(两个 Shell 分别位于上下) * `Ctrl-B O` 切换到另一个 Shell * `Ctrl-B ?` 查看帮助 - * `Ctrl-B d` 断开 tmux 并让其在后台运行(可以使用 `tmux attach` 重新进入) + * `Ctrl-B d` 断开 `tmux` 并让其在后台运行(可以使用 `tmux attach` 重新进入) -tmux 的一大好处是,在一台计算机上启动 tmux 会话之后,也可以从另一台计算机上进入到这个会话,由此可以看出,tmux 对 Shell 进行了守护daemonize。 +`tmux` 的一大好处是,在一台计算机上启动 `tmux` 会话之后,也可以从另一台计算机上进入到这个会话,由此可以看出,`tmux` 对 Shell 进行了守护进程化daemonize。 -例如,当我在树莓派上运行 tmux,我就可以从计算机上连接到树莓派并登录 IRC,当我断开连接时,树莓派上的 tmux 会继续运行,并等待我的下一次连接,在此期间 IRC 是处于持续登录状态的。 +例如,当我在树莓派上运行 `tmux`,我就可以从计算机上连接到树莓派并登录 IRC,当我断开连接时,树莓派上的 `tmux` 会继续运行,并等待我的下一次连接,在此期间 IRC 是处于持续登录状态的。 ### GNU Screen ![GNU Screen terminal][6] -[GNU Screen][7] 也是一个 Shell 复用工具,类似于 tmux,你可以在断开一个活动会话后重连到其中,它也支持竖直或水平拆分屏幕。 - -Screen 的灵活性比 tmux 要弱一些。它默认的绑定按键组合是 `Ctrl-A`,和 Bash 中光标移动到行首的快捷键是一样的。因此,当你正在运行 Screen 的时候,如果想要将光标移动到行首,就需要多按一次 `Ctrl-A`。而我自己的做法是,在 `$HOME/.screenrc` 文件中将绑定按键组合重新设置为 `Ctrl-J`。 +[GNU Screen][7] 也是一个 Shell 复用工具,类似于 `tmux`,你可以在断开一个活动会话后重连到其中,它也支持竖直或水平拆分屏幕。 +`screen` 的灵活性比 `tmux` 要弱一些。它默认的绑定按键组合是 `Ctrl-A`,和 Bash 中光标移动到行首的快捷键是一样的。因此,当你正在运行 `screen` 的时候,如果想要将光标移动到行首,就需要多按一次 `Ctrl-A`。而我自己的做法是,在 `$HOME/.screenrc` 文件中将绑定按键组合重新设置为 `Ctrl-J`。 ``` -`escape ^jJ` +escape ^jJ ``` -尽管 Screen 在屏幕拆分功能上做得很好,但 tmux 上的一些缺点在 Screen 上也同样存在。例如在拆分 Shell 时,新的 Shell 不会在一个新的面板中启动,而是需要使用 `Ctrl-A Tab` 导航到另一个空间(如果你按照我的方式重新设置了按键组合,需要对应地把 `Ctrl-A` 改为 `Ctrl-J`),然后通过 `Ctrl-A C` 手动创建一个新的 Shell。 +尽管 `screen` 在屏幕拆分功能上做得很好,但 `tmux` 上的一些缺点在 Screen 上也同样存在。例如在拆分 Shell 时,在一个新的面板中不会启动新的 Shell ,而是需要使用 `Ctrl-A Tab` 导航到另一个面板(如果你按照我的方式重新设置了按键组合,需要对应地把 `Ctrl-A` 改为 `Ctrl-J`),然后通过 `Ctrl-A C` 手动创建一个新的 Shell。 -和 tmux 不同的是,Screen 在推出一个 Shell 的时候,屏幕拆分状态不会改变,这样的设计在某些情况下是比较适合的,但麻烦之处在于需要手动管理屏幕拆分状态。 +和 `tmux` 不同的是,`screen` 在退出一个 Shell 的时候,屏幕拆分状态不会改变,这样的设计在某些情况下是比较适合的,但麻烦之处在于需要手动管理屏幕拆分状态。 -尽管如此,Screen 还是一个相当可靠灵活的应用程序,在无法使用 tmux 的时候,你可以选择 Screen 作为备选方案。 +尽管如此,`screen` 还是一个相当可靠灵活的应用程序,在无法使用 `tmux` 的时候,你可以选择 `screen` 作为备选方案。 -在默认按键方案下,Screen 常用的基本命令包括: +在默认按键方案下,`screen` 常用的基本命令包括: * `Ctrl-A |` 竖直拆分屏幕(两个 Shell 分别位于左右) * `Ctrl-A S` 水平拆分屏幕(两个 Shell 分别位于上下) * `Ctrl-A Tab` 切换到另一个 Shell * `Ctrl-A ?` 查看帮助 - * `Ctrl-A d` 断开 Screen 并让其在后台运行(可以使用 `screen -r` 重新进入) + * `Ctrl-A d` 断开 `screen` 并让其在后台运行(可以使用 `screen -r` 重新进入) ### Konsole @@ -88,11 +88,11 @@ Screen 的灵活性比 tmux 要弱一些。它默认的绑定按键组合是 `Ct [Konsole][9] 是 KDE Plasma 桌面使用的终端应用程序。和 KDE 一样,Konsole 也以高度可定制、功能强大的特点而著称。 -和 tmux、GNU Screen 类似,Konsole 也具有拆分屏幕的功能。由于 Konsole 是图形界面的终端,因此还可以用鼠标来控制它的屏幕拆分。 +和 `tmux`、GNU Screen 类似,Konsole 也具有拆分屏幕的功能。由于 Konsole 是图形界面的终端,因此还可以用鼠标来控制它的屏幕拆分。 Konsole 的屏幕拆分功能在“查看View”菜单中。它也支持竖直和水平方向的拆分,只要点击鼠标就可以切换到另一个面板上。每个面板都是一个独立的终端,因此都可以拥有独立的主题和标签页。 -Konsole 和 tmux、GNU Screen 最大的不同之处在于不能断开和重新连接 Konsole。除非使用远程桌面软件,否则只能在打开 Konsole 时使用,这一点和大多数图形界面应用程序是一样的。 +Konsole 和 `tmux`、GNU Screen 最大的不同之处在于不能断开和重新连接 Konsole。除非使用远程桌面软件,否则只能在打开 Konsole 时使用,这一点和大多数图形界面应用程序是一样的。 ### Emacs @@ -108,28 +108,27 @@ Emacs 的一些重要快捷键包括: * `Ctrl-X 3` 竖直拆分屏幕(两个 Shell 分别位于左右) * `Ctrl-X 2` 水平拆分屏幕(两个 Shell 分别位于上下) - * `Ctrl-X O` 切换到另一个 Shell(你也可以使用鼠标操作) - * `Ctrl-X 0` 关闭当前面板 + * `Ctrl-X O` (大写字母 `O`)切换到另一个 Shell(你也可以使用鼠标操作) + * `Ctrl-X 0` (数字 `0`)关闭当前面板 如果你运行了 emacs-client 的话,就可以像 tmux 和 GNU Screen 一样断开和重新连接到 Emacs 了。 -### Window manager +### 窗口管理器 ![Ratpoison split screen][11] 除了文本编辑器之外,一些 Linux 桌面也同样具有拆分屏幕、加载终端这样的功能。例如 [Ratpoison][12]、[Herbsluftwm][13]、i3、Awesome,甚至是启用了特定设置的 KDE Plasma 桌面,都可以将多个应用程序在桌面上分块显示。 -这些桌面可以让各个应用程序占据屏幕的固定位置,而不是逐个叠放在一起,因此你可以在多个应用程序窗口之间轻松切换。你还可以打开多个终端,以达到终端复用的目的。更进一步,你还可以在桌面复用工具中加载终端复用工具。 +这些桌面可以让各个应用程序占据屏幕的固定位置,而不是浮在你的桌面“之上”,因此你可以在多个应用程序窗口之间轻松切换。你还可以打开多个终端,排布成网格,就像终端复用工具一样。更进一步,你还可以在你的桌面复用工具中加载一个终端复用工具。 -And there's nothing stopping you from loading Emacs with split buffers inside of that. No one knows what happens if you take it further than that, and most Linux users agree it's best not to find out. +而且,没有什么可以阻止你在里面载入 Emacs 并分割缓冲区。没有人知道,如果你把它更进一步,会发生什么,大多数 Linux 用户不会外传这种秘密。 -和 tmux、GNU Screen 不同,你在断开与桌面的连接后无法重新连接到同一个桌面会话,除非你使用了远程桌面软件进行连接。 +和 `tmux`、GNU Screen 不同,你在断开与桌面的连接后无法重新连接到同一个桌面会话,除非你使用了远程桌面软件进行连接。 ### 更多选择 除了上面介绍到的工具以外,还有诸如 [Tilix][14]、Terminator 这样的终端模拟器,它们同样可以实现屏幕拆分、嵌入终端组件等功能。欢迎在评论区分享你喜欢的终端拆分工具。 - -------------------------------------------------------------------------------- via: https://opensource.com/article/20/5/split-terminal @@ -137,7 +136,7 @@ via: https://opensource.com/article/20/5/split-terminal 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5880afedad4b77a17b5390fabbc9a573e8327554 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 May 2020 13:26:22 +0800 Subject: [PATCH 2114/3057] PUB @HankChow https://linux.cn/article-12236-1.html --- .../20200508 5 ways to split your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200508 5 ways to split your Linux terminal.md (99%) diff --git a/translated/tech/20200508 5 ways to split your Linux terminal.md b/published/20200508 5 ways to split your Linux terminal.md similarity index 99% rename from translated/tech/20200508 5 ways to split your Linux terminal.md rename to published/20200508 5 ways to split your Linux terminal.md index acb8f405ff..3bc58045fa 100644 --- a/translated/tech/20200508 5 ways to split your Linux terminal.md +++ b/published/20200508 5 ways to split your Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12236-1.html) [#]: subject: (5 ways to split your Linux terminal) [#]: via: (https://opensource.com/article/20/5/split-terminal) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From d77fce2febc205ca95cee5b2c0d690659337e87e Mon Sep 17 00:00:00 2001 From: "qfzy1233@163.com" Date: Thu, 21 May 2020 16:59:45 +0800 Subject: [PATCH 2115/3057] Update 20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md --- ...Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md index 73e60dc17a..1f803fc2ca 100644 --- a/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md +++ b/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md @@ -7,7 +7,7 @@ [#]: via: (https://itsfoss.com/lubuntu-20-04-review/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) -Lubuntu 20.04 Review: Lightweight, Minimalistic, Polished +Lubuntu 20.04 简述: 轻量, 简约, 文雅 ====== _**Lubuntu 20.04 LTS is significantly different than its previous LTS version. It is aiming to give you a more polished experience rather than just focusing on older computer. Read more about it as I review Lubuntu 20.04.**_ From 1d3ea1677e89fe5cce98f42db79b9341704fa20e Mon Sep 17 00:00:00 2001 From: qfzy1233 Date: Thu, 21 May 2020 21:09:25 +0800 Subject: [PATCH 2116/3057] Update 20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md --- ...ew- Lightweight, Minimalistic, Polished.md | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md index 1f803fc2ca..a303a3853f 100644 --- a/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md +++ b/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md @@ -10,118 +10,118 @@ Lubuntu 20.04 简述: 轻量, 简约, 文雅 ====== -_**Lubuntu 20.04 LTS is significantly different than its previous LTS version. It is aiming to give you a more polished experience rather than just focusing on older computer. Read more about it as I review Lubuntu 20.04.**_ +_**Lubuntu20.04 LTS 与之前的 LTS 版本有很大的不同。它的旨在给你一个更完善的体验,而不仅仅是关注旧的电脑。阅读更多关于Lubuntu20.04的内容。**_ -### Lubuntu 20.04 Review: First LTS release with LXQt +### Lubuntu 20.04 一览: 第一个基于 LXQt 的长期支持版 -I have been using Lubuntu 20.04 from a few days before the release. I usually dwell in Arch world with Manjaro and Cinnamon desktop so using Lubuntu was a pleasant change for me. +我在 Lubuntu20.04 发行前几天就已经开始使用它了。我通常使用 Arch 阵营中 Manjaro 和 Cinnamon desktop,所以使用 Lubuntu 对我来说是一个愉快的改变。 -Here’s what I have noticed and felt about Lubuntu 20.04. +以下是我在使用 Lubuntu 20.04.时的一些感受和注记。 -#### Bye bye LXDE, Hello LXQt! +#### 再见LXDE,你好LXQt! -For a long time, [Lubuntu][1] relied on [LXDE][2] to provide a lightweight Linux experience. It now uses LXQt desktop environment. +很长一段时间以来,[Lubuntu][1]都依赖于[LXDE][2]来提供轻量级的Linux体验。现在它使用LXQt桌面环境。 -[LXDE][3] is based on GTK (the libraries used by GNOME) and more specifically on GTK+ 2 which is dated in 2020. Dissatisfied with GTK+ 3, LXDE developer Hong Jen Yee decided to port the entire desktop to Qt (the libraries used by KDE). LXDE, the Qt port of it, and the [Razor-qt][4] project were combined to form [LXQt][5]. Although today, LXDE and LXQt coexist as separate projects. +[LXDE][3]是基于 GTK (GNOME使用的库),更具体地说是基于2020年的 GTK+ 2。LXDE 开发人员 Hong Jen Yee 不满意 GTK+ 3,决定将整个桌面移植到Qt (KDE使用的库)。LXDE、it的Qt端口和[Razor-qt][4]项目合并形成[LXQt][5]。所以现在,LXDE和LXQt作为单独的项目共存。 -Since LXDE developer itself is focusing on LXQt, it makes no sense for Lubuntu to stick with a desktop environment that had its last stable release more than three years ago. +由于 LXDE 开发者本身关注于 LXQt ,所以 Lubuntu 死磕桌面环境是没有意义的,因为上一次稳定发行版已经是三年多以前的事情了。 -Lubuntu 18.04 is the last version of with [LXDE][3]. Fortunately it’s a long term support edition. It will be supported officially by Lubuntu team till 2021. +Lubuntu 18.04是[LXDE][3]的最后一个版本。幸运的是,这是一个长期支持版本。Lubuntu团队将提供支持直到2021年。 ![][6] -#### Not exclusively for older machines +#### 不仅适于老机器 -As the definition of “older machine” has changed in 2020 Lubuntu 18.04 is the last 32bit version. Nowadays even a 10 year old machine comes with at least 2 gigabytes of ram and a dual-core 64bit processor. +由于“老机器”的定义在2020年发生了变化,Lubuntu 18.04是最后一个32位版本。现在,即使是一台10年前的老机器也至少有2g的内存和一个双核64位处理器。 -As per that, [Lubuntu Team will no longer provide minimum system requirements and will no longer primarily focus on older hardware][7]. Although LXQt is still a lightweight, classic yet polished and feature rich desktop environment. +因此,Lubuntu 团队将不再提供最低的系统需求,也不再主要关注旧的硬件。尽管 LXQt 仍然是一个轻量级的、经典的、完善的、功能丰富的桌面环境。 -The First Lubuntu release with LXQt was 18.10, giving the developers three standard releases to perfect the LXQt desktop before the Lubuntu 20.04 LTS release, which is a good development strategy. +Lubuntu 的第一个 LXQt 发行版是18.10,在Lubuntu20.04 LTS 发行版之前,开发人员经历了三个标准发行版来完善 LXQt 桌面,这是一个很好的开发策略。 -#### Not the regular Ubiquity, Lubuntu 20.04 uses Calamares installer +#### 与以往不同的是 Lubuntu 20.04 使用 Calamares 安装器 -![Lubuntu 20.04 Calamares Installer][8] +![Lubuntu 20.04 Calamares 安装器][8] -A fresh installation begins with the new [Calamares][9] installer, in place of the Ubiquity installer that other [official Ubuntu flavors][10] use. +在新版本中全新的[Calamares][9]安装器,取代了其他[Ubuntu官方版本][10]使用的普遍安装程序。 -The whole process is done in approximately 10 minutes, slightly faster than the previous Lubuntu releases. +整个安装过程在大约10分钟内完成,比之前Lubuntu的版本稍微快一些。 -As the .iso comes with the essential applications pre-installed you can get your system fully configured pretty fast too. +由于镜像文件附带了预先安装的基本应用程序,你也可以很快地完全配置您的系统。 -#### No upgrade from Lubuntu 18.04 to Lubuntu 20.04 +#### 不要直接从 Lubuntu 18.04 升级到 Lubuntu 20.04 -Normally, you can [upgrade Ubuntu from one LTS to another LTS release][11]. But Lubuntu team advises not to upgrade from Lubuntu 18.04 to 20.04. They recommend a fresh install and rightly so. +通常,你可以[将Ubuntu从一个LTS版本升级到另一个LTS版本][11]。但是 Lubuntu 团队建议不要从 Lubuntu18.04升级到20.04。他们建议重新安装,这才是正确的。 -Lubuntu 18.04 used LXDE desktop while 20.04 uses LXQt. Due to the extensive changes in the desktop environments, upgrading to 20.04 from 18.04 will result in a broken system. +Lubuntu 18.04使用LXDE桌面,20.04使用LXQt。由于桌面环境的巨大变化,从18.04升级到20.04将导致系统崩溃。 -#### **More KDE and Qt applications** +#### **更多的KDE和Qt应用程序** ![][12] -Here are some of the applications that are available by default in this new release and as I can see, not all of them are lightweight and most of them are Qt-based. +下面是在这个新版本中默认可用的一些应用程序,正如我们所看到的,并非所有应用程序都是轻量级的,而且大多数应用程序都是基于qt的。 -Even the software center used is KDE’s Discover instead of Ubuntu’s GNOME software center. +甚至使用的软件中心也是 KDE 的 Discover,而不是 Ubuntu 的 GNOME 软件中心。 - * Ark – archive manager - * Bluedevil – bluetooth connector - * Discover Software Center – package management system - * FeatherPad – text editor - * FireFox – web browser - * K3b – CD/DVD burner - * Kcalc – calculator - * KDE partition manager – partition manager - * LibreOffice – Office suite (Qt interface version) - * LXimage-Qt – image viewer and screenshot tool - * Muon – package manager + * Ark – 压缩文件管理器 + * Bluedevil – 蓝牙连接管理 + * Discover Software Center – 包管理系统 + * FeatherPad – 文本编辑器 + * FireFox – 浏览器 + * K3b – CD/DVD 刻录器 + * Kcalc – 计算器 + * KDE partition manager – 分区管理工具 + * LibreOffice – 办公套件 (Qt 接口版本) + * LXimage-Qt – 图片查看及截图制作 + * Muon – 包管理器 - * Noblenote – note taker - * PCManFM-Qt – File manager - * Qlipper – clipboard manager - * qPDFview – PDF viewer - * PulseAudio – audio controller - * Qtransmission – bittorrent client (Qt interface version) - * Quassel – IRC client - * ScreenGrab – Screenshot creator - * Skanlite – scanning - * Startup Disk Creator – USB boot disk maker - * Trojita – email client - * VLC – media player + * Noblenote – 笔记工具 + * PCManFM-Qt – 文件管理器 + * Qlipper – 剪贴板管理工具 + * qPDFview – PDF 阅读器 + * PulseAudio – 音频控制器 + * Qtransmission – BT下载工具 (Qt 接口版本) + * Quassel – 实时聊天客户端 + * ScreenGrab – 截屏制作工具 + * Skanlite – 扫描工具 + * Startup Disk Creator – USB 启动盘制作工具 + * Trojita – 邮件客户端 + * VLC – 媒体播放器 * [MPV video player][13] -#### Testing Lubuntu 20.04 LTS +#### 测试 Lubuntu 20.04 LTS -Boot times on the LXQt version of Lubuntu are under a minute, booting from an SSD though. +LXQt 版Lubuntu的启动时间不到一分钟,不过是从SSD启动的。 -LXQt currently requires slightly more memory than the Gtk+ v2-based LXDE, but the alternative Gtk+ v3 toolkit would also have required more memory. +LXQt 目前需要的内存比基于 Gtk+ v2 的LXDE稍微多一点,但是另一种 Gtk+ v3 工具包也需要更多的内存。 -After a reboot the system runs approximately at a very low of 340 MB for the modern standards, 100 MB more than LXDE. +在重新启动之后,系统以非常低的内存占用情况运行,大约只有340 MB(按照现代标准),比LXDE多100 MB。 -![htop running on Lubuntu 20.04][14] +![htop 在 Lubuntu 20.04 上运行][14] -LXQt is not only for users with an older hardware but also for those who are seeking a simple and classic experience at their new machine. +LXQt 不仅适用于使用旧硬件的用户,也适用于那些希望在新机器上获得简单而经典体验的用户。 -The desktop layout looks similar to KDE’s Plasma desktop, don’t you think? +桌面布局看起来类似于 KDE 的 Plasma 桌面,你不这样认为吗? -![Lubuntu 20.04 Desktop][15] +![Lubuntu 20.04 桌面环境][15] -There’s an application menu in the lower-left corner, a taskbar for pinned and active applications, and a system tray in the lower-right corner. +在左下角有一个应用程序菜单,一个用于固定和活动应用程序的任务栏,右下角有一个系统托盘。 -Lubuntu in its LXQt version can be easily customized and everything is in the menu under preferences, with most key items under LXQt Settings. +Lubuntu 的 LXQt 版本可以很容易的定制,所有的东西都在菜单的首选项下,大部分的关键项目都在 LXQt 设置下。 -It is worth-mentioning that LXQt uses the popular [Openbox window manager][16] by default. +值得一提的是, LXQt 在默认情况下使用流行的[ Openbox 窗口管理器][16]。 -Like the last three releases, 20.04 LTS comes with a default dark theme Lubuntu Arc, but it is quick and easy to change it if it doesn’t suit your taste. +与前三个发行版一样,20.04 LTS 附带了一个默认的黑暗主题 Lubuntu ,但是如果不适合你的口味,可以快速、轻松地更改它。 -In daily use, Lubuntu 20.04 has proven to me completely trouble-free as every Ubuntu flavour in fact. +就日常使用而言,Lubuntu20.04 已经向我证明了它是完全没有问题的,因为它是 Ubuntu 的一个版本。 -#### Conclusion +#### 结论 -Lubuntu team has successfully made the transition to a modern, still lightweight and minimal desktop environment. LXDE looks like abandoned and it is a good thing to move away to an active project. +Lubuntu团队已经成功地过渡到一个现代的、依然轻量级的、最小的桌面环境。LXDE看起来被遗弃了,迁移到一个活跃的项目也是一件好事。 -I hope that Lubuntu 20.04 makes you as much enthusiastic as I am, and if so don’t hesitate to let me know at the comments below. Stay tuned! +我希望Lubuntu 20.04能够像我一样让你充满热情,如果是这样,请在下面的评论中告诉我。请继续关注! -------------------------------------------------------------------------------- @@ -129,7 +129,7 @@ via: https://itsfoss.com/lubuntu-20-04-review/ 作者:[Dimitrios Savvopoulos][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qfzy1233](https://github.com/qfzy1233) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a800366dee5e9a4ccf433ee486934f309410338c Mon Sep 17 00:00:00 2001 From: qfzy1233 Date: Thu, 21 May 2020 21:12:13 +0800 Subject: [PATCH 2117/3057] Rename sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md to translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md --- ...8 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md (100%) diff --git a/sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md similarity index 100% rename from sources/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md rename to translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md From 5296c06b50143be1aecf58c0fe4e4f47ebb73bde Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 May 2020 21:32:36 +0800 Subject: [PATCH 2118/3057] APL --- .../tech/20190510 Learn to change history with git rebase.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sources/tech/20190510 Learn to change history with git rebase.md b/sources/tech/20190510 Learn to change history with git rebase.md index 4d46fef81f..7e2f6c943e 100644 --- a/sources/tech/20190510 Learn to change history with git rebase.md +++ b/sources/tech/20190510 Learn to change history with git rebase.md @@ -1,8 +1,5 @@ -Translating by Scoutydren.... - - [#]: collector: (lujun9972) -[#]: translator: (Scoutydren) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 01c8c99e9a86603429dc0a1c2353eae3ee70f39d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 22 May 2020 08:41:57 +0800 Subject: [PATCH 2119/3057] translated --- ... MySQL-MariaDB Database Server on Linux.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) rename {sources => translated}/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md (66%) diff --git a/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md b/translated/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md similarity index 66% rename from sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md rename to translated/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md index a2070192d0..247a2806c4 100644 --- a/sources/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md +++ b/translated/tech/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md @@ -7,26 +7,26 @@ [#]: via: (https://www.2daygeek.com/check-mysql-mariadb-database-server-uptime-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Three Methods to Check Uptime of MySQL/MariaDB Database Server on Linux +在 Linux 上检查 MySQL/MariaDB 数据库正常运行时间的三种方法 ====== -We all know the purpose of the uptime command in Linux. +我们都知道在 Linux 中使用 uptime 命令的目的。 -This is used to check the **[uptime of the Linux system][1]** and how long the system runs without restarting. +它用于检查 **[Linux 系统的正常运行时间][1]**以及系统未重启运行的时间。 -The Linux admin job is to keep the system up and running. +Linux 管理员的工作是保持系统正常运行。 -If you want to check how long other services like **[Apache][2]**, MySQL, MariaDB, sftp, etc., are running on Linux, how do you do that? +如果要检查 Linux 上的其他服务(例如 **[Apache][2]**、MySQL、MariaDB、sftp 等)运行了多长时间,该怎么做? -Each service has their own command to check the uptime of service. +每个服务都有自己的命令来检查服务的正常运行时间。 -But you can also use other commands for this purpose. +但是你也可以为此使用其他命令。 -### Method-1: How to Check the Uptime of a MySQL/MariaDB Database Server on Linux Using the ps Command +### 方法 1:如何使用 ps 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 -The **[ps command][3]** stands for process status. This is one of the most basic commands that shows the system running processes with details. +**[ps命令][3]**代表进程状态。这是最基本的命令之一,它显示了系统正在运行的进程的详细信息。 -To do so, you first need to find the PID of **[MySQL][4]**/MariaDB using the **[pidof command][5]**. +为此,你首先需要使用 **[pidof 命令][5]查找 **[MySQL][4]**/MariaDB的 PID。 ``` # pidof mysqld | cut -d" " -f1 @@ -34,9 +34,9 @@ To do so, you first need to find the PID of **[MySQL][4]**/MariaDB using the **[ 2412 ``` -Once you have the MySQL/[**MariaDB**][6] PID, use the “etime” option with the ps command and get the uptime. +获取 MySQL/[**MariaDB**][6] 的 PID 后,请在 ps 命令中使用 “etime” 选项获得正常运行时间。 - * **etime:** elapsed time since the process was started, in the form of [[DD-]hh:]mm:ss. + * **etime:**自进程启动以来经过的时间,形式为 [[DD-]hh:]mm:ss。 @@ -47,7 +47,7 @@ Once you have the MySQL/[**MariaDB**][6] PID, use the “etime” option with th 2-08:49:30 ``` -Alternatively, use the “lstart” option with the ps command to get the uptime of a given PID. +或者,在 ps 命令中使用 “lstart” 选项来获取指定 PID 的正常运行时间。 ``` # ps -p 2412 -o lstart @@ -56,17 +56,17 @@ Alternatively, use the “lstart” option with the ps command to get the uptime Sat May 2 03:02:15 2020 ``` -The MySQL/MariaDB process has been running for 2 days, 03 hours, 02 minutes and 15 seconds. +MySQL/MariaDB 进程已经运行了 2 天 03 小时 02 分 15 秒。 -### Method-2: How to Check the Uptime of a MySQL/MariaDB Database Server on Linux Using the Systemctl Command +### 方法 2:如何使用 Systemctl 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 -The **[systemctl command][7]** is used to control the systemd system and service manager. +**[systemctl 命令][7]** 用于控制 systemd 系统和服务管理器。 -systemd is a new init system and system manager, that was adopted by most of Linux distributions now over the traditional SysVinit manager. +systemd 是新的 init 系统和系统管理器,现在大多数 Linux 发行版都淘汰了传统的 SysVinit 管理器而采用了systemd。 ``` # systemctl status mariadb -or +或者 # systemctl status mysql ● mariadb.service - MariaDB 10.1.44 database server @@ -95,13 +95,13 @@ Warning: Journal has been rotated since unit was started. Log output is incomple Hint: Some lines were ellipsized, use -l to show in full. ``` -### Method-3: How to Check the Uptime of a MySQL/MariaDB Database Server on Linux Using the MySQLAdmin Command +### 方法 3:如何使用 MySQLAdmin 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 -**[MySQLAdmin][8]** is a command-line utility for MySQL Server that is installed when installing the MySQL package. +**[MySQLAdmin][8]** 是安装 MySQL 软件包时安装的 MySQL 服务器命令行程序。 -The MySQLAdmin client allows you to perform some basic administrative functions on the MySQL server. +MySQLAdmin 客户端允许你在 MySQL 服务器上执行一些基本的管理功能。 -It is used to create a database, drop a database, set a root password, change the root password, check MySQL status, verify MySQL functionality, monitor mysql processes, and verify the configuration of the server. +它用于创建数据库、删除数据库、设置 root 密码、更改 root 密码、检查 MySQL 状态、验证 MySQL 功能、监视 mysql 进程以及验证服务器的配置。 ``` # mysqladmin -u root -pPassword version @@ -126,7 +126,7 @@ via: https://www.2daygeek.com/check-mysql-mariadb-database-server-uptime-linux/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 857b4a97909200aba0d174447499fbdad66806ad Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 22 May 2020 09:14:28 +0800 Subject: [PATCH 2120/3057] translating --- ...thon templating languages you should (probably) never use.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200401 3 Python templating languages you should (probably) never use.md b/sources/tech/20200401 3 Python templating languages you should (probably) never use.md index e23b443b0d..7d73216ea5 100644 --- a/sources/tech/20200401 3 Python templating languages you should (probably) never use.md +++ b/sources/tech/20200401 3 Python templating languages you should (probably) never use.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 61327d3809182c7fd516594c7c1b8cf0ade000cc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 May 2020 09:17:37 +0800 Subject: [PATCH 2121/3057] TSL PART 1 --- ...Learn to change history with git rebase.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) rename {sources => translated}/tech/20190510 Learn to change history with git rebase.md (89%) diff --git a/sources/tech/20190510 Learn to change history with git rebase.md b/translated/tech/20190510 Learn to change history with git rebase.md similarity index 89% rename from sources/tech/20190510 Learn to change history with git rebase.md rename to translated/tech/20190510 Learn to change history with git rebase.md index 7e2f6c943e..03dbb641f9 100644 --- a/sources/tech/20190510 Learn to change history with git rebase.md +++ b/translated/tech/20190510 Learn to change history with git rebase.md @@ -7,19 +7,18 @@ [#]: via: (https://git-rebase.io/) [#]: author: (git-rebase https://git-rebase.io/) -Learn to change history with git rebase! +学习用 git 变基来改变历史! ====== -One of Git 's core value-adds is the ability to edit history. Unlike version control systems that treat the history as a sacred record, in git we can change history to suit our needs. This gives us a lot of powerful tools and allows us to curate a good commit history in the same way we use refactoring to uphold good software design practices. These tools can be a little bit intimidating to the novice or even intermediate git user, but this guide will help to demystify the powerful git-rebase . -``` -A word of caution : changing the history of public, shared, or stable branches is generally advised against. Editing the history of feature branches and personal forks is fine, and editing commits that you haven't pushed yet is always okay. Use git push -f to force push your changes to a personal fork or feature branch after editing your commits. -``` +[Git][1] 的核心的附加价值之一就是编辑历史记录的能力。不同于将历史记录视为神圣的记录的版本控制系统,在 Git 中,我们可以根据自己的需要修改历史记录。这为我们提供了很多强大的工具,让我们可以像使用重构来维护良好的软件设计实践一样,编织良好的提交历史。这些工具对于新手甚至是有经验的 Git 用户来说可能会有些生畏,但本指南将帮助我们揭秘强大的 git-rebase。 -Despite the scary warning, it's worth mentioning that everything mentioned in this guide is a non-destructive operation. It's actually pretty difficult to permanently lose data in git. Fixing things when you make mistakes is covered at the end of this guide. +> 值得注意的是:一般建议不要修改公共分支、共享分支或稳定分支的历史记录。编辑特性分支和个人分支的历史记录是可以的,编辑还没有推送的提交也是可以的。在编辑完提交后,使用 `git push -f` 来强制推送你的修改到个人分支或特性分支。 -### Setting up a sandbox +尽管有这么可怕的警告,但值得一提的是,本指南中提到的一切都是非破坏性操作。实际上,在 Git 中永久丢失数据是相当困难的。当你犯错时的修复方法在本指南的最后会涉及到。 -We don't want to mess up any of your actual repositories, so throughout this guide we'll be working with a sandbox repo. Run these commands to get started: +### 设置沙盒 + +我们不想破坏你的实际版本库,所以在整个指南中,我们将使用一个沙盒版本库。运行这些命令来开始工作。[^1] ``` git init /tmp/rebase-sandbox @@ -27,31 +26,30 @@ cd /tmp/rebase-sandbox git commit --allow-empty -m"Initial commit" ``` -If you run into trouble, just run rm -rf /tmp/rebase-sandbox and run these steps again to start over. Each step of this guide can be run on a fresh sandbox, so it's not necessary to re-do every task. +如果你遇到麻烦,只需运行 `rm -rf /tmp/rebase-sandbox`,然后重新运行这些步骤重新开始。本指南的每一步都可以在一个新的沙箱上运行,所以没有必要重做每个任务。 +### 修正最新的提交 -### Amending your last commit - -Let's start with something simple: fixing your most recent commit. Let's add a file to our sandbox - and make a mistake: +让我们从简单的事情开始:修复你最近的提交。让我们将一个文件添加到我们的沙盒中,并犯个错误。 ``` echo "Hello wrold!" >greeting.txt - git add greeting.txt - git commit -m"Add greeting.txt" +git add greeting.txt +git commit -m"Add greeting.txt" ``` -Fixing this mistake is pretty easy. We can just edit the file and commit with `--amend`, like so: +修复这个错误是非常容易的。我们只需要编辑文件,然后用 `--amend` 提交就可以了,就像这样: ``` echo "Hello world!" >greeting.txt - git commit -a --amend +git commit -a --amend ``` -Specifying `-a` automatically stages (i.e. `git add`'s) all files that git already knows about, and `--amend` will squash the changes into the most recent commit. Save and quit your editor (you have a chance to change the commit message now if you'd like). You can see the fixed commit by running `git show`: +指定 `-a` 会自动将所有 Git 已经知道的文件进行暂存(即 `--amend`),而 `--amend` 会将更改的内容压制到最近的提交中。保存并退出你的编辑器(如果你愿意的话,现在你有机会修改提交信息)。你可以通过运行 `--git show` 看到修复的提交。 ``` commit f5f19fbf6d35b2db37dcac3a55289ff9602e4d00 (HEAD -> master) -Author: Drew DeVault +Author: Drew DeVault Date: Sun Apr 28 11:09:47 2019 -0400 Add greeting.txt @@ -592,3 +590,5 @@ via: https://git-rebase.io/ [a]: https://git-rebase.io/ [b]: https://github.com/lujun9972 +[1]: https://git-scm.com/ +[2]: https://git-scm.com/docs/git-rebase From 34ea82a55a2721f03e5812add565ff1ad0d58fc8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 May 2020 10:17:58 +0800 Subject: [PATCH 2122/3057] PRF @lxbwolf --- ... Go binaries by prohibiting comparisons.md | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md b/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md index ba2e321bb3..b9fabc8f27 100644 --- a/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md +++ b/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Ensmallening Go binaries by prohibiting comparisons) @@ -10,25 +10,27 @@ 通过禁止比较让 Go 二进制文件变小 ====== -大家常规的认知是,Go 程序中声明的类型越多,生成的二进制文件就越大。这个符合直觉,毕竟如果你写的代码不去操作定义的类型,那么定义一堆类型就没有意义了。然而,链接器的部分工作就是检测程序没有引用的函数,比如仅仅有某个功能的子功能使用的库中的某些函数,然后把他们从最后的编译产出中删除。常言道,“类型越多,二进制文件越大“,对于多数 Go 程序还是正确的。 +![](https://img.linux.net.cn/data/attachment/album/202005/22/101617lcha7vvqzhh7d565.jpg) -本文中我会深入讲解在 Go 程序的上下文中相等的意义,以及为什么[像这样][1]的修改会对 Go 程序的大小有重大的影响。 +大家常规的认知是,Go 程序中声明的类型越多,生成的二进制文件就越大。这个符合直觉,毕竟如果你写的代码不去操作定义的类型,那么定义一堆类型就没有意义了。然而,链接器的部分工作就是检测没有被程序引用的函数(比如说它们是一个库的一部分,其中只有一个子集的功能被使用),然后把它们从最后的编译产出中删除。常言道,“类型越多,二进制文件越大”,对于多数 Go 程序还是正确的。 + +本文中我会深入讲解在 Go 程序的上下文中“相等”的意义,以及为什么[像这样][1]的修改会对 Go 程序的大小有重大的影响。 ### 定义两个值相等 -Go 的语法定义了赋值和相等的概念。赋值是把一个值赋给一个标识符的行为。并不是所有声明的标识符都可以被赋值,如常量和函数就不可以。相等是通过检查标识符的内容是否相等来比较两个标识符的行为。 +Go 的语法定义了“赋值”和“相等”的概念。赋值是把一个值赋给一个标识符的行为。并不是所有声明的标识符都可以被赋值,如常量和函数就不可以。相等是通过检查标识符的内容是否相等来比较两个标识符的行为。 作为强类型语言,“相同”的概念从根源上被植入标识符的类型中。两个标识符只有是相同类型的前提下,才有可能相同。除此之外,值的类型定义了如何比较该类型的两个值。 -例如,整型是用算数方法进行比较的。对于指针类型,是否相等是指他们指向的地址是否相同。map 和 channel 等引用类型,跟指针类似,如果它们有相同的地址,那么就认为它们是相同的。 +例如,整型是用算数方法进行比较的。对于指针类型,是否相等是指它们指向的地址是否相同。映射和通道等引用类型,跟指针类似,如果它们指向相同的地址,那么就认为它们是相同的。 -上面都是按位比较相等的例子,即值占用的位模式内存是相同的,那么这些值就相等。这个就是 memcmp,全称为 memory comparison,相等是通过比较两个内存区域的内容来定义的。 +上面都是按位比较相等的例子,即值占用的内存的位模式是相同的,那么这些值就相等。这就是所谓的 memcmp,即内存比较,相等是通过比较两个内存区域的内容来定义的。 -记住这个思路,我会很快回来的。 +记住这个思路,我过会儿再来谈。 ### 结构体相等 -除了整型、浮点型和指针等标量类型,还有复合类型;结构体。所有的结构体以程序中的顺序被排列在内存中。因此下面这个声明 +除了整型、浮点型和指针等标量类型,还有复合类型:结构体。所有的结构体以程序中的顺序被排列在内存中。因此下面这个声明: ``` type S struct { @@ -41,7 +43,7 @@ type S struct { ``` a := S{1, 2, 3, 4} b := S{1, 2, 3, 4} -fmt.Println(a == b) // prints true +fmt.Println(a == b) // 输出 true ``` 编译器在底层使用 memcmp 来比较 `a` 的 32 个字节和 `b` 的 32 个字节。 @@ -61,38 +63,38 @@ type S struct { func main() a := S{1, 2, 3, 4} b := S{1, 2, 3, 4} - fmt.Println(a == b) // prints true + fmt.Println(a == b) // 输出 true } ``` -编译代码后,这个比较表达式的结果还是 true,但是编译器在底层并不能仅依赖比较 `a` 和 `b` 的位模式,因为结构体有*填充*。 +编译代码后,这个比较表达式的结果还是 `true`,但是编译器在底层并不能仅依赖比较 `a` 和 `b` 的位模式,因为结构体有*填充*。 -Go 要求结构体的所有字段都对齐。2 字节的值必须从偶数地址开始,4 字节的值必须从 4 的倍数地址开始,以此类推[1][2]。编译器根据字段的类型和底层平台加入了填充来确保字段都*对齐*。在填充之后,编译器实际上看到的是[2][3]: +Go 要求结构体的所有字段都对齐。2 字节的值必须从偶数地址开始,4 字节的值必须从 4 的倍数地址开始,以此类推 [^1]。编译器根据字段的类型和底层平台加入了填充来确保字段都*对齐*。在填充之后,编译器实际上看到的是 [^2]: ``` type S struct { a byte - _ [7]byte // padding + _ [7]byte // 填充 b uint64 c int16 - _ [2]int16 // padding + _ [2]int16 // 填充 d uint32 } ``` 填充的存在保证了字段正确对齐,而填充确实占用了内存空间,但是填充字节的内容是未知的。你可能会认为在 Go 中 填充字节都是 0,但实际上并不是 — 填充字节的内容是未定义的。由于它们并不是被定义为某个确定的值,因此按位比较会因为分布在 `s` 的 24 字节中的 9 个填充字节不一样而返回错误结果。 -Go 通过生成相等函数来解决这个问题。在这个例子中,`s` 的相等函数只比较函数中的字段略过填充部分,这样就能正确比较类型 `s` 的两个值。 +Go 通过生成所谓的相等函数来解决这个问题。在这个例子中,`s` 的相等函数只比较函数中的字段略过填充部分,这样就能正确比较类型 `s` 的两个值。 ### 类型算法 -嚄,需要做很多准备工作才能解释原因,对于 Go 程序中定义的每种类型,编译器都会生成几个支持它的函数,编译器内部把它们识别为类型的算法。如果类型是一个 map 的 key,那么除相等函数外,编译器还会生成一个哈希函数。为了维持稳定,哈希函数在计算结果时也会像相等函数一样考虑诸如填充等因素。 +呵,这是个很大的设置,说明了为什么,对于 Go 程序中定义的每种类型,编译器都会生成几个支持函数,编译器内部把它们称作类型的算法。如果类型是一个映射的键,那么除相等函数外,编译器还会生成一个哈希函数。为了维持稳定,哈希函数在计算结果时也会像相等函数一样考虑诸如填充等因素。 -凭直觉判断编译器什么时候生成这些函数实际上很难,有时并不明显,(因为)这超出了你的预期,而且链接器也很难消除没有被使用的类型,因为反射往往导致链接器在裁剪类型时变得更保守。 +凭直觉判断编译器什么时候生成这些函数实际上很难,有时并不明显,(因为)这超出了你的预期,而且链接器也很难消除没有被使用的函数,因为反射往往导致链接器在裁剪类型时变得更保守。 ### 通过禁止比较来减小二进制文件的大小 -现在,我们能解释 Brad 的修改了。向类型添加一个不可比较的字段[3][4],结构体也随之变成不可比较的,从而强制编译器不再生成相等和哈希算法、规避了链接器对那些类型的消除、在实际应用中减小了生成的二进制文件的大小。作为这项技术的一个例子,下面的程序: +现在,我们来解释一下 Brad 的修改。向类型添加一个不可比较的字段 [^3],结构体也随之变成不可比较的,从而强制编译器不再生成相等函数和哈希函数,规避了链接器对那些类型的消除,在实际应用中减小了生成的二进制文件的大小。作为这项技术的一个例子,下面的程序: ``` package main @@ -101,7 +103,7 @@ import "fmt" func main() { type t struct { - // _ [0][]byte uncomment to prevent comparison + // _ [0][]byte // 取消注释以阻止比较 a byte b uint16 c int32 @@ -112,28 +114,24 @@ func main() { } ``` -用 Go 1.14.2(darwin/amd64)编译,大小从 2174088 降到了 2174056,节省了 32 字节。单独看节省的这 32 字节似乎微不足道,但是考虑到你的程序中每个类型及其传递闭包都会生成相等和哈希函数,还有他们的依赖,这些函数的大小随类型大小和复杂度的不同而不同,禁止它们会大大减小最终的二进制文件的大小,效果比之前使用 `-ldflags="-s -w"` 还要好。 +用 Go 1.14.2(darwin/amd64)编译,大小从 2174088 降到了 2174056,节省了 32 字节。单独看节省的这 32 字节似乎微不足道,但是考虑到你的程序中每个类型及其传递闭包都会生成相等和哈希函数,还有它们的依赖,这些函数的大小随类型大小和复杂度的不同而不同,禁止它们会大大减小最终的二进制文件的大小,效果比之前使用 `-ldflags="-s -w"` 还要好。 -最后总结一下,如果你不想把类型定义为可比较的,像这样的入侵可以在源码层级强制实现,而且会使生成的二进制文件变小。 +最后总结一下,如果你不想把类型定义为可比较的,可以在源码层级强制实现像这样的奇技淫巧,会使生成的二进制文件变小。 * * * -附录:在 Brad 的推动下,[Cherry Zhang][5] 和 [Keith Randall][6] 已经在 Go 1.15 做了大量的改进来修复最恶名昭彰的消除无用相等和哈希函数失败(虽然我猜想这也是为了避免这类 CL 的扩散)。 - - 1. 在 32 位平台上 `int64` 和 `unit64` 的值可能不是按 8 字节对齐的,因为平台原生的是以 4 字节对齐的。查看 [issue 599][7] 了解内部详细信息[][8]。 - 2. 32 位平台会在 `a` 和 `b` 的声明中填充 `_ [3]byte`。查看前面的内容[][9]。 - 3. Brad 使用的是`[0]func()`,但是所有能限制和禁止比较的类型都可以。添加了一个有 0 个元素的数组的声明后,结构体的大小和对齐不会受影响。[][10] - +附录:在 Brad 的推动下,[Cherry Zhang][5] 和 [Keith Randall][6] 已经在 Go 1.15 做了大量的改进,修复了最严重的故障,消除了无用的相等和哈希函数(虽然我猜想这也是为了避免这类 CL 的扩散)。 +[^1]: 在 32 位平台上 `int64` 和 `unit64` 的值可能不是按 8 字节对齐的,因为平台原生的是以 4 字节对齐的。查看 [议题 599][7] 了解内部详细信息。 +[^2]: 32 位平台会在 `a` 和 `b` 的声明中填充 `_ [3]byte`。参见前一条。 +[^3]: Brad 使用的是`[0]func()`,但是所有能限制和禁止比较的类型都可以。添加了一个有 0 个元素的数组的声明后,结构体的大小和对齐不会受影响。 #### 相关文章: - 1. [Go 运行时如何高效地实现 map(不使用泛型)][11] + 1. [Go 运行时如何高效地实现映射(不使用泛型)][11] 2. [空结构体][12] 3. [填充很难][13] - 4. [Go 中有类型的 nil 2][14] - - + 4. [Go 中有类型的 nil(2)][14] -------------------------------------------------------------------------------- @@ -142,7 +140,7 @@ via: https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting- 作者:[Dave Cheney][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d1ffed9a8a149524f00d34ab2816f2f7c6b827f1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 May 2020 10:18:30 +0800 Subject: [PATCH 2123/3057] PUB @lxbwolf https://linux.cn/article-12238-1.html --- ...509 Ensmallening Go binaries by prohibiting comparisons.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200509 Ensmallening Go binaries by prohibiting comparisons.md (99%) diff --git a/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md b/published/20200509 Ensmallening Go binaries by prohibiting comparisons.md similarity index 99% rename from translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md rename to published/20200509 Ensmallening Go binaries by prohibiting comparisons.md index b9fabc8f27..1d1a6b1590 100644 --- a/translated/tech/20200509 Ensmallening Go binaries by prohibiting comparisons.md +++ b/published/20200509 Ensmallening Go binaries by prohibiting comparisons.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12238-1.html) [#]: subject: (Ensmallening Go binaries by prohibiting comparisons) [#]: via: (https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons) [#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) From c341228e692fae3ff3fd6fb629473e5526489ce0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 May 2020 11:41:39 +0800 Subject: [PATCH 2124/3057] PRF @geekpi --- ...r getting around your Linux file system.md | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/translated/tech/20200326 Tricks for getting around your Linux file system.md b/translated/tech/20200326 Tricks for getting around your Linux file system.md index 3883ab5c8d..474b6886dd 100644 --- a/translated/tech/20200326 Tricks for getting around your Linux file system.md +++ b/translated/tech/20200326 Tricks for getting around your Linux file system.md @@ -1,34 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Tricks for getting around your Linux file system) [#]: via: (https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -使用 Linux 文件系统的技巧 +在 Linux 文件系统中导航的技巧 ====== -cd 命令可能是任何 Linux 用户学习的前 10 个命令之一,但这并不是在 Linux 文件系统中切换的唯一方法,这里还有其他一些方法。 + +> cd 命令可能是任何 Linux 用户学习的前 10 个命令之一,但这并不是在 Linux 文件系统中导航的唯一方法,这里还有其他一些方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/22/114058yrzlx94rz9lbx974.jpg) 无论你是在文件系统中四处查看、寻找文件还是尝试进入重要目录,Linux 都可以提供很多帮助。在本文中,我们将介绍一些技巧,使你可以在文件系统中移动,查找和使用所需的命令也更加轻松。 -### 添加到 $PATH +### 添加到 \$PATH -确保你不必花费大量时间在 Linux 系统上查找命令的最简单、最有用的方法之一就是在 $PATH 变量中添加适当的目录。但是,添加到 $PATH 变量中的目录顺序非常重要。它们确定系统在目录中查找要运行命令的目录顺序--在找到第一个匹配项时停止。 +确保你不必花费大量时间在 Linux 系统上查找命令的最简单、最有用的方法之一就是在 `$PATH` 变量中添加适当的目录。但是,添加到 `$PATH` 变量中的目录顺序非常重要。它们确定系统在目录中查找要运行命令的目录顺序--在找到第一个匹配项时停止。 例如,你可能希望将家目录放在第一个,这样,如果你创建的脚本与其他可执行文件有相同的名称,那么只要输入该脚本的名称,它便会运行。 -要将家目录添加到 $PATH 变量中,可以执行以下操作: +要将家目录添加到 `$PATH` 变量中,可以执行以下操作: ``` $ export PATH=~:$PATH ``` -**~** 字符代表家目录。 - -如果将脚本保存在 bin 目录中,下面的会有效: +`~` 字符代表家目录。 +如果将脚本保存在 `bin` 目录中,下面的会有效: ``` $ export PATH=~/bin:$PATH @@ -36,14 +38,12 @@ $ export PATH=~/bin:$PATH 然后,你可以运行位于家目录中的脚本,如下所示: -[][2] - ``` $ myscript Good morning, you just ran /home/myacct/bin/myscript ``` -**重要提示:**上面的命令_添加_搜索路径因为 $PATH (当前路径)包含了。它们不会覆盖它。你的搜索路径应该在 **.bashrc** 文件中配置,任何持久更改也需要在这里添加。 +**重要提示:**上面显示的命令会添加到你的搜索路径中,因为 `$PATH`(当前路径)被包含在内。它们不会覆盖它。你的搜索路径应该在你的 `.bashrc` 文件中配置,任何你打算永久化的更改也应该添加到那里。 ### 使用符号链接 @@ -53,17 +53,17 @@ Good morning, you just ran /home/myacct/bin/myscript ln -s /var/www/html www ``` -参数的顺序很重要。第一个(/var/www/html)是目标,第二个是你创建的链接的名称。如果你当前不在家目录中,那么以下命令将执行相同的操作: +参数的顺序很重要。第一个(`/var/www/html`)是目标,第二个是你创建的链接的名称。如果你当前不在家目录中,那么以下命令将执行相同的操作: ``` ln -s /var/www/html ~/www ``` -设置好之后,您可以使用 “cd www” 进入 **/var/www/html**。 +设置好之后,你可以使用 `cd www` 进入 `/var/www/html`。 ### 使用 shopt -**shopt** 命令还提供了一种让移动到其他目录更加容易的方法。当你使用 **shopt** 的 **autocd** 选项时,只需输入名称即可转到目录。例如: +`shopt` 命令还提供了一种让移动到其他目录更加容易的方法。当你使用 `shopt` 的 `autocd` 选项时,只需输入名称即可转到目录。例如: ``` $ shopt -s autocd @@ -79,23 +79,23 @@ $ pwd /home/myacct/bin ``` -在上面的第一组命令中,启用了 shopt 命令的 autocd 选项。输入 **www**,然后调用 “cd www” 命令。由于此符号链接是在上面的 **ln** 命令示例之一中创建的,因此将我们移至 **/var/www/html**。 **pwd -P** 命令显示实际位置。 +在上面的第一组命令中,启用了 `shopt` 命令的 `autocd` 选项。输入 `www`,就会调用 `cd www` 命令。由于此符号链接是在上面的 `ln` 命令示例之一中创建的,因此将我们移至 `/var/www/html`。 `pwd -P` 命令显示实际位置。 -在第二组中,键入 **~/bin** 会在用户家目录调用 **cd** 进入 **bin** 目录。 +在第二组中,键入 `~/bin` 会调用 `cd` 进入在用户家目录的 `bin` 目录。 -请注意,当你输入的是命令时,**autocd** 行为将_不会_生效,即使它也是目录的名称。 +请注意,当你输入的是命令时,`autocd` 行为将*不会*生效,即使它也是目录的名称。 -**shopt** 是 bash 内置,它有很多选项。这只是意味着你不必在要进入每个目录的名称之前输入 “cd”。 +`shopt` 是 bash 内置命令,它有很多选项。这只是意味着你不必在要进入每个目录的名称之前输入 `cd`。 -要查看 **shopt** 的其他选项,只需输入 “shopt”。 +要查看 `shopt` 的其他选项,只需输入 `shopt`。 -### 使用 $CDPATH +### 使用 \$CDPATH -进入特定目录的最有用技巧之一可能是将你希望能够轻松进入的路径添加到 **$CDPATH** 中。这将创建一个只需输入完整路径名的一部分即可进入的目录列表。 +可能进入特定目录的最有用技巧之一,就是将你希望能够轻松进入的路径添加到 `$CDPATH` 中。这将创建一个目录列表,只需输入完整路径名的一部分即可进入。 -一方面,这可能有点棘手。你的 **$CDPATH** 需要包含要移动到的目录的目录,而不是目录本身。 +一方面,这可能有点棘手。你的 `$CDPATH` 需要包含要移动到的目录的父目录,而不是目录本身。 -例如,假设你希望仅通过输入 “cd html” 就可以移至 **/var/www/html** 目录,并仅使用 “cd” 和简单目录名即可移至 /var/log 中的子目录。在这种情况下,此 **$CDPATH** 将起作用: +例如,假设你希望仅通过输入 `cd html` 就可以移至 `/var/www/html` 目录,并仅使用 `cd` 和简单目录名即可移至 `/var/log` 中的子目录。在这种情况下,此 `$CDPATH` 就可以起作用: ``` $ CDPATH=.:/var/log:/var/www @@ -110,9 +110,9 @@ $ cd html /var/www/html ``` -当你输入的不是完整路径时,**$CDPATH** 就会生效。它向下查看其目录列表,以查看指定的目录是否存在于其中一个目录中。找到匹配项后,它将带你到那里。 +当你输入的不是完整路径时,`$CDPATH` 就会生效。它向下查看其目录列表,以查看指定的目录是否存在于其中一个目录中。找到匹配项后,它将带你到那里。 -保持 “.” 在 **$CDPATH** 开头意味着你可以进入本地目录,而不必在 **$CDPATH** 中定义它们。 +在 `$CDPATH` 开头保持 `.` 意味着你可以进入本地目录,而不必在 `$CDPATH` 中定义它们。 ``` $ export CDPATH=".:$CDPATH" @@ -123,7 +123,6 @@ cd -- Videos 在 Linux 文件系统键切换并不难,但是如果你使用一些方便的技巧轻松地到达各个位置,那你可以节省一些大脑细胞。 -加入 [Facebook][3] 和 [LinkedIn][4] 上的 Network World 社区,评论热门主题。 -------------------------------------------------------------------------------- @@ -132,7 +131,7 @@ via: https://www.networkworld.com/article/3533421/tricks-for-getting-around-your 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a069d4c1d32f3b475c4a9a9d987f260b14a100ef Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 May 2020 11:42:17 +0800 Subject: [PATCH 2125/3057] PUB @geekpi https://linux.cn/article-12239-1.html --- ...200326 Tricks for getting around your Linux file system.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200326 Tricks for getting around your Linux file system.md (98%) diff --git a/translated/tech/20200326 Tricks for getting around your Linux file system.md b/published/20200326 Tricks for getting around your Linux file system.md similarity index 98% rename from translated/tech/20200326 Tricks for getting around your Linux file system.md rename to published/20200326 Tricks for getting around your Linux file system.md index 474b6886dd..d9d6cf1006 100644 --- a/translated/tech/20200326 Tricks for getting around your Linux file system.md +++ b/published/20200326 Tricks for getting around your Linux file system.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12239-1.html) [#]: subject: (Tricks for getting around your Linux file system) [#]: via: (https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From e3606e39f833a1e4e0b1a06631984c8873b681e0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 00:39:22 +0800 Subject: [PATCH 2126/3057] TSL PART 2 --- ...Learn to change history with git rebase.md | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/translated/tech/20190510 Learn to change history with git rebase.md b/translated/tech/20190510 Learn to change history with git rebase.md index 03dbb641f9..3882711388 100644 --- a/translated/tech/20190510 Learn to change history with git rebase.md +++ b/translated/tech/20190510 Learn to change history with git rebase.md @@ -28,7 +28,7 @@ git commit --allow-empty -m"Initial commit" 如果你遇到麻烦,只需运行 `rm -rf /tmp/rebase-sandbox`,然后重新运行这些步骤重新开始。本指南的每一步都可以在一个新的沙箱上运行,所以没有必要重做每个任务。 -### 修正最新的提交 +### 修正最近的提交 让我们从简单的事情开始:修复你最近的提交。让我们将一个文件添加到我们的沙盒中,并犯个错误。 @@ -63,9 +63,9 @@ index 0000000..cd08755 +Hello world! ``` -### Fixing up older commits +### 修复更旧的提交 -Amending only works for the most recent commit. What happens if you need to correct an older commit? Let's start by setting up our sandbox accordingly: +`--amend` 只对最近的提交有效。如果你需要修正一个较旧的提交,会发生什么?让我们相应地从设置沙盒开始: ``` echo "Hello!" >greeting.txt @@ -77,14 +77,14 @@ git add farewell.txt git commit -m"Add farewell.txt" ``` -Looks like `greeting.txt` is missing "world". Let's write a commit normally which fixes that: +看起来 `greeting.txt ` 像是丢失了 `"world"`。让我们正常地写个提交来解决这个问题: ``` echo "Hello world!" >greeting.txt git commit -a -m"fixup greeting.txt" ``` -So now the files look correct, but our history could be better - let's use the new commit to "fixup" the last one. For this, we need to introduce a new tool: the interactive rebase. We're going to edit the last three commits this way, so we'll run `git rebase -i HEAD~3` (`-i` for interactive). This'll open your text editor with something like this: +现在文件看起来正确,但是我们的历史记录可以会更好一点 —— 让我们使用新的提交来“修复”(`fixup`)最后一个提交。为此,我们需要引入一个新工具:交互式变基。我们将以这种方式编辑最后三个提交,因此我们将运行`git rebase -i HEAD~3`(`-i` 代表交互式)。这样会打开文本编辑器,如下所示: ``` pick 8d3fc77 Add greeting.txt @@ -98,9 +98,9 @@ pick 0b9d0bb fixup greeting.txt # f, fixup = like "squash", but discard this commit's log message ``` -This is the rebase plan, and by editing this file you can instruct git on how to edit history. I've trimmed the summary to just the details relevant to this part of the rebase guide, but feel free to skim the full summary in your text editor. +这是变基计划,通过编辑此文件,你可以指导 Git 如何编辑历史记录。我已经将该摘要删节为仅与变基计划这一部分相关的细节,但是你可以在文本编辑器中浏览完整的摘要。 -When we save and close our editor, git is going to remove all of these commits from its history, then execute each line one at a time. By default, it's going to pick each commit, summoning it from the heap and adding it to the branch. If we don't edit this file at all, we'll end up right back where we started, picking every commit as-is. We're going to use one of my favorite features now: fixup. Edit the third line to change the operation from "pick" to "fixup" and move it to immediately after the commit we want to "fix up": +当我们保存并关闭编辑器时,Git 将从其历史记录中删除所有这些提交,然后一次执行每一行。默认情况下,它将选取(`pick`)每个提交,将其从堆中召唤出来并将其添加到分支中。如果我们对此文件根本没有做任何编辑,则将直接回到起点,按原样选取每个提交。现在,我们将使用我最喜欢的功能之一:修复(`fixup`)。编辑第三行,将操作从 `pick` 更改为 `fixup`,并将其立即移至我们要“修复”的提交之后: ``` pick 8d3fc77 Add greeting.txt @@ -108,9 +108,9 @@ fixup 0b9d0bb fixup greeting.txt pick 2a73a77 Add farewell.txt ``` -**Tip** : We can also abbreviate this with just "f" to speed things up next time. +**技巧**:我们也可以只用 `f` 来缩写它,以加快下次的速度。 -Save and quit your editor - git will run these commands. We can check the log to verify the result: +保存并退出编辑器,Git 将运行这些命令。我们可以检查日志以验证结果: ``` $ git log -2 --oneline @@ -118,9 +118,9 @@ fcff6ae (HEAD -> master) Add farewell.txt a479e94 Add greeting.txt ``` -### Squashing several commits into one +### 将多个提交压扁为一个 -As you work, you may find it useful to write lots of commits as you reach small milestones or fix bugs in previous commits. However, it may be useful to "squash" these commits together, to make a cleaner history before merging your work into master. For this, we'll use the "squash" operation. Let's start by writing a bunch of commits - just copy and paste this if you want to speed it up: +在工作时,当你达到较小的里程碑或修复以前的提交中的错误时,你可能会发现写很多提交很有用。但是,在将你的工作合并到 `master` 分支之前,将这些提交“压扁”(`squash`)在一起以使历史记录更清晰可能很有用。为此,我们将使用“压扁”(`squash `)操作。让我们从编写一堆提交开始,如果要加快速度,只需复制并粘贴这些: ``` git checkout -b squash @@ -131,7 +131,7 @@ for c in H e l l o , ' ' w o r l d; do done ``` -That's a lot of commits to make a file that says "Hello, world"! Let's start another interactive rebase to squash them together. Note that we checked out a branch to try this on, first. Because of that, we can quickly rebase all of the commits since we branched by using `git rebase -i master`. The result: +要做出一个写着 “Hello,world”的文件,要做很多事情!让我们开始另一个交互式变基,将它们压扁在一起。请注意,我们首先签出了一个分支来进行尝试。因此,因为我们使用 `git rebase -i master` 进行的分支,我们可以快速变基所有提交。结果: ``` pick 1e85199 Add 'H' to squash.txt @@ -154,9 +154,9 @@ pick 6b608ae Add 'd' to squash.txt # s, squash = use commit, but meld into previous commit ``` -**Tip** : your local master branch evolves independently of the remote master branch, and git stores the remote branch as `origin/master`. Combined with this trick, `git rebase -i origin/master` is often a very convenient way to rebase all of the commits which haven't been merged upstream yet! +**技巧**:你的本地 `master` 分支独立于远程 `master` 分支而发展,并且 Git 将远程分支存储为 `origin/master`。结合这种技巧,`git rebase -i origin/master` 通常是一种非常方便的方法,可以变基所有尚未合并到上游的提交! -We're going to squash all of these changes into the first commit. To do this, change every "pick" operation to "squash", except for the first line, like so: +我们将把所有这些更改压扁到第一个提交中。为此,将第一行除外的每个“选取”(`pick`)操作都更改为“压扁”(`squash `),如下所示: ``` pick 1e85199 Add 'H' to squash.txt @@ -173,7 +173,7 @@ squash a513fd1 Add 'l' to squash.txt squash 6b608ae Add 'd' to squash.txt ``` -When you save and close your editor, git will think about this for a moment, then open your editor again to revise the final commit message. You'll see something like this: +保存并关闭编辑器时,Git 会考虑片刻,然后再次打开编辑器以修改最终的提交消息。你会看到以下内容: ``` # This is a combination of 12 commits. @@ -242,11 +242,11 @@ Add 'd' to squash.txt # ``` -This defaults to a combination of all of the commit messages which were squashed, but leaving it like this is almost always not what you want. The old commit messages may be useful for reference when writing the new one, though. +默认情况下,这是所有要压扁的提交的消息的组合,但是像这样将其保留肯定不是你想要的。不过,旧的提交消息在编写新的提交消息时可能很有用,所以放在这里以供参考。 -**Tip** : the "fixup" command you learned about in the previous section can be used for this purpose, too - but it discards the messages of the squashed commits. +**提示**:你在上一节中了解的“修复”(`fixup`)命令也可以用于此目的,但它会丢弃压缩的提交消息。 -Let's delete everything and replace it with a better commit message, like this: +让我们删除所有内容,并用更好的提交消息替换它,如下所示: ``` Add squash.txt with contents "Hello, world" @@ -268,7 +268,7 @@ Add squash.txt with contents "Hello, world" # ``` -Save and quit your editor, then examine your git log - success! +保存并退出编辑器,然后检查你的 Git 日志,成功! ``` commit c785f476c7dff76f21ce2cad7c51cf2af00a44b6 (HEAD -> squash) @@ -278,7 +278,7 @@ Date: Sun Apr 28 14:21:56 2019 -0400 Add squash.txt with contents "Hello, world" ``` -Before we move on, let's pull our changes into the master branch and get rid of this scratch one. We can use `git rebase` like we use `git merge`, but it avoids making a merge commit: +在继续之前,让我们将所做的更改拉入 `master` 分支中,并摆脱掉这一草稿。我们可以像使用 `git merge` 一样使用 `git rebase`,但是它避免了创建合并提交: ``` git checkout master @@ -286,11 +286,11 @@ git rebase squash git branch -D squash ``` -We generally prefer to avoid using git merge unless we're actually merging unrelated histories. If you have two divergent branches, a git merge is useful to have a record of when they were... merged. In the course of your normal work, rebase is often more appropriate. +除非我们实际上正在合并无关的历史记录,否则我们通常希望避免使用 `git merge`。如果你有两个不同的分支,则 `git merge` 对于记录合并它们的时间非常有用。在正常工作过程中,变基通常更为合适。 -### Splitting one commit into several +### 将一个提交拆分为多个 -Sometimes the opposite problem happens - one commit is just too big. Let's look into splitting it up. This time, let's write some actual code. Start with a simple C program2 (you can still copy+paste this snippet into your shell to do this quickly): +有时会发生相反的问题:一个提交太大了。让我们来看一看拆分它们。这次,让我们写一些实际的代码。从一个简单的 C 程序 `program2 ` 开始(你仍然可以将此代码段复制并粘贴到你的 shell 中以快速执行此操作): ``` cat <main.c @@ -300,14 +300,14 @@ int main(int argc, char *argv[]) { EOF ``` -We'll commit this first. +首先提交它: ``` git add main.c git commit -m"Add C program skeleton" ``` -Next, let's extend the program a bit: +然后把这个程序扩展一些: ``` cat <main.c @@ -328,13 +328,13 @@ int main(int argc, char *argv[]) { EOF ``` -After we commit this, we'll be ready to learn how to split it up. +提交之后,我们就可以准备学习如何将其拆分: ``` git commit -a -m"Flesh out C program" ``` -The first step is to start an interactive rebase. Let's rebase both commits with `git rebase -i HEAD~2`, giving us this rebase plan: +第一步是启动交互式变基。让我们用 `git rebase -i HEAD~2` 来变基这两个提交,变基计划如下: ``` pick 237b246 Add C program skeleton @@ -347,7 +347,7 @@ pick b3f188b Flesh out C program # e, edit = use commit, but stop for amending ``` -Change the second commit's command from "pick" to "edit", then save and close your editor. Git will think about this for a second, then present you with this: +将第二个提交的命令从 `pick` 更改为 `edit`,然后保存并关闭编辑器。Git 会考虑一秒钟,然后向你建议: ``` Stopped at b3f188b... Flesh out C program @@ -360,7 +360,7 @@ Once you are satisfied with your changes, run git rebase --continue ``` -We could follow these instructions to add new changes to the commit, but instead let's do a "soft reset"3 by running `git reset HEAD^`. If you run `git status` after this, you'll see that it un-commits the latest commit and adds its changes to the working tree: +我们可以按照以下说明为提交添加新的更改,但我们可以通过运行 `git reset HEAD^` 来进行“软重置” [^3]。如果在此之后运行 `git status`,你将看到它取消提交最新的提交,并将其更改添加到工作树中: ``` Last commands done (2 commands done): @@ -379,7 +379,7 @@ Changes not staged for commit: no changes added to commit (use "git add" and/or "git commit -a") ``` -To split this up, we're going to do an interactive commit. This allows us to selectively commit only specific changes from the working tree. Run `git commit -p` to start this process, and you'll be presented with the following prompt: +为了对此进行拆分,我们将进行交互式提交。这使我们能够选择性地仅提交工作树中的特定更改。运行 `git commit -p` 开始这个过程,将出现以下提示: ``` diff --git a/main.c b/main.c @@ -404,7 +404,7 @@ index b1d9c2c..3463610 100644 Stage this hunk [y,n,q,a,d,s,e,?]? ``` -Git has presented you with just one "hunk" (i.e. a single change) to consider committing. This one is too big, though - let's use the "s" command to "split" up the hunk into smaller parts. +Git 仅向你提供了一个“大块”(即单个更改)以进行提交。不过,这太大了,让我们使用 `s` 命令将这个“大块”拆分成较小的部分。 ``` Split into 2 hunks. @@ -421,9 +421,9 @@ Split into 2 hunks. Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? ``` -**Tip** : If you're curious about the other options, press "?" to summarize them. +**提示**:如果你对其他选项感到好奇,请按 `?` 汇总显示。 -This hunk looks better - a single, self-contained change. Let's hit "y" to answer the question (and stage that "hunk"), then "q" to "quit" the interactive session and proceed with the commit. Your editor will pop up to ask you to enter a suitable commit message. +这个大块看起来更好:单一、独立的更改。让我们按 `y` 来回答问题(并暂存那个“大块”),然后按 `q` 以“退出”交互式会话并继续进行提交。会弹出编辑器,要求输入合适的提交消息。 ``` Add get_name function to C program @@ -446,14 +446,14 @@ Add get_name function to C program # ``` -Save and close your editor, then we'll make the second commit. We could do another interactive commit, but since we just want to include the rest of the changes in this commit we'll just do this: +保存并关闭编辑器,然后我们进行第二次提交。我们可以执行另一个交互式提交,但是由于我们只想在此提交中包括其余更改,因此我们将执行以下操作: ``` git commit -a -m"Prompt user for their name" git rebase --continue ``` -That last command tells git that we're done editing this commit, and to continue to the next rebase command. That's it! Run `git log` to see the fruits of your labor: +最后一条命令告诉 Git 我们已经完成了此提交的编辑,并继续执行下一个变基命令。就是这样!运行 `git log` 来查看你的劳动成果: ``` $ git log -3 --oneline From d75d7b60d39651e1ff8860a7e7067c31535a0106 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 10:24:29 +0800 Subject: [PATCH 2127/3057] TSL FIN --- ...Learn to change history with git rebase.md | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/translated/tech/20190510 Learn to change history with git rebase.md b/translated/tech/20190510 Learn to change history with git rebase.md index 3882711388..300afe1f7c 100644 --- a/translated/tech/20190510 Learn to change history with git rebase.md +++ b/translated/tech/20190510 Learn to change history with git rebase.md @@ -290,7 +290,7 @@ git branch -D squash ### 将一个提交拆分为多个 -有时会发生相反的问题:一个提交太大了。让我们来看一看拆分它们。这次,让我们写一些实际的代码。从一个简单的 C 程序 `program2 ` 开始(你仍然可以将此代码段复制并粘贴到你的 shell 中以快速执行此操作): +有时会发生相反的问题:一个提交太大了。让我们来看一看拆分它们。这次,让我们写一些实际的代码。从一个简单的 C 程序 [^2] 开始(你仍然可以将此代码段复制并粘贴到你的 shell 中以快速执行此操作): ``` cat <main.c @@ -462,9 +462,9 @@ fe19cc3 (HEAD -> master) Prompt user for their name 237b246 Add C program skeleton ``` -### Reordering commits +### 重新排序提交 -This one is pretty easy. Let's start by setting up our sandbox: +这很简单。 让我们从设置沙箱开始: ``` echo "Goodbye now!" >farewell.txt @@ -480,7 +480,7 @@ git add inquiry.txt git commit -m"Add inquiry.txt" ``` -The git log should now look like this: +Git 日志现在应如下所示: ``` f03baa5 (HEAD -> master) Add inquiry.txt @@ -488,7 +488,7 @@ a4cebf7 Add greeting.txt 90bb015 Add farewell.txt ``` -Clearly, this is all out of order. Let's do an interactive rebase of the past 3 commits to resolve this. Run `git rebase -i HEAD~3` and this rebase plan will appear: +显然,这都是乱序。让我们对过去的 3 个提交进行交互式变基来解决此问题。运行 `git rebase -i HEAD~3`,这个变基规划将出现: ``` pick 90bb015 Add farewell.txt @@ -503,7 +503,7 @@ pick f03baa5 Add inquiry.txt # These lines can be re-ordered; they are executed from top to bottom. ``` -The fix is now straightforward: just reorder these lines in the order you wish for the commits to appear. Should look something like this: +现在,解决方法很简单:只需按照你希望提交出现的顺序重新排列这些行。应该看起来像这样: ``` pick a4cebf7 Add greeting.txt @@ -511,35 +511,35 @@ pick f03baa5 Add inquiry.txt pick 90bb015 Add farewell.txt ``` -Save and close your editor and git will do the rest for you. Note that it's possible to end up with conflicts when you do this in practice - click here for help resolving conflicts. +保存并关闭你的编辑器,而 Git 将为你完成其余工作。请注意,在实践中这样做可能会导致冲突,参看下面章节以获取解决冲突的帮助。 ### git pull --rebase -If you've been writing some commits on a branch which has been updated upstream, normally `git pull` will create a merge commit. In this respect, `git pull`'s behavior by default is equivalent to: +如果你一直在上游更新的分支上编写一些提交,通常 `git pull` 将创建一个合并提交。在这方面,`git pull` 的默认行为等同于: ``` git fetch origin git merge origin/master ``` -There's another option, which is often more useful and leads to a much cleaner history: `git pull --rebase`. Unlike the merge approach, this is equivalent to the following: +还有另一种选择,它通常更有用,并且导致更清晰的历史记录:`git pull --rebase`。与合并方式不同,这基本上 [^4] 等效于以下内容: ``` git fetch origin git rebase origin/master ``` -The merge approach is simpler and easier to understand, but the rebase approach is almost always what you want to do if you understand how to use git rebase. If you like, you can set it as the default behavior like so: +合并方式更简单易懂,但是如果你了解如何使用 `git rebase`,那么变基方式几乎可以做到你想要做的任何事情。如果愿意,可以将其设置为默认行为,如下所示: ``` git config --global pull.rebase true ``` -When you do this, technically you're applying the procedure we discuss in the next section... so let's explain what it means to do that deliberately, too. +当你执行此操作时,从技术上讲,你将应用我们在下一节中讨论的过程...因此,让我们也解释一下故意执行此操作的含义。 -### Using git rebase to... rebase +### 使用 git rebase 来变基 -Ironically, the feature of git rebase that I use the least is the one it's named for: rebasing branches. Say you have the following branches: +具有讽刺意味的是,我最少使用的 Git 变基功能是它以之命名的功能:变基分支。假设你有以下分支: ``` o--o--o--o--> master @@ -547,14 +547,14 @@ o--o--o--o--> master \--o--> feature-2 ``` -It turns out feature-2 doesn't depend on any of the changes in feature-1, so you can just base it off of master. The fix is thus: +事实证明,`feature-2` 不依赖于 `feature-` 的任何更改,因此你可以将其作为基础。因此,解决方法是: ``` git checkout feature-2 git rebase master ``` -The non-interactive rebase does the default operation for all implicated commits ("pick")4, which simply rolls your history back to the last common anscestor and replays the commits from both branches. Your history now looks like this: +非交互式变基对所有牵连的提交(`pick`)[^5] 都执行默认操作,它简单地将你的历史回滚到最后一个共同的祖先,并从两个分支中重放提交。你的历史记录现在看起来像这样: ``` o--o--o--o--> master @@ -562,20 +562,23 @@ o--o--o--o--> master \--o--o--> feature-1 ``` -### Resolving conflicts +### 解决冲突 -The details on resolving merge conflicts are beyond the scope of this guide - keep your eye out for another guide for this in the future. Assuming you're familiar with resolving conflicts in general, here are the specifics that apply to rebasing. +解决合并冲突的详细信息不在本指南的范围内,将来请你注意另一篇指南。假设你熟悉通常的解决冲突的方法,那么这里是专门适用于变基的部分。 -The details on resolving merge conflicts are beyond the scope of this guide - keep your eye out for another guide for this in the future. Assuming you're familiar with resolving conflicts in general, here are the specifics that apply to rebasing. +有时,在进行变基时会遇到合并冲突,你可以像处理其他任何合并冲突一样处理该冲突。Git 将在受影响的文件中设置冲突标记,`git status` 将显示你需要解决的问题,并且你可以使用 `git add` 或 `git rm` 将文件标记为已解决。但是,在 `git rebase` 的上下文中,你应该注意两个选项。 -Sometimes you'll get a merge conflict when doing a rebase, which you can handle just like any other merge conflict. Git will set up the conflict markers in the affected files, `git status` will show you what you need to resolve, and you can mark files as resolved with `git add` or `git rm`. However, in the context of a git rebase, there are two options you should be aware of. +首先是如何完成冲突解决。解决由于 `git merge` 引起的冲突时,你将不会像使用 `git commit` 那样,适当的变基命令是 `git rebase --continue`。但是,还有一个可用的选项:`git rebase --skip`。 这将跳过你正在处理的提交,它不会包含在变基中。这在执行非交互性变基时最常见,这时 Git 不意识到它从“其他”分支中提取的提交是与“我们”分支上冲突的提交的更新版本。 -The first is how you complete the conflict resolution. Rather than `git commit` like you'll use when addressing conflicts that arise from `git merge`, the appropriate command for rebasing is `git rebase --continue`. However, there's another option available to you: `git rebase --skip`. This will skip the commit you're working on, and it won't be included in the rebase. This is most common when doing a non-interactive rebase, when git doesn't realize that a commit it's pulled from the "other" branch is an updated version of the commit that it conflicts with on "our" branch. +### 帮帮我! 我把它弄坏了! -### Help! I broke it! - -No doubt about it - rebasing can be hard sometimes. If you've made a mistake and in so doing lost commits which you needed, then `git reflog` is here to save the day. Running this command will show you every operation which changed a ref, or reference - that is, branches and tags. Each line shows you what the old reference pointed to, and you can `git cherry-pick`, `git checkout`, `git show`, or use any other operation on git commits once thought lost. +毫无疑问,变基有时会很难。如果你犯了一个错误,并因此而丢失了所需的提交,那么可以使用 `git reflog` 来节省下一天的时间。运行此命令将向你显示更改一个引用(即分支和标记)的每个操作。每行显示你旧的引用所指的内容,你可对你认为丢失的 Git 提交执行 `git cherry-pick`、`git checkout`、`git show` 或任何其他操作。 +[^1]: 我们添加了一个空的初始提交以简化本教程的其余部分,因为要对版本库的初始提交进行变基需要特殊的命令(即` git rebase --root`)。 +[^2]: 如果要编译此程序,请运行 `cc -o main main.c`,然后运行 `./main` 查看结果。 +[^3]: 实际上,这是“混合重置”。“软重置”(使用 `git reset --soft` 完成)将暂存更改,因此你无需再次 `git add` 添加它们,并且可以一次性提交所有更改。这不是我们想要的。我们希望选择性地暂存部分更改,以拆分提交。 +[^4]: 实际上,这取决于上游分支本身是否已变基或删除/压扁了某些提交。`git pull --rebase` 尝试通过在 `git rebase` 和 `git merge-base` 中使用 “fork-point” 机制来从这种情况中恢复,以避免变基非本地提交。 +[^5]: 实际上,这取决于 Git 的版本。从 2.26.0 版开始,默认的非交互行为以前与交互行为稍有不同,这种方式通常并不重要。 -------------------------------------------------------------------------------- @@ -583,7 +586,7 @@ via: https://git-rebase.io/ 作者:[git-rebase][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[wxy](https://github.com/wxy) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -592,3 +595,4 @@ via: https://git-rebase.io/ [b]: https://github.com/lujun9972 [1]: https://git-scm.com/ [2]: https://git-scm.com/docs/git-rebase + From a24b22cb80f4d3725bc03342368a44bc50abdb74 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 11:20:58 +0800 Subject: [PATCH 2128/3057] PRF @geekpi --- ...un multiple versions of Python on a Mac.md | 68 ++++++++----------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md b/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md index def57f9a21..00e1d6a039 100644 --- a/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md +++ b/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to use pyenv to run multiple versions of Python on a Mac) @@ -9,14 +9,16 @@ 如何在 Mac 上使用 pyenv 运行多个版本的 Python ====== -如果你需要运行 macOS 上没有安装的 Python 版本,请试试 pyenv。 -![Searching for code][1] + +> 如果你在 macOS 上运行的项目需要没有安装的 Python 版本,请试试 pyenv。 + +![](https://img.linux.net.cn/data/attachment/album/202005/23/112041pawp65alw6tmea6l.jpg) 即使对于有经验的开发人员,管理本地 Python 开发环境仍然是一个挑战。尽管有详细的[软件包管理策略][2],但仍需要采取另外的步骤来确保你在需要时运行所需的 Python 版本。 ### 为什么 Python 版本重要? -起初这是一个奇怪的概念,但是编程语言会像其他任何软件一样发生变化。它们有 bug,修复和更新,就像你喜欢的 [API][3] 和任何其他软件一样。同样,不同的发行版由称为[语义版本][4]的三位数标识。 +起初这是一个奇怪的概念,但是编程语言会像其他任何软件一样发生变化。它们有错误、修复和更新,就像你喜欢的 [API][3] 和任何其他软件一样。同样,不同的发行版由称为[语义化版本][4]的三位数标识。 > 😭😭😭 [pic.twitter.com/yt1Z2439W8][5] > @@ -24,8 +26,7 @@ 多年来,Python 2 是该语言的常用主要版本。在 2020 年 1 月,Python 2 [到达最后寿命][7],此后,Python 的核心维护者将仅支持 Python 3。Python 3 稳步发展,并定期发布新更新。对我来说定期获取这些更新很重要。 -最近,我尝试在依赖于 Python 3.5.9 的 macOS 上运行一个项目,但该版本尚未安装在系统上。我认为 Python 包管理器 **pip** 可以安装它,但事实并非如此: - +最近,我试图在 macOS 上运行一个依赖于 Python 3.5.9 的项目,而我的系统上并没有安装这个版本。我认为 Python 包管理器 `pip` 可以安装它,但事实并非如此: ``` $ pip install python3.5.9 @@ -34,20 +35,19 @@ Collecting python3.5.9 ERROR: No matching distribution found for python3.5.9 ``` -或者,我可以从官方 Python 网站下载该版本,但是除了现有的 Python 版本外,如何在 Mac 上运行它?每次运行指定 Python 解释器版本(例如 python3.7 或 python3.5)似乎很容易出错。一定会有更好的方法。 +或者,我也可以从官方 Python 网站下载该版本,但我如何在我的 Mac 上与现有的 Python 版本一起运行?每次运行时指定 Python 解释器版本(例如 python3.7 或 python3.5)似乎很容易出错。一定会有更好的方法。 -_(说明:我知道这对经验丰富的 Python 开发人员没有意义,但对当时的我来说是有意义的。我很乐意谈论为什么我仍然认为应该如此。)_ +(说明:我知道这对经验丰富的 Python 开发人员没有意义,但对当时的我来说是有意义的。我很乐意谈一谈为什么我仍然认为它应该这样做。) ### 安装和设置 pyenv -值得庆幸的是,**pyenv** 可以解决这一系列复杂性。首先,我需要安装 pyenv。我可以[从源码][8]自己克隆并编译它,但是我更喜欢通过 Homebrew 包管理器来管理软件包: +值得庆幸的是,`pyenv` 可以绕开这一系列复杂的问题。首先,我需要安装 `pyenv`。我可以[从源码][8]克隆并编译它,但是我更喜欢通过 Homebrew 包管理器来管理软件包: ``` -`$ brew install pyenv` +$ brew install pyenv ``` -为了通过 pyenv 使用 Python 版本,必须了解 shell 的 PATH 变量。PATH 通过命令名称确定 shell 在哪里搜索文件。你必须确保 shell 程序能够找到 pyenv 运行的 Python 版本,而不是默认安装的版本(通常称为_系统版本_)。如果不更改路径,那么结果如下: - +为了通过 `pyenv` 使用 Python 版本,必须了解 shell 的 `PATH` 变量。`PATH` 决定了 shell 通过命令的名称来搜索文件的位置。你必须确保 shell 程序能够找到通过 `pyenv` 运行的 Python 版本,而不是默认安装的版本(通常称为*系统版本*)。如果不更改路径,那么结果如下: ``` $ which python @@ -56,61 +56,56 @@ $ which python 这是 Python 的系统版本。 -要正确设置 pyenv,可以在 Bash 或 zsh 中运行以下命令: +要正确设置 `pyenv`,可以在 Bash 或 zsh 中运行以下命令: ``` -`$ PATH=$(pyenv root)/shims:$PATH` +$ PATH=$(pyenv root)/shims:$PATH ``` -现在,如果你检查 Python 的版本,你会看到它是 pyenv 管理的版本: - +现在,如果你检查 Python 的版本,你会看到它是 `pyenv` 管理的版本: ``` $ which python /Users/my_username/.pyenv/shims/python ``` -该 export 语句(PATH=)仅会对该 shell 实例进行更改,为了永久更改,你需要将它添加到 dotfile 中。由于 zsh 是 macOS 的默认 shell,因此我将重点介绍它。将相同的语法添加到 **~/.zshrc** 文件中: - +该导出语句(`PATH=`)仅会对该 shell 实例进行更改,为了使更改永久生效,你需要将它添加到点文件当中。由于 zsh 是 macOS 的默认 shell,因此我将重点介绍它。将相同的语法添加到 `~/.zshrc` 文件中: ``` -`$ echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc` +$ echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc ``` -现在,每次我们在 zsh 中运行命令时,它将使用 pyenv 版本的 Python。请注意,我在 **echo** 中使用了单引号,因此它不会评估和扩展命令。 +现在,每次我们在 zsh 中运行命令时,它将使用 `pyenv` 版本的 Python。请注意,我在 `echo` 中使用了单引号,因此它不会评估和扩展命令。 -.zshrc 文件仅管理 zsh 实例,因此请确保检查你的 shell 程序并编辑关联的 dotfile。如果需要再次检查默认 shell 程序,可以运行 **echo $SHELL**。如果是 zsh,请使用上面的命令。如果你使用 Bash,请将 **~/.zshrc** 更改为 **~/.bashrc**。如果您想了解更多信息,可以在pyenv的自述文件中深入研究[path setting] [9]。 +`.zshrc` 文件仅管理 zsh 实例,因此请确保检查你的 shell 程序并编辑关联的点文件。如果需要再次检查默认 shell 程序,可以运行 `echo $SHELL`。如果是 zsh,请使用上面的命令。如果你使用 Bash,请将 `~/.zshrc` 更改为 `~/.bashrc`。如果你想了解更多信息,可以在 `pyenv` 的 `README` 中深入研究[路径设置][9]。 ### 使用 pyenv 管理 Python 版本 -现在 pyenv 已经可用,我们可以看到它只有系统 Python 可用: +现在 `pyenv` 已经可用,我们可以看到它只有系统 Python 可用: ``` $ pyenv versions system ``` -如上所述,你绝对不想使用此版本([阅读更多有关信息][10])。现在 pyenv 已正确设置,我希望它有我经常使用的几个不同版本的 Python。 - -有一种方法可以通过运行 **pyenv install --list** 来查看 pyenv 可以访问的所有不同仓库中的所有 Python 版本。这是一个很长的列表,将来可能会有所帮助。目前,我决定在 [Python 下载页面][11]找到的每个最新的“点版本”(3.5.x 或 3.6.x,其中 x 是最新的)。因此,我将安装 3.5.9 和 3.8.0: +如上所述,你绝对不想使用此版本([阅读更多有关信息][10])。现在 `pyenv` 已正确设置,我希望它能有我经常使用的几个不同版本的 Python。 +有一种方法可以通过运行 `pyenv install --list` 来查看 pyenv 可以访问的所有仓库中的所有 Python 版本。这是一个很长的列表,将来回顾的时候可能会有所帮助。目前,我决定在 [Python 下载页面][11]找到的每个最新的“点版本”(3.5.x 或 3.6.x,其中 x 是最新的)。因此,我将安装 3.5.9 和 3.8.0: ``` $ pyenv install 3.5.9 $ pyenv install 3.8.0 ``` -这将需要一段时间,因此休息一会(或阅读上面的链接之一)。有趣的是,输出遍历了该版本的 Python 的下载和构建。例如,输出显示文件直接来自 [Python.org][12]。 +这将需要一段时间,因此休息一会(或阅读上面的链接之一)。有趣的是,输出中显示了该版本的 Python 的下载和构建。例如,输出显示文件直接来自 [Python.org][12]。 安装完成后,你可以设置默认值。我喜欢最新的,因此将全局默认 Python 版本设置为最新版本: - ``` -`$ pyenv global 3.8.0` +$ pyenv global 3.8.0 ``` -该版本立即在我的 shell 中设置完成。要确认: - +该版本立即在我的 shell 中设置完成。确认一下: ``` $ python -V @@ -119,15 +114,13 @@ Python 3.8.0 我要运行的项目仅适于 Python 3.5,因此我将在本地设置该版本并确认: - ``` $ pyenv local 3.5.9 $ python -V Python 3.5.9 ``` -因为我在 pyenv 中使用了 **local** 选项,所以它向当前目录添加了一个文件来跟踪该信息。 - +因为我在 `pyenv` 中使用了 `local` 选项,所以它向当前目录添加了一个文件来跟踪该信息。 ``` $ cat .python-version @@ -136,7 +129,6 @@ $ cat .python-version 现在,我终于可以为想要的项目设置虚拟环境,并确保运行正确版本的 Python。 - ``` $ python -m venv venv $ source ./venv/bin/activate @@ -148,9 +140,9 @@ $ source ./venv/bin/activate ### 总结 -默认情况下,运行多个 Python 版本可能是一个挑战。我发现 pyenv 可以确保在我需要时可以有我需要的 Python 版本。 +默认情况下,运行多个 Python 版本可能是一个挑战。我发现 `pyenv` 可以确保在我需要时可以有我需要的 Python 版本。 -你还有其他初学者或中级 Python 问题吗? 请发表评论,我们将在以后的文章中考虑它们。 +你还有其他初学者或中级 Python 问题吗? 请发表评论,我们将在以后的文章中考虑介绍它们。 -------------------------------------------------------------------------------- @@ -159,7 +151,7 @@ via: https://opensource.com/article/20/4/pyenv 作者:[Matthew Broberg][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/) 荣誉推出 @@ -177,4 +169,4 @@ via: https://opensource.com/article/20/4/pyenv [10]: https://opensource.com/article/19/5/python-3-default-mac [11]: https://www.python.org/downloads/ [12]: http://python.org -[13]: https://opensource.com/article/19/6/python-virtual-environments-mac +[13]: https://linux.cn/article-11086-1.html From 8d72aeeee5b5d0603acd46a586fb49356acd5afc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 11:21:39 +0800 Subject: [PATCH 2129/3057] PUB @geekpi https://linux.cn/article-12241-1.html --- ...o use pyenv to run multiple versions of Python on a Mac.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200407 How to use pyenv to run multiple versions of Python on a Mac.md (99%) diff --git a/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md b/published/20200407 How to use pyenv to run multiple versions of Python on a Mac.md similarity index 99% rename from translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md rename to published/20200407 How to use pyenv to run multiple versions of Python on a Mac.md index 00e1d6a039..3bcf991e02 100644 --- a/translated/tech/20200407 How to use pyenv to run multiple versions of Python on a Mac.md +++ b/published/20200407 How to use pyenv to run multiple versions of Python on a Mac.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12241-1.html) [#]: subject: (How to use pyenv to run multiple versions of Python on a Mac) [#]: via: (https://opensource.com/article/20/4/pyenv) [#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) From 0649b38785676e7d93a9f1852737ba4efd28eebe Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 13:06:35 +0800 Subject: [PATCH 2130/3057] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qfzy1223 翻译后应该自己审阅一下。 --- ...ew- Lightweight, Minimalistic, Polished.md | 92 +++++++++---------- 1 file changed, 44 insertions(+), 48 deletions(-) diff --git a/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md index a303a3853f..2a85242dd2 100644 --- a/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md +++ b/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md @@ -1,127 +1,123 @@ [#]: collector: (lujun9972) [#]: translator: (qfzy1233) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Lubuntu 20.04 Review: Lightweight, Minimalistic, Polished) [#]: via: (https://itsfoss.com/lubuntu-20-04-review/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) -Lubuntu 20.04 简述: 轻量, 简约, 文雅 +Lubuntu 20.04 点评:轻量、简约、文雅 ====== -_**Lubuntu20.04 LTS 与之前的 LTS 版本有很大的不同。它的旨在给你一个更完善的体验,而不仅仅是关注旧的电脑。阅读更多关于Lubuntu20.04的内容。**_ +> Lubuntu 20.04 LTS 与之前的 LTS 版本有很大的不同。它旨在给你一个更完善的体验,而不仅仅是关注旧电脑。请阅读更多关于 Lubuntu 20.04 的内容。 -### Lubuntu 20.04 一览: 第一个基于 LXQt 的长期支持版 +### Lubuntu 20.04 点评:第一个基于 LXQt 的长期支持版 -我在 Lubuntu20.04 发行前几天就已经开始使用它了。我通常使用 Arch 阵营中 Manjaro 和 Cinnamon desktop,所以使用 Lubuntu 对我来说是一个愉快的改变。 +我在 Lubuntu 20.04 发行前几天就已经开始使用它了。我通常使用 Arch 阵营中 Manjaro 和 Cinnamon 桌面,所以使用 Lubuntu 对我来说是一个愉快的改变。 以下是我在使用 Lubuntu 20.04.时的一些感受和注记。 -#### 再见LXDE,你好LXQt! +#### 再见 LXDE,你好 LXQt! -很长一段时间以来,[Lubuntu][1]都依赖于[LXDE][2]来提供轻量级的Linux体验。现在它使用LXQt桌面环境。 +长期以来,[Lubuntu][1] 都依靠 [LXDE][2] 来提供轻量级的 Linux 体验。但现在,它使用的是 LXQt 桌面环境。 -[LXDE][3]是基于 GTK (GNOME使用的库),更具体地说是基于2020年的 GTK+ 2。LXDE 开发人员 Hong Jen Yee 不满意 GTK+ 3,决定将整个桌面移植到Qt (KDE使用的库)。LXDE、it的Qt端口和[Razor-qt][4]项目合并形成[LXQt][5]。所以现在,LXDE和LXQt作为单独的项目共存。 +[LXDE][3] 是基于 GTK(GNOME 所使用的库),更具体地说是基于 2020 年的 GTK+ 2。由于对 GTK+ 3 不满意,LXDE 开发人员 Hong Jen Yee 决定将整个桌面移植到 Qt(KDE 所使用的库)。LXDE 的 Qt 移植版本和 [Razor-qt][4] 项目合并形成 [LXQt][5]。所以现在,LXDE 和 LXQt 作为单独的项目而共存。 -由于 LXDE 开发者本身关注于 LXQt ,所以 Lubuntu 死磕桌面环境是没有意义的,因为上一次稳定发行版已经是三年多以前的事情了。 +既然 LXDE 开发者本身专注于 LXQt,那么 Lubuntu 坚持使用三年多前上一次稳定发布版的桌面环境 LXDE 是没有意义的。 -Lubuntu 18.04是[LXDE][3]的最后一个版本。幸运的是,这是一个长期支持版本。Lubuntu团队将提供支持直到2021年。 +因此,Lubuntu 18.04 是使用 [LXDE][3] 的最后一个版本。幸运的是,这是一个长期支持版本。Lubuntu 团队将提供支持直到 2021 年。 ![][6] #### 不仅适于老机器 -由于“老机器”的定义在2020年发生了变化,Lubuntu 18.04是最后一个32位版本。现在,即使是一台10年前的老机器也至少有2g的内存和一个双核64位处理器。 +随着在 2020 年“老机器”的定义发生了变化,Lubuntu 18.04 成为了最后一个 32 位版本。现在,即使是一台 10 年前的老机器也至少有 2G 的内存和一个双核 64 位处理器。 -因此,Lubuntu 团队将不再提供最低的系统需求,也不再主要关注旧的硬件。尽管 LXQt 仍然是一个轻量级的、经典的、完善的、功能丰富的桌面环境。 +因此,Lubuntu 团队将不再设置最低的系统需求,也不再主要关注旧硬件。尽管 LXQt 仍然是一个轻量级的、经典而不失精致的、功能丰富的桌面环境。 -Lubuntu 的第一个 LXQt 发行版是18.10,在Lubuntu20.04 LTS 发行版之前,开发人员经历了三个标准发行版来完善 LXQt 桌面,这是一个很好的开发策略。 +在 Lubuntu 20.04 LTS 发布之前,Lubuntu 的第一个 LXQt 发行版是 18.10,开发人员经历了三个标准发行版来完善 LXQt 桌面,这是一个很好的开发策略。 -#### 与以往不同的是 Lubuntu 20.04 使用 Calamares 安装器 +#### 不用常规的 Ubiquity,Lubuntu 20.04 使用的是 Calamares 安装程序 -![Lubuntu 20.04 Calamares 安装器][8] +![Lubuntu 20.04 Calamares 安装程序][8] -在新版本中全新的[Calamares][9]安装器,取代了其他[Ubuntu官方版本][10]使用的普遍安装程序。 +在新版本中使用了全新的 [Calamares][9] 安装程序,取代了其它 [Ubuntu 官方版本][10]使用的 Ubiquity 安装程序。 -整个安装过程在大约10分钟内完成,比之前Lubuntu的版本稍微快一些。 +整个安装过程在大约能在 10 分钟内完成,比之前 Lubuntu 的版本稍微快一些。 -由于镜像文件附带了预先安装的基本应用程序,你也可以很快地完全配置您的系统。 +由于镜像文件附带了预先安装的基本应用程序,所以你可以很快就可以完成系统的完全配置。 #### 不要直接从 Lubuntu 18.04 升级到 Lubuntu 20.04 -通常,你可以[将Ubuntu从一个LTS版本升级到另一个LTS版本][11]。但是 Lubuntu 团队建议不要从 Lubuntu18.04升级到20.04。他们建议重新安装,这才是正确的。 +通常,你可以[将 Ubuntu 从一个 LTS 版本升级到另一个 LTS 版本][11]。但是 Lubuntu 团队建议不要从 Lubuntu 18.04 升级到 20.04。他们建议重新安装,这才是正确的。 -Lubuntu 18.04使用LXDE桌面,20.04使用LXQt。由于桌面环境的巨大变化,从18.04升级到20.04将导致系统崩溃。 +Lubuntu 18.04 使用 LXDE 桌面,20.04 使用 LXQt。由于桌面环境的巨大变化,从 18.04 升级到 20.04 将导致系统崩溃。 -#### **更多的KDE和Qt应用程序** +#### 更多的 KDE 和 Qt 应用程序 ![][12] -下面是在这个新版本中默认可用的一些应用程序,正如我们所看到的,并非所有应用程序都是轻量级的,而且大多数应用程序都是基于qt的。 +下面是在这个新版本中默认提供的一些应用程序,正如我们所看到的,并非所有应用程序都是轻量级的,而且大多数应用程序都是基于 Qt 的。 甚至使用的软件中心也是 KDE 的 Discover,而不是 Ubuntu 的 GNOME 软件中心。 - * Ark – 压缩文件管理器 + * Ark – 归档文件管理器 * Bluedevil – 蓝牙连接管理 - * Discover Software Center – 包管理系统 + * Discover 软件中心 – 包管理系统 * FeatherPad – 文本编辑器 * FireFox – 浏览器 * K3b – CD/DVD 刻录器 * Kcalc – 计算器 - * KDE partition manager – 分区管理工具 - * LibreOffice – 办公套件 (Qt 接口版本) - * LXimage-Qt – 图片查看及截图制作 + * KDE 分区管理器 – 分区管理工具 + * LibreOffice – 办公套件(Qt 界面版本) + * LXimage-Qt – 图片查看器及截图制作 * Muon – 包管理器 - - * Noblenote – 笔记工具 * PCManFM-Qt – 文件管理器 * Qlipper – 剪贴板管理工具 * qPDFview – PDF 阅读器 * PulseAudio – 音频控制器 - * Qtransmission – BT下载工具 (Qt 接口版本) - * Quassel – 实时聊天客户端 + * Qtransmission – BT 下载工具(Qt 界面版本) + * Quassel – IRC 客户端 * ScreenGrab – 截屏制作工具 * Skanlite – 扫描工具 - * Startup Disk Creator – USB 启动盘制作工具 + * 启动盘创建工具 – USB 启动盘制作工具 * Trojita – 邮件客户端 * VLC – 媒体播放器 - * [MPV video player][13] - - + * [MPV 视频播放器][13] #### 测试 Lubuntu 20.04 LTS -LXQt 版Lubuntu的启动时间不到一分钟,不过是从SSD启动的。 +LXQt 版 Lubuntu 的启动时间不到一分钟,虽然是从 SSD 启动的。 -LXQt 目前需要的内存比基于 Gtk+ v2 的LXDE稍微多一点,但是另一种 Gtk+ v3 工具包也需要更多的内存。 +LXQt 目前需要的内存比基于 Gtk+ 2 的 LXDE 稍微多一点,但是另一种 Gtk+ 3 工具包也需要更多的内存。 -在重新启动之后,系统以非常低的内存占用情况运行,大约只有340 MB(按照现代标准),比LXDE多100 MB。 +在重新启动之后,系统以非常低的内存占用情况运行,大约只有 340 MB(按照现代标准),比 LXDE 多 100 MB。 ![htop 在 Lubuntu 20.04 上运行][14] -LXQt 不仅适用于使用旧硬件的用户,也适用于那些希望在新机器上获得简单而经典体验的用户。 +LXQt 不仅适用于硬件较旧的用户,也适用于那些希望在新机器上获得简约经典体验的用户。 -桌面布局看起来类似于 KDE 的 Plasma 桌面,你不这样认为吗? +桌面布局看起来类似于 KDE 的 Plasma 桌面,你觉得呢? ![Lubuntu 20.04 桌面环境][15] -在左下角有一个应用程序菜单,一个用于固定和活动应用程序的任务栏,右下角有一个系统托盘。 +在左下角有一个应用程序菜单,一个用于显示固定和活动的应用程序的任务栏,右下角有一个系统托盘。 -Lubuntu 的 LXQt 版本可以很容易的定制,所有的东西都在菜单的首选项下,大部分的关键项目都在 LXQt 设置下。 +Lubuntu 的 LXQt 版本可以很容易的定制,所有的东西都在菜单的首选项下,大部分的关键项目都在 LXQt “设置”中。 -值得一提的是, LXQt 在默认情况下使用流行的[ Openbox 窗口管理器][16]。 +值得一提的是,LXQt 在默认情况下使用流行的 [Openbox 窗口管理器][16]。 -与前三个发行版一样,20.04 LTS 附带了一个默认的黑暗主题 Lubuntu ,但是如果不适合你的口味,可以快速、轻松地更改它。 +与前三个发行版一样,20.04 LTS 附带了一个默认的黑暗主题 Lubuntu Arc,但是如果不适合你的口味,可以快速更换,也很方便。 -就日常使用而言,Lubuntu20.04 已经向我证明了它是完全没有问题的,因为它是 Ubuntu 的一个版本。 +就日常使用而言,事实证明,Lubuntu 20.04 向我证明,其实每一个 Ubuntu 的分支版本都完全没有问题。 #### 结论 -Lubuntu团队已经成功地过渡到一个现代的、依然轻量级的、最小的桌面环境。LXDE看起来被遗弃了,迁移到一个活跃的项目也是一件好事。 +Lubuntu 团队已经成功地过渡到一个现代的、依然轻量级的、极简的桌面环境。LXDE 看起来被遗弃了,迁移到一个活跃的项目也是一件好事。 -我希望Lubuntu 20.04能够像我一样让你充满热情,如果是这样,请在下面的评论中告诉我。请继续关注! +我希望 Lubuntu 20.04 能够让你和我一样热爱,如果是这样,请在下面的评论中告诉我。请继续关注! -------------------------------------------------------------------------------- @@ -130,7 +126,7 @@ via: https://itsfoss.com/lubuntu-20-04-review/ 作者:[Dimitrios Savvopoulos][a] 选题:[lujun9972][b] 译者:[qfzy1233](https://github.com/qfzy1233) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8fcc773133dc9ae5679f8209431789b1800e5586 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 13:37:54 +0800 Subject: [PATCH 2131/3057] PUB @qfzy1223 https://linux.cn/article-12242-1.html --- ...ntu 20.04 Review- Lightweight, Minimalistic, Polished.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md index 2a85242dd2..3b04dc37b8 100644 --- a/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md +++ b/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qfzy1233) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12242-1.html) [#]: subject: (Lubuntu 20.04 Review: Lightweight, Minimalistic, Polished) [#]: via: (https://itsfoss.com/lubuntu-20-04-review/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) @@ -18,7 +18,7 @@ Lubuntu 20.04 点评:轻量、简约、文雅 以下是我在使用 Lubuntu 20.04.时的一些感受和注记。 -#### 再见 LXDE,你好 LXQt! +#### 再见 LXDE,你好 LXQt! 长期以来,[Lubuntu][1] 都依靠 [LXDE][2] 来提供轻量级的 Linux 体验。但现在,它使用的是 LXQt 桌面环境。 From 140327cab51c528e00a3f01cc20bfbb964092d34 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 13:39:03 +0800 Subject: [PATCH 2132/3057] PUB @qfzy1223 https://linux.cn/article-12242-1.html --- ...8 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md (100%) diff --git a/translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/published/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md similarity index 100% rename from translated/tech/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md rename to published/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md From b876ff2b4eadcaa74f1247e0aa016eb40ea05f94 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Sat, 23 May 2020 19:11:29 +0800 Subject: [PATCH 2133/3057] APL --- .../tech/20200222 How to install TT-RSS on a Raspberry Pi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md b/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md index ec5a177314..beaff7bebd 100644 --- a/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md +++ b/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f3a1f2c476122a72a5897c8a954de022fb059d4e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 20:15:13 +0800 Subject: [PATCH 2134/3057] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lxbwolf subtree 这个词我遵照 GitHub 采用的译法,译做了 “子树”。 --- ...t projects with submodules and subtrees.md | 127 ++++++++---------- 1 file changed, 57 insertions(+), 70 deletions(-) diff --git a/translated/tech/20200506 Managing Git projects with submodules and subtrees.md b/translated/tech/20200506 Managing Git projects with submodules and subtrees.md index a67f328d0c..90a8bd29c8 100644 --- a/translated/tech/20200506 Managing Git projects with submodules and subtrees.md +++ b/translated/tech/20200506 Managing Git projects with submodules and subtrees.md @@ -1,84 +1,80 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Managing Git projects with submodules and subtrees) [#]: via: (https://opensource.com/article/20/5/git-submodules-subtrees) [#]: author: (Manaswini Das https://opensource.com/users/manaswinidas) -使用子模块和子仓库管理 Git 项目 +使用子模块和子树来管理 Git 项目 ====== -使用子模块和子仓库来帮助你管理多个仓库中共有的子项目。 -![Digital creative of a browser on the internet][1] -如果你参与了开源项目的开发,那么你可能会用 Git 来管理你的源码。你可能遇到过有很多依赖和/或子项目的项目。你怎么管理它们? +> 使用子模块和子树来帮助你管理多个存储库中共有的子项目。 -对于一个开源组织,社区*和*产品想要实现单一来源文档和依赖管理比较棘手。文档和项目往往会碎片化和变得冗余,这致使它们很难维护。 +![](https://img.linux.net.cn/data/attachment/album/202005/23/201323myyhob22eg2y2jqt.jpg) + +如果你参与了开源项目的开发,那么你很可能已经用了 Git 来管理你的源码。你可能遇到过有很多依赖和/或子项目的项目。你是如何管理它们的? + +对于一个开源组织,要实现社区**和**产品的单一来源文档和依赖管理比较棘手。文档和项目往往会碎片化和变得冗余,这致使它们很难维护。 ### 必要性 -假设你想要在一个仓库中把一个项目作为子项目来用。传统的方法是把该项目复制到父仓库中。但是,如果你想要在多个父项目中用同一个子项目呢?(如果)把子项目复制到所有父项目中,当有更新时,你不得不在每个父项目中都做修改,这是不太可行的。(因为)这会导致父项目中的冗余和数据不一致,也会使更新和维护子项目变得很困难。 +假设你想把单个项目作为一个存储库内的子项目,传统的方法是把该项目复制到父存储库中,但是,如果你想要在多个父项目中使用同一个子项目呢?如果把子项目复制到所有父项目中,当有更新时,你都要在每个父项目中做修改,这是不太可行的。这会导致父项目中的冗余和数据不一致,使更新和维护子项目变得很困难。 -### Git 子模块和子仓库 +### Git 子模块和子树 -如果你可以用一条命令把一个项目放进另一个项目中,会怎样呢?如果你随时可以把一个项目作为子项目添加到任意数目的项目中,并可以同步更新修改呢?Git 提供了这类问题的解决方案:Git 子模块和 Git 子仓库。创建这些工具的目的是以更加模块化的水平来支持共用代码的开发工作流,(创建者)意在消除 Git 仓库源码管理source-code management与它下面的子仓库间的障碍。 +如果你可以用一条命令把一个项目放进另一个项目中,会怎样呢?如果你随时可以把一个项目作为子项目添加到任意数目的项目中,并可以同步更新修改呢?Git 提供了这类问题的解决方案:Git 子模块submodule和 Git 子树subtree。创建这些工具的目的是以更加模块化的水平来支持共用代码的开发工作流,旨在 Git 存储库源码管理source-code management(SCM)与它下面的子树之间架起一座桥梁。 ![Cherry tree growing on a mulberry tree][2] -生长在桑树上的樱桃树 +*生长在桑树上的樱桃树* -下面是本文要详细介绍的概念的一个真实应用场景。如果你已经很熟悉 tree,这个模型看起来是下面这样: +下面是本文要详细介绍的概念的一个真实应用场景。如果你已经很熟悉树形结构,这个模型看起来是下面这样: ![Tree with subtrees][3] -CC BY-SA opensource.com - ### Git 子模块是什么? -Git 在它默认的包中提供了子模块,子模块可以把 Git 仓库嵌入到其他仓库中。确切地说,Git 子模块是指向子仓库中的某次提交。下面是我 [Docs-test][4] GitHub 仓库中的 Git 子模块: +Git 在它默认的包中提供了子模块,子模块可以把 Git 存储库嵌入到其他存储库中。确切地说,Git 子模块指向子树中的某次提交。下面是我 [Docs-test][4] GitHub 存储库中的 Git 子模块的样子: ![Git submodules screenshot][5] -**[文件夹@提交 Id][6]** 格式表明这个仓库是一个子模块,你可以直接点击文件夹进入该子仓库。名为 **.gitmodules** 的配置文件包含所有子模块仓库的详细信息。我的仓库的 **.gitmodules** 文件如下: +[文件夹@提交 Id][6] 格式表明这个存储库是一个子模块,你可以直接点击文件夹进入该子树。名为 `.gitmodules` 的配置文件包含所有子模块存储库的详细信息。我的存储库的 `.gitmodules` 文件如下: ![Screenshot of .gitmodules file][7] -你可以用下面的命令在你的仓库中使用 Git 子模块: +你可以用下面的命令在你的存储库中使用 Git 子模块: -#### 克隆一个仓库并加载子模块 - -克隆一个含有子模块的仓库: +#### 克隆一个存储库并加载子模块 +克隆一个含有子模块的存储库: ``` -`$ git clone --recursive ` +$ git clone --recursive ``` -如果你之前已经克隆了仓库,现在想加载它的子模块: - +如果你之前已经克隆了存储库,现在想加载它的子模块: ``` -`$ git submodule update --init` +$ git submodule update --init ``` 如果有嵌套的子模块: - ``` -`$ git submodule update --init --recursive` +$ git submodule update --init --recursive ``` #### 下载子模块 -串行地连续下载多个子模块是很枯燥的工作,所以 **clone** 和 **submodule update** 会支持 **\--jobs** 或 **-j** 参数: +串行地连续下载多个子模块是很枯燥的工作,所以 `clone` 和 `submodule update` 会支持 `--jobs` (或 `-j`)参数: 例如,想一次下载 8 个子模块,使用: - ``` $ git submodule update --init --recursive -j 8 -$ git clone --recursive --jobs 8 <URL to Git repo> +$ git clone --recursive --jobs 8 ``` #### 拉取子模块 @@ -87,103 +83,94 @@ $ git clone --recursive --jobs 8 <URL to Git repo> 拉取子模块的所有修改: - ``` -`$ git submodule update --remote` +$ git submodule update --remote ``` -#### 使用 submodule 创建仓库: - -向一个父仓库添加子仓库: +#### 使用子模块创建存储库: +向一个父存储库添加子树: ``` -`$ git submodule add ` +$ git submodule add ``` 初始化一个已存在的 Git 子模块: - ``` -`$ git submodule init` +$ git submodule init ``` -你也可以通过为 **submodule update** 命令添加 **\--update** 参数在子模块中创建分支和追踪提交: - +你也可以通过为 `submodule update` 命令添加 `--update` 参数在子模块中创建分支和追踪提交: ``` -`$ git submodule update --remote` +$ git submodule update --remote ``` -#### 更新子模块提交 - -上面提到过,一个子模块就是一个指向子仓库中某次提交的链接。如果你想更新子模块的提交,不要担心。你不需要显式地指定最新的提交。你只需要使用通用的 **submodule update** 命令: +#### 更新子模块的提交 +上面提到过,一个子模块就是一个指向子树中某次提交的链接。如果你想更新子模块的提交,不要担心。你不需要显式地指定最新的提交。你只需要使用通用的 `submodule update` 命令: ``` -`$ git submodule update` +$ git submodule update ``` -就像你平时创建父仓库和把父仓库推送到 GitHub 那样添加和提交就可以了。 +就像你平时创建父存储库和把父存储库推送到 GitHub 那样添加和提交就可以了。 -#### 从一个父仓库中删除一个子模块 - -仅仅手动删除一个子项目文件夹不会从父项目中移除这个子项目。想要删除名为 **childmodule** 的子模块,使用: +#### 从一个父存储库中删除一个子模块 +仅仅手动删除一个子项目文件夹不会从父项目中移除这个子项目。想要删除名为 `childmodule` 的子模块,使用: ``` -`$ git rm -f childmodule` +$ git rm -f childmodule ``` 虽然 Git 子模块看起来很容易上手,但是对于初学者来说,有一定的使用门槛。 -### Git 子仓库是什么? +### Git 子树是什么? -Git 子仓库,是在 Git 1.7.11 引入的,让你可以把任何仓库的副本作为子目录嵌入另一个仓库中。它是 Git 项目可以注入和管理项目依赖的几种方法之一。它在常规的提交中保存了外部依赖信息。Git 子仓库提供了整洁的集成点,因此很容易复原它们。 +Git 子树 subtree,是在 Git 1.7.11 引入的,让你可以把任何存储库的副本作为子目录嵌入另一个存储库中。它是 Git 项目可以注入和管理项目依赖的几种方法之一。它在常规的提交中保存了外部依赖信息。Git 子树提供了整洁的集成点,因此很容易复原它们。 -如果你参考 [GitHub 提供的子仓库教程][8] 来使用子仓库,那么无论你什么时候添加子仓库,在本地都不会看到 **.gittrees** 配置文件。这让我们很难分辨哪个是子仓库,因为它们看起来很像普通的文件夹,但是它们却是子仓库的副本。默认的 Git 包中不提供带 **.gittrees** 配置文件的 Git 子仓库版本,因此如果你想要带 **.gittrees** 配置文件的 git-subtree,必须从 Git 源码仓库的 [**/contrib/subtree** 文件夹][9] 下载 git-subtree。 +如果你参考 [GitHub 提供的子树教程][8]来使用子树,那么无论你什么时候添加子树,在本地都不会看到 `.gittrees` 配置文件。这让我们很难分辨哪个是子树,因为它们看起来很像普通的文件夹,但是它们却是子树的副本。默认的 Git 包中不提供带 `.gittrees` 配置文件的 Git 子树版本,因此如果你想要带 `.gittrees` 配置文件的 git-subtree 命令,必须从 Git 源码存储库的 [/contrib/subtree 文件夹][9] 下载 git-subtree。 -你可以像克隆其他常规的仓库那样克隆任何含有子仓库的仓库,但由于在父仓库中有整个子仓库的副本,因此克隆过程可能会持续很长时间。 +你可以像克隆其他常规的存储库那样克隆任何含有子树的存储库,但由于在父存储库中有整个子树的副本,因此克隆过程可能会持续很长时间。 -你可以用下面的命令在你的仓库中使用 Git 子仓库。 +你可以用下面的命令在你的存储库中使用 Git 子树。 -#### 向父仓库中添加一个子仓库 - -想要向父仓库中添加一个子仓库,首先你需要执行 **remote add**,之后执行 **subtree add** 命令: +#### 向父存储库中添加一个子树 +想要向父存储库中添加一个子树,首先你需要执行 `remote add`,之后执行 `subtree add` 命令: ``` -$ git remote add remote-name <URL to Git repo> -$ git subtree add --prefix=folder/ remote-name <URL to Git repo> subtree-branchname +$ git remote add remote-name +$ git subtree add --prefix=folder/ remote-name subtree-branchname ``` -上面的命令会把整个子项目的提交历史合并到父仓库。 - -#### 向子仓库推送修改以及从子仓库拉取修改 +上面的命令会把整个子项目的提交历史合并到父存储库。 +#### 向子树推送修改以及从子树拉取修改 ``` -`$ git subtree push-all` +$ git subtree push-all ``` 或者 - ``` -`$ git subtree pull-all` +$ git subtree pull-all ``` ### 你应该使用哪个? 任何工具都有优缺点。下面是一些可能会帮助你决定哪种最适合你的特性: - * Git 子模块的仓库占用空间更小,因为它们只是指向子项目的某次提交的链接,而 Git 子仓库保存了整个子项目及其提交历史。 - * Git 子模块需要在服务器中可访问,但子仓库是去中心化的。 - * Git 子模块大量用于基于组件的开发,而 Git 子仓库多用于基于系统的开发。 + * Git 子模块的存储库占用空间更小,因为它们只是指向子项目的某次提交的链接,而 Git 子树保存了整个子项目及其提交历史。 + * Git 子模块需要在服务器中可访问,但子树是去中心化的。 + * Git 子模块大量用于基于组件的开发,而 Git 子树多用于基于系统的开发。 -Git 子仓库并不是 Git 子模块的直接可替代项。有明确的说明来指导我们该使用哪种。如果有一个归属于你的外部仓库,使用场景是向它回推代码,那么就使用 Git 子模块,因为推送代码更容易。如果你有第三方代码,且不会向它推送代码,那么使用 Git 子仓库,因为拉取代码更容易。 +Git 子树并不是 Git 子模块的直接可替代项。有明确的说明来指导我们该使用哪种。如果有一个归属于你的外部存储库,使用场景是向它回推代码,那么就使用 Git 子模块,因为推送代码更容易。如果你有第三方代码,且不会向它推送代码,那么使用 Git 子树,因为拉取代码更容易。 -自己尝试使用 Git 子仓库和子模块,然后在评论中留下你的使用感想。 +自己尝试使用 Git 子树和子模块,然后在评论中留下你的使用感想。 -------------------------------------------------------------------------------- @@ -192,7 +179,7 @@ via: https://opensource.com/article/20/5/git-submodules-subtrees 作者:[Manaswini Das][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9945ab96d6fe13a65d52f686e6fd45e8f7a28168 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 May 2020 20:15:44 +0800 Subject: [PATCH 2135/3057] PUB @lxbwolf https://linux.cn/article-12244-1.html --- ...0506 Managing Git projects with submodules and subtrees.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200506 Managing Git projects with submodules and subtrees.md (99%) diff --git a/translated/tech/20200506 Managing Git projects with submodules and subtrees.md b/published/20200506 Managing Git projects with submodules and subtrees.md similarity index 99% rename from translated/tech/20200506 Managing Git projects with submodules and subtrees.md rename to published/20200506 Managing Git projects with submodules and subtrees.md index 90a8bd29c8..d52aef42a6 100644 --- a/translated/tech/20200506 Managing Git projects with submodules and subtrees.md +++ b/published/20200506 Managing Git projects with submodules and subtrees.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12244-1.html) [#]: subject: (Managing Git projects with submodules and subtrees) [#]: via: (https://opensource.com/article/20/5/git-submodules-subtrees) [#]: author: (Manaswini Das https://opensource.com/users/manaswinidas) From 52553ba6a3098e2bbf7d766f39fa6198adf32aea Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Sun, 24 May 2020 01:07:04 +0800 Subject: [PATCH 2136/3057] TSL --- ...How to install TT-RSS on a Raspberry Pi.md | 245 ------------------ ...How to install TT-RSS on a Raspberry Pi.md | 244 +++++++++++++++++ 2 files changed, 244 insertions(+), 245 deletions(-) delete mode 100644 sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md create mode 100644 translated/tech/20200222 How to install TT-RSS on a Raspberry Pi.md diff --git a/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md b/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md deleted file mode 100644 index beaff7bebd..0000000000 --- a/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md +++ /dev/null @@ -1,245 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install TT-RSS on a Raspberry Pi) -[#]: via: (https://opensource.com/article/20/2/ttrss-raspberry-pi) -[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) - -How to install TT-RSS on a Raspberry Pi -====== -Read your news feeds while keeping your privacy intact with Tiny Tiny -RSS. -![Raspberries with pi symbol overlay][1] - -[Tiny Tiny RSS][2] (TT-RSS) is a free and open source web-based news feed (RSS/Atom) reader and aggregator. It's ideally suited to those who are privacy-focused and still rely on RSS for their daily news. Tiny Tiny RSS is self-hosted software, so you have 100% control of the server, your data, and your overall privacy. It also supports a wide range of plugins, add-ons, and themes, Want a dark mode interface? No problem. Want to filter your incoming news based on keywords? TT-RSS has you covered there, as well. - -![Tiny Tiny RSS screenshot][3] - -Now that you know what TT-RSS is and why you may want to use it, I'll explain everything you need to know about installing it on a Raspberry Pi or a Debian 10 server. - -### Install and configure TT-RSS - -To install TT-RSS on a Raspberry Pi, you must also install and configure the latest version of PHP (7.3 as of this writing), PostgreSQL for the database backend, the Nginx web server, Git, and finally, TT-RSS. - -#### 1\. Install PHP 7 - -Installing PHP 7 is, by far, the most involved part of this process. Thankfully, it's not as difficult as it might appear. Start by installing the following support packages: - - -``` -`$ sudo apt install -y ca-certificates apt-transport-https` -``` - -Now, add the repository PGP key: - - -``` -`$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -` -``` - -Next, add the PHP repository to your apt sources: - - -``` -`$ echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list` -``` - -Then update your repository index: - - -``` -`$ sudo apt update` -``` - -Finally, install PHP 7.3 (or the latest version) and some common components: - - -``` -`$ sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-opcache php7.3-curl php7.3-mbstring php7.3-pgsql php7.3-zip php7.3-xml php7.3-gd php7.3-intl` -``` - -The command above assumes you're using PostgreSQL as your database backend and installs **php7.3-pgsql**. If you'd rather use MySQL or MariaDB, you can easily change this to **php7.3-mysql**. - -Next, verify that PHP is installed and running on your Raspberry Pi: - - -``` -`$ php -v` -``` - -Now it's time to install and configure the webserver. - -#### 2\. Install Nginx - -Nginx can be installed via apt with: - - -``` -`$ sudo apt install -y nginx` -``` - -Modify the default Nginx virtual host configuration so that the webserver will recognize PHP files and know what to do with them: - - -``` -`$ sudo nano /etc/nginx/sites-available/default` -``` - -You can safely delete everything in the original file and replace it with: - - -``` -server { -        listen 80 default_server; -        listen [::]:80 default_server; - -        root /var/www/html; -        index index.html index.htm index.php; -        server_name _; - -        location / { -                try_files $uri $uri/ =404; -        } - -        location ~ \\.php$ { -          include snippets/fastcgi-php.conf; -          fastcgi_pass unix:/run/php/php7.3-fpm.sock; -        } - -} -``` - -Use **Ctrl+O** to save your new configuration file and then **Ctrl+X** to exit Nano. You can test your new configuration with: - - -``` -`$ nginx -t` -``` - -If there are no errors, restart the Nginx service: - - -``` -`$ systemctl restart nginx` -``` - -#### 3\. Install PostgreSQL - -Next up is installing the database server. Installing PostgreSQL on the Raspberry Pi is super easy: - - -``` -`$ sudo apt install -y postgresql postgresql-client postgis` -``` - -Check to see if the database server was successfully installed by entering: - - -``` -`$ psql --version` -``` - -#### 4\. Create the Tiny Tiny RSS database - -Before you can do anything else, you need to create a database that the TT-RSS software will use to store data. First, log into the PostgreSQL server: - - -``` -`sudo -u postgres psql` -``` - -Next, create a new user and assign a password: - - -``` -`CREATE USER username WITH PASSWORD 'your_password' VALID UNTIL 'infinity';` -``` - -Then create the database that will be used by TT-RSS: - - -``` -`CREATE DATABASE tinyrss;` -``` - -Finally, grant full permissions to the new user: - - -``` -`GRANT ALL PRIVILEGES ON DATABASE tinyrss to user_name;` -``` - -That's it for the database. You can exit the **psql** app by typing **\q**. - -#### 5\. Install Git - -Installing TT-RSS requires Git, so install Git with: - - -``` -`$ sudo apt install git -y` -``` - -Now, change directory to wherever Nginx serves web pages: - - -``` -`$ cd /var/www/html` -``` - -Then download the latest source for TT-RSS: - - -``` -`$ git clone https://git.tt-rss.org/fox/tt-rss.git tt-rss` -``` - -Note that this process creates a new **tt-rss** folder. - -#### 6\. Install and configure Tiny Tiny RSS - -It's finally time to install and configure your new TT-RSS server. First, verify that you can open **** in a web browser. If you get a **403 Forbidden** error, your permissions are not set properly on the **/var/www/html** folder. The following will usually fix this issue: - - -``` -`$ chmod 755 /var/www/html/ -v` -``` - -If everything goes as planned, you'll see the TT-RSS Installer page, and it will ask you for some database information. Just tell it the database username and password that you created earlier; the database name; **localhost** for the hostname; and **5432** for the port. - -Click **Test Configuration** to continue. If all went well, you should see a red button labeled **Initialize Database.** Click on it to begin the installation. Once finished, you'll have a configuration file that you can copy and save as **config.php** in the TT-RSS directory. - -After finishing with the installer, open your TT-RSS installation at **** and log in with the default credentials (username: **admin**, password: **password**). The system will recommend that you change the admin password as soon as you log in. I highly recommend that you follow that advice and change it as soon as possible. - -### Set up TT-RSS - -If all went well, you can start using TT-RSS right away. It's recommended that you create a new non-admin user, log in as the new user, and start importing your feeds, subscribing, and configuring it as you see fit. - -Finally, and this is super important, don't forget to read the [Updating Feeds][4] section on TT-RSS's wiki. It describes how to create a simple systemd service that will update your feeds. If you skip this step, your RSS feeds will not update automatically. - -### Conclusion - -Whew! That was a lot of work, but you did it! You now have your very own RSS aggregation server. Want to learn more about TT-RSS? I recommend checking out the official [FAQ][5], the [support][6] forum, and the detailed [installation][7] notes. Feel free to comment below if you have any questions or issues. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/ttrss-raspberry-pi - -作者:[Patrick H. 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]: https://opensource.com/users/pmullins -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) -[2]: https://tt-rss.org/ -[3]: https://opensource.com/sites/default/files/uploads/tt-rss.jpeg (Tiny Tiny RSS screenshot) -[4]: https://tt-rss.org/wiki/UpdatingFeeds -[5]: https://tt-rss.org/wiki/FAQ -[6]: https://community.tt-rss.org/c/tiny-tiny-rss/support -[7]: https://tt-rss.org/wiki/InstallationNotes diff --git a/translated/tech/20200222 How to install TT-RSS on a Raspberry Pi.md b/translated/tech/20200222 How to install TT-RSS on a Raspberry Pi.md new file mode 100644 index 0000000000..16c49f98b5 --- /dev/null +++ b/translated/tech/20200222 How to install TT-RSS on a Raspberry Pi.md @@ -0,0 +1,244 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to install TT-RSS on a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/2/ttrss-raspberry-pi) +[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) + +怎样在树莓派上安装 TT-RSS +====== +使用 Tiny Tiny RSS 来保护你阅读新闻 feed 时的隐私。 +![Raspberries with pi symbol overlay][1] + +[Tiny Tiny RSS][2](TT-RSS)是一个免费开源的基于 web 的新闻 feed(RSS/Atom)阅读器和聚合工具。它非常适合那些对隐私很在意又依赖他们的日常消息的 RSS 的人。TT-RSS 是自运维的软件,因此你对服务器、你的数据以及你全部的隐私都有 100% 的掌控。它还支持大量的插件、扩展和主题。你喜欢深色的界面?没问题。你希望基于关键词过滤发来的消息?TT-RSS 也能让你得偿所愿。 + +![Tiny Tiny RSS screenshot][3] + +现在你知道 TT-RSS 是什么了,那么为什么你可能会想用它呢?我会讲述要把它安装到树莓派或 Debian 10 服务器上你需要了解的所有的东西。 + +### 安装和配置 TT-RSS + +要把 TT-RSS 安装到树莓派上,你还需要安装和配置最新版本的 PHP(本文撰写时 PHP 最新版本是 7.3)、后端数据库 PostgreSQL、Nginx web 服务器、Git,最后才是 TT-RSS。 + +#### 1\. 安装 PHP 7 + +安装 PHP 7 是整个过程中最重要的部分。幸运的是,它并不像看起来那样困难。从安装下面的支持包开始: + + +``` +`$ sudo apt install -y ca-certificates apt-transport-https` +``` + +现在,添加存储库 PGP key + + +``` +`$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -` +``` + +下一步,把 PHP 库添加到你的 apt 源: + + +``` +`$ echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list` +``` + +然后更新你的存储库索引: + + +``` +`$ sudo apt update` +``` + +最后,安装 PHP 7.3(或最新版本)和一些通用组件: + + +``` +`$ sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-opcache php7.3-curl php7.3-mbstring php7.3-pgsql php7.3-zip php7.3-xml php7.3-gd php7.3-intl` +``` + +上面的命令默认你使用的后端数据库是 PostgreSQL,会安装 **php7.3-pgsql**。如果你想用 MySQL 或 MariaDB,你可以把命令参数改为 **php7.3-mysql**。 + +下一步,确认 PHP 已安装并在你的树莓派上运行着: + + +``` +`$ php -v` +``` + +现在是时候安装和配置 webserver 了。 + +#### 2\. 安装 Nginx + +可以用下面的命令安装 Nginx: + + +``` +`$ sudo apt install -y nginx` +``` + +修改默认的 Nginx 虚拟主机配置,这样 webserver 才能识别 PHP 文件以及知道如何处理它们。 + + +``` +`$ sudo nano /etc/nginx/sites-available/default` +``` + +你可以安全地删除原文件中的所有内容,用下面的内容替换: + + +``` +server { +        listen 80 default_server; +        listen [::]:80 default_server; + +        root /var/www/html; +        index index.html index.htm index.php; +        server_name _; + +        location / { +                try_files $uri $uri/ =404; +        } + +        location ~ \\.php$ { +          include snippets/fastcgi-php.conf; +          fastcgi_pass unix:/run/php/php7.3-fpm.sock; +        } + +} +``` + +按 **Ctrl+O** 保存修改后的配置文件,然后按 **Ctrl+X** 退出 Nano。你可以用下面的命令测试你的新配置文件: + + +``` +`$ nginx -t` +``` + +如果没有报错,重启 Nginx 服务: + + +``` +`$ systemctl restart nginx` +``` + +#### 3\. 安装 PostgreSQL + +接下来是安装数据库服务器。在树莓派上安装 PostgreSQL 超级简单: + + +``` +`$ sudo apt install -y postgresql postgresql-client postgis` +``` + +输入下面的命令看一下数据库服务器安装是否成功: + + +``` +`$ psql --version` +``` + +#### 4\. 创建 Tiny Tiny RSS 数据库 + +在做其他事之前,你需要创建一个数数据库,用来给 TT-RSS 软件保存数据。首先,登录 PostgreSQL 服务器: + + +``` +`sudo -u postgres psql` +``` + +下一步,新建一个用户,设置密码: + + +``` +`CREATE USER username WITH PASSWORD 'your_password' VALID UNTIL 'infinity';` +``` + +然后创建一个给 TT-RSS 用的数据库: + + +``` +`CREATE DATABASE tinyrss;` +``` + +最后,给新建的用户赋最高权限: + + +``` +`GRANT ALL PRIVILEGES ON DATABASE tinyrss to user_name;` +``` + +这是安装数据库的步骤。你可以输入 **\q** 来退出 **psql** 程序。 + +#### 5\. 安装 Git + +安装 TT-RSS 需要用 Git,所以输入下面的命令安装 Git: + + +``` +`$ sudo apt install git -y` +``` + +现在,进入到 Nginx 服务器的根目录: + + +``` +`$ cd /var/www/html` +``` + +下载 TT-RSS 最新源码: + + +``` +`$ git clone https://git.tt-rss.org/fox/tt-rss.git tt-rss` +``` + +注意,这一步会创建一个 **tt-rss** 文件夹。 + +#### 6\. 安装和配置Tiny Tiny RSS + +现在是安装和配置你的新 TT-RSS 服务器的最后时刻了。首先,确认下你在浏览器中能打开 ****。如果浏览器显示 **403 Forbidden**,那么就证明 **/var/www/html** 文件夹的权限没有设置正确。下面的命令通常能解决这个问题: + + +``` +`$ chmod 755 /var/www/html/ -v` +``` + +如果一切正常,你会看到 TT-RSS 安装页面,它会让你输入一些数据的信息。你只需要输入前面你创建的数据库用户名和密码;数据库名;主机名填 **localhost**;端口填 **5432**。 + +点击 **检测配置**。如果一切正常,你会看到一个有**初始化数据库**标签的红色按钮。点击它来开始安装。结束后,你会看到一个配置文件,你可以把它复制到 TT-RSS 的目录,另存为 **config.php**。 + +安装过程结束后,浏览器输入 **** 打开 TT-RSS,使用默认的凭证登录(用户名:**admin**,密码:**password**)。登录后系统会提示你修改密码。我强烈建议你尽快修改密码。 + +### 配置 TT-RSS + +如果一切正常,你现在就可以开始使用 TT-RSS 了。建议你新建一个非管理员用户,使用新用户名登录,并开始导入你的 feed、订阅,按照你的意愿来配置它。 + +最后,并且是超级重要的事,不要忘了阅读 TT-RSS wiki 上的 [更新 Feed][4] 部分。它讲述了如何创建一个更新 feed 的简单系统服务。如果你跳过了这一步,你的 RSS feed 就不会自动更新。 + +### 总结 + +呵!工作量不小,但是你做完了!你现在有自己的 RSS 聚合服务器了。想了解 TT-RSS 更多的知识?我推荐你去看官方的 [FAQ][5],[支持的][6]论坛,和详细的[安装][7]笔记。如果你有任何问题,尽情地在下面评论吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/ttrss-raspberry-pi + +作者:[Patrick H. Mullins][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/pmullins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) +[2]: https://tt-rss.org/ +[3]: https://opensource.com/sites/default/files/uploads/tt-rss.jpeg (Tiny Tiny RSS screenshot) +[4]: https://tt-rss.org/wiki/UpdatingFeeds +[5]: https://tt-rss.org/wiki/FAQ +[6]: https://community.tt-rss.org/c/tiny-tiny-rss/support +[7]: https://tt-rss.org/wiki/InstallationNotes From 42a925e8608687ac1ac2001887392ec512e74e4e Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 25 May 2020 08:42:36 +0800 Subject: [PATCH 2137/3057] translated --- ...t 5- Here-s How to Install it on Ubuntu.md | 106 ------------------ ...t 5- Here-s How to Install it on Ubuntu.md | 105 +++++++++++++++++ 2 files changed, 105 insertions(+), 106 deletions(-) delete mode 100644 sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md create mode 100644 translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md diff --git a/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md b/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md deleted file mode 100644 index 666c57c8ff..0000000000 --- a/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md +++ /dev/null @@ -1,106 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu) -[#]: via: (https://itsfoss.com/audacious-4-release/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu -====== - -[Audacious][1] is an open-source audio player available for multiple platforms that include Linux. Almost after 2 years of its last major release, Audacious 4.0 has arrived with some big changes. - -The latest release Audacious 4.0 comes with [Qt 5][2] UI by default. You can still go for the old GTK2 UI from the source – however, the new features will be added to the Qt UI only. - -Let’s take a look at what has changed and how to install the latest Audacious on your Linux system. - -### Audacious 4.0 Key Changes & Features - -![Audacious 4 Release][3] - -Of course, the major change would be the use of Qt 5 UI as the default. In addition to that, there are a lot of improvements and feature additions mentioned in their [official announcement post][4], here they are: - - * Clicking on playlist column headers sorts the playlist - * Dragging playlist column headers changes the column order - * Application-wide settings for volume and time step sizes - * New option to hide playlist tabs - * Sorting playlist by path now sorts folders after files - * Implemented additional MPRIS calls for compatibility with KDE 5.16+ - * New OpenMPT-based tracker module plugin - * New VU Meter visualization plugin - * Added option to use a SOCKS network proxy - * The Song Change plugin now works on Windows - * New “Next Album” and “Previous Album” commands - * The tag editor in Qt UI can now edit multiple files at once - * Implemented equalizer presets window for Qt UI - * Lyrics plugin gained the ability to save and load lyrics locally - * Blur Scope and Spectrum Analyzer visualizations ported to Qt - * MIDI plugin SoundFont selection ported to Qt - * JACK output plugin gained some new options - * Added option to endlessly loop PSF files - - - -If you didn’t know about it previously, you can easily get it installed and use the equalizer coupled with [LADSP][5] effects to tweak your music experience. - -![Audacious Winamp Classic Interface][6] - -### How to Install Audacious 4.0 on Ubuntu - -It is worth noting that the [unofficial PPA][7] is made available by [UbuntuHandbook][8]. You can simply follow the instructions below to install it on Ubuntu 16.04, 18.04, 19.10, and 20.04. - -1\. First, you have to add the PPA to your system by typing in the following command in the terminal: - -``` -sudo add-apt-repository ppa:ubuntuhandbook1/apps -``` - -3\. Next, you need to update/refresh the package information from the repositories/sources you have and proceed to install the app. Here’s how to do that: - -``` -sudo apt update -sudo apt install audacious audacious-plugins -``` - -That’s it. You don’t have to do anything else. In either case, if you want to [remove the PPA and the software][9], just type in the following commands in order: - -``` -sudo add-apt-repository --remove ppa:ubuntuhandbook1/apps -sudo apt remove --autoremove audacious audacious-plugins -``` - -You can also check out their GitHub page for more information on the source and potentially install it on other Linux distros as well, if that’s what you’re looking for. - -[Audacious Source Code][10] - -### Wrapping Up - -The new features and the Qt 5 UI switch should be a good thing to improve the user experience and the functionality of the audio player. If you’re a fan of the classic Winamp interface, it works just fine as well – but missing a few features as mentioned in their announcement post. - -You can try it out and let me know your thoughts in the comments below! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/audacious-4-release/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://audacious-media-player.org -[2]: https://doc.qt.io/qt-5/qt5-intro.html -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-4-release.jpg?ssl=1 -[4]: https://audacious-media-player.org/news/45-audacious-4-0-released -[5]: https://www.ladspa.org/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-winamp.jpg?ssl=1 -[7]: https://itsfoss.com/ppa-guide/ -[8]: http://ubuntuhandbook.org/index.php/2020/03/audacious-4-0-released-qt5-ui/ -[9]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ -[10]: https://github.com/audacious-media-player/audacious diff --git a/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md b/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md new file mode 100644 index 0000000000..8493ff968c --- /dev/null +++ b/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu) +[#]: via: (https://itsfoss.com/audacious-4-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +使用 Qt 5 的 Audacious 4.0 发布:以下是在 Ubuntu 上安装它的方法 +====== + +[Audacious][1]是用于包括 Linux 在内的多个平台的开源音频播放器。继上次发布主版本将近 2 年后,Audacious 4.0 带来了一些重大变化。 + +最新版本的 Audacious 4.0 默认带 [Qt 5][2] UI。你仍然可以从源中使用旧的 GTK2 UI,但是,新功能仅会添加到 Qt UI 中。 + +让我们看下发生了什么变化以及如何在 Linux 系统上安装最新的 Audacious。 + +### Audacious 4.0 关键变化和功能 + +![Audacious 4 Release][3] + +当然,主要的变化是默认使用 Qt 5 UI。除此之外,他们的[官方公告][4]中提到了许多改进和功能补充,它们是: + + * 单击播放列表列头可对播放列表进行排序 +  * 拖动播放列表列头会更改列顺序 +  * 应用中的音量和时间步长设置 +  * 隐藏播放列表标签的新选项 +  * 按路径对播放列表排序现在将文件夹排序在文件后面 +  * 实现了额外的 MPRIS 调用,以与 KDE 5.16+ 兼容 +  * 新的基于 OpenMPT 的跟踪器模块插件 +  * 新的 VU Meter 可视化插件 +  * 添加了使用 SOCKS 网络代理的选项 +  * Song Change 插件现在可在 Windows 上使用 +  * 新的“下一张专辑”和“上一张专辑”命令 +  * Qt UI 中的标签编辑器现在可以一次编辑多个文件 +  * 为 Qt UI 实现均衡器预设窗口 +  * 歌词插件获得了在本地保存和加载歌词的功能 +  * 模糊范围和频谱分析器可视化已移植到 Qt +  * MIDI 插件 SoundFont 选择已移植到 Qt +  * JACK 输出插件获得了一些新选项 +  * 添加了无限循环 PSF 文件的选项 + + +如果你以前不了解它,你可以轻松安装它,并使用均衡器和 [LADSP][5] 效果器来调整音乐体验。 + +![Audacious Winamp Classic Interface][6] + +### 如何在 Ubuntu 上安装 Audacious 4.0 + +值得注意的是,[UbuntuHandbook][8] 提供了[非官方 PPA][7]。你可以按照以下说明在 Ubuntu 16.04、18.04、19.10 和 20.04 上进行安装。 + +1\. 首先,你必须在终端中输入以下命令将 PPA 添加到系统中: + +``` +sudo add-apt-repository ppa:ubuntuhandbook1/apps +``` + +2\. 接下来,你需要从仓库/源码中更新/刷新软件包信息,然后继续安装该应用。方法如下: + +``` +sudo apt update +sudo apt install audacious audacious-plugins +``` + +就是这样。你无需执行其他任何操作。无论什么情况,如果你想[删除 PPA 和软件][9],只需按顺序输入以下命令: + +``` +sudo add-apt-repository --remove ppa:ubuntuhandbook1/apps +sudo apt remove --autoremove audacious audacious-plugins +``` + +你也可以在它的 GitHub 页面上查看有关源码的更多信息,并根据需要在其他 Linux 发行版上进行安装。 + +[Audacious Source Code][10] + +### 总结 + +新功能和 Qt 5 UI 开关对于改善用户体验和音频播放器的功能应该是一件好事。如果你是经典 Winamp 界面的粉丝,它也可以正常工作。但缺少其公告中提到的一些功能。 + +你可以尝试一下,并在下面的评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/audacious-4-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://audacious-media-player.org +[2]: https://doc.qt.io/qt-5/qt5-intro.html +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-4-release.jpg?ssl=1 +[4]: https://audacious-media-player.org/news/45-audacious-4-0-released +[5]: https://www.ladspa.org/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-winamp.jpg?ssl=1 +[7]: https://itsfoss.com/ppa-guide/ +[8]: http://ubuntuhandbook.org/index.php/2020/03/audacious-4-0-released-qt5-ui/ +[9]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[10]: https://github.com/audacious-media-player/audacious From f41febeddd0bd1c590572a7beac23f4918b9f7c2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 25 May 2020 08:49:31 +0800 Subject: [PATCH 2138/3057] translating --- ...00304 Getting started with the Gutenberg editor in Drupal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md b/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md index 6050adebfa..84c177f4de 100644 --- a/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md +++ b/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 376e2bcae07cd505448eecb6291ac5ea8b7a77d3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:42:06 +0800 Subject: [PATCH 2139/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Usin?= =?UTF-8?q?g=20=E2=80=98apt=20search=E2=80=99=20and=20=E2=80=98apt=20show?= =?UTF-8?q?=E2=80=99=20Commands=20to=20Search=20and=20Find=20Details=20of?= =?UTF-8?q?=20Packages=20in=20Ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md --- ...arch and Find Details of Packages in Ubuntu.md | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md diff --git a/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md b/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md new file mode 100644 index 0000000000..d1d80bcb5d --- /dev/null +++ b/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using ‘apt search’ and ‘apt show’ Commands to Search and Find Details of Packages in Ubuntu) +[#]: via: (https://itsfoss.com/apt-search-command/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Using ‘apt search’ and ‘apt show’ Commands to Search and Find Details of Packages in Ubuntu +====== + +_**This is a detailed beginners guide to apt search command. Using apt search and apt show commands, you can get details of the available versions, dependencies, repositories and other important information about packages in Ubuntu.**_ + +Have you ever wondered if a certain package is available to install via [apt package manager][1]? + +Have you wondered if the package offered by [Ubuntu repositories][2] are the latest one or not? + +The apt package manager in [Ubuntu][3] and many other distribution provides two handy [apt command options][4] for this purpose. + +The apt search command looks for the provided string in the name and description of the packages. + +``` +apt search package_name +``` + +The apt show command provides detailed information on a package: + +``` +apt show package_name +``` + +The commands don’t require you to [be root in Ubuntu][5]. Here’s an example of these commands: + +![][6] + +### Why would you want to use apt search or apt show command? + +Let’s say you want to [install Gambas programming language in Ubuntu][7]. You are happy with your knowledge of the apt command so you decided to use the command line for installing application. + +You open a terminal and use the apt command to install gambas but it results in [unable to locate package error][8]. + +``` +sudo apt install gambas +Reading package lists... Done +Building dependency tree +Reading state information... Done +E: Unable to locate package gambas +``` + +Why did Ubuntu not find the gambas package? Because there is no such package called gambas. Instead, it is available as gambas3. This is a situation where you could take the advantage of the apt search command. + +Let’s move to apt show command. This command provides detailed information about a package, its repository, dependencies and a lot more. + +Knowing what version of a package is available from the official repository could help you in deciding whether you should install it from some other sources. + +Quick recall + +The apt package manager works on a local database/cache of available packages from various repositories. This database contains the information about the available package version, dependencies etc. It doesn’t contain the entire package itself. The packages are downloaded from the remote repositories. + +When you run the sudo apt update command, this cache is created/updated in the /var/lib/apt/lists/ directory. The apt search and apt show commands utilize this cache. + +The term package is used for an application, program, software. + +### Search for available packages using apt search command + +![][9] + +Let me continue the gambas example. Say, you search for + +``` +apt search gambas +``` + +It will give you a huge list of packages that have “gambas” in its name or description. This output list is in alphabetical order. + +Now, you’ll of course have to make some intelligent prediction about the package you want. In this example, the first result says “Complete visual development environment for Gambas”. This gives you a good hint that this is the main package you are looking for. + +![][10] + +Why so many packages associated with gambas? Because a number of these gambas packages are probably dependencies that will installed automatically if you install the gambas3 package. If you use the _‘apt show gambas3_‘ command, it will show all the dependencies that will be installed with gambas3 package. + +Some of these listed packages could be libraries that a developer may need in some special cases while developing her/his software. + +#### Use apt search for package name only + +By default, apt search command looks for the searched term in both the name of the package and its description. + +You may narrow down the search by instructing the apt command to search for package names only. + +``` +apt search --names-only search_term +``` + +If you are following this as a tutorial, give it a try. Check the output with search term ‘transitional’ with and without –names-only option and you’ll see how the output changes. + +``` +apt search transitional +apt search --names-only transitional +``` + +**Bonus Tip**: You can use ‘apt list –installed’ command to [look for installed packages in Ubuntu][11]. + +### Get detailed information on a package using apt show command + +The output of the apt search commands a brief introduction of the packages. If you want more details, use the apt show command. + +``` +apt show exact_package_name +``` + +The apt show command works on the exact package name and it gives you a lot more information on the package. You get: + + * Version information + * Repository information + * Origin and maintainer of the package information + * Where to file a bug + * Download and installation size + * Dependencies + * Detailed description of the package + * And a lot more + + + +Here’s an example: + +![][12] + +You need to give the exact package name otherwise the apt show won’t work. The good thing is that tab completion works apt show command. + +As you can see in the previous image, you have plenty of information that you may found helpful. + +The apt show command also works on installed packages. In that case, you can see which source the package was installed from. Was it a PPA or some third-party repository or universe or the main repository itself? + +Personally, I use apt show a lot. This helps me know if the package version provided by Ubuntu is the latest or not. Pretty handy tool! + +### Conclusion + +If you read my detailed [guide on the difference between apt and apt-get commands][13], you would know that this ‘apt search’ command works similar to ‘apt-cache search’. There is no such command as “apt-get search”. + +The purpose of creating apt command is to give you one tool with only enough option to manage the packages in your Debian/Ubuntu system. The apt-get, apt-cache and other apt tools still exist, and they can be used in scripting for more complex scenarios. + +I hope you found this introduction to **apt search** and **apt show** commands useful. I welcome your questions and suggestions on this topic. + +If you liked it, please share it on various Linux forums and communities you frequent. That helps us a lot. Thank you. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/apt-search-command/ + +作者:[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://wiki.debian.org/Apt +[2]: https://itsfoss.com/ubuntu-repositories/ +[3]: https://ubuntu.com/ +[4]: https://itsfoss.com/apt-command-guide/ +[5]: https://itsfoss.com/root-user-ubuntu/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-apt-show-example-800x493.png?resize=800%2C493&ssl=1 +[7]: https://itsfoss.com/install-gambas-ubuntu/ +[8]: https://itsfoss.com/unable-to-locate-package-error-ubuntu/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-command.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-command-example.png?fit=800%2C297&ssl=1 +[11]: https://itsfoss.com/list-installed-packages-ubuntu/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-show-command-example-800x474.png?resize=800%2C474&ssl=1 +[13]: https://itsfoss.com/apt-vs-apt-get-difference/ From 6c60cbd23cd910e1eb347b5fc2a987985a504c75 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:42:30 +0800 Subject: [PATCH 2140/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20to=20Make=20a=20GIF=20in=20GIMP=20[Simple=20Tutorial]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How to Make a GIF in GIMP -Simple Tutorial.md --- ... to Make a GIF in GIMP -Simple Tutorial.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20200525 How to Make a GIF in GIMP -Simple Tutorial.md diff --git a/sources/tech/20200525 How to Make a GIF in GIMP -Simple Tutorial.md b/sources/tech/20200525 How to Make a GIF in GIMP -Simple Tutorial.md new file mode 100644 index 0000000000..7a07e849c1 --- /dev/null +++ b/sources/tech/20200525 How to Make a GIF in GIMP -Simple Tutorial.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Make a GIF in GIMP [Simple Tutorial]) +[#]: via: (https://itsfoss.com/make-gif-in-gimp/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Make a GIF in GIMP [Simple Tutorial] +====== + +Making a GIF can be fun and many users would like to know how to make one. You can create a GIF very easily with [GIMP][1], the powerful open-source image editing software. + +In this GIMP tutorial, I’ll show you how to create a simple GIF in GIMP. + +### Making a GIF in GIMP + +![][2] + +Using GIMP as an animation tool requires you to think of every layer as of an animation frame. In this tutorial, I will create a simple web banner based on It’s FOSS logo. I will use 2 images as my layers but feel free to add more when you make your own. + +The method that I use here is called “the **combine** method”, in which the new frame is added to the previous frame. My idea is to make a “flashing” web banner, to draw the attention at something important. + +I presume that you have [already installed GIMP in Ubuntu][3] or whichever operating system you are using. Let’s start making the GIF. + +#### Step 1 + +From the File menu, click on **Open as Layers** and select all the images you want to include in the GIF. Then click **Open**. + +![][4] + +You can order your images in the layers tab. The GIF sequence will start with your bottom layer and run through each layer bottom to top. + +![Change the order of layers][5] + +From the main menu select **Filters**, then **Animation** and finally click **Optimise (for GIF)**. + +![][6] + +What “Optimise” does? + +Optimise examines each layer, and reuses information from previous frames if they haven’t changed at the following frame. It only stores new values for pixels that change, and purges any duplicate parts. + +If a frame is exactly the same as the previous one, it removes that frame completely and the previous frame just stays on the screen for longer. + +To view GIF, from main menu click on **Filter** then **Animation** and **Playback**. + +![][7] + +Press the **Playback** button to start GIF. To save GIF on the File Menu select **File**, click on **Export as**. + +![][8] + +Name your GIF and choose the folder you want to save it in. On “**Select File Type**“, choose GIF Image. + +![Save As Gif][9] + +When prompted select ‘As Animation’, ‘Loop Forever’, set the desired delay value and to take effect click on “Use delay entered above for all frames”. + +The most important option is to set the frame disposal action as “**Cumulative layers (combine)**” to get the “**flashing**” effect for our banner. Click Export as a final step. + +![Gif Export Options][10] + +**Your GIF is ready!** + +![][11] + +This was an easy-to-follow, simple example, although GIMP has a much greater depth in animation creating and requires a good amount of study and practice to master it. + +If you are interested in more GIMP tutorials, you may read how to outline text in GIMP. Stay tuned at It’s FOSS for more such useful tips in the future. [Subscribing to the weekly newsletter][12] is the best way to stay updated. Enjoy! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/make-gif-in-gimp/ + +作者:[Dimitrios Savvopoulos][a] +选题:[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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/create-gif-in-gimp.jpg?ssl=1 +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/1.-open-as-layers.jpeg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/layers-order.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/2.-optimize-for-gif-1.png?fit=800%2C647&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/3.-playback.png?fit=800%2C692&ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/4.-export-as.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/5.-save-as-gif.png?fit=800%2C677&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/6.-export-options-1.png?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/its-foss-logo.gif?fit=800%2C417&ssl=1 +[12]: https://itsfoss.com/subscribe-to-newsletter/ From 56b7fb2f2ed9751a0506056fc3b1ba3d14b39570 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:43:15 +0800 Subject: [PATCH 2141/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Now?= =?UTF-8?q?=20You=20Can=20Run=20Linux=20Apps=20in=20Windows=20(Thanks=20to?= =?UTF-8?q?=20WSL)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md --- ...n Linux Apps in Windows (Thanks to WSL).md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md diff --git a/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md b/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md new file mode 100644 index 0000000000..e6e79cbb08 --- /dev/null +++ b/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Now You Can Run Linux Apps in Windows (Thanks to WSL)) +[#]: via: (https://itsfoss.com/run-linux-apps-windows-wsl/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Now You Can Run Linux Apps in Windows (Thanks to WSL) +====== + +Microsoft’s recent “[Build 2020][1]” developer conference involved some interesting announcements. I’m not sure if it’s something to be excited about or skeptical about — but Microsoft you have our attention now more than ever. + +And, among all the announcements, the ability to run GUI apps on WSL (Windows Subsystem for Linux) gained the spotlight. + +Not to forget the [fiasco with Xamrin.Forms rebranding as MAUI][2] which conflicts with an existing open-source project ([Maui Project][3]) by Uri Herrera of [Nitrux Linux.][4] + +In case you didn’t know, WSL is an environment that lets you have a console-only Linux experience from within Windows 10. It is also one of the [best ways to run Linux commands in Windows.][5] + +While the announcement through a blog post ([DirectX ❤ Linux][6]) may have been a PR bait as [Liam Dawe thinks][7]. But, it’s still something worth talking about. + +### Support for Linux GUI Apps On WSL + +![][8] + +Recently, Microsoft announced a bunch of new features coming to WSL (a.k.a. WSL 2) during the online developer conference. + +The introduction of [Windows Package Manager][9], [Windows Terminal 1.0][10], and a couple others were some its highlights. + +But, the support for GPU hardware acceleration to **Windows Subsystem for Linux 2** was something significant. + +So, does this mean that you can run Linux apps on Windows using WSL? Looks like it… + +Microsoft plans to make it happen using a brand-new Linux kernel driver **dxgkrnl**. To give you a technical brief, I’d quote the description from their announcement here: + +![Linux Kernel Driver Wsl][11] + +> Dxgkrnl is a brand-new kernel driver for Linux that exposes the **/dev/dxg** device to user mode Linux. **/dev/dxg** exposes a set of IOCTL that closely mimic the native WDDM D3DKMT kernel service layer on Windows. Dxgkrnl inside the Linux kernel connects over the VM Bus to its big brother on the Windows host and uses this VM bus connection to communicate with the physical GPU. + +I’m no expert here but it means that the **Linux applications on WSL will have the same access to the GPU as native Windows applications do**. + +The support for GUI apps will be coming later this fall (not with May 2020 update) — so we’ll have to see when that happens. + +Microsoft is specifically targeting the developers who want the comfort of using their Linux IDE on Windows. Google is also targeting the same user base by [bringing GUI Linux apps to Chromebook][12]. + +Well, that’s good news for users who want to stick with Windows. But, is it really? + +### Microsoft Loves Linux — Do They Really? + +![Microsoft Loves Linux][13] + +It is definitely a good thing that they are embracing Linux and its benefits through their efforts of incorporating a Linux environment on Windows. + +But, how is it really going to help the **desktop Linux users**? I don’t see any real-word benefits from it as of now. + +You’re free to have a different opinion here. But, I think there’s no real value to the desktop users of Linux through the development of WSL. At least, none so far. + +It was interesting to notice that someone on [Linux Unplugged podcast][14] highlighted Microsoft’s move as something in the line of EEE (Embrace, extend, and extinguish) for which they’re known for. + +Maybe, who knows? Of course, the effort they’ve put to pull this off is worth appreciating — but it’s exciting and mystifying at the same time. + +### Does this mean Windows users will no longer switch to Linux? + +The reason why Microsoft is embracing Linux on its platform is that they know what it’s capable of and why developers (or users) prefer using. + +But, with the updates to WSL 2, I tend to agree to what Abhishek thinks if this continues: + +> Eventually, desktop Linux will be confined to become a desktop application under Windows… + +Well, of course, the native experience is still superior for the time being. And, it’ll be rare to see that the existing Linux desktop users will use Windows over it. But, that’s still something to worry about. + +What do you think about all this? I’m not ruling the advantages of WSL for users forced to use Windows — but do you think Microsoft’s progress with WSL is going to be something hostile in nature or something that will help Linux in the long run? + +Let me know your thoughts in the comments! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/run-linux-apps-windows-wsl/ + +作者:[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://news.microsoft.com/build2020/ +[2]: https://itsfoss.com/microsoft-maui-kde-row/ +[3]: https://mauikit.org/ +[4]: https://itsfoss.com/nitrux-linux/ +[5]: https://itsfoss.com/run-linux-commands-in-windows/ +[6]: https://devblogs.microsoft.com/directx/directx-heart-linux/ +[7]: https://www.gamingonlinux.com/2020/05/microsoft-build-directx-and-linux-plus-more +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Linux-GUI-app-Windows-WSL.png?ssl=1 +[9]: https://devblogs.microsoft.com/commandline/windows-package-manager-preview/ +[10]: https://devblogs.microsoft.com/commandline/windows-terminal-1-0/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/linux-kernel-driver-wsl.png?ssl=1 +[12]: https://itsfoss.com/linux-apps-chromebook/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/microsoft-loves-linux.jpg?ssl=1 +[14]: https://linuxunplugged.com/354 From b43ed403a7f4e9e9306f2ea7b9d27570312fa896 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:43:45 +0800 Subject: [PATCH 2142/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Ubun?= =?UTF-8?q?tu=20Budgie=2020.04=20Review:=20Smooth,=20Polished=20&=20Plenty?= =?UTF-8?q?=20of=20Changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md --- ...w- Smooth, Polished - Plenty of Changes.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md diff --git a/sources/tech/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md b/sources/tech/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md new file mode 100644 index 0000000000..93226912f5 --- /dev/null +++ b/sources/tech/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ubuntu Budgie 20.04 Review: Smooth, Polished & Plenty of Changes) +[#]: via: (https://itsfoss.com/ubuntu-budgie-20-04-review/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Ubuntu Budgie 20.04 Review: Smooth, Polished & Plenty of Changes +====== + +As we promised our readers, we’ll be reviewing all major flavors of [Ubuntu 20.04 LTS release][1]. In that continuation, here’s our take on the Ubuntu Budgie. + +![Ubuntu Budgie Desktop][2] + +[Ubuntu Budgie][3], as the name implies, is an [official flavor of Ubuntu][4] using the [Budgie desktop environment][5]. This flavor is a newer member of the Ubuntu family. Ubuntu Budgie’s first release was 16.04 and it was accepted as an official flavor with the 17.04 release. + +Their [goal][6] is to “combine the simplicity and elegance of the Budgie interface to produce a traditional desktop orientated distro with a modern paradigm”. + +### Ubuntu 20.04 Review: What has changed and what has not! + +There have been a surprising number of updates and improvements to [Ubuntu Budgie since the 18.04 LTS release][7]. + + * New stylish menu apple + * Budgie-based network manager applet as default + * New Window Shuffler allows you to tile applications from the keyboard + * New tool to quickly switch desktop layout + * 4k resolution support + * GNOME Firmware and Drawing are new default applications + * Backport packages have now been rebuilt for 20.04 + * Firefox is the default browser. + * Catfish file and text search is now the default + * budgie-nemo integration + * System Tray applet removed due to bugs + * Event alerts sounds are disabled by default + * Fix for keyboard shortcuts mysteriously going missing + * Better lock screen styling + * Files (Nautilus) has been replaced with Files (Nemo) due to community demand + * Plank dock has now been switched to the bottom of the screen, is transparent and has the bounce animations by default + * The Quick Notes and Hot Corners applets have been ported from Python to Vala to improve speed + * Celluloid replaces MPV + * GNOME dependencies have been updated + + + +![][8] + +Ubuntu Budgie now ships with the most recent release of the Budgie desktop environment (10.5.1). Improvements include: + + * New Raven section in Budgie Desktop Settings + * Raven Notification grouping and the ability to turn off notifications + * Icon Task List has been revamped + * Ability to set number of virtual desktops + + + +Ubuntu Budgie comes with a whole slew of Budgie applets and min-apps. They can be installed through Ubuntu Budgie Welcome. + +![Ubuntu Budgie Welcome][9] + + * WeatherShow – shows the forecast for the next five days and updates every 3 hours + * Wallstreet – a wallpaper utility that allows you to cycle through a folder of images + * Visual-space – a compact workspace switcher + * Dropby – this applet allows you to quickly manage USB thumb drives from the panel + * Kangaroo – quickly browser folders from the panel + * Trash applet – manage your trash can + * Fuzzyclock – shows time in a fuzzy way + * Workspace stopwatch – allows you to keep track of the time spent in each workspace + + + +For a complete list of changes and updates, visit the [changelog][10]. + +#### System Requirements + +Ubuntu Budgie 20.04 has updated the [system requirements][11]: + + * 4GB or more of RAM + * 64-bit capable Intel and AMD processors + * UEFI PCs booting in CSM mode + * Modern Intel-based Apple Macs + + + +As you can see, Budgie is not really a lightweight option here. + +#### Included Apps + +![][12] + +The following useful applications are included in Ubuntu Budgie by default: + + * AisleRiot Solitaire + * Geary + * Catfish search tool + * Cheese webcam tool + * GNOME Drawing + * GNOME 2048 + * GNOME Mahjongg + * GNOME Mines + * GNOME Sudoku + + + * Gthumb + * LibreOffice + * Maps + * Rhythmbox + * Tilix + * Ubuntu Budgie Welcome + * Evince document viewer + * Plank + * Celluloid + + + +![Ubuntu Budgie Ram Usage][13] + +### Installation + +Initially, I was unable to get Ubuntu Budgie to do into the live environment so that I could install it. It turned out that Ubuntu Budgie was trying to boot via EFI. I contacted the [Ubuntu Budgie forum][14] and was able to get a solution. + +Once the purple splash screen I had to hit ESC and select legacy. After that, it booted as normal and installed without issue. I have only run into this issue with Ubuntu Budgie. I downloaded and tried the Ubuntu MATE 20.04 ISO, but didn’t have a similar issue. + +### Experience with Ubuntu Budgie 20.04 + +![][15] + +Other than the minor installation issue, my time with Ubuntu Budgie was very pleasant. The Budgie desktop has come a long way since [Ikey][16] first created it and it has become a very mature option. The goal of Ubuntu Budgie is to “produce a traditional desktop orientated distro”. It does that in spades. All the changes that they have made continually add more polish to their product. + +Overall, Ubuntu Budgie is a very nice looking distro. From the default theme to wallpaper options, you can tell that a lot of effort was put into making the visual experience very appealing. + +One thing to keep in mind is that Ubuntu Budgie is not intended for low spec systems. I’m running it on my Dell Latitude D630. Without any applications open, it used about 700 MB of RAM. + +One part of Ubuntu Budgie that I enjoyed more than I should have, was the inclusion of the [Tilix terminal emulator][17]. Tilix allows you to add terminal windows to the right or below. It has a whole host of features and just loved using it. I’m planning to install on my other Linux systems. + +### Final Thoughts on Ubuntu Budgie 20.04 + +Ubuntu Budgie is a welcome addition to the litany of official flavors. Budgie feels very smooth and polished. It gets out of your way and lets you get work done. + +If you are tired of your current desktop environment and want to take a look at something new, check it out. If you’re happy with your current setup, check Ubuntu Budgie’s live DVD. You just might like it. + +![Ubuntu Budgie About][18] + +Have you already tried Ubuntu 20.04 Budgie? How’s your experience with it? If not, which Ubuntu 20.04 flavor are you using right now? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-budgie-20-04-review/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/download-ubuntu-20-04/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-busgie-desktop.png?resize=800%2C500&ssl=1 +[3]: https://ubuntubudgie.org/ +[4]: https://itsfoss.com/which-ubuntu-install/ +[5]: https://en.wikipedia.org/wiki/Budgie_(desktop_environment +[6]: https://ubuntubudgie.org/about-us/ +[7]: https://itsfoss.com/ubuntu-budgie-18-review/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-desktop-settings.jpeg?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-welcome.png?resize=800%2C472&ssl=1 +[10]: https://ubuntubudgie.org/2020/04/21/ubuntu-budgie-20-04lts-release-notes-for-18-04-upgraders/ +[11]: https://ubuntubudgie.org/downloads/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-applications.jpeg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-ram-usage.png?resize=800%2C600&ssl=1 +[14]: https://discourse.ubuntubudgie.org/t/cant-get-ub-to-boot/3397 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-20-04.jpg?ssl=1 +[16]: https://itsfoss.com/ikey-doherty-serpent-interview/ +[17]: https://gnunn1.github.io/tilix-web/ +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-about.png?resize=800%2C648&ssl=1 From 80833cef50eccca48355dadf12b32961e241d4b0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:45:47 +0800 Subject: [PATCH 2143/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20to=20Compress=20PDF=20in=20Linux=20[GUI=20&=20Terminal]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md --- ...o Compress PDF in Linux -GUI - Terminal.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md diff --git a/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md b/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md new file mode 100644 index 0000000000..eba596bcb9 --- /dev/null +++ b/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Compress PDF in Linux [GUI & Terminal]) +[#]: via: (https://itsfoss.com/compress-pdf-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Compress PDF in Linux [GUI & Terminal] +====== + +_**Brief: Learn how to reduce the size of a PDF file in Linux. Both command line and GUI methods have been discussed.**_ + +I was filling some application form and it asked to upload the necessary documents in PDF format. Not a big issue. I gathered all the [scanned images and combined them in one PDF using gscan2pdf tool][1]. + +The problem came when I tried to upload this PDF file. The upload failed because it exceeded the maximum file size limit. This only meant that I needed to somehow reduce the size of the PDF file. + +Now, you may use an online PDF compressing website but I don’t trust them. A file with important documents uploading to an unknown server is not a good idea. You could never be sure that they don’t keep a copy your uploaded PDF document. + +This is the reason why I prefer compressing PDF files on my system rather than uploading it to some random server. + +In this quick tutorial, I’ll show you how to reduce the size of PDF files in Linux. I’ll show both command line and GUI methods. + +### Method 1: Reduce PDF file size in Linux command line + +![][2] + +You can use [Ghostscript][3] command line tool for compressing a PDF file. Most Linux distributions include the open source version of Ghostscript already. However, you can still try to install it just to make sure. + +On Debian/Ubuntu based distributions, use the following command to install Ghostscript: + +``` +sudo apt install ghostscript +``` + +Now that you have made sure that Ghostscript is installed, you can use the following command to reduce the size of your PDF file: + +``` +gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf +``` + +In the above command, you should add the correct path of the input and out PDF file. + +The command looks scary and confusing. I advise copying and pasting most of it. What you need to know is the dPDFSETTINGS parameter. This is what determines the compression level and thus the quality of your compressed PDF file. + +dPDFSETTINGS | Description +---|--- +/prepress (default) | Higher quality output (300 dpi) but bigger size +/ebook | Medium quality output (150 dpi) with moderate output file size +/screen | Lower quality output (72 dpi) but smallest possible output file size + +Do keep in mind that some PDF files may not be compressed a lot or at all. Applying compression on some PDF files may even produce a file bigger than the original. There is not much you can do in such cases. + +### Method 2: Compress PDF files in Linux using GUI tool + +I understand that not everyone is comfortable with command line tool. The [PDF editors in Linux][4] doesn’t help much with compression. This is why we at It’s FOSS worked on creating a GUI version of the Ghostscript command that you saw above. + +[Panos][5] from It’s FOSS team [worked on creating a Python-Qt based GUI wrapper for the Ghostscript][6]. The tool gives you a simple UI where you can select your input file, select a compression level and click on the compress button to compress the PDF file. + +![][7] + +The compressed PDF file is saved in the same folder as the original PDF file. Your original PDF file remains untouched. The compressed file is renamed by appending -compressed to the original file name. + +If you are not satisfied with the compression, you can choose another compression level and compress the file again. + +You may find the source code of the PDF Compressor on our GitHub repository. To let you easily use the tool, we have packaged it in AppImage format. Please [refer to this guide to know how to use AppImage][8]. + +[Download PDF Compressor (AppImage)][9] + +Please keep in mind that the tool is in early stages of developments. You may experience some issues. If you do, please let us know in the comments or even better, [file a bug here][10]. + +We’ll try to add more packages (Snap, Deb, PPAs etc) in the future releases. If you have experience with the development and packaging, please feel free to give us a hand. + +Would you like It’s FOSS team to work on creating more such small desktop tools in future? Your feedback and suggestions are welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/compress-pdf-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/convert-multiple-images-pdf-ubuntu-1304/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/compress-pdf-linux.jpg?ssl=1 +[3]: https://www.ghostscript.com/ +[4]: https://itsfoss.com/pdf-editors-linux/ +[5]: https://github.com/libreazer +[6]: https://github.com/itsfoss/compress-pdf +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/compress-PDF.jpg?fit=800%2C448&ssl=1 +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://github.com/itsfoss/compress-pdf/releases/download/0.1/compress-pdf-v0.1-x86_64.AppImage +[10]: https://github.com/itsfoss/compress-pdf/issues From 0b04425e3794f68c0be82a17e8ac509986c8046f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:46:16 +0800 Subject: [PATCH 2144/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Copy?= =?UTF-8?q?Q=20Clipboard=20Manager=20for=20Keeping=20a=20Track=20of=20Clip?= =?UTF-8?q?board=20History?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md --- ...or Keeping a Track of Clipboard History.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md diff --git a/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md b/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md new file mode 100644 index 0000000000..616ee5971a --- /dev/null +++ b/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (CopyQ Clipboard Manager for Keeping a Track of Clipboard History) +[#]: via: (https://itsfoss.com/copyq-clipboard-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +CopyQ Clipboard Manager for Keeping a Track of Clipboard History +====== + +How do you copy-paste text? Let me guess. You either use the right click menu to copy-paste or use Ctrl+C to copy a text and Ctrl+V to paste the text. The text copied this way is saved to ‘clipboard’. The [clipboard][1] is a special location in the memory of your system that stores cut or copied text (and in some cases images). + +But have you ever been in a situation where you had a text copied and then you copy another text and then realize you needed the text you copied earlier? Trust me, it happens a lot. + +Instead of wondering about finding the previous text to copy again, you can use a clipboard manager. + +A clipboard manager is a handy little tool that keeps a history of the text you had copied. If you need to use the earlier copied text, you can use the clipboard manager to copy it again. + +![Clipboard][2] + +There are several clipboard managers available for Linux. In this article, I’ll cover one such tool that goes by the name CopyQ. + +### CopyQ Clipboard Manager + +[CopyQ][3] is nifty clipboard manager that has plenty of features to manage your system’s clipboard. It is an open source software available for free for major Linux distributions. + +Like any other clipboard manager, CopyQ monitors the system clipboard and saves its content. It can save both text and images from the clipboard. + +CopyQ sits in the system tray and you can easily access it from there. From the system tray, just click on the text that you want. It will automatically copy this text and you would notice that the copied text moves on to the top of the saved clipboards. + +![][4] + +In the system tray, it shows only the five recent clips. You can open the main window using the “Show/hide main window” option in the system tray. CopyQ saves up to 200 clips. You may edit the clipboard items here. + +![][5] + +You may also set a keyboard shortcut to bring the clipboard with a few key combination. This option is available in Preferences->Shortcuts. + +![][6] + +If you decide to use it, I advise enabling the autostart so that CopyQ runs automatically when you start your system. By default, it saves 200 items in the history and that’s a lot in my opinion. You may want to change that as well. + +![][7] + +CopyQ is an advanced clipboard manager with plenty of additional features. You can search for text in the saved clipboard items. You can sort, create, edit or change the order of the clipboard items. + +You can ignore clipboard copied from some windows or containing some text. You can also temporarily disable clipboard saving. CopyQ also supports [Vim][8]-like editor and shortcut for Vim fans. + +There are many more features that you may explore on your own. For me, the most notable feature is that it gives me easy access to older copied text, and I am happy with that. + +### Installing CopyQ on Linux + +CopyQ is available for Linux, Windows and macOS. You can get the executable file for Windows and macOS [from its website][3]. + +For Linux, CopyQ is available in the repositories of all major Linux distributions. Which means that you can find it in your software center or install it using your distribution’s package manager. + +Ubuntu users may find it in the software center if [universe repository is enabled][9]. + +![CopyQ in Ubuntu Software Center][10] + +Alternatively, you can use the apt command to install it: + +``` +sudo apt install copyq +``` + +Ubuntu users also have the option to [use the official PPA][11] and always get the latest stable CopyQ version. For example, at the time of writing this article, CopyQ version in Ubuntu 20.04 is 3.10 while [PPA has newer version][12] 3.11. It’s your choice really. + +``` +sudo add-apt-repository ppa:hluk/copyq +sudo apt update +sudo apt install copyq +``` + +You may also want to know [how to remove PPA][13] later. + +### Do you use a clipboard manager? + +I find it surprising that many people are not even aware of an essential utility like clipboard manager. For me, it’s one of the [essential productivity tools on Linux][14]. + +As I mentioned at the beginning of the article, there are several clipboard managers available for Linux. CopyQ is one of such tools. Do you use or know of some other similar clipboard tool? Why not let us know in the comments? + +If you started using CopyQ after reading this article, do share your experience with it. What you liked and what you didn’t like? The comment section is all yours. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/copyq-clipboard-manager/ + +作者:[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.computerhope.com/jargon/c/clipboar.htm +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/clipboard.png?ssl=1 +[3]: https://hluk.github.io/CopyQ/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-system-tray.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-main-window.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-shortcuts.png?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-auto-start.png?ssl=1 +[8]: https://itsfoss.com/vim-8-release-install/ +[9]: https://itsfoss.com/ubuntu-repositories/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-software-center.png?resize=800%2C474&ssl=1 +[11]: https://itsfoss.com/ppa-guide/ +[12]: https://launchpad.net/~hluk/+archive/ubuntu/copyq +[13]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[14]: https://itsfoss.com/productivity-tips-ubuntu/ From 67b1f629460074c7f64d75d6627df88b8c741e21 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:46:40 +0800 Subject: [PATCH 2145/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20What?= =?UTF-8?q?=20to=20do=20When=20You=20See=20=E2=80=9CRepository=20does=20no?= =?UTF-8?q?t=20have=20a=20release=20file=E2=80=9D=20Error=20in=20Ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md --- ...ot have a release file- Error in Ubuntu.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md diff --git a/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md b/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md new file mode 100644 index 0000000000..6cfd9f34de --- /dev/null +++ b/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What to do When You See “Repository does not have a release file” Error in Ubuntu) +[#]: via: (https://itsfoss.com/repository-does-not-have-release-file-error-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What to do When You See “Repository does not have a release file” Error in Ubuntu +====== + +One of the [several ways of installing software in Ubuntu][1] is by using PPA or adding third-party repositories. A few magical lines give you easy access to a software or its newer version that is not available by default in [Ubuntu][2]. + +All thing looks well and good until you get habitual of adding additional third-party repositories and one day, you see an error like this while [updating Ubuntu][3]: + +**E: The repository ‘ focal Release’ does not have a Release file. +N: Updating from such a repository can’t be done securely, and is therefore disabled by default. +N: See apt-secure(8) manpage for repository creation and user configuration details.** + +In this tutorial for Ubuntu beginners, I’ll explain what does this error mean, why do you see it and what can you do to handle this error? + +### Understanding “Repository does not have a release file” error + +![][4] + +Let’s go step by step here. The error message is: + +**E: The repository ‘ focal release’ does not have a release file** + +The important part of this error message is “focal release”. + +You probably already know that [each Ubuntu release has a codename][5]. For Ubuntu 20.04, the codename is Focal Fossa. The “focal” in the error message indicates Focal Fossa which is Ubuntu 20.04. + +The error is basically telling you that though you have added a third-party repository to your system’s sources list, this new repository is not available for your current Ubuntu version. + +_**Why so? Because probably you are using a new version of Ubuntu and the developer has not made the software available for this new version.**_ + +At this point, I highly recommend reading my detailed guides on [PPA][6] and [Ubuntu repositories][7]. These two articles will give you a better, in-depth knowledge of the topic. Trust me, you won’t be disappointed. + +### How to know if the PPA/third party is available for your Ubuntu version [Optional] + +First you should [check your Ubuntu version and its codename][8] using ‘lsb_release -a’ command: + +``` +[email protected]:~$ lsb_release -a +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 20.04 LTS +Release: 20.04 +Codename: focal +``` + +As you can see, the codename it shows is focal. Now the next thing you can do is to go to the website of the software in question. + +This could be the tricky part but you can figure it out with some patience and effort. + +In the example here, the error complained about ****. It is a PPA repository and you may easily find its webpage. How, you may ask. + +Use Google or a [Google alternative search engine][9] like Duck Duck Go and search for “ppa numix”. This should give you the first result from [launchpad.net][10] which is the website used for hosting PPA related code. + +On the webpage of the PPA, you can go to the “Overview of published packages” and filter it by the codename of your Ubuntu version: + +![][11] + +For non-PPA third-party repository, you’ll have to check of the official website of the software and see if the repository is available for your Ubuntu version or not. + +### What to do if the repository is not available for your Ubuntu version + +In case when the repository in question is not available for your Ubuntu version, here’s what you can do: + + * Delete the troublesome repository from your list of repository so that you don’t see the error every time you run the update. + * Get the software from another source (if it is possible). + + + +To delete the troublesome repository, start Software & Updates tool: + +![][12] + +Go to the Other Software tab and look for the repository in question. Highlight it and then click on Remove button to delete it from your system. + +![Remove Ppa][13] + +This will [delete the PPA][14] or the repository in question. + +Next step is to get the software from some other source and that’s totally subjective. In some cases, you can still download the DEB file from the PPA website and use the software (I have explained the steps in the [PPA guide][6]). Alternatively, you can check the project’s website if there is a Snap/Flatpak or Python version of the software available. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/repository-does-not-have-release-file-error-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-remove-software-manjaro/ +[2]: https://ubuntu.com/ +[3]: https://itsfoss.com/update-ubuntu/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Repository-does-not-have-a-release-file.png?ssl=1 +[5]: https://itsfoss.com/linux-code-names/ +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://itsfoss.com/ubuntu-repositories/ +[8]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[9]: https://itsfoss.com/privacy-search-engines/ +[10]: https://launchpad.net/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/check-repo-version.png?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/remove-ppa.jpg?ssl=1 +[14]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ From 0e2d9b3eb48c0916dd972ce393d92d97e24d2383 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:47:00 +0800 Subject: [PATCH 2146/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Ubun?= =?UTF-8?q?tu=20MATE=2020.04=20LTS=20Review:=20Better=20Than=20Ever?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md --- ...MATE 20.04 LTS Review- Better Than Ever.md | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 sources/tech/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md diff --git a/sources/tech/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md b/sources/tech/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md new file mode 100644 index 0000000000..ad62bc57e5 --- /dev/null +++ b/sources/tech/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ubuntu MATE 20.04 LTS Review: Better Than Ever) +[#]: via: (https://itsfoss.com/ubuntu-mate-20-04-review/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu MATE 20.04 LTS Review: Better Than Ever +====== + +Ubuntu MATE 20.04 LTS is undoubtedly one of the most popular [official flavors of Ubuntu][1]. + +It’s not just me, but [Ubuntu 20.04 survey results][2] also pointed out the same. Popular or not, it is indeed an impressive Linux distribution specially for older hardware. As a matter of fact, it is also one of the [best lightweight Linux distros][3] available out there. + +So, I thought of trying it out for a while in a virtual machine setting to provide you an overview of what you can expect out of it. And, whether it’s worth trying out. + +### What’s New In Ubuntu MATE 20.04 LTS? + +[Subscribe to our YouTube channel for more Linux videos][4] + +The primary highlight on Ubuntu MATE 20.04 LTS would be the addition of MATE Desktop 1.24. + +You can expect all the new features of the MATE Desktop 1.24 to come packed in with Ubuntu MATE 20.04. In addition to that, there have been many significant changes, improvements, and additions. + +Here’s an overview of what has changed in Ubuntu MATE 20.04: + + * Addition of MATE Desktop 1.24 + * Numerous visual improvements + * Dozens of bugs fixed + * Based on [Linux Kernel 5.4][5] series + * Addition of experimental [ZFS][6] support + * Addition of GameMode from [Feral Interactive][7]. + * Several package updates + + + +Now, to get a better idea on Ubuntu MATE 20.04, I’ll give you some more details. + +### User Experience Improvements + +![][8] + +Considering that more users are leaning towards Linux on Desktop, the user experience plays a vital role in that. + +If it’s something easy to use and pleasant to look at that makes all the difference as the first impression. + +With Ubuntu MATE 20.04 LTS, I wasn’t disappointed either. Personally, I’m a fan of the latest [GNOME 3.36][9]. I like it on my [Pop OS 20.04][10] but with the presence of [MATE 1.24][11], it Ubuntu MATE was also a good experience. + +You will see some significant changes to the window manager including the addition of **invisible resize borders**, **icons rendering in HiDPI**, **rework of ALT+TAB workspace switcher pop ups**, and a couple of other changes that comes as part of the latest MATE 1.24 desktop. + +![][12] + +Also, **MATE Tweak** has got some sweet improvements where you get to preserve user preferences even if you change the layout of the desktop. The new **MATE Welcome screen** also informs the user about the ability to change the desktop layout, so they don’t have to fiddle around to know about it. + +Among other things, one of my favorite additions would be the **minimized app preview feature**. + +For instance, you have an app minimized but want to get a preview of it before launching it – now you can do that by simply hovering your mouse over the taskbar as shown in the image below. + +![][13] + +Now, I must mention that it does not work as expected for every application. So, I’d still say **this feature is buggy and needs improvements**. + +### App Additions or Upgrades + +![][14] + +With MATE 20.04, you will notice a new **Firmware updater** which is a GTK frontend for [fwupd][15]. You can manage your drivers easily using the updater. + +This release also **replaces** **Thunderbird with the Evolution** email client. While [Thunderbird][16] is a quite popular desktop email client, [Evolution][17] integrates better with the MATE desktop and proves to be more useful. + +![][18] + +Considering that we have MATE 1.24 on board, you will also find a **new time and date manager app**. Not just that, if you need a magnifier, [Magnus][19] comes baked in with Ubuntu MATE 20.04. + +![][20] + +Ubuntu MATE 20.04 also includes upgrades to numerous packages/apps that come pre-installed. + +![][21] + +While these are small additions – but help in a big way to make the distro more useful. + +### Linux Kernel 5.4 + +Ubuntu MATE 20.04 ships with the last major stable kernel release of 2019 i.e [Linux Kernel 5.4][5]. + +With this, you will be getting the native [exFAT support][22] and improved hardware support as well. Not to mention, the support for [WireGuard][23] VPN is also a nice thing to have. + +So, you will be noticing numerous benefits of Linux Kernel 5.4 including the kernel lock down feature. In case you’re curious, you can read our coverage on [Linux Kernel 5.4][5] to get more details on it. + +### Adding GameMode by Feral Interactive + +Feral Interactive – popularly known for bringing games to Linux platform came up with a useful command-line tool i.e. [GameMode][7]. + +You won’t get a GUI – but using the command-line you can apply temporary system optimizations before launching a game. + +While this may not make a big difference for every system but it’s best to have more resources available for gaming and the GameMode ensures that you get the necessary optimizations. + +### Experimental ZFS Install Option + +You get the support for ZFS as your root file system. It is worth noting that it is an experimental feature and should not be used if you’re not sure what you’re doing. + +To get a better idea of ZFS, I recommend you reading one of our articles on [What is ZFS][6] by [John Paul][24]. + +### Performance & Other Improvements + +Ubuntu MATE is perfectly tailored as a lightweight distro and also something fit for modern desktops. + +![][25] + +In this case, I didn’t run any specific benchmark tools- but for an average user, I didn’t find any performance issues in my virtual machine setting. If it helps, I tested this on a host system with an i5-7400 processor with a GTX 1050 graphics card coupled with 16 Gigs of RAM. And, 7 GB of RAM + 768 MB of graphics memory + 2 cores of my processor was allocated for the virtual machine. + +![][26] + +When you test it out yourself, feel free to let me know how it was for you. + +Overall, along with all the major improvements, there are subtle changes/fixes/improvements here and there that makes Ubuntu MATE 20.04 LTS a good upgrade. + +### Should You Upgrade? + +If you are running Ubuntu MATE 19.10, you should proceed upgrading it immediately as the support for it ends in **June 2020.** + +For Ubuntu MATE 18.04 users (**supported until April 2021**) – it depends on what works for you. If you need the features of the latest release, you should choose to upgrade it immediately. + +But, if you don’t necessarily need the new stuff, you can look around for the [list of existing bugs][27] and join the [Ubuntu MATE community][28] to know more about the issues revolving the latest release. + +Once you do the research needed, you can then proceed to upgrade your system to Ubuntu MATE 20.04 LTS which will be **supported until April 2023**. + +_**Have you tried the latest Ubuntu MATE 20.04 yet? What do you think about it? Let me know your thoughts in the comments.**_ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-mate-20-04-review/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/which-ubuntu-install/ +[2]: https://ubuntu.com/blog/ubuntu-20-04-survey-results +[3]: https://itsfoss.com/lightweight-linux-beginners/ +[4]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[5]: https://itsfoss.com/linux-kernel-5-4/ +[6]: https://itsfoss.com/what-is-zfs/ +[7]: https://github.com/FeralInteractive/gamemode +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-20-04.jpg?ssl=1 +[9]: https://itsfoss.com/gnome-3-36-release/ +[10]: https://itsfoss.com/pop-os-20-04-review/ +[11]: https://mate-desktop.org/blog/2020-02-10-mate-1-24-released/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-desktop-layout.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-minimized-app.png?ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-20-04-firmware.png?ssl=1 +[15]: https://fwupd.org +[16]: https://www.thunderbird.net/en-US/ +[17]: https://wiki.gnome.org/Apps/Evolution +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-evolution.png?ssl=1 +[19]: https://kryogenix.org/code/magnus/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-magnus.jpg?ssl=1 +[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-apps.png?ssl=1 +[22]: https://cloudblogs.microsoft.com/opensource/2019/08/28/exfat-linux-kernel/ +[23]: https://wiki.ubuntu.com/WireGuard +[24]: https://itsfoss.com/author/john/ +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-system-reosource.jpg?ssl=1 +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-focal-neofetch.png?ssl=1 +[27]: https://bugs.launchpad.net/ubuntu-mate +[28]: https://ubuntu-mate.community/ From 082304afe99219d190a18f32a2f577a88118c662 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:47:26 +0800 Subject: [PATCH 2147/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200524=20Diam?= =?UTF-8?q?ond=20interface=20composition=20in=20Go=201.14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200524 Diamond interface composition in Go 1.14.md --- ...iamond interface composition in Go 1.14.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 sources/tech/20200524 Diamond interface composition in Go 1.14.md diff --git a/sources/tech/20200524 Diamond interface composition in Go 1.14.md b/sources/tech/20200524 Diamond interface composition in Go 1.14.md new file mode 100644 index 0000000000..611bb2c39e --- /dev/null +++ b/sources/tech/20200524 Diamond interface composition in Go 1.14.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Diamond interface composition in Go 1.14) +[#]: via: (https://dave.cheney.net/2020/05/24/diamond-interface-composition-in-go-1-14) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Diamond interface composition in Go 1.14 +====== + +Per the [overlapping interfaces proposal][1], Go 1.14 now permits embedding of interfaces with overlapping method sets. This is a brief post explain what this change means: + +Let’s start with the definition of the three key interfaces from the `io` package; `io.Reader`, `io.Writer`, and `io.Closer`: + +``` +package io + +type Reader interface { + Read([]byte) (int, error) +} + +type Writer interface { + Write([]byte) (int, error) +} + +type Closer interface { + Close() error +} +``` + +Just as embedding a type inside a struct allows the embedded type’s fields and methods to be accessed as if it were declared on the embedding type[1][2], the process is true for interfaces. Thus there is no difference between explicitly declaring + +``` +type ReadCloser interface { + Read([]byte) (int, error) + Close() error +} +``` + +and using embedding to compose the interface + +``` +type ReadCloser interface { + Reader + Closer +} +``` + +You can even mix and match + +``` +type WriteCloser interface { + Write([]byte) (int, error) + Closer +} +``` + +However, prior to Go 1.14, if you continued to compose interface declarations in this manner you would likely find that something like this, + +``` +type ReadWriteCloser interface { + ReadCloser + WriterCloser +} +``` + +would fail to compile + +``` +% go build interfaces.go +command-line-arguments +./interfaces.go:27:2: duplicate method Close +``` + +Fortunately, with Go 1.14 this is no longer a limitation, thus solving problems that typically occur with diamond-shaped embedding graphs. + +However, there is a catch that I ran into attempting to demonstrate this feature to the local user group–this feature is only enabled when the Go compiler uses the 1.14 (or later) spec. + +As near as I can make out the rules for which version of the Go spec is used during compilation appear to be: + + 1. If your source code is stored inside `GOPATH` (or you have _disabled_ modules with `GO111MODULE=off`) then the version of the Go spec used to compile with matches the version of the compiler you are using. Said another way, if you have Go 1.13 installed, your Go version is 1.13. If you have Go 1.14 installed, your version is 1.14. No surprises here. + 2. If your source code is stored outside `GOPATH` (or you have forced modules on with `GO111MODULE=on`) then the `go` tool will take the Go version from the `go.mod` file. + 3. If there is no Go version listed in `go.mod` then the version of the spec will be the version of Go installed. This is identical to point 1. + 4. If you are in module mode, either by being outside `GOPATH` or with `GO111MODULE=on`, but there is no `go.mod` file in the current, or any parent, directory then the version of the Go spec used to compile your code defaults to Go 1.13. + + + +The last point caught me out. + + 1. It is said that embedding promotes the type’s fields and methods.[][3] + + + +### Related posts: + + 1. [Struct composition with Go][4] + 2. [term: low level serial with a high level interface][5] + 3. [Accidental method value][6] + 4. [How does the go build command work ?][7] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/24/diamond-interface-composition-in-go-1-14 + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/proposal/blob/master/design/6977-overlapping-interfaces.md +[2]: tmp.nUQHg5BP9T#easy-footnote-bottom-1-4179 (It is said that embedding promotes the type’s fields and methods.) +[3]: tmp.nUQHg5BP9T#easy-footnote-1-4179 +[4]: https://dave.cheney.net/2015/05/22/struct-composition-with-go (Struct composition with Go) +[5]: https://dave.cheney.net/2014/05/08/term-low-level-serial-with-a-high-level-interface (term: low level serial with a high level interface) +[6]: https://dave.cheney.net/2014/05/19/accidental-method-value (Accidental method value) +[7]: https://dave.cheney.net/2013/10/15/how-does-the-go-build-command-work (How does the go build command work ?) From bfc2e73b7e593a3f39c05cb017544a25e8b1e662 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 May 2020 10:47:46 +0800 Subject: [PATCH 2148/3057] PRF @wxy --- ...tration of Kubernetes clusters with k9s.md | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md b/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md index 811278a001..ce71f05b26 100644 --- a/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md +++ b/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md @@ -1,57 +1,57 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Speed up administration of Kubernetes clusters with k9s) [#]: via: (https://opensource.com/article/20/5/kubernetes-administration) [#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) -用 k9s 加速 Kubernetes 集群管理 +k9s:你没看错,这是一个加速 k8s 集群管理的工具 ====== > 看看这个很酷的 Kubernetes 管理的终端 UI。 -![Dogs playing chess][1] +![](https://img.linux.net.cn/data/attachment/album/202005/25/104742pqjmiroc44honcs5.jpg) -通常情况下,我写的关于 Kubernetes 管理的文章中,都是做集群管理的 `kubectl` 命令。然而最近,有人给我介绍了 [k9s][2] 项目,可以让我快速查看和解决 Kubernetes 中的日常问题。这对我的工作流程有了很大的改善,我将在本教程中告诉你如何上手。  +通常情况下,我写的关于 Kubernetes 管理的文章中用的都是做集群管理的 `kubectl` 命令。然而最近,有人给我介绍了 [k9s][2] 项目,可以让我快速查看并解决 Kubernetes 中的日常问题。这极大地改善了我的工作流程,我会在这篇教程中告诉你如何上手它。  -它的安装可以在 Mac、Windows 和 Linux 中进行。每种操作系统的说明可以在这里找到[这里][2]。请务必完成安装,以便能够跟上本教程。 +它可以安装在 Mac、Windows 和 Linux 中,每种操作系统的说明可以在[这里][2]找到。请先完成安装,以便能够跟上本教程。 -我将使用 Linux 和 Minikube,这是一种在个人电脑上运行 Kubernetes 的轻量级方式。按照[此教程][3]或使用[该文档][4]来安装它。 +我会使用 Linux 和 Minikube,这是一种在个人电脑上运行 Kubernetes 的轻量级方式。按照[此教程][3]或使用[该文档][4]来安装它。 ### 设置 k9s 配置文件 -安装好 `k9s` 应用后,从帮助命令开始总是很好的。 +安装好 `k9s` 应用后,从帮助命令开始总是很好的起点。 ``` $ k9s help ``` -正如你所看到的,我们可以用 `k9s` 来配置很多功能。我们唯一需要进行的步骤就是写一个配置文件。而`info` 命令会告诉我们应用程序要在哪里找该配置文件。 +正如你在帮助信息所看到的,我们可以用 `k9s` 来配置很多功能。我们唯一需要进行的步骤就是编写配置文件。而 `info` 命令会告诉我们该应用程序要在哪里找它的配置文件。 ``` $ k9s info - ____  __.________ -|    |/ _/   __   \\______ -|      < \\____    /  ___/ -|    |  \   /    /\\___ \ -|____|__ \ /____//____  > -        \/            \/ + ____ __.________ +| |/ _/ __ \______ +| < \____ / ___/ +| | \ / /\___ \ +|____|__ \ /____//____ > + \/ \/ -Configuration:   /Users/jess/.k9s/config.yml -Logs:            /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log -Screen Dumps:    /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess +Configuration: /Users/jess/.k9s/config.yml +Logs: /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log +Screen Dumps: /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess ``` -如果要添加一个配置文件,该目录不存在的话就创建一个目录,然后添加一个配置文件。 +如果要添加配置文件,该配置目录不存在的话就创建它,然后添加一个配置文件。 ``` $ mkdir -p ~/.k9s/ $ touch ~/.k9s/config.yml ``` -在这篇介绍中,我们将使用 k9s 版本库中推荐的默认 `config.yml`。维护者注意,这种格式可能会有变化,所以我们可以[在这里查看][5]最新版本。 +在这篇介绍中,我们将使用 `k9s` 版本库中推荐的默认 `config.yml`。维护者请注意,这种格式可能会有变化,可以[在这里查看][5]最新版本。 ``` k9s: @@ -73,7 +73,7 @@ k9s:       namespace:         active: ""         favorites: -       - all +        - all         - kube-system         - default       view: @@ -87,7 +87,7 @@ k9s:       warn: 70 ``` -我们设置了 `k9s` 寻找本地的 minikube 配置,所以我要确认 minikube 已经上线了,就可以使用了。 +我们设置了 `k9s` 寻找本地的 minikube 配置,所以我要确认 minikube 已经上线可以使用了。 ``` $ minikube status @@ -105,26 +105,26 @@ kubeconfig: Configured $ k9s ``` -启动后,会弹出 `k9s` 基于文本的用户界面。在没有命名空间标志的情况下,它会向你显示默认命名空间中的 Pod。 +启动后,会弹出 `k9s` 的基于文本的用户界面。在没有指定命名空间标志的情况下,它会向你显示默认命名空间中的 Pod。 ![K9s screenshot][6] -如果你运行在一个有很多 Pod 的环境中,默认的视图可能会让人不知所措。或者,我们可以将注意力集中在给定的命名空间上。退出应用程序,运行 `k9s -n `,其中 ``` 是已有的命名空间。在下图中,我运行了 `k9s -n minecraft`,它显示了我的损坏的 Pod: +如果你运行在一个有很多 Pod 的环境中,默认视图可能会让人不知所措。或者,我们可以将注意力集中在给定的命名空间上。退出该应用程序,运行 `k9s -n `,其中 `` 是已存在的命名空间。在下图中,我运行了 `k9s -n minecraft`,它显示了我损坏的 Pod: ![K9s screenshot][7] 所以,一旦你有了 `k9s` 后,有很多事情你可以更快地完成。  -通过快捷键来导航 `k9s`,我们可以随时使用方向键和回车键来选择列出的项目。还有不少其他的通用快捷键来导航到不同的视图。 +通过快捷键来导航 `k9s`,我们可以随时使用方向键和回车键来选择列出的项目。还有不少其他的通用快捷键可以导航到不同的视图。 * `0`:显示在所有命名空间中的所有 Pod ![K9s screenshot][8] * `d`:描述所选的 Pod - ![K9s screenshot][9] + ![K9s screenshot][9] * `l`:显示所选的 Pod 的日志 ![Using k9s to show Kubernetes pod logs][10] -你可能会注意到 `k9s` 被设置为使用 [Vim 命令键][11],包括使用 `J` 和 `K` 键上下移动。Emacs 用户们,败退吧 :) +你可能会注意到 `k9s` 设置为使用 [Vim 命令键][11],包括使用 `J` 和 `K` 键上下移动等。Emacs 用户们,败退吧 :) ### 快速查看不同的 Kubernetes 资源 @@ -141,11 +141,11 @@ $ k9s * `:cj`:跳转到 cronjob 视图,查看集群中计划了哪些作业。 ![K9s screenshot][17] -这个应用最常用的工具是键盘;要在任何页面上往上或往下翻页,请使用方向键。如果你需要退出,记得使用 Vim 键绑定。键入 `:q`,然后按回车键离开。 +这个应用最常用的工具是键盘;要在任何页面往上或下翻页,请使用方向键。如果你需要退出,记得使用 Vim 绑定键,键入 `:q`,然后按回车键离开。 ### 用 k9s 排除 Kubernetes 的故障示例 -当出现故障的时候,`k9s` 怎么帮忙?举个例子,我让几个 Pod 由于配置错误而死机。下面你可以看到我那个可怜的 “hello” 部署死了。当我们将其高亮显示出来,可以按 `d` 运行 `describe` 命令,看看是什么原因导致了故障。 +当出现故障的时候,`k9s` 怎么帮忙?举个例子,我让几个 Pod 由于配置错误而死亡。下面你可以看到我那个可怜的 “hello” 部署死了。当我们将其高亮显示出来,可以按 `d` 运行 `describe` 命令,看看是什么原因导致了故障。 ![K9s screenshot][18] @@ -155,15 +155,15 @@ $ k9s ![K9s screenshot][20] -不幸的是,日志也没有提供任何有用的信息(可能是因为部署从未正确配置过),而且 Pod也不会出现。 +不幸的是,日志也没有提供任何有用的信息(可能是因为部署从未正确配置过),而且 Pod 也没有出现。 -然后我使用 `esc` 退了出来,我看看删除 Pod 是否能解决这个问题。要做到这一点,我高亮显示 Pod,然后使用 `ctrl-d`。幸好 `k9s` 在删除前会提示用户。  +然后我使用 `esc` 退了出来,我看看删除 Pod 是否能解决这个问题。要做到这一点,我高亮显示该 Pod,然后使用 `ctrl-d`。幸好 `k9s` 在删除前会提示用户。  ![K9s screenshot][21] -虽然我确实删除了这个 Pod,但部署资源仍然存在,所以新的 Pod 会重新出现。它还会继续重启并死掉,无论什么原因(我们还不知道)。 +虽然我确实删除了这个 Pod,但部署资源仍然存在,所以新的 Pod 会重新出现。无论什么原因(我们还不知道),它还会继续重启并死掉。 -在这里,我会重复查看日志,描述资源,甚至使用 `e` 快捷方式来编辑运行中的 Pod 以排除故障行为。在这个特殊情况下,失败的 Pod 没有配置在这个环境下运行。因此,让我们删除部署来停止崩溃接着重启的循环。 +在这里,我会重复查看日志,描述资源,甚至使用 `e` 快捷方式来编辑运行中的 Pod 以排除故障行为。在这个特殊情况下,失败的 Pod 是因为没有配置在这个环境下运行。因此,让我们删除部署来停止崩溃接着重启的循环。 我们可以通过键入 `:deploy` 并点击回车进入部署。从那里我们高亮显示并按 `ctrl-d` 来删除。 @@ -171,13 +171,13 @@ $ k9s ![K9s screenshot][23] -部署失败了! 只用了几个按键就把这个失败的部署给清理掉了。 +这个有问题的部署被干掉了! 只用了几个按键就把这个失败的部署给清理掉了。 ### k9s 是极其可定制的 -这个应用有很多自定义选项,乃至于 UI 的配色方案。这里有几个可编辑的选项,你可能会感兴趣。 +这个应用有很多自定义选项、乃至于 UI 的配色方案。这里有几个可编辑的选项,你可能会感兴趣。 -* 调整你把 `config.yml` 文件放置的位置(这样你就可以把它存储在[版本控制][24]中)。 +* 调整你放置 `config.yml` 文件的位置(这样你就可以把它存储在[版本控制][24]中)。 * 在 `alias.yml` 文件中添加[自定义别名][25]。 * 在 `hotkey.yml` 文件中创建[自定义热键][26]。 * 探索现有的[插件][27]或编写自己的插件。 @@ -186,7 +186,7 @@ $ k9s ### 用 k9s 简化你的生活 -我很容易在团队的系统上用非常人工的方式进行管理,更多的是为了锻炼脑力,而不是别的。当我第一次听说 `k9s` 的时候,我想,“这只是懒惰的 Kubernetes 而已。”于是我否定了它,回到了到处进行人工干预的状态。实际上,我在处理我的积压工作时就开始每天使用它,我觉得它的使用速度比单独使用 `kubectl` 快得多,这让我大吃一惊。现在,我已经皈依了。  +我倾向于以一种非常手动的方式来管理我团队的系统,更多的是为了锻炼脑力,而不是别的。当我第一次听说 `k9s` 的时候,我想,“这只是懒惰的 Kubernetes 而已。”于是我否定了它,然后回到了到处进行人工干预的状态。实际上,当我在处理积压工作时就开始每天使用它,而让我震惊的是它比单独使用 `kubectl` 快得多。现在,我已经皈依了。  了解你的工具并掌握做事情的“硬道理”很重要。还有一点很重要的是要记住,就管理而言,重要的是要更聪明地工作,而不是更努力。使用 `k9s`,就是我践行这个目标的方法。我想,我们可以把它叫做懒惰的 Kubernetes 管理,也没关系。 @@ -197,7 +197,7 @@ via: https://opensource.com/article/20/5/kubernetes-administration 作者:[Jessica Cherry][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fe985a1944d86cea62046c05796335ec2e2cc330 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:48:46 +0800 Subject: [PATCH 2149/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200522=20Turn?= =?UTF-8?q?=20your=20Raspberry=20Pi=20homelab=20into=20a=20network=20files?= =?UTF-8?q?ystem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200522 Turn your Raspberry Pi homelab into a network filesystem.md --- ...ry Pi homelab into a network filesystem.md | 310 ++++++++++++++++++ 1 file changed, 310 insertions(+) create mode 100644 sources/tech/20200522 Turn your Raspberry Pi homelab into a network filesystem.md diff --git a/sources/tech/20200522 Turn your Raspberry Pi homelab into a network filesystem.md b/sources/tech/20200522 Turn your Raspberry Pi homelab into a network filesystem.md new file mode 100644 index 0000000000..1880949d15 --- /dev/null +++ b/sources/tech/20200522 Turn your Raspberry Pi homelab into a network filesystem.md @@ -0,0 +1,310 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Turn your Raspberry Pi homelab into a network filesystem) +[#]: via: (https://opensource.com/article/20/5/nfs-raspberry-pi) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +Turn your Raspberry Pi homelab into a network filesystem +====== +Add shared filesystems to your homelab with an NFS server. +![Blue folders flying in the clouds above a city skyline][1] + +A shared filesystem is a great way to add versatility and functionality to a homelab. Having a centralized filesystem shared to the clients in the lab makes organizing data, doing backups, and sharing data considerably easier. This is especially useful for web applications load-balanced across multiple servers and for persistent volumes used by [Kubernetes][2], as it allows pods to be spun up with persistent data on any number of nodes. + +Whether your homelab is made up of ordinary computers, surplus enterprise servers, or Raspberry Pis or other single-board computers (SBCs), a shared filesystem is a useful asset, and a network filesystem (NFS) server is a great way to create one. + +I have written before about [setting up a "private cloud at home][3]," a homelab made up of Raspberry Pis or other SBCs and maybe some other consumer hardware or a desktop PC. An NFS server is an ideal way of sharing data between these components. Since most SBCs' operating systems (OSes) run off an SD card, there are some challenges. SD cards suffer from increased failures, especially when used as the OS disk for a computer, and they are not made to be constantly read from and written to. What you really need is a real hard drive: they are generally cheaper per gigabyte than SD cards, especially for larger disks, and they are less likely to sustain failures. Raspberry Pi 4's now come with USB 3.0 ports, and USB 3.0 hard drives are ubiquitous and affordable. It's a perfect match. For this project, I will use a 2TB USB 3.0 external hard drive plugged into a Raspberry Pi 4 running an NFS server. + +![Raspberry Pi with a USB hard disk][4] + +(Chris Collins, [CC BY-SA 4.0][5]) + +### Install the NFS server software + +I am running Fedora Server on a Raspberry Pi, but this project can be done with other distributions as well. To run an NFS server on Fedora, you need the nfs-utils package, and luckily it is already installed (at least in Fedora 31). You also need the rpcbind package if you are planning to run NFSv3 services, but it is not strictly required for NFSv4. + +If these packages are not already on your system, install them with the **dnf** command: + + +``` +# Intall nfs-utils and rpcbind +$ sudo dnf install nfs-utils rpcbind +``` + +Raspbian is another popular OS used with Raspberry Pis, and the setup is almost exactly the same. The package names differ, but that is about the only major difference. To install an NFS server on a system running Raspbian, you need the following packages: + + * **nfs-common:** These files are common to NFS servers and clients + * **nfs-kernel-server:** The main NFS server software package + + + +Raspbian uses **apt-get** for package management (not **dnf**, as Fedora does), so use that to install the packages: + + +``` +# For a Raspbian system, use apt-get to install the NFS packages +$ sudo apt-get install nfs-common nfs-kernel-server +``` + +### Prepare a USB hard drive as storage + +As I mentioned above, a USB hard drive is a good choice for providing storage for Raspberry Pis or other SBCs, especially because the SD card used for the OS disk image is not ideal. For your private cloud at home, you can use cheap USB 3.0 hard drives for large-scale storage. Plug the disk in and use **fdisk** to find out the device ID assigned to it, so you can work with it. + + +``` +# Find your disk using fdisk +# Unrelated disk content omitted +$ sudo fdisk -l + +Disk /dev/sda: 1.84 TiB, 2000398933504 bytes, 3907029167 sectors +Disk model: BUP Slim BK +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xe3345ae9 + +Device     Boot Start        End    Sectors  Size Id Type +/dev/sda1        2048 3907028991 3907026944  1.8T 83 Linux +``` + +For clarity, in the example output above, I omitted all the disks except the one I'm interested in. You can see the USB disk I want to use was assigned the device **/dev/sda**, and you can see some information about the model (**Disk model: BUP Slim BK**), which helps me identify the correct disk. The disk already has a partition, and its size confirms it is the disk I am looking for. + +_Note:_ Make sure to identify the correct disk and partition for your device. It may be different than the example above. + +Each partition created on a drive gets a special universally unique identifier (UUID). The computer uses the UUID to make sure it is mounting the correct partition to the correct location using the **/etc/fstab** config file. You can retrieve the UUID of the partition using the **blkid** command: + + +``` +# Get the block device attributes for the partition +# Make sure to use the partition that applies in your case.  It may differ. +$ sudo blkid /dev/sda1 + +/dev/sda1: LABEL="backup" UUID="bd44867c-447c-4f85-8dbf-dc6b9bc65c91" TYPE="xfs" PARTUUID="e3345ae9-01" +``` + +In this case, the UUID of **/dev/sda1** is **bd44867c-447c-4f85-8dbf-dc6b9bc65c91**. Yours will be different, so make a note of it. + +### Configure the Raspberry Pi to mount this disk on startup, then mount it + +Now that you have identified the disk and partition you want to use, you need to tell the computer how to mount it, to do so whenever it boots up, and to go ahead and mount it now. Because this is a USB disk and might be unplugged, you will also configure the Raspberry Pi to not wait on boot if the disk is not plugged in or is otherwise unavailable. + +In Linux, this is done by adding the partition to the **/etc/fstab** configuration file, including where you want it to be mounted and some arguments to tell the computer how to treat it. This example will mount the partition to **/srv/nfs**, so start by creating that path: + + +``` +# Create the mountpoint for the disk partition +$ sudo mkdir -p /srv/nfs +``` + +Next, modify the **/etc/fstab** file using the following syntax format: + + +``` +`                   ` +``` + +Use the UUID you identified earlier for the disk ID. As I mentioned in the prior step, the mountpoint is **/srv/nfs**. For the filesystem type, it is usually best to select the actual filesystem, but since this will be a USB disk, use **auto**. + +For the options values, use **nosuid,nodev,nofail**. + +#### An aside about man pages: + +That said, there are a _lot_ of possible options, and the manual (man) pages are the best way to see what they are. Investigating the man page for for fstab is a good place to start: + + +``` +# Open the man page for fstab +$ man fstab +``` + +This opens the manual/documentation associated with the fstab command. In the man page, each of the options is broken down to show what it does and the common selections. For example, **The fourth field (fs_mntopts)** gives some basic information about the options that work in that field and directs you to **man (8) mount** for more in-depth description of the mount options. That makes sense, as the **/etc/fstab** file, in essence, tells the computer how to automate mounting disks, in the same way you would manually use the mount command. + +You can get more information about the options you will use from mount's man page. The numeral 8, in parentheses, indicates the man page section. In this case, section 8 is for _System Administration tools and Daemons_. + +Helpfully, you can get a list of the standard sections from the man page for **man**. + +Back to mountng the disk, take a look at **man (8) mount**: + + +``` +# Open Section 8 of the man pages for mount +$ man (8) mount +``` + +In this man page, you can examine what the options listed above do: + + * **nosuid:** Do not honor the suid/guid bit. Do not allow any files that might be on the USB disk to be executed as root. This is a good security practice. + * **nodev:** Do not interpret characters or block special devices on the file system; i.e., do not honor any device nodes that might be on the USB disk. Another good security practice. + * **nofail:** Do not log any errors if the device does not exist. This is a USB disk and might not be plugged in, so it will be ignored if that is the case. + + + +Returning to the line you are adding to the **/etc/fstab** file, there are two final options: **fs_freq** and **fs_passno**. Their values are related to somewhat legacy options, and _most_ modern systems just use a **0** for both, especially for filesystems on USB disks. The fs_freq value relates to the dump command and making dumps of the filesystem. The fs_passno value defines which filesystems to **fsck** on boot and their order. If it's set, usually the root partition would be **1** and any other filesystems would be **2**. Set the value to **0** to skip using **fsck** on this partition. + +In your preferred editor, open the **/etc/fstab** file and add the entry for the partition on the USB disk, replacing the values here with those gathered in the previous steps. + + +``` +# With sudo, or as root, add the partition info to the /etc/fstab file +UUID="bd44867c-447c-4f85-8dbf-dc6b9bc65c91"    /srv/nfs    auto    nosuid,nodev,nofail,noatime 0 0 +``` + +### Enable and start the NFS server + +With the packages installed and the partition added to your **/etc/fstab** file, you can now go ahead and start the NFS server. On a Fedora system, you need to enable and start two services: **rpcbind** and **nfs-server**. Use the **systemctl** command to accomplish this: + + +``` +# Start NFS server and rpcbind +$ sudo systemctl enable rpcbind.service +$ sudo systemctl enable nfs-server.service +$ sudo systemctl start rpcbind.service +$ sudo systemctl start nfs-server.service +``` + +On Raspbian or other Debian-based distributions, you just need to enable and start the **nfs-kernel-server** service using the **systemctl** command the same way as above. + +#### RPCBind + +The rpcbind utility is used to map remote procedure call (RPC) services to ports on which they listen. According to the rpcbind man page: + +> "When an RPC service is started, it tells rpcbind the address at which it is listening, and the RPC program numbers it is prepared to serve. When a client wishes to make an RPC call to a given program number, it first contacts rpcbind on the server machine to determine the address where RPC requests should be sent." + +In the case of an NFS server, rpcbind maps the protocol number for NFS to the port on which the NFS server is listening. However, NFSv4 does not require the use of rpcbind. If you use _only_ NFSv4 (by removing versions two and three from the configuration), rpcbind is not required. I've included it here for backward compatibility with NFSv3. + +### Export the mounted filesystem + +The NFS server decides which filesystems are shared with (exported to) which remote clients based on another configuration file, **/etc/exports**. This file is just a map of host internet protocol (IP) addresses (or subnets) to the filesystems to be shared and some options (read-only or read-write, root squash, etc.). The format of the file is: + + +``` +`     (options)` +``` + +In this example, you will export the partition mounted to **/srv/nfs**. This is the "directory" piece. + +The second part, the host or hosts, includes the hosts you want to export this partition to. These can be specified as a single host with a fully qualified domain name or hostname, the IP address of the host, a number of hosts using wildcard characters to match domains (e.g., *.example.org), IP networks (e.g., classless inter-domain routing, or CIDR, notation), or netgroups. + +The third piece includes options to apply to the export: + + * **ro/rw:** Export the filesystem as read only or read write + * **wdelay:** Delay writes to the disk if another write is imminent to improve performance (this is _probably_ not as useful with a solid-state USB disk, if that is what you are using) + * **root_squash:** Prevent any root users on the client from having root access on the host, and set the root UID to **nfsnobody** as a security precaution + + + +Test exporting the partition you have mouted at **/srv/nfs** to a single client—for example, a laptop. Identify your client's IP address (my laptop's is **192.168.2.64**, but yours will likely be different). You could share it to a large subnet, but for testing, limit it to the single IP address. The CIDR notation for just this IP is **192.168.2.64/32**; a **/32** subnet is just a single IP. + +Using your preferred editor, edit the **/etc/exports** file with your directory, host CIDR, and the **rw** and **root_squash** options: + + +``` +# Edit your /etc/exports file like so, substituting the information from your systems +/srv/nfs    192.168.2.64/32(rw,root_squash) +``` + +_Note:_ If you copied the **/etc/exports** file from another location or otherwise overwrote the original with a copy, you may need to restore the SELinux context for the file. You can do this with the **restorecon** command: + + +``` +# Restore the SELinux context of the /etc/exports file +$ sudo restorecon /etc/exports +``` + +Once this is done, restart the NFS server to pick up the changes to the **/etc/exports** file: + + +``` +# Restart the nfs server +$ sudo systemctl restart nfs-server.service +``` + +### Open the firewall for the NFS service + +Some systems, by default, do not run a [firewall service][6]. Raspbian, for example, defaults to open iptables rules, with ports opened by different services immediately available from outside the machine. Fedora server, by contrast, runs the firewalld service by default, so you must open the port for the NFS server (and rpcbind, if you will be using NFSv3). You can do this with the **firewall-cmd** command. + +Check the zones used by firewalld and get the default zone. For Fedora Server, this will be the FedoraServer zone: + + +``` +# List the zones +# Output omitted for brevity +$ sudo firewall-cmd --list-all-zones + +# Retrieve just the default zone info +# Make a note of the default zone +$ sudo firewall-cmd --get-default-zone + +# Permanently add the nfs service to the list of allowed ports +$ sudo firewall-cmd --add-service=nfs --permanent + +# For NFSv3, we need to add a few more ports, nfsv3, rpc-mountd, rpc-bind +$ sudo firewall-cmd --add-service=(nfs3,mountd,rpc-bind) + +# Check the services for the zone, substituting the default zone in use by your system +$ sudo firewall-cmd --list-services --zone=FedoraServer + +# If all looks good, reload firewalld +$ sudo firewall-cmd --reload +``` + +And with that, you have successfully configured the NFS server with your mounted USB disk partition and exported it to your test system for sharing. Now you can test mounting it on the system you added to the exports list. + +### Test the NFS exports + +First, from the NFS server, create a file to read in the **/srv/nfs** directory: + + +``` +# Create a test file to share +echo "Can you see this?" >> /srv/nfs/nfs_test +``` + +Now, on the client system you added to the exports list, first make sure the NFS client packages are installed. On Fedora systems, this is the **nfs-utils** package and can be installed with **dnf**. Raspbian systems have the **libnfs-utils** package that can be installed with **apt-get**. + +Install the NFS client packages: + + +``` +# Install the nfs-utils package with dnf +$ sudo dnf install nfs-utils +``` + +Once the client package is installed, you can test out the NFS export. Again on the client, use the mount command with the IP of the NFS server and the path to the export, and mount it to a location on the client, which for this test is the **/mnt** directory. In this example, my NFS server's IP is **192.168.2.109**, but yours will likely be different: + + +``` +# Mount the export from the NFS server to the client host +# Make sure to substitute the information for your own hosts +$ sudo mount 192.168.2.109:/srv/nfs /mnt + +# See if the nfs_test file is visible: +$ cat /mnt/nfs_test +Can you see this? +``` + +Success! You now have a working NFS server for your homelab, ready to share files with multiple hosts, allow multi-read/write access, and provide centralized storage and backups for your data. There are many options for shared storage for homelabs, but NFS is venerable, efficient, and a great option to add to your "private cloud at home" homelab. Future articles in this series will expand on how to automatically mount NFS shares on clients and how to use NFS as a storage class for Kubernetes Persistent Volumes. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/nfs-raspberry-pi + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO (Blue folders flying in the clouds above a city skyline) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://opensource.com/article/20/5/disk-image-raspberry-pi +[4]: https://opensource.com/sites/default/files/uploads/raspberrypi_with_hard-disk.jpg (Raspberry Pi with a USB hard disk) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/article/18/9/linux-iptables-firewalld From 9e5006889aa4a9ce01cd5c177c853ada99936c4a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:49:11 +0800 Subject: [PATCH 2150/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200522=20Fast?= =?UTF-8?q?=20data=20modeling=20with=20JavaScript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200522 Fast data modeling with JavaScript.md --- ...0522 Fast data modeling with JavaScript.md | 452 ++++++++++++++++++ 1 file changed, 452 insertions(+) create mode 100644 sources/tech/20200522 Fast data modeling with JavaScript.md diff --git a/sources/tech/20200522 Fast data modeling with JavaScript.md b/sources/tech/20200522 Fast data modeling with JavaScript.md new file mode 100644 index 0000000000..9c565d6e90 --- /dev/null +++ b/sources/tech/20200522 Fast data modeling with JavaScript.md @@ -0,0 +1,452 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fast data modeling with JavaScript) +[#]: via: (https://opensource.com/article/20/5/data-modeling-javascript) +[#]: author: (Szymon https://opensource.com/users/schodevio) + +Fast data modeling with JavaScript +====== +This tutorial showcases a method to model data in just a few minutes. +![Analytics: Charts and Graphs][1] + +As a backend developer at the [Railwaymen][2], a software house in Kraków, Poland, some of my tasks rely on models that manipulate and customize data retrieved from a database. When I wanted to improve my skills in frontend frameworks, I [chose Vue][3], and I thought it would be good to have a similar way to model data in a store. I started with some libraries that I found through [NPM][4], but they offered many more features than I needed. + +So I decided to build my own solution, and I was very surprised that the base took less than 15 lines of code and is very flexible. I implemented this solution in an open source application which I developed and called [Evally][5] - a web app that helps businesses keep track of their employees' performance reviews and professional development. It reminds managers or HR representatives about employees' upcoming evaluations and gathers all of the data needed to assess their performance in the fairest way. + +### Model and list + +The only things you need to do are to create a class and use the defaultsDeep function in the [Lodash][6] JavaScript library: + + +``` +`_.defaultsDeep(object, [sources])` +``` + +Arguments: + + * `object (Object)`: The destination object + * `[sources] (...Object)`: The source objects + + + +Returns: + + * `(Object)`: Returns object + + + +This helper function: [Lodash Docs][7] + +> "Assigns recursively own and inherited enumerable string keyed properties of source objects to the destination object for all destination properties that resolve to undefined. Source objects are applied from left to right. Once a property is set, additional values of the same property are ignored." + +For example: + + +``` +_.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }) + // => { 'a': { 'b': 2, 'c': 3 } } +``` + +That's all! To try it out, create a file called **base.js** and import the defaultsDeep function from the Lodash package: + + +``` + // base.js + import defaultsDeep from "lodash/defaultsDeep"; +``` + +Next, create and export the Model class, where constructor will use the Lodash helper function to assign values to all passed attributes and initialize the attributes that were not received with default values: + + +``` + // base.js + // ... + + export class Model { +   constructor(attributes = {}) { +     defaultsDeep(this, attributes, this.defaults); +   } + } +``` + +Now, create your first real model, Employee, with attributes for firstName, lastName, position and hiredAt where "position" defines "Programmer" as the default value: + + +``` + // employee.js + import { Model } from "./base.js"; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + } +``` + +Next, begin creating employees: + + +``` +// app.js + import { Employee } from "./employee.js"; + + const programmer = new Employee({ +   firstName: "Will", +   lastName: "Smith" + }); + + // => Employee { + //   firstName: "Will", + //   lastName: "Smith", + //   position: "Programmer", + //   hiredAt: "", + //   constructor: Object + // } + + const techLeader = new Employee({ +   firstName: "Charles", +   lastName: "Bartowski", +   position: "Tech Leader" + }); + + // => Employee { + //   firstName: "Charles", + //   lastName: "Bartowski", + //   position: "Tech Leader", + //   hiredAt: "", + //   constructor: Object + // } +``` + +You have two employees, and the first one's position is assigned from the defaults. Here's how multiple employees can be defined: + + +``` + // base.js + + // ... + + export class List { +   constructor(items = []) { +     this.models = items.map(item => new this.model(item)); +   } + } + +[/code] [code] + + // employee.js + import { Model, List } from "./base.js"; + + // … + + export class EmployeesList extends List { +   get model() { +     return Employee; +   } + } +``` + +The List class constructor maps an array of received items into an array of desired models. The only requirement is to provide a correct model class name: + + +``` + // app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + const employees = new EmployeesList([ +   { +     firstName: "Will", +     lastName: "Smith" +   }, +   { +     firstName: "Charles", +     lastName: "Bartowski", +     position: "Tech Leader" +   } + ]); + + // => EmployeesList {models: Array[2], constructor: Object} + //  models: Array[2] + //   0: Employee + //     firstName: "Will" + //     lastName: "Smith" + //     position: "Programmer" + //     hiredAt: "" + //     <constructor>: "Employee" + //   1: Employee + //     firstName: "Charles" + //     lastName: "Bartowski" + //     position: "Tech Leader" + //     hiredAt: "" + //     <constructor>: "Employee" + //   <constructor>: "EmployeesList" +``` + +### Ways to use this approach + +This simple solution allows you to keep your data structure in one place and avoid code repetition. The [DRY][8] principle rocks! You can also customize your models as needed, such as in the following examples. + +#### Custom getters + +Do you need one attribute to be dependent on the others? No problem; you can do this by improving your Employee model: + + +``` +// employee.js + import { Model } from "./base.js"; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + +   get fullName() { +     return [this.firstName, this.lastName].join(' ') +   } + + } + +[/code] [code] + +// app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + console.log(techLeader.fullName); + // => Charles Bartowski +``` + +Now you don't have to repeat the code to do something as simple as displaying the employee's full name. + +#### Date formatting + +Model is a good place to define other formats for given attributes. The best examples are dates: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + +   get formattedHiredDate() { +     if (!this.hiredAt) return "---"; + +     return moment(this.hiredAt).format('MMMM DD, YYYY'); +   } + } + +[/code] [code] + +// app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + techLeader.hiredAt = "2020-05-01"; + + console.log(techLeader.formattedHiredDate); + // => May 01, 2020 +``` + +Another case related to dates (which I discovered developing the Evally app) is the ability to operate with different date formats. Here's an example that uses datepicker: + + 1. All employees fetched from the database have the hiredAt date in the format: +YEAR-MONTH-DAY, e.g., 2020-05-01 + 2. You need to display the hiredAt date in a more friendly format: +MONTH DAY, YEAR, e.g., May 01, 2020 + 3. A datepicker uses the format: +DAY-MONTH-YEAR, e.g., 01-05-2020 + + + +Resolve this issue with: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { + +   // … + +   get formattedHiredDate() { +     if (!this.hiredAt) return "---"; + +     return moment(this.hiredAt).format('MMMM DD, YYYY'); +   } + +   get hiredDate() { +     return ( +       this.hiredAt +         ? moment(this.hiredAt).format('DD-MM-YYYY') +         : '' +     ); +   } + +   set hiredDate(date) { +     const mDate = moment(date, 'DD-MM-YYYY'); +  +     this.hiredAt = ( +       mDate.isValid() +         ? mDate.format('YYYY-MM-DD') +         : '' +     ); +   } + } +``` + +This adds getter and setter functions to handle datepicker's functionality. + + +``` + // Get date from server + techLeader.hiredAt = '2020-05-01'; + console.log(techLeader.formattedHiredDate); + // => May 01, 2020 + + // Datepicker gets date + console.log(techLeader.hiredDate); + // => 01-05-2020 + + // Datepicker sets new date + techLeader.hiredDate = '15-06-2020'; + + // Display new date + console.log(techLeader.formattedHiredDate); + // => June 15, 2020 +``` + +This makes it very simple to manage multiple date formats. + +#### Storage for model-related information + +Another use for a model class is storing general information related to the model, like paths for routing: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { + +   // … + +   static get routes() { +     return { +       employeesPath: '/api/v1/employees', +       employeePath: id => `/api/v1/employees/${id}` +     } +   } + + } + +[/code] [code] + + // Path for POST requests + console.log(Employee.routes.employeesPath) + + // Path for GET request + console.log(Employee.routes.employeePath(1)) +``` + +### Customize the list of models + +Don't forget about the List class, which you can customize as needed: + + +``` +// employee.js + import { Model, List } from "./base.js"; + + // … + + export class EmployeesList extends List { +   get model() { +     return Employee; +   } + +   findByFirstName(val) { +     return this.models.find(item => item.firstName === val); +   } + +   filterByPosition(val) { +     return this.models.filter(item => item.position === val); +   } + } + +[/code] [code] + + console.log(employees.findByFirstName('Will')) + // => Employee { + //   firstName: "Will", + //   lastName: "Smith", + //   position: "Programmer", + //   hiredAt: "", + //   constructor: Object + // } + + console.log(employees.filterByPosition('Tech Leader')) + // => [Employee] + //     0: Employee + //       firstName: "Charles" + //       lastName: "Bartowski" + //       position: "Tech Leader" + //       hiredAt: "" + //       <constructor>: "Employee" +``` + +### Summary + +This simple structure for data modeling in JavaScript should save you some development time. You can add new functions whenever you need them to keep your code cleaner and easier to maintain. All of this code is available in my [CodeSandbox][9], so try it out and let me know how it goes by leaving a comment below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/data-modeling-javascript + +作者:[Szymon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/schodevio +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://railwaymen.org/ +[3]: https://blog.railwaymen.org/vue-vs-react-which-one-is-better-for-your-app-similarities-differences +[4]: https://www.npmjs.com/ +[5]: https://github.com/railwaymen/evally +[6]: https://lodash.com/ +[7]: https://lodash.com/docs/4.17.15 +[8]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself +[9]: https://codesandbox.io/s/02jsdatamodels-1mhtb From 997550f2cdd3b4c257049a81661ee38dac63280c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:49:28 +0800 Subject: [PATCH 2151/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200522=20A=20?= =?UTF-8?q?beginner's=20guide=20to=20web=20scraping=20with=20Python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200522 A beginner-s guide to web scraping with Python.md --- ...ner-s guide to web scraping with Python.md | 493 ++++++++++++++++++ 1 file changed, 493 insertions(+) create mode 100644 sources/tech/20200522 A beginner-s guide to web scraping with Python.md diff --git a/sources/tech/20200522 A beginner-s guide to web scraping with Python.md b/sources/tech/20200522 A beginner-s guide to web scraping with Python.md new file mode 100644 index 0000000000..010744161b --- /dev/null +++ b/sources/tech/20200522 A beginner-s guide to web scraping with Python.md @@ -0,0 +1,493 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A beginner's guide to web scraping with Python) +[#]: via: (https://opensource.com/article/20/5/web-scraping-python) +[#]: author: (Julia Piaskowski https://opensource.com/users/julia-piaskowski) + +A beginner's guide to web scraping with Python +====== +Get some hands-on experience with essential Python tools to scrape +complete HTML sites. +![HTML code][1] + +There are plenty of great books to help you learn Python, but who actually reads these A to Z? (Spoiler: not me). + +Many people find instructional books useful, but I do not typically learn by reading a book front to back. I learn by doing a project, struggling, figuring some things out, and then reading another book. So, throw away your book (for now), and let's learn some Python. + +What follows is a guide to my first scraping project in Python. It is very low on assumed knowledge in Python and HTML. This is intended to illustrate how to access web page content with Python library [requests][2] and parse the content using [BeatifulSoup4][3], as well as JSON and [pandas][4]. I will briefly introduce [Selenium][5], but I will not delve deeply into how to use that library—that topic deserves its own tutorial. Ultimately I hope to show you some tricks and tips to make web scraping less overwhelming. + +### Installing our dependencies + +All the resources from this guide are available at my [GitHub repo][6]. If you need help installing Python 3, check out the tutorials for [Linux][7], [Windows][8], and [Mac][9]. + + +``` +$ python3 -m venv +$ source venv/bin/activate +$ pip install requests bs4 pandas +``` + +If you like using JupyterLab, you can run all the code using this [notebook][10]. There are a lot of ways to [install JupyterLab][11], and this is one of them: + + +``` +# from the same virtual environment as above, run: +$ pip install jupyterlab +``` + +### Setting a goal for our web scraping project + +Now we have our dependencies installed, but what does it take to scrape a webpage?  + +Let's take a step back and be sure to clarify our goal. Here is my list of requirements for a successful web scraping project. + + * We are gathering information that is worth the effort it takes to build a working web scraper. + * We are downloading information that can be legally and ethically gathered by a web scraper. + * We have some knowledge of how to find the target information in HTML code. + * We have the right tools: in this case, it's the libraries **BeautifulSoup** and **requests**. + * We know (or are willing to learn) how to parse JSON objects. + * We have enough data skills to use **pandas**. + + + +A comment on HTML: While HTML is the beast that runs the Internet, what we mostly need to understand is how tags work. A tag is a collection of information sandwiched between angle-bracket enclosed labels. For example, here is a pretend tag, called "pro-tip": + + +``` +<pro-tip> All you need to know about html is how tags work </pro-tip> +``` + +We can access the information in there ("All you need to know…") by calling its tag "pro-tip." How to find and access a tag will be addressed further in this tutorial. For more of a look at HTML basics, check out [this article][12]. + +### What to look for in a web scraping project + +Some goals for gathering data are more suited for web scraping than others. My guidelines for what qualifies as a good project are as follows. + +There is no public API available for the data. It would be much easier to capture structured data through an API, and it would help clarify both the legality and ethics of gathering the data. There needs to be a sizable amount of structured data with a regular, repeatable format to justify this effort. Web scraping can be a pain. BeautifulSoup (bs4) makes this easier, but there is no avoiding the individual idiosyncrasies of websites that will require customization. Identical formatting of the data is not required, but it does make things easier. The more "edge cases" (departures from the norm) present, the more complicated the scraping will be. + +Disclaimer: I have zero legal training; the following is not intended to be formal legal advice. + +On the note of legality, accessing vast troves of information can be intoxicating, but just because it's possible doesn't mean it should be done. + +There is, thankfully, public information that can guide our morals and our web scrapers. Most websites have a [robots.txt][13] file associated with the site, indicating which scraping activities are permitted and which are not. It's largely there for interacting with search engines (the ultimate web scrapers). However, much of the information on websites is considered public information. As such, some consider the robots.txt file as a set of recommendations rather than a legally binding document. The robots.txt file does not address topics such as ethical gathering and usage of the data. + +Questions I ask myself before beginning a scraping project: + + * Am I scraping copyrighted material? + * Will my scraping activity compromise individual privacy? + * Am I making a large number of requests that may overload or damage a server? + * Is it possible the scraping will expose intellectual property I do not own? + * Are there terms of service governing use of the website, and am I following those? + * Will my scraping activities diminish the value of the original data? (for example, do I plan to repackage the data as-is and perhaps siphon off website traffic from the original source)? + + + +When I scrape a site, I make sure I can answer "no" to all of those questions. + +For a deeper look at the legal concerns, see the 2018 publications [Legality and Ethics of Web Scraping by Krotov and Silva][14] and [Twenty Years of Web Scraping and the Computer Fraud and Abuse Act by Sellars][15]. + +### Now it's time to scrape! + +After assessing the above, I came up with a project. My goal was to extract addresses for all Family Dollar stores in Idaho. These stores have an outsized presence in rural areas, so I wanted to understand how many there are in a rather rural state. + +The starting point is the [location page for Family Dollar][16]. + +![Family Dollar Idaho locations page][17] + +To begin, let's load up our prerequisites in our Python virtual environment. The code from here is meant to be added to a Python file (_scraper.py_ if you're looking for a name) or be run in a cell in JupyterLab. + + +``` +import requests # for making standard html requests +from bs4 import BeautifulSoup # magical tool for parsing html data +import json # for parsing data +from pandas import DataFrame as df # premier library for data organization +``` + +Next, we request data from our target URL. + + +``` +page = requests.get("") +soup = BeautifulSoup(page.text, 'html.parser') +``` + +BeautifulSoup will take HTML or XML content and transform it into a complex tree of objects. Here are several common object types that we will use. + + * **BeautifulSoup**—the parsed content + * **Tag**—a standard HTML tag, the main type of bs4 element you will encounter + * **NavigableString**—a string of text within a tag + * **Comment**—a special type of NavigableString + + + +There is more to consider when we look at **requests.get()** output. I've only used **page.text()** to translate the requested page into something readable, but there are other output types: + + * **page.text()** for text (most common) + * **page.content()** for byte-by-byte output + * **page.json()** for JSON objects + * **page.raw()** for the raw socket response (no thank you) + + + +I have only worked on English-only sites using the Latin alphabet. The default encoding settings in **requests** have worked fine for that. However, there is a rich internet world beyond English-only sites. To ensure that **requests** correctly parses the content, you can set the encoding for the text: + + +``` +page = requests.get(URL) +page.encoding = 'ISO-885901' +soup = BeautifulSoup(page.text, 'html.parser') +``` + +Taking a closer look at BeautifulSoup tags, we see: + + * The bs4 element **tag** is capturing an HTML tag + * It has both a name and attributes that can be accessed like a dictionary: **tag['someAttribute']** + * If a tag has multiple attributes with the same name, only the first instance is accessed. + * A tag's children are accessed via **tag.contents**. + * All tag descendants can be accessed with **tag.contents**. + * You can always access the full contents as a string with: **re.compile("your_string")** instead of navigating the HTML tree. + + + +### Determine how to extract relevant content + +Warning: this process can be frustrating. + +Extraction during web scraping can be a daunting process filled with missteps. I think the best way to approach this is to start with one representative example and then scale up (this principle is true for any programming task). Viewing the page's HTML source code is essential. There are a number of ways to do this. + +You can view the entire source code of a page using Python in your terminal (not recommended). Run this code at your own risk: + + +``` +print(soup.prettify()) +``` + +While printing out the entire source code for a page might work for a toy example shown in some tutorials, most modern websites have a massive amount of content on any one of their pages. Even the 404 page is likely to be filled with code for headers, footers, and so on. + +It is usually easiest to browse the source code via **View Page Source** in your favorite browser (right-click, then select "view page source"). That is the most reliable way to find your target content (I will explain why in a moment). + +![Family Dollar page source code][18] + +  + +In this instance, I need to find my target content—an address, city, state, and zip code—in this vast HTML ocean. Often, a simple search of the page source (**ctrl + F**) will yield the section where my target location is located. Once I can actually see an example of my target content (the address for at least one store), I look for an attribute or tag that sets this content apart from the rest. + +It would appear that first, I need to collect web addresses for different cities in Idaho with Family Dollar stores and visit those websites to get the address information. These web addresses all appear to be enclosed in a **href** tag. Great! I will try searching for that using the **find_all** command: + + +``` +dollar_tree_list = soup.find_all('href') +dollar_tree_list +``` + +Searching for **href** did not yield anything, darn. This might have failed because **href** is nested inside the class **itemlist**. For the next attempt, search on **item_list**. Because "class" is a reserved word in Python, **class_** is used instead. The bs4 function **soup.find_all()** turned out to be the Swiss army knife of bs4 functions. + + +``` +dollar_tree_list = soup.find_all(class_ = 'itemlist') +for i in dollar_tree_list[:2]: +  print(i) +``` + +Anecdotally, I found that searching for a specific class was often a successful approach. We can learn more about the object by finding out its type and length. + + +``` +type(dollar_tree_list) +len(dollar_tree_list) +``` + +The content from this BeautifulSoup "ResultSet" can be extracted using **.contents**. This is also a good time to create a single representative example. + + +``` +example = dollar_tree_list[2] # a representative example +example_content = example.contents +print(example_content) +``` + +Use **.attr** to find what attributes are present in the contents of this object. Note: **.contents** usually returns a list of exactly one item, so the first step is to index that item using the bracket notation. + + +``` +example_content = example.contents[0] +example_content.attrs +``` + +Now that I can see that **href** is an attribute, that can be extracted like a dictionary item: + + +``` +example_href = example_content['href'] +print(example_href) +``` + +### Putting together our web scraper + +All that exploration has given us a path forward. Here's the cleaned-up version of the logic we figured out above. + + +``` +city_hrefs = [] # initialise empty list + +for i in dollar_tree_list: +    cont = i.contents[0] +    href = cont['href'] +    city_hrefs.append(href) + +#  check to be sure all went well +for i in city_hrefs[:2]: +  print(i) +``` + +The output is a list of URLs of Family Dollar stores in Idaho to scrape. + +That said, I still don't have address information! Now, each city URL needs to be scraped to get this information. So we restart the process, using a single, representative example. + + +``` +page2 = requests.get(city_hrefs[2]) # again establish a representative example +soup2 = BeautifulSoup(page2.text, 'html.parser') +``` + +![Family Dollar map and code][19] + +The address information is nested within **type= "application/ld+json"**. After doing a lot of geolocation scraping, I've come to recognize this as a common structure for storing address information. Fortunately, **soup.find_all()** also enables searching on **type**. + + +``` +arco = soup2.find_all(type="application/ld+json") +print(arco[1]) +``` + +The address information is in the second list member! Finally! + +I extracted the contents (from the second list item) using **.contents** (this is a good default action after filtering the soup). Again, since the output of contents is a list of one, I indexed that list item: + + +``` +arco_contents = arco[1].contents[0] +arco_contents +``` + +Wow, looking good. The format presented here is consistent with the JSON format (also, the type did have "**json**" in its name). A JSON object can act like a dictionary with nested dictionaries inside. It's actually a nice format to work with once you become familiar with it (and it's certainly much easier to program than a long series of RegEx commands). Although this structurally looks like a JSON object, it is still a bs4 object and needs a formal programmatic conversion to JSON to be accessed as a JSON object: + + +``` +arco_json =  json.loads(arco_contents) + +[/code] [code] + +type(arco_json) +print(arco_json) +``` + +In that content is a key called **address** that has the desired address information in the smaller nested dictionary. This can be retrieved thusly: + + +``` +arco_address = arco_json['address'] +arco_address +``` + +Okay, we're serious this time. Now I can iterate over the list store URLs in Idaho: + + +``` +locs_dict = [] # initialise empty list + +for link in city_hrefs: +  locpage = requests.get(link)   # request page info +  locsoup = BeautifulSoup(locpage.text, 'html.parser') +      # parse the page's content +  locinfo = locsoup.find_all(type="application/ld+json") +      # extract specific element +  loccont = locinfo[1].contents[0]   +      # get contents from the bs4 element set +  locjson = json.loads(loccont)  # convert to json +  locaddr = locjson['address'] # get address +  locs_dict.append(locaddr) # add address to list +``` + +### Cleaning our web scraping results with pandas + +We have loads of data in a dictionary, but we have some additional crud that will make reusing our data more complex than it needs to be. To do some final data organization steps, we convert to a pandas data frame, drop the unneeded columns "**@type**" and "**country**"), and check the top five rows to ensure that everything looks alright. + + +``` +locs_df = df.from_records(locs_dict) +locs_df.drop(['@type', 'addressCountry'], axis = 1, inplace = True) +locs_df.head(n = 5) +``` + +Make sure to save results!! + + +``` +df.to_csv(locs_df, "family_dollar_ID_locations.csv", sep = ",", index = False) +``` + +We did it! There is a comma-separated list of all the Idaho Family Dollar stores. What a wild ride. + +### A few words on Selenium and data scraping + +[Selenium][5] is a common utility for automatic interaction with a webpage. To explain why it's essential to use at times, let's go through an example using Walgreens' website. **Inspect Element** provides the code for what is displayed in a browser: + +![Walgreens location page and code][20] + +  + +While **View Page Source** provides the code for what **requests** will obtain: + +![Walgreens source code][21] + +When these two don't agree, there are plugins modifying the source code—so, it should be accessed after the page has loaded in a browser. **requests** cannot do that, but **Selenium** can. + +Selenium requires a web driver to retrieve the content. It actually opens a web browser, and this page content is collected. Selenium is powerful—it can interact with loaded content in many ways (read the documentation). After getting data with **Selenium**, continue to use **BeautifulSoup** as before: + + +``` +url = "[https://www.walgreens.com/storelistings/storesbycity.jsp?requestType=locator\&state=ID][22]" +driver = webdriver.Firefox(executable_path = 'mypath/geckodriver.exe') +driver.get(url) +soup_ID = BeautifulSoup(driver.page_source, 'html.parser') +store_link_soup = soup_ID.find_all(class_ = 'col-xl-4 col-lg-4 col-md-4') +``` + +I didn't need Selenium in the case of Family Dollar, but I do keep it on hand for those times when rendered content differs from source code. + +### Wrapping up + +In conclusion, when using web scraping to accomplish a meaningful task: + + * Be patient + * Consult the manuals (these are very helpful) + + + +If you are curious about the answer: + +![Family Dollar locations map][23] + +There are many many Family Dollar stores in America. + +The complete source code is: + + +``` +import requests +from bs4 import BeautifulSoup +import json +from pandas import DataFrame as df + +page = requests.get("") +soup = BeautifulSoup(page.text, 'html.parser') + +# find all state links +state_list = soup.find_all(class_ = 'itemlist') + +state_links = [] + +for i in state_list: +    cont = i.contents[0] +    attr = cont.attrs +    hrefs = attr['href'] +    state_links.append(hrefs) + +# find all city links +city_links = [] + +for link in state_links: +    page = requests.get(link) +    soup = BeautifulSoup(page.text, 'html.parser') +    familydollar_list = soup.find_all(class_ = 'itemlist') +    for store in familydollar_list: +        cont = store.contents[0] +        attr = cont.attrs +        city_hrefs = attr['href'] +        city_links.append(city_hrefs) +# to get individual store links +store_links = [] + +for link in city_links: +    locpage = requests.get(link) +    locsoup = BeautifulSoup(locpage.text, 'html.parser') +    locinfo = locsoup.find_all(type="application/ld+json") +    for i in locinfo: +        loccont = i.contents[0] +        locjson = json.loads(loccont) +        try: +            store_url = locjson['url'] +            store_links.append(store_url) +        except: +            pass + +# get address and geolocation information +stores = [] + +for store in store_links: +    storepage = requests.get(store) +    storesoup = BeautifulSoup(storepage.text, 'html.parser') +    storeinfo = storesoup.find_all(type="application/ld+json") +    for i in storeinfo: +        storecont = i.contents[0] +        storejson = json.loads(storecont) +        try: +            store_addr = storejson['address'] +            store_addr.update(storejson['geo']) +            stores.append(store_addr) +        except: +            pass + +# final data parsing +stores_df = df.from_records(stores) +stores_df.drop(['@type', 'addressCountry'], axis = 1, inplace = True) +stores_df['Store'] = "Family Dollar" + +df.to_csv(stores_df, "family_dollar_locations.csv", sep = ",", index = False) +``` + +\-- +_Author's note: This article is an adaptation of a [talk I gave at PyCascades][24] in Portland, Oregon on February 9, 2020._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/web-scraping-python + +作者:[Julia Piaskowski][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/julia-piaskowski +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_html_code.png?itok=VjUmGsnl (HTML code) +[2]: https://requests.readthedocs.io/en/master/ +[3]: https://beautiful-soup-4.readthedocs.io/en/latest/ +[4]: https://pandas.pydata.org/ +[5]: https://www.selenium.dev/ +[6]: https://github.com/jpiaskowski/pycas2020_web_scraping +[7]: https://opensource.com/article/20/4/install-python-linux +[8]: https://opensource.com/article/19/8/how-install-python-windows +[9]: https://opensource.com/article/19/5/python-3-default-mac +[10]: https://github.com/jpiaskowski/pycas2020_web_scraping/blob/master/example/Familydollar_location_scrape-all-states.ipynb +[11]: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html +[12]: https://opensource.com/article/20/4/build-websites +[13]: https://www.contentkingapp.com/academy/robotstxt/ +[14]: https://www.researchgate.net/publication/324907302_Legality_and_Ethics_of_Web_Scraping +[15]: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3221625 +[16]: https://locations.familydollar.com/id/ +[17]: https://opensource.com/sites/default/files/uploads/familydollar1.png (Family Dollar Idaho locations page) +[18]: https://opensource.com/sites/default/files/uploads/familydollar2.png (Family Dollar page source code) +[19]: https://opensource.com/sites/default/files/uploads/familydollar3.png (Family Dollar map and code) +[20]: https://opensource.com/sites/default/files/uploads/walgreens1.png (Walgreens location page and code) +[21]: https://opensource.com/sites/default/files/uploads/walgreens2.png (Walgreens source code) +[22]: https://www.walgreens.com/storelistings/storesbycity.jsp?requestType=locator\&state=ID +[23]: https://opensource.com/sites/default/files/uploads/family_dollar_locations.png (Family Dollar locations map) +[24]: https://2020.pycascades.com/talks/adventures-in-babysitting-webscraping-for-python-and-html-novices/ From f3703fd32c8b41f8f9517309fad1a8b28e677a2e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:49:49 +0800 Subject: [PATCH 2152/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200521=20Use?= =?UTF-8?q?=20the=20internet=20from=20the=20command=20line=20with=20curl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200521 Use the internet from the command line with curl.md --- ...nternet from the command line with curl.md | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 sources/tech/20200521 Use the internet from the command line with curl.md diff --git a/sources/tech/20200521 Use the internet from the command line with curl.md b/sources/tech/20200521 Use the internet from the command line with curl.md new file mode 100644 index 0000000000..c580ea0879 --- /dev/null +++ b/sources/tech/20200521 Use the internet from the command line with curl.md @@ -0,0 +1,186 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use the internet from the command line with curl) +[#]: via: (https://opensource.com/article/20/5/curl-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Use the internet from the command line with curl +====== +Download our new curl cheat sheet. Curl is a fast and efficient way to +pull the information you need from the internet without using a +graphical interface. +![Cheat Sheet cover image][1] + +Curl is commonly considered a non-interactive web browser. That means it's able to pull information from the internet and display it in your terminal or save it to a file. This is literally what web browsers, such as Firefox or Chromium, do except they _render_ the information by default, while curl downloads and displays raw information. In reality, the curl command does much more and has the ability to transfer data to or from a server using one of many supported protocols, including HTTP, FTP, SFTP, IMAP, POP3, LDAP, SMB, SMTP, and many more. It's a useful tool for the average terminal user, a vital convenience for the sysadmin, and a quality assurance tool for microservices and cloud developers. + +Curl is designed to work without user interaction, so unlike Firefox, you must think about your interaction with online data from start to finish. For instance, if you want to view a web page in Firefox, you launch a Firefox window. After Firefox is open, you type the website you want to visit into the URL field or a search engine. Then you navigate to the site and click on the page you want to see. + +The same concepts apply to curl, except you do it all at once: you launch curl at the same time you feed it the internet location you want and tell it whether you want to the data to be saved in your terminal or to a file. The complexity increases when you have to interact with a site that requires authentication or with an API, but once you learn the **curl** command syntax, it becomes second nature. To help you get the hang of it, we collected the pertinent syntax information in a handy [cheat sheet][2]. + +### Download a file with curl + +You can download a file with the **curl** command by providing a link to a specific URL. If you provide a URL that defaults to **index.html**, then the index page is downloaded, and the file you downloaded is displayed on your terminal screen. You can pipe the output to less or tail or any other command: + + +``` +$ curl "" | tail -n 4 +    <h1>Example Domain</h1> +    <p>This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.</p> +    <p><a href="[https://www.iana.org/domains/example"\>More][3] information...</a></p> +</div></body></html> +``` + +Because some URLs contain special characters that your shell normally interprets, it's safest to surround your URL in quotation marks. + +Some files don't translate well to being displayed in a terminal. You can use the **\--remote-name** option to cause the file to be saved according to what it's called on the server: + + +``` +$ curl --remote-name "" +$ ls +linux-distro.iso +``` + +Alternatively, you can use the **\--output** option to name your download whatever you want: + + +``` +`curl "http://example.com/foo.html" --output bar.html` +``` + +### List contents of a remote directory with curl + +Because curl is non-interactive, it's difficult to browse a page for downloadable elements. Provided that the remote server you're connecting to allows it, you can use **curl** to list the contents of a directory: + + +``` +`$ curl --list-only "https://example.com/foo/"` +``` + +### Continue a partial download + +If you're downloading a very large file, you might find that you have to interrupt the download. Curl is intelligent enough to determine where you left off and continue the download. That means the next time you're downloading a 4GB Linux distribution ISO and something goes wrong, you never have to go back to the start. The syntax for **\--continue-at** is a little unusual: if you know the byte count where your download was interrupted, you can provide it; otherwise, you can use a lone dash (**-**) to tell curl to detect it automatically: + + +``` +`$ curl --remote-name --continue-at - "https://example.com/linux-distro.iso"` +``` + +### Download a sequence of files + +If you need to download several files—rather than just one big file—curl can help with that. Assuming you know the location and file-name pattern of the files you want to download, you can use curl's sequencing notation: the start and end point between a range of integers, in brackets. For the output filename, use **#1** to indicate the first variable: + + +``` +`$ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp"` +``` + +If you need to use another variable to represent another sequence, denote each variable in the order it appears in the command. For example, in this command, **#1** refers to the directories **images_000** through **images_009**, while **#2** refers to the files **file_1.webp** through **file_4.webp**: + + +``` +$ curl "" \ +\--output "file_#1-#2.webp" +``` + +### Download all PNG files from a site + +You can do some rudimentary web scraping to find what you want to download, too, using only **curl** and **grep**. For instance, say you need to download all images associated with a web page you're archiving. First, download the page referencing the images. Pipe the page to grep with a search for the image type you're targeting (PNG in this example). Finally, create a **while** loop to construct a download URL and to save the files to your computer: + + +``` +$ curl |\ +grep --only-matching 'src="[^"]*.[png]"' |\ +cut -d\" -f2 |\ +while read i; do \ +curl " -o "${i##*/}"; \ +done +``` + +This is just an example, but it demonstrates how flexible curl can be when combined with a Unix pipe and some clever, but basic, parsing. + +### Fetch HTML headers + +Protocols used for data exchange have a lot of metadata embedded in the packets that computers send to communicate. HTTP headers are components of the initial portion of data. It can be helpful to view these headers (especially the response code) when troubleshooting your connection to a site: + + +``` +curl --head "" +HTTP/2 200 +accept-ranges: bytes +age: 485487 +cache-control: max-age=604800 +content-type: text/html; charset=UTF-8 +date: Sun, 26 Apr 2020 09:02:09 GMT +etag: "3147526947" +expires: Sun, 03 May 2020 09:02:09 GMT +last-modified: Thu, 17 Oct 2019 07:18:26 GMT +server: ECS (sjc/4E76) +x-cache: HIT +content-length: 1256 +``` + +### Fail quickly + +A 200 response is the usual HTTP indicator of success, so it's what you usually expect when you contact a server. The famous 404 response indicates that a page can't be found, and 500 means there was a server error. + +To see what errors are happening during negotiation, add the **\--show-error** flag: + + +``` +`$ curl --head --show-error "http://opensource.ga"` +``` + +These can be difficult for you to fix unless you have access to the server you're contacting, but curl generally tries its best to resolve the location you point it to. Sometimes when testing things over a network, seemingly endless retries just waste time, so you can force curl to exit upon failure quickly with the **\--fail-early** option: + + +``` +`curl --fail-early "http://opensource.ga"` +``` + +### Redirect query as specified by a 3xx response + +The 300 series of responses, however, are more flexible. Specifically, the 301 response means that a URL has been moved permanently to a different location. It's a common way for a website admin to relocate content while leaving a "trail" so people visiting the old location can still find it. Curl doesn't follow a 301 redirect by default, but you can make it continue on to a 301 destination by using the **\--location** option: + + +``` +$ curl "" | grep title +<title>301 Moved Permanently</title> +$ curl --location "" +<title>Internet Assigned Numbers Authority</title> +``` + +### Expand a shortened URL + +The **\--location** option is useful when you want to look at shortened URLs before visiting them. Shortened URLs can be useful for social networks with character limits (of course, this may not be an issue if you use a [modern and open source social network][4]) or for print media in which users can't just copy and paste a long URL. However, they can also be a little dangerous because their destination is, by nature, concealed. By combining the **\--head** option to view just the HTTP headers and the **\--location** option to unravel the final destination of a URL, you can peek into a shortened URL without loading the full resource: + + +``` +$ curl --head --location \ +"" +``` + +### [Download our curl cheat sheet][2] + +Once you practice thinking about the process of exploring the web as a single command, curl becomes a fast and efficient way to pull the information you need from the internet without bothering with a graphical interface. To help you build it into your usual workflow, we've created a [curl cheat sheet][2] with common curl uses and syntax, including an overview of using it to query an API. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/curl-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/downloads/curl-command-cheat-sheet +[3]: https://www.iana.org/domains/example"\>More +[4]: https://opensource.com/article/17/4/guide-to-mastodon From 85fc81ae0faa0846e6591d9e9f64c42b912353c2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 May 2020 10:49:54 +0800 Subject: [PATCH 2153/3057] PUB @wxy https://linux.cn/article-12247-1.html --- ...Speed up administration of Kubernetes clusters with k9s.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200506 Speed up administration of Kubernetes clusters with k9s.md (99%) diff --git a/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md b/published/20200506 Speed up administration of Kubernetes clusters with k9s.md similarity index 99% rename from translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md rename to published/20200506 Speed up administration of Kubernetes clusters with k9s.md index ce71f05b26..2d3665fc79 100644 --- a/translated/tech/20200506 Speed up administration of Kubernetes clusters with k9s.md +++ b/published/20200506 Speed up administration of Kubernetes clusters with k9s.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12247-1.html) [#]: subject: (Speed up administration of Kubernetes clusters with k9s) [#]: via: (https://opensource.com/article/20/5/kubernetes-administration) [#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) From e70d2a86b4801b595c95ad19b4596da73b591302 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:50:22 +0800 Subject: [PATCH 2154/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200521=20Easy?= =?UTF-8?q?=20DNS=20configuration=20with=20PowerDNS=20for=20nameservers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200521 Easy DNS configuration with PowerDNS for nameservers.md --- ...iguration with PowerDNS for nameservers.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/tech/20200521 Easy DNS configuration with PowerDNS for nameservers.md diff --git a/sources/tech/20200521 Easy DNS configuration with PowerDNS for nameservers.md b/sources/tech/20200521 Easy DNS configuration with PowerDNS for nameservers.md new file mode 100644 index 0000000000..aa577d6aff --- /dev/null +++ b/sources/tech/20200521 Easy DNS configuration with PowerDNS for nameservers.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Easy DNS configuration with PowerDNS for nameservers) +[#]: via: (https://opensource.com/article/20/5/powerdns) +[#]: author: (Jonathan Garrido https://opensource.com/users/jgarrido) + +Easy DNS configuration with PowerDNS for nameservers +====== +Use PDNS to provide a stable and reliable Domain Name System (DNS) +server for your project. +![Computer laptop in space][1] + +A few months ago, we got a requirement to provide a stable and reliable Domain Name System ([DNS][2]) server for a new project. The project dealt with auto-deployment using containers and where each new environment would generate a unique, random URL. After a lot of research on possible solutions, we decided to give [PowerDNS][3] (PDNS) a try. + +At the outset, we discovered that PowerDNS is supported in all major Linux distros, is available under the GPL license, and keeps its repositories up to date. We also found neat and well-organized [documentation][4] on the official site and tons of how-to's around the web from people who really like and use the product. After reading a few pages and learning some basic commands, PDNS was installed, up, and running, and our journey began. + +### Database-driven + +PowerDNS keeps its records in a SQL database. This was new for us, and not having to use flat files to keep records was a good change. We picked MariaDB as our power tool of choice, and since there is tons of advance information about the proper settings for installing the nameserver, we could set up and harden our database flawlessly. + +### Easy configuration + +The second thing that engaged us was all the features PDNS has in its config file. This file, pdns.conf, has a lot of options that you can enable or disable just by adding or removing the # sign. This was truly amazing because it gave us the chance to integrate this new service into our current infrastructure with only the values that we want, no more, no less, just the features that we need. A quick example: + +Who can access your webserver? + + +``` +`webserver-allow-from=172.10.0.1,172.10.1.2` +``` + +Can I forward requests based in a domain? Sure! + + +``` +forward-zones=mylocal.io=127.0.0.1:5300 +forward-zones+=example.com=172.10.0.5:53 +forward-zones+=lucky.tech=172.10.1.5:53 +``` + +### API included + +We could activate using this config file, and this is when we started to meet PDNS's "power" by solving the first request from our development team, the API service. This feature gave us the ability to send requests to simply and cleanly create, modify, or remove records in our DNS server. + +This API has some basic security parameters, so in just a few steps, you can control who has the right to interact with the nameserver based on a combination of an IP address and a pre-share key as a way of authentication. Here's what the configuration for this looks like: + + +``` +api=yes +api-key=lkjdsfpoiernf +webserver-allow-from=172.10.7.13,172.10.7.5 +``` + +### Logging + +PDNS does an extraordinary job when it comes to logging. You can monitor your server and see how the machine is doing by using the log files and a simple built-in web server. Using a browser, you can see different types of statistics from the machine, like CPU usage and the DNS queries received. This is very valuable—for example, we were able to detect a few "not-so-healthy" PCs that were sending DNS requests to our server looking for sites that are related to malicious traffic. After digging into the logs, we could see where traffic was coming from and do a clean operation on those PCs. + +### Other features + +This is only a glimpse of all the things you can do with PowerDNS; there is much more to it. It is a complete nameserver with a lot of features and functionalities that make it worth giving it a try. + +At this moment, we are not implementing [DNSSEC][5], but it appears that it can be put into production quickly with just one click. Also, PowerDNS has a nice approach when it comes to separating the recursor service from the nameserver. I read that it also supports [DNS RPZ][6] (Response Policy Zones), and there are also some very nice and well-designed frontends available that let you manage your server using a simple web browser, like the one in the image below. + +![PowerDNS frontend][7] + +([PowerDNS documentation][4], MIT License) + +Believe it or not, you can boost your knowledge about DNS and IT ops a lot just by expending a few hours "playing" with PDNS. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/powerdns + +作者:[Jonathan Garrido][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jgarrido +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://en.wikipedia.org/wiki/Domain_Name_System +[3]: https://www.powerdns.com/opensource.html +[4]: https://doc.powerdns.com/ +[5]: https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions +[6]: https://dnsrpz.info/ +[7]: https://opensource.com/sites/default/files/uploads/pdns.jpg (PowerDNS frontend) From 6c95315abb5654e1c9f481d816b88ccf95de216c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 10:51:27 +0800 Subject: [PATCH 2155/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200520=20How?= =?UTF-8?q?=20to=20configure=20your=20router=20using=20VTY=20shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200520 How to configure your router using VTY shell.md --- ...o configure your router using VTY shell.md | 198 ++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 sources/tech/20200520 How to configure your router using VTY shell.md diff --git a/sources/tech/20200520 How to configure your router using VTY shell.md b/sources/tech/20200520 How to configure your router using VTY shell.md new file mode 100644 index 0000000000..29a427583a --- /dev/null +++ b/sources/tech/20200520 How to configure your router using VTY shell.md @@ -0,0 +1,198 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to configure your router using VTY shell) +[#]: via: (https://opensource.com/article/20/5/vty-shell) +[#]: author: (M Umer https://opensource.com/users/noisybotnet) + +How to configure your router using VTY shell +====== +Free range routing gives you options for implementing multiple +protocols. This guide will get you started. +![Multi-colored and directional network computer cables][1] + +Recently, I wrote an article explaining how we can implement Open Shortest Path First (OSPF) using the [Quagga][2] routing suite. There are multiple software suites that can be used instead of Quagga to implement different routing protocols. One such option is free range routing (FRR). + +### FRR + +[FRR][3] is a routing software suite, which has been derived from Quagga and is distributed under GNU GPL2 license. Like Quagga, it provides implementations of all major routing protocols such as OSPF, Routing Information Protocol (RIP), Border Gateway Protocol (BGP), and Intermediate system-to-intermediate system (IS-IS) for Unix-like platforms. + +Several companies, such as Big Switch Networks, Cumulus, Open Source Routing, and 6wind, who were behind the development of Quagga, created FRR to improve on Quagga's well-established foundations. + +#### Architecture + +FRR is a suite of daemons that work together to build the routing table. Each major protocol is implemented in its own daemon, and these daemons talk to the core and protocol-independent daemon Zebra, which provides kernel routing table updates, interface lookups, and redistribution of routes between different routing protocols. Each protocol-specific daemon is responsible for running the relevant protocol and building the routing table based on the information exchanged. + +![FRR architecture][4] + +### VTY shell + +[VTYSH][5] is an integrated shell for the FRR routing engine. It amalgamates all the CLI commands defined in each of the daemons and presents them to the user in a single shell. It provides a Cisco-like modal CLI, and many of the commands are similar to Cisco IOS commands. There are different modes to the CLI, and certain commands are only available within a specific mode. + +### Setup + +In this tutorial, we'll be implementing the routing information protocol (RIP) to configure dynamic routing using FRR. We can do this in two ways—either by editing the protocol daemon configuration file in an editor or by using the VTY shell. We'll be using the VTY shell in this example. Our setup includes two CentOS 7.7 hosts, named Alpha and Beta. Both hosts have two network interfaces and share access to the 192.168.122.0/24 network. We'll be advertising routes for 10.12.11.0/24 and 10.10.10.0/24 networks. + +**For Host Alpha:** + + * eth0 IP: 192.168.122.100/24 + * Gateway: 192.168.122.1 + * eth1 IP: 10.10.10.12/24 + + + +**For Host Beta:** + + * eth0 IP: 192.168.122.50/24 + * Gateway: 192.168.122.1 + * eth1 IP: 10.12.11.12/24 + + + +#### Installation of package + +First, we need to install the FRR package on both hosts; this can be done by following the instructions in the [official FRR documentation][6]. + +#### Enable IP forwarding + +For routing, we need to enable IP forwarding on both hosts since that will performed by the Linux kernel. + + +``` +sysctl -w net.ipv4.conf.all.forwarding = 1 + +sysctl -w net.ipv6.conf.all.forwarding = 1 +sysctl -p +``` + +#### Enabling the RIPD daemon + +Once installed, all the configuration files will be stored in the **/etc/frr** directory. The daemons must be explicitly enabled by editing the **/etc/frr/daemons** file. This file determines which daemons are activated when the FRR service is started. To enable a particular daemon, simply change the corresponding "no" to "yes." A subsequent service restart should start the daemon. + +![FRR daemon restart][7] + +#### Firewall configuration + +Since RIP protocol uses UDP as its transport protocol and is assigned port 520, we need to allow this port in `firewalld` configuration. + + +``` +firewall-cmd --add-port=520/udp –permanent + +firewalld-cmd -reload +``` + +We can now start the FRR service using: + + +``` +`systemctl start frr` +``` + +#### Configuration using VTY + +Now, we need to configure RIP using the VTY shell. + +On Host Alpha: + + +``` +[root@alpha ~]# vtysh + +Hello, this is FRRouting (version 7.2RPKI). +Copyright 1996-2005 Kunihiro Ishiguro, et al. + +alpha# configure terminal +alpha(config)# router rip +alpha(config-router)# network 192.168.122.0/24 +alpha(config-router)# network 10.10.10.0/24 +alpha(config-router)# route 10.10.10.5/24 +alpha(config-router)# do write +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +alpha(config-router)# do write memory +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +alpha(config-router)# exit +``` + +Similarly, on Host Beta: + + +``` +[root@beta ~]# vtysh + +Hello, this is FRRouting (version 7.2RPKI). +Copyright 1996-2005 Kunihiro Ishiguro, et al. + +beta# configure terminal +beta(config)# router rip +beta(config-router)# network 192.168.122.0/24 +beta(config-router)# network 10.12.11.0/24 +beta(config-router)# do write +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/zebra.conf +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +beta(config-router)# do write memory +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/zebra.conf +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +beta(config-router)# exit +``` + +Once done, check the routes on both hosts as follows: + + +``` +[root@alpha ~]# ip route show +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 dev eth1 proto kernel scope link src 10.10.10.12 metric 101 +10.12.11.0/24 via 192.168.122.50 dev eth0 proto 189 metric 20 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.100 metric 100 +``` + +We can see that the routing table on Alpha contains an entry of 10.12.11.0/24 via 192.168.122.50, which was offered through RIP. Similarly, on Beta, the table contains an entry of network 10.10.10.0/24 via 192.168.122.100. + + +``` +[root@beta ~]# ip route show +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 via 192.168.122.100 dev eth0 proto 189 metric 20 +10.12.11.0/24 dev eth1 proto kernel scope link src 10.12.11.12 metric 101 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.50 metric 100 +``` + +### Conclusion + +As you can see, the setup and configuration are relatively simple. To add complexity, we can add more network interfaces to the router to provide routing for more networks. The configurations can be made by editing the configuration files in an editor, but using VTY shell provides us a frontend to all FRR daemons in a single, combined session. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/vty-shell + +作者:[M Umer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/noisybotnet +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: https://opensource.com/article/20/4/quagga-linux +[3]: https://en.wikipedia.org/wiki/FRRouting +[4]: https://opensource.com/sites/default/files/uploads/frr_architecture.png (FRR architecture) +[5]: http://docs.frrouting.org/projects/dev-guide/en/latest/vtysh.html +[6]: http://docs.frrouting.org/projects/dev-guide/en/latest/building-frr-for-centos7.html +[7]: https://opensource.com/sites/default/files/uploads/frr_daemon_restart.png (FRR daemon restart) From a9c0409fc69e55ac57149d9d55d75a675a50e90a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 12:21:23 +0800 Subject: [PATCH 2156/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200521=20Glic?= =?UTF-8?q?o=20(Weighted=20Rock=20Paper=20Scissors)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md --- ...21 Glico (Weighted Rock Paper Scissors).md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md diff --git a/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md b/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md new file mode 100644 index 0000000000..77e3cfb5ed --- /dev/null +++ b/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Glico (Weighted Rock Paper Scissors)) +[#]: via: (https://theartofmachinery.com/2020/05/21/glico_weighted_rock_paper_scissors.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Glico (Weighted Rock Paper Scissors) +====== + +This still isn’t the blog post I said I was going to write about now, but I figured some game theory would make a good post at the moment, especially when a lot of people I know are working at home with kids who need entertaining. Here’s some stuff about a traditional Japanese kids’ game called Glico, a form of weighted Rock Paper Scissors (RPS). + +### Glico + +I’ll assume you’re familiar with regular RPS. It’s pretty obvious how to play well: the three plays, “rock”, “paper” and “scissors”, are equally strong, so the only trick is to play them unpredictably enough. + +But what happens if the three plays have different values? Weighted RPS, under the name “Glico”, has been a well-known Japanese children’s game since at least before WWII, but let me explain an English adaptation. Traditionally it’s played starting at the bottom of a flight of stairs, and the aim is to get to the top first. Players can climb up steps by winning rounds of RPS. The trick is that the number of steps depends on the winning hand in each round. A player who wins with “rock” gets to climb up four steps by spelling out R-O-C-K, and similarly “paper” is worth five steps and “scissors” worth eight. This simple twist to the game creates whole new layers of offence and defence as players struggle to win with “scissors” as much as possible, without being too predictable and vulnerable. + +(The rules for the Japanese version vary by region, but usually “rock” is worth 3 steps, while “paper” and “scissors” are worth 6. The mnemonic is that “rock”, “paper” and “scissors” are referred to as グー, パー and チョキ respectively, and the words spelled out when playing are グリコ (“Glico”, a food/confectionary brand), パイナップル (pineapple) and チョコレート (chocolate).) + +Just a few notes before getting into the maths: The game works best with two players, but in the traditional rules for three or more players, each round is handled by having multiple rematches. Each time there’s a clear winning hand (e.g., two players with “paper” beating one with “rock”) the losers are eliminated until there’s one winner. That can take a long time, so cycling systematically between pairs of players might be faster for several players. (I’ll assume two players from now on.) Also, older kids sometimes add an extra challenge by requiring an exact landing at the top of the stairs to win. For example, if you’re five steps from the top, only “paper” will win; “scissors” will overshoot by three steps, and you’ll end up three steps back down from the top. Be warned: that makes gameplay a lot harder. + +### Calculating the optimal strategy + +Simple strategies like “just play rock” are what game theorists call “pure strategies”. By design, no pure strategy in RPS is better than all others, and an adaptive opponent can quickly learn to exploit any pure strategy (e.g., by always playing “paper” against someone who always plays “rock”). Any decent player will play RPS with something like a “mixed strategy” (selecting from the pure strategies at random, maybe with different probabilities). Game theory tells us that finite, two-player, zero-sum games always have optimal mixed strategies — i.e., a mixed strategy that’s as good or better than any other, even against an adaptive opponent. You might do better by exploiting a weak opponent, but you can’t do better against a perfect one. In plain RPS, the statistically unbeatable strategy is to play each hand with equal probability (\frac{1}{3}). + +Glico is made up of multiple rounds of weighted RPS. A truly optimal player won’t just use one set of probabilities (p_{r}), (p_{p}) and (p_{s}) for playing “rock”, “paper” and “scissors” each round. The optimal probabilities will vary depending the position of both players on the stairs. For example, a player who is four steps from winning is either happy with any winning hand, or only wants “rock”, depending on the rules, and (theoretically) both players should recognise that and adapt their probabilities accordingly. However, it’s more practical to play with an optimal greedy strategy — i.e., assuming everyone is just trying to get the maximum step value each round. + +I’ll calculate an optimal greedy strategy for weighted RPS in two ways. One way is longer but uses nothing but high school algebra and logical thinking, while the other way uses the power of linear programming. + +#### The longer way + +The greedy version of Glico has no end goal; the players are just trying to win points. It helps with solving the game if we make it zero sum — any time you win (N) points, your opponent loses (N) points, and vice versa. That just scales and shifts the score per round, so it doesn’t change the optimal strategy. Why do it? We know that optimal players can’t get any advantage over each other because the game is symmetric. If the game is zero sum, that means that no strategy can have an expected value of more than 0 points. That lets us write some equations. For example, playing “rock” might win you 4 points against “scissors”, or lose you 5 against “paper”. Against an optimal opponent, we can say + +[4p_{s} - 5p_{p} \leq 0] + +Is the inequality necessary? When would a pure strategy have a negative value against a non-adaptive but optimal player? Imagine if we added a fourth pure strategy, “bomb”, that simply gave 1000 points to the opponent. Obviously no optimal player would ever play “bomb”, so (p_{b} = 0). Playing “bomb” against an optimal player would have expected value -1000. We can say that some pure strategies are just _bad_: they have suboptimal value against an optimal opponent, and an optimal player will never play them. Other pure strategies have optimal value against an optimal opponent, and they’re reasonable to include in an optimal strategy. + +Bad pure strategies aren’t always as obvious as “bomb”, but we can argue that none of the pure strategies in RPS are bad. “Rock” is the only way to beat “scissors”, and “paper” is the only way to beat “rock”, and “scissors” is the only way to beat “paper”. At least one must be in the optimal strategy, so we can expect them all to be. So let’s make that (\leq) into (=), and add the equations for playing “paper” and “scissors”, plus the fact that these are probabilities that add up to 1: + +[\begin{matrix} {4p_{s} - 5p_{p}} & {= 0} \ {5p_{r} - 8p_{s}} & {= 0} \ {8p_{p} - 4p_{r}} & {= 0} \ {p_{r} + p_{p} + p_{s}} & {= 1} \ \end{matrix}] + +That’s a system of linear equations that can be solved algorithmically using Gaussian elimination — either by hand or by using any good numerical algorithms software. I won’t go into the details, but here’s the solution: + +[\begin{matrix} p_{r} & {= 0.4706} \ p_{p} & {= 0.2353} \ p_{s} & {= 0.2941} \ \end{matrix}] + +Even though it’s worth the least, an optimal player will play “rock” almost half the time to counterattack “scissors”. The rest of the time is split between “paper” and “scissors”, with a slight bias towards “scissors”. + +#### The powerful way + +The previous solution needed special-case analysis: it exploited the symmetry of the game, and made some guesses about how good/bad the pure strategies are. What about games that are more complex, or maybe not even symmetric (say, because one player has a handicap)? There’s a more general solution using what’s called linear programming (which dates to when “programming” just meant “scheduling” or “planning”). + +By the way, linear programming (LP) has a funny place in computer science. There are some industries and academic circles where LP and generalisations like mixed integer programming are super hot. Then there are computer science textbooks that never even mention them, so there are industries where the whole topic is pretty much unheard of. It might be because it wasn’t even known for a long time if LP problems can be solved in polynomial time (they can), so LP doesn’t have the same theoretical elegance as, say, shortest path finding, even if it has a lot of practical use. + +Anyway, solving weighted RPS with LP is pretty straightforward. We just need to describe the game using a bunch of linear inequalities in multiple variables, and express strategic value as a linear function that can be optimised. That’s very similar to what was done before, but this time we won’t try to guess at the values of any strategies. We’ll just assume we’re choosing values (p_{r}), (p_{p}) and (p_{s}) to play against an opponent who scores an average (v) against us each round. The opponent is smart enough to choose a strategy that’s as least as good as any pure strategy, so we can say + +[\begin{matrix} {4p_{s} - 5p_{p}} & {\leq v} \ {5p_{r} - 8p_{s}} & {\leq v} \ {8p_{p} - 4p_{r}} & {\leq v} \ \end{matrix}] + +The opponent can only play some combination of “rock”, “paper” and “scissors”, so (v) can’t be strictly greater than all of them — at least one of the inequalities above must be tight. To model the gameplay fully, the only other constraints we need are the rules of probability: + +[\begin{matrix} {p_{r} + p_{p} + p_{s}} & {= 1} \ p_{r} & {\geq 0} \ p_{p} & {\geq 0} \ p_{s} & {\geq 0} \ \end{matrix}] + +Now we’ve modelled the problem, we just need to express what needs to be optimised. That’s actually dead simple: we just want to minimise (v), the average score the opponent can win from us. An LP solver can find a set of values for all variables that minimises (v) within the constraints, and we can read off the optimal strategy directly. + +I’ve tried a few tools, and the [Julia][1] library [JuMP][2] has my current favourite FOSS API for throwaway optimisation problems. Here’s some code: + +``` +# You might need Pkg.add("JuMP"); Pkg.add("GLPK") +using JuMP +using GLPK + +game = Model(GLPK.Optimizer) + +@variable(game, 0 <= pr <= 1) +@variable(game, 0 <= pp <= 1) +@variable(game, 0 <= ps <= 1) +@variable(game, v) + +@constraint(game, ptotal, pr + pp + ps == 1) +@constraint(game, rock, 4*ps - 5*pp <= v) +@constraint(game, paper, 5*pr - 8*ps <= v) +@constraint(game, scissors, 8*pp - 4*pr <= v) + +@objective(game, Min, v) + +println(game) +optimize!(game) + +println("Opponent's value: ", value(v)) +println("Rock: ", value(pr)) +println("Paper: ", value(pp)) +println("Scissors: ", value(ps)) +``` + +Here’s the output: + +``` +Min v +Subject to + ptotal : pr + pp + ps = 1.0 + rock : 4 ps - 5 pp - v ≤ 0.0 + paper : 5 pr - 8 ps - v ≤ 0.0 + scissors : 8 pp - 4 pr - v ≤ 0.0 + pr ≥ 0.0 + pp ≥ 0.0 + ps ≥ 0.0 + pr ≤ 1.0 + pp ≤ 1.0 + ps ≤ 1.0 + +Opponent's value: 0.0 +Rock: 0.47058823529411764 +Paper: 0.23529411764705882 +Scissors: 0.29411764705882354 +``` + +As argued in the previous solution, the best value the opponent can get against the optimal player is 0. + +### What does optimality mean? + +The optimal solution was calculated assuming an all-powerful opponent. It guarantees that even the best weighted RPS player can’t get an advantage over you, but it turns out you can’t get an advantage over a terrible player, either, if you insist on playing this “optimal” strategy. That’s because weighted RPS has no bad plays, in the sense that “bomb” is bad. _Any_ strategy played against the above “optimal” strategy will have expected value of 0, so it’s really a defensive, or “safe” strategy. To play truly optimally and win against a bad player, you’ll have to adapt your strategy. For example, if your opponent plays “scissors” too often and “paper” not enough, you should adapt by playing “rock” more often. Of course, your opponent might just be pretending to be weak, and could start taking advantage of your deviation from the safe strategy. + +Games don’t always work out like that. For example, in theory, you could derive an optimal safe strategy for more complex games like poker. Such a strategy would tend to win against normal humans because even the best normal humans make bad poker plays. On the other hand, a “shark” at the table might be able to win against the “fish” faster by exploiting their weaknesses more aggressively. If you’re thinking of using LP to directly calculate a strategy for Texas Hold’em, though, sorry, but you’ll hit a combinatorial explosion of pure strategies as you account for all the cases like “if I’m dealt AJ on the big blind and I call a four-blind raise from the button preflop and then the flop is a rainbow 3K9…”. Only heavily simplified toy poker games are solvable with the general approach. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/05/21/glico_weighted_rock_paper_scissors.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://julialang.org/ +[2]: https://github.com/JuliaOpt/JuMP.jl From 84e17bfc8e7900790cdb2a5134ff3eb9aa4177c9 Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Mon, 25 May 2020 18:39:18 +0800 Subject: [PATCH 2157/3057] translating --- ...5 Now You Can Run Linux Apps in Windows (Thanks to WSL).md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md b/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md index e6e79cbb08..77e3ba785a 100644 --- a/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md +++ b/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lnrCoder) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -80,7 +80,7 @@ via: https://itsfoss.com/run-linux-apps-windows-wsl/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lnrCoder](https://github.com/lnrCoder) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 845f2d3db0f92e736d88e2ccfa7e36d52e205cb3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:20:51 +0800 Subject: [PATCH 2158/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20to=20Remove=20Files=20Older=20than=20N=20Days=20Using=20Tmpw?= =?UTF-8?q?atch/Tmpreaper=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md --- ... Days Using Tmpwatch-Tmpreaper on Linux.md | 198 ++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 sources/tech/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md diff --git a/sources/tech/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md b/sources/tech/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md new file mode 100644 index 0000000000..aa63946c77 --- /dev/null +++ b/sources/tech/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md @@ -0,0 +1,198 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Remove Files Older than N Days Using Tmpwatch/Tmpreaper on Linux) +[#]: via: (https://www.2daygeek.com/how-to-remove-files-older-than-n-days-using-tmpwatch-tmpreaper-on-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Remove Files Older than N Days Using Tmpwatch/Tmpreaper on Linux +====== + +You may have missed deleting files that are no longer needed on your computer in some directory. + +This can be “Download” or any other directory. + +It may have grown up over a period of time. + +If you have enough storage, you should remove them, as this will slow down your system when you list files. + +Also, it can be clumsy when you have thousands of files in one directory. + +It is very difficult to find a file in a specific directory when you do not know the file name you want to check. + +We can do this by using the find command with some combination, and we have written an article about this in the past. + + * [**Bash Script to Delete Files/Folders Older Than “X” Days in Linux**][1] + * [**How To Find And Delete Files Older Than “X” Days And “X” Hours In Linux?**][1] + * [**How To Automatically Delete Or Clean Up /tmp Folder Contents In Linux?**][1] + + + +Today we are going to show you how to achieve this using the Tmpwatch utility on Linux. + +### What is Tmpwatch + +Tmpwatch recursively removes files that have not been accessed for a specified period of time in the specified directories. + +Typically, it is used to automatically clean directories used for temporary file systems, such as / tmp and /var/tmp. + +It only remove empty directories, regular files, and symbolic links. + +It doesn’t switch to other file systems, and avoids the “lost+found” directory belonging to the root user. + +By default, tmpwatch deletes files based on their atime (access time), not their mtime (conversion time). + +You can change this behavior by adding other parameters in the tmpwatch command. + +**WARNING:** Please do not run “tmpwatch” or “tmpreaper” in “/” because there is no mechanism in the program to protect against this. + +### How to Install Tmpwatch on Linux + +Tmpwatch can be installed as follows from the distribution official repository. + +For **RHEL/CentOS 6** systems, use the **[yum command][2]** to install Tmpwatch. + +``` +$ sudo yum install -y tmpwatch +``` + +For **Debian** and **Ubuntu** systems, use the **[apt command][3]** or **[apt-get command][4]** to install Tmpreaper. + +``` +$ sudo apt-get install tmpreaper +``` + +For **openSUSE** systems, use the **[zypper command][5]** to install Tmpwatch. + +``` +$ sudo zypper install -y tmpwatch +``` + +For **Fedora** systems, use the **[dnf command][6]** to install Tmpwatch. + +``` +$ sudo dnf install -y tmpwatch +``` + +**Make a note:** If you are using Debian-based systems, use “tmpreaper” instead of tmpwatch. All examples will work as expected. + +### Understanding Key Options and Arguments + + * **atime** (File Last Access Time) – Access time shows the last time the data from a file was accessed by any of the process such as command or script, etc,. + * **mtime** (File Last Modify Time) – mtime shows when you modify a file contents or save a file. Most of the times ctime and mtime will be the same, unless the file attributes are updated. + * **ctime** (File Last Change Time) – ctime shows when your file metadata got changed. It means when the file attributes are changed like ownership or group, etc,. + * **dirmtime** (Directory Last modification time) – dirmtime shows when your directory last modified. + + + +The time parameter defines the threshold for removing files. + + * d – for days + * h – for hours + * m – for minutes + * s – for seconds + + + +### How to Removes Files That Haven’t Been Accessed for a Period of Time Using the Tmpwatch Command + +As I said at the beginning of the article, Tmpwatch deletes files by default (atime) depending on the time of access to the files. Also, since hours are the default parameter, you do not need to add the suffix to time if the action is performed using the hour unit. + +For example, run the command below to recursively remove files that have not been accessed for the past 5 hours. + +``` +# tmpwatch 5 /tmp +``` + +Run the command below to delete files that have not been modified for the last 10 hours. If you want to delete files using mtime, you need to add the “-m” option with the tmpwatch command. + +``` +# tmpwatch -m 10 /home/daygeek/Downloads +``` + +### How to Delete Files That Haven’t Been Accessed more than “X” Days Using the Tmpwatch Command + +If you want to delete files using days, you need to add the suffix “d”. The example below deletes files older than 30 days. + +``` +# tmpwatch 30d /home/daygeek/Downloads +``` + +### How to Delete All Files That Haven’t Been Accessed for a Period of Time Using the Tmpwatch Command + +The below command removes all file types, not just regular files, symbolic links and directories based on mtime. + +``` +# tmpwatch -am 12 /tmp +``` + +### How to Exclude a Directory with Tmpwatch + +The below command will delete all files and excludes directories that haven’t been modified for the past 10 hours. + +``` +# tmpwatch -am 10 --nodirs /home/daygeek/Downloads +``` + +### How to Exclude a Specific Path with Tmpwatch + +The command below will delete all files except the directory below which has not been modified for the past 10 hours. + +``` +# tmpwatch -am 10 --exclude=/home/daygeek/Downloads/Movies /home/daygeek/Downloads +``` + +### How to Exclude Specific Pattern with Tmpwatch + +The command below will delete all files except the Pattern below which has not been modified for the past 10 hours. + +``` +# tmpwatch -am 10 --exclude-pattern='*.pdf' /home/daygeek/Downloads +``` + +### How to Perform Dry Run with Tmpwatch Command + +Run the below command if you want to perform dry run. + +``` +# tmpwatch -t 5h /home/daygeek/Downloads +``` + +### How to Setup a Cronjob to Delete files Periodically Using Tmpwatch + +By default it leaves a **[cronjob][7]** file under the **“/etc/cron.daily/tmpreaper”** directory. This cronjob works according to the configuration file located in **“/etc/timereaper.conf”**. You can customize the file according to your needs. + +It runs once a day and deletes files older than 7 days. + +Alternatively, if you would like to perform an action routinely, you can manually add a conjob based on your needs. + +``` +# crontab -e + +0 10 * * * /usr/sbin/tmpwatch 15d /home/daygeek/Downloads +``` + +The above cronjob will delete files that are older than 15 days daily at 10AM. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-remove-files-older-than-n-days-using-tmpwatch-tmpreaper-on-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-days-in-linux/ +[2]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[6]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[7]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ From 1ced5eeaa11b5af8a5a170d041398fa8b38ae5fb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:21:08 +0800 Subject: [PATCH 2159/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20to=20Execute=20a=20Command=20or=20Script=20at=20Reboot=20or?= =?UTF-8?q?=20Startup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md --- ... Command or Script at Reboot or Startup.md | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md diff --git a/sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md b/sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md new file mode 100644 index 0000000000..5d81b593de --- /dev/null +++ b/sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md @@ -0,0 +1,159 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Execute a Command or Script at Reboot or Startup) +[#]: via: (https://www.2daygeek.com/execute-run-linux-scripts-command-at-reboot-startup/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Execute a Command or Script at Reboot or Startup +====== + +Well known services on Linux can be added on boot without any problems. + +For example, if you want to add Apache Httpd **[service on boot][1]**, you can do this with the help of the chkconfig and systemctl command. + +Sometimes you need to add a custom script or command or service on boot, and how to do it? + +You can do this using the below three methods. + +In this article, we will show you how to use these methods with examples. + +### Method-1: How to Run Script or Command at Reboot or Startup Using /etc/rc.d/rc.local File + +The **“/etc/rc.local”** file is traditionally executed after all normal computer services have been started at the end of the process of switching to a multiuser runlevel. + +This method also works on the systemd system. + +You need to add the location of your script to the “/etc/rc.d/rc.local” file to run on boot. + +Make sure the file has permission to run. + +``` +# chmod +x /etc/rc.d/rc.local +``` + +To demonstrate this, we are going to create a simple sample script. You can create any script as needed. + +``` +# vi /opt/scripts/run-script-on-boot.sh + +#!/bin/bash +date > /root/on-boot-output.txt +hostname > /root/on-boot-output.txt +``` + +Once the script is ready, set the executable permission. + +``` +# chmod +x /opt/scripts/run-script-on-boot.sh +``` + +Finally add the script to the bottom of the file. + +``` +# vi /etc/rc.d/rc.local + +/opt/scripts/run-script-on-boot.sh +``` + +**[Restart your system][2]** to check this. + +``` +# reboot +``` + +### Method-2: How to Execute a Command or Script at Reboot or Startup Using the crontab + +cron executes scheduled jobs automatically in the backend at a specific time. + +This can be easily accomplished using a special string called **“@reboot”** with **[cron job][3]**. + +@reboot is a special string and allows the user to run any command or script at startup (boot time). + +This example runs the “/opt/scripts/run-script-on-boot.sh” file on the system restart. + +We are going to use the same script as above. + +To do so, just add the following entry in the crontab file. + +``` +# crontab -e + +@reboot /opt/scripts/run-script-on-boot.sh +``` + +Restart your system to check this. + +``` +# reboot +``` + +### Method-3: How to Run a Command or Script at Reboot or Startup Using the systemd service unit + +This method only works on the systemd system. This method is very straightforward. + +We are going to use the same script above to demonstrate this. + +To do so, you need to create a systemd startup script and place it in the **“/etc/systemd/system/”** directory. + +This is our sample systemd startup unit script. + +``` +# vi sample-on-boot-script.service + +[Unit] +Description=Run a Custom Script at Startup +After=default.target + +[Service] +ExecStart=/opt/scripts/run-script-on-boot.sh + +[Install] +WantedBy=default.target +``` + +Once you place the unit script in the systemd location, run the following command to update the systemd configuration files and enable the service. + +``` +# systemctl daemon-reload +# systemctl enable sample-on-boot-script.service +``` + +Restart your system to check this. + +``` +# reboot +``` + +### Bonus Tips: + +If you want to run a script in the background, you need to add the trailing ampersand “&” symbol. + +``` +/Path/To/My_Script & +``` + +If you want to run the command as a different user, use the following format. + +``` +su - $USER -c /Path/To/My_Script +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/execute-run-linux-scripts-command-at-reboot-startup/ + +作者:[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/enable-disable-services-on-boot-linux-chkconfig-systemctl-command/ +[2]: https://www.2daygeek.com/6-commands-to-shutdown-halt-poweroff-reboot-the-linux-system/ +[3]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ From 09d3980627207144fc8abc523fb0fdb22810c0e8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:21:25 +0800 Subject: [PATCH 2160/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20to=20Manipulate=20an=20Ethernet=20Card=20Using=20the=20ethto?= =?UTF-8?q?ol=20Command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md --- ...Ethernet Card Using the ethtool Command.md | 314 ++++++++++++++++++ 1 file changed, 314 insertions(+) create mode 100644 sources/tech/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md diff --git a/sources/tech/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md b/sources/tech/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md new file mode 100644 index 0000000000..42c7bd824a --- /dev/null +++ b/sources/tech/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md @@ -0,0 +1,314 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Manipulate an Ethernet Card Using the ethtool Command) +[#]: via: (https://www.2daygeek.com/linux-ethtool-command-view-change-ethernet-adapter-settings-nic-card/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Manipulate an Ethernet Card Using the ethtool Command +====== + +Ethtool is used to view and modify network device driver parameters and hardware settings, especially for wired ethernet devices. + +You can change ethernet card parameters as required, including auto-negotiation, Speed, Duplex and Wake-on LAN. + +The configuration of your Ethernet card allows your computer to communicate effectively over the network. + +This tool provides many information about Ethernet devices connected to your Linux system. + +In this article, we will show you how to change the below parameters and how to view them. + +This article will help you troubleshoot Ethernet card related problems on a Linux system. + +The following information will help you understand how Ethernet card works. + + * **Half Duplex:** Half-duplex mode allows a device to either send or receive packets at a time. + * **Full Duplex:** Full-duplex mode allows a device to send and receive packets simultaneously. + * **Auto-Negotiation:** Auto-negotiation is a mechanism that allows a device to automatically choose the best network speed and mode of operation (full-duplex or half-dual mode). + * **Speed:** By default it uses maximum speed and you can change it according to your need. + * **Link detection:** Link detection shows the status of the network interface card. If it shows “no” then try restarting the interface. If the link detection still says “no”, check if there are any issues with the cables connected between the switch and the system. + + + +### How to Install ethtool on Linux + +By default ethtool should already be installed on most systems. If not, you can install it from the distribution official repository. + +For **RHEL/CentOS 6/7** systems, use the **[yum command][1]** to install ethtool. + +``` +$ sudo yum install -y ethtool +``` + +For **RHEL/CentOS 8** and **Fedora** systems, use the **[dnf command][2]** to install ethtool. + +``` +$ sudo yum install -y ethtool +``` + +For **Debian** based systems, use the **[apt command][3]** or **[apt-get command][4]** to install ethtool. + +``` +$ sudo apt-get install ethtool +``` + +For **openSUSE** systems, use the **[zypper command][5]** to install ethtool. + +``` +$ sudo zypper install -y ethtool +``` + +For **Arch Linux** systems, use the **[pacman command][6]** to install ethtool. + +``` +$ sudo pacman -S ethtool +``` + +### How to Check the Available Network Interface on Linux + +You can use the **[ip command][7]** or the **ifconfig command** (deprecated in modern distribution) to verify the name and other details of the available and active network interfaces. + +``` +# ip a +or +# ifconfig + +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 +2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 + link/ether 00:10:22:35:23:sf brd ff:ff:ff:ff:ff:ff + inet 192.164.23.100/24 brd 192.164.23.255 scope global eth0 + valid_lft forever preferred_lft forever +``` + +### How to Check Network Interface Card (NIC) Information on Linux + +Once you have the Ethernet interface name, you can easily check the details of it using the ethtool command as shown below. + +On Linux, each network interface card (NIC) is assigned unique names, such as ethX, enpXXX, and so on. + + * The older Linux distribution used the **eth[X]** format. For example, RHEL 6 and their older versions. + * Modern Linux distributions use **enp[XXX]** or **ens[XXX]** formats. For example, most of the modern Linux distribution uses this format, including RHEL 7, Debian 10, Ubuntu 16.04 LTS. + + + +``` +# ethtool eth0 + +Settings for eth0: + Supported ports: [ TP ] + Supported link modes: 1000baseT/Full + 10000baseT/Full + Supported pause frame use: No + Supports auto-negotiation: No + Supported FEC modes: Not reported + Advertised link modes: Not reported + Advertised pause frame use: No + Advertised auto-negotiation: No + Advertised FEC modes: Not reported + Speed: 10000Mb/s + Duplex: Full + Port: Twisted Pair + PHYAD: 0 + Transceiver: internal + Auto-negotiation: off + MDI-X: Unknown + Supports Wake-on: uag + Wake-on: d + Link detected: yes +``` + +### How to Check Ethernet Card Driver and Firmware Version on Linux + +You can check driver version, firmware version, and bus details using the ethtool command with the **“-i”** option as shown below. + +``` +# ethtool -i eth0 + +driver: vmxnet3 +version: 1.4.16.0-k-NAPI +firmware-version: +expansion-rom-version: +bus-info: 0000:0b:00.0 +supports-statistics: yes +supports-test: no +supports-eeprom-access: no +supports-register-dump: yes +supports-priv-flags: no +``` + +### How to Check Network Usage Statistics on Linux + +You can view network usage statistics using the ethtool command with the **“-S”** option. It shows the bytes transferred, received, errors etc. + +``` +# ethtool -S eth0 + +NIC statistics: + Tx Queue#: 0 + TSO pkts tx: 2053 + TSO bytes tx: 7167572 + ucast pkts tx: 4028081 + ucast bytes tx: 399093197 + mcast pkts tx: 0 + mcast bytes tx: 0 + bcast pkts tx: 0 + bcast bytes tx: 0 + pkts tx err: 0 + pkts tx discard: 0 + drv dropped tx total: 0 + too many frags: 0 + giant hdr: 0 + hdr err: 0 + tso: 0 + ring full: 0 + pkts linearized: 0 + hdr cloned: 0 + giant hdr: 0 + Tx Queue#: 1 + TSO pkts tx: 1955 + TSO bytes tx: 6536945 + ucast pkts tx: 3711838 + ucast bytes tx: 346309662 + mcast pkts tx: 0 + mcast bytes tx: 0 + bcast pkts tx: 1186 + bcast bytes tx: 49812 + pkts tx err: 0 + pkts tx discard: 0 + drv dropped tx total: 0 + too many frags: 0 + giant hdr: 0 + hdr err: 0 + tso: 0 + ring full: 0 + pkts linearized: 0 + hdr cloned: 0 + giant hdr: 0 + Rx Queue#: 0 + LRO pkts rx: 0 + LRO byte rx: 0 + ucast pkts rx: 5084776 + ucast bytes rx: 4673133395 + mcast pkts rx: 0 + mcast bytes rx: 0 + bcast pkts rx: 154143 + bcast bytes rx: 45415676 + pkts rx OOB: 0 + pkts rx err: 0 + drv dropped rx total: 0 + err: 0 + fcs: 0 + rx buf alloc fail: 0 + Rx Queue#: 1 + LRO pkts rx: 0 + LRO byte rx: 0 + ucast pkts rx: 6346769 + ucast bytes rx: 4835534292 + mcast pkts rx: 0 + mcast bytes rx: 0 + bcast pkts rx: 3464 + bcast bytes rx: 714646 + pkts rx OOB: 0 + pkts rx err: 0 + drv dropped rx total: 0 + err: 0 + fcs: 0 + rx buf alloc fail: 0 + tx timeout count: 0 +``` + +### How to Change the Speed of Ethernet Device on Linux + +You can change the speed of the Ethernet as needed. When you make this change the interface will automatically go offline and you will need to bring it back online using the **[ifup command][8]** or the ip command or the nmcli command. + +``` +# ethtool -s eth0 speed 100 +# ip link set eth0 up +``` + +### How to Enable/Disable Auto-Negotiation for Ethernet Device on Linux + +You can enable or disable Auto-Negotiation using the ethtool command with the **“autoneg”** option as shown below. + +``` +# ethtool -s eth0 autoneg off +# ethtool -s eth0 autoneg on +``` + +### How to Change Multiple Parameters at Once + +If you want to change multiple parameters of the Ethernet interface simultaneously using the ethtool command, use the format below. + +``` +Syntax: +ethtool –s [device_name] speed [10/100/1000] duplex [half/full] autoneg [on/off] +``` + +``` +# ethtool –s eth0 speed 1000 duplex full autoneg off +``` + +### How to Check Auto-negotiation, RX and TX of a Particular Interface on Linux + +To view auto-negotiation details about a specific Ethernet device, use the below format. + +``` +# ethtool -a eth0 +``` + +### How to Identify a Specific NIC from Multiple Devices (Blink LED Port of NIC Card) + +This option is very useful if you want to identify a specific physical interface port among others. The below ethtool command blink the LED of the eth0 port. + +``` +# ethtool -p eth0 +``` + +### How to Set These Parameters in Linux Permanently + +After a system restarts the changes you made with ethtool will be reverted by default. + +To make custom settings permanent, you need to update your value in the network configuration file. Depending on your Linux distribution you may need to update this value to the correct file. + +For RHEL based systems. You must use the ETHTOOL_OPTS variables. + +``` +# vi /etc/sysconfig/network-scripts/ifcfg-eth0 + +ETHTOOL_OPTS="speed 1000 duplex full autoneg off" +``` + +For **Debian** based systems. + +``` +# vi /etc/network/interfaces + +post-up ethtool -s eth0 speed 1000 duplex full autoneg off +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-ethtool-command-view-change-ethernet-adapter-settings-nic-card/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[2]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[6]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[7]: https://www.2daygeek.com/ip-command-configure-network-interface-usage-linux/ +[8]: https://www.2daygeek.com/enable-disable-up-down-nic-network-interface-port-linux-using-ifconfig-ifdown-ifup-ip-nmcli-nmtui/ From fa9e6ca25d7097fd32ad4b5f3d4777f03c00de9c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:23:52 +0800 Subject: [PATCH 2161/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200520=20Fedo?= =?UTF-8?q?ra=20Silverblue,=20an=20introduction=20for=20developers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200520 Fedora Silverblue, an introduction for developers.md --- ...verblue, an introduction for developers.md | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sources/tech/20200520 Fedora Silverblue, an introduction for developers.md diff --git a/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md b/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md new file mode 100644 index 0000000000..a112f4ca6d --- /dev/null +++ b/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora Silverblue, an introduction for developers) +[#]: via: (https://fedoramagazine.org/fedora-silverblue-brings-future-tech-to-the-desktop/) +[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/) + +Fedora Silverblue, an introduction for developers +====== + +![][1] + +The Fedora [Silverblue project][2] takes Fedora workstation, libostree and podman, puts them in a blender, and creates a new Immutable Fedora Workstation. Fedora Silverblue is an OS that stops you from changing the core system files arbitrarily, and readily allows you to change the environment system files. The article [What is Silverblue][3] describes the big picture, and this article drills down into details for the developer. + +Fedora Silverblue ties together a few different projects to make a system that is a git-like object, capable of layering packages, and has a container focused work flow. Silverblue is not the only distribution going down this road. It is the desktop equivalent of [CoreOS][4], the server OS used by [Red Hat Openshift][5]. + +Silverblue’s idea of ‘immutable’ has nothing to do with immutable layers in a container. Silverblue keeps system files immutable by making them read-only. + +### Why immutable? + +Has an upgrade left your system in an unusable state? Have you wondered why one server in a pool of identical machines is being weird? These problems can happen when one system library – one tiny little file out of hundreds – is corrupted, badly configured or the wrong version. Or maybe your upgrade works fine but it’s not what you’d hoped for, and you want to roll back to the previous state. + +An immutable OS is intended to stop problems like these biting you. This is not an easy thing to achieve – simple changes, like flipping the file system between read-write and read-only, may only change a fault-finding headache to a maintenance headache. + +Freezing the system is good news for sysadmins, but what about developers? Setting up a development environment means heavily customizing the system, and filling it with living code that changes over time. The answer is partly a case of combining components, and partly the ability to swap between OS versions. + +### How it works + +So how do you get the benefits of immutability without losing the ability to do your work? If you’re thinking ‘containers’, good guess – part of the solution uses [podman][6]. But much of the work happens underneath the container layer, at the OS level. + +Fedora Silverblue ties together a few different projects to turn an immutable OS into a usable workstation. Silverblue uses libostree to provide the base system, lets you edit config files in /etc/, and provides three different ways to install packages. + + * [rpm-ostree][7] installs RPM packages, similar to DNF in the traditional Fedora workstation. Use this for things that shouldn’t go in containers, like KVM/libvirt. + * [flatpak][8] installs packages from a central flathub repo. This is the one-stop shop for graphical desktop apps like LibreOffice. + * The traditional _dnf install_ still works, but only inside a [toolbox][9] (a Fedora container). A developer’s workbench goes in a toolbox. + + + +If you want to know more about these components, check out [Pieces of Silverblue][10]. + +### Rolling back and pinning upgrades + +All operating systems need upgrades. Features are added, security holes are plugged and bugs are squashed. But sometimes an upgrade is not a developer’s friend. + +A developer depends on many things to get the job done. A good development environment is stuffed with libraries, editors, toolchains and apps that are controlled by the OS, not the developer. An upgrade may cause trouble. Have any of these situations happened to you? + + * A new encryption library is too strict, and an upgrade stopped an API working. + * Code works well, but has deprecated syntax. An upgrade brought error-throwing misery. + * The development environment is lovingly hand-crafted. An upgrade broke dependencies and added conflicts. + + + +In a traditional environment, unpicking a troublesome upgrade is hard. In Silverblue, it’s easy. Silverblue keeps two copies of the OS – your current upgrade and your previous version. Point the OS at the previous version, reboot, and you’ve got your old system files back. + +You aren’t limited to two copies of your file system – you can keep more by pinning your favorite versions. Dusty Mabe, one of the engineers who has been working on the system since the [Project Atomic][11] days, describes how to pin extra copies of the OS in his article [Pinning Deployments in OSTree Based Systems][12]. + +Your home directory is not affected by rolling back. Rpm-ostree does not touch /etc/ and /var/. + +### System updates and package installs + +Silverblue’s rpm-ostree treats all the files as one object, stored in a repository. The working file system is a checked-out copy of this object. After a system update, you get two objects in that repository – one current object and one updated object. The updated object is checked out and becomes the new file system. + +You install your workhorse applications in toolboxes, which provide container isolation. And you install your desktop applications using Flatpak. + +This new OS requires a shift in approach. For instance, you don’t have to keep only one copy of your system files – you can store a few and select which one you use. That means you can swap back and forth between an old Fedora release and the rawhide (development) version in a matter of minutes. + +### Build your own Silverblue VM + +You can safely install Fedora Silverblue in a VM on your workstation. If you’ve got a hypervisor and half an hour to spare (10 minutes for ISO download, and 20 minutes for the build), you can see for yourself. + + 1. Download Fedora Silverblue ISO from + 2. (not Fedora workstation from ). + 3. Boot a VM with the Fedora Silverblue ISO. You can squeeze Fedora into compute resources of 1 CPU, 1024MiB of memory and 12GiB of storage, but bigger is better. + 4. Answer [Anaconda][13]’s questions. + 5. Wait for the [Gnome][14] desktop to appear. + 6. Answer [Initial Setup][15]’s questions. + + + +Then you’re ready to set up your developer’s tools. If you’re looking for an IDE, check these out. Use flatpak on the desktop to install them. + + * [Gnome Builder][16] (Gnome’s official IDE) + * [Eclipse][17] + * [Code::Blocks][18] + + + +Finally, use the CLI to create your first toolbox. Load it with modules using [npm][19], [gem][20], [pip][21], [git][22] or your other favorite tools. + +### Help! + +If you get stuck, ask questions at the [forum][23]. + +If you’re looking for ideas about how to use Silverblue, read articles in the [magazine][24]. + +### Is Silverblue for you? + +Silverblue is full of shiny new tech. That in itself is enough to attract the cool kids, like moths to a flame. But this OS is not for everyone. It’s a young system, so some bugs will still be lurking in there. And pioneering tech requires a change of habit – that’s extra cognitive load that the new user may not want to take on. + +The OS brings immutable benefits, like keeping your system files safe. It also brings some drawbacks, like the need to reboot after adding system packages. Silverblue also enables new ways of working. If you want to explore new directions in the OS, find out if Silverblue brings benefits to your work. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-silverblue-brings-future-tech-to-the-desktop/ + +作者:[Nick Hardiman][a] +选题:[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/nickhardiman/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/silverblue-introfordev-816x345.png +[2]: https://silverblue.fedoraproject.org/ +[3]: https://fedoramagazine.org/what-is-silverblue/ +[4]: http://coreos.com/ +[5]: https://www.openshift.com/products/container-platform +[6]: https://github.com/containers/libpod +[7]: https://rpm-ostree.readthedocs.io/en/latest/ +[8]: https://docs.flatpak.org/en/latest/ +[9]: https://github.com/containers/toolbox +[10]: https://fedoramagazine.org/pieces-of-fedora-silverblue/ +[11]: https://www.projectatomic.io/ +[12]: https://www.projectatomic.io/blog/2018/05/pinning-deployments-ostree-based-systems/ +[13]: https://fedoraproject.org/wiki/Anaconda +[14]: https://www.gnome.org/ +[15]: https://fedoraproject.org/wiki/InitialSetup +[16]: https://wiki.gnome.org/Apps/Builder +[17]: https://www.eclipse.org/ide/ +[18]: http://www.codeblocks.org/ +[19]: https://www.npmjs.com/package/package +[20]: https://rubygems.org/ +[21]: https://pypi.org/ +[22]: https://git-scm.com/ +[23]: https://discussion.fedoraproject.org/c/desktop/silverblue/6 +[24]: https://fedoramagazine.org/?s=silverblue From 9a81323aeb5689bbd03073a0a69c98e589c3110e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:24:06 +0800 Subject: [PATCH 2162/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200518=20Usin?= =?UTF-8?q?g=20Fedora=20to=20implement=20REST=20API=20in=20JavaScript:=20p?= =?UTF-8?q?art=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md --- ...mplement REST API in JavaScript- part 2.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md diff --git a/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md b/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md new file mode 100644 index 0000000000..b02822c4fa --- /dev/null +++ b/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Fedora to implement REST API in JavaScript: part 2) +[#]: via: (https://fedoramagazine.org/using-fedora-to-implement-rest-api-in-javascript-part-2/) +[#]: author: (Vaclav Keil https://fedoramagazine.org/author/vaclavk/) + +Using Fedora to implement REST API in JavaScript: part 2 +====== + +![][1] + +In [part 1][2] previously, you saw how to quickly create a simple API service using Fedora Workstation, Express, and JavaScript. This article shows you the simplicity of how to create a new API. This part shows you how to: + + * Install a DB server + * Build a new route + * Connect a new datasource + * Use Fedora terminal to send and receive data + + + +### Generating an app + +Please refer to the [previous article][2] for more details. But to make things simple, change to your work directory and generate an app skeleton. +``` + +``` + +$ cd our-work-directory +$ npx express-generator –no-view –git /myApp +$ cd myApp +$ npm i +``` + +``` + +### Installing a database server + +In this part, we’ll install MariaDB database. MariaDB is the Fedora default database. + +``` +$ dnf module list mariadb | sort -u ## lists the streams available +$ sudo dnf module install mariadb:10.3 ##10.4 is the latest +``` + +_Note: the default profile is mariadb/server_. + +For those who need to spin up a Docker container a ready made container with Fedora 31 is available. + +``` +$ docker pull registry.fedoraproject.org/f31/mariadb +$ docker run -d --name mariadb_database -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 registry.fedoraproject.org/f31/mariadb +``` + +Now start the MariaDB service. + +``` +$ sudo systemctl start mariadb +``` + +If you’d like the service to start at boot, you can also enable it in systemd: + +``` +$ sudo systemctl enable mariadb ## start at boot +``` + +Next, setup the database as needed: + +``` +$ mysql -u root -p ## root password is blank +MariaDB> CREATE DATABASE users; +MariaDB> create user dbuser identified by ‘123456‘; +MariaDB> grant select, insert, update, create, drop on users.* to dbuser; +MariaDB> show grants for dbuser; +MariaDB> \q +``` + +A database connector is needed to use the database with Node.js. + +``` +$ npm install mariadb ## installs MariaDB Node.js connector +``` + +We’ll leverage Sequelize in this sample API. Sequelize is a promise-based Node.js ORM (Object Relational Mapper) for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. + +``` +$ npm install sequelize ## installs Sequelize +``` + +### Connecting a new datasource + +Now, create a new _db_ folder and create a new file _sequelize.js_ there: + +``` +const Sequelize = require('sequelize'), + sequelize = new Sequelize(process.env.db_name || 'users', process.env.db_user || 'dbuser', process.env.db_pass || '123456', { + host: 'localhost', + dialect: 'mariadb', + ssl: true +}) + +module.exports = sequelize +``` + +_Note: For the sake of completeness I‘m including a link to the related Github repo: _ + +Let‘s create a new file _models/user.js_. A nice feature of a Sequelize model is that it helps us to create the necessary tables and colums automatically. The code snippet responsible for doing this is seen below: + +``` +sequelize.sync({ +force: false +}) +``` + +Note: never switch to true with a production database – it would _drop your tables at app start_! + +We will refer to the earlier created sequelize.js this way: + +``` +const sequelize = require('../db/sequelize') +``` + +### Building new routes + +Next, you’ll create a new file _routes/user.js_. You already have _routes/users.js_ from the previous article. You can copy and paste the code in and proceed with editing it. + +You’ll also need a reference to the previously created model. + +``` +const User = require('../models/user') +``` + +Change the route path to _/users_ and also create a new **post** method route. + +Mind the async – await keywords there. An interaction with a database will take some time and this one will do the trick. Yes, an async function returns a promise and this one makes promises easy to use. + +_Note: This code is not production ready, since it would also need to include an authentication feature._ + +We‘ll make the new route working this way: + +``` +const userRouter = require('./routes/user') +app.use(userRouter) +``` + +Let‘s also remove the existing _usersRouter_. The _routes/users.js_ can be deleted too. + +``` +$ npm start +``` + +With the above command, you can launch your new app. + +### Using the terminal to send and retrieve data + +Let’s create a new database record through the post method: + +``` +$ curl -d 'name=Adam' http://localhost:3000/users +``` + +To retrieve the data created through the API, do an HTTP GET request: + +``` +$ curl http://localhost:3000/users +``` + +The console output of the curl command is a JSON array containing data of all the records in the _Users_ table. + +_Note: This is not really the usual end result — an application consumes the API finally. The API will usually also have endpoints to update and remove data._ + +### More automation + +Let‘s assume we might want to create an API serving many tables. It‘s possible and very handy to automatically generate models for Sequelize from our database. Sequelize-auto will do the heavy lifting for us. The resulting files (_models.js_) would be placed and imported within the _/models_ directory. + +``` +$ npm install sequelize-auto +``` + +A node.js connector is needed to use this one and we have it already installed for MariaDB. + +### Conclusion + +It‘s possible to develop and run an API using Fedora, Fedora default MariaDB, JavaScript and efficiently develop a solution like with a noSQL database. For those used to working with MongoDB or a similar noSQL database, Fedora and MariaDB are important open-source enablers. + +* * * + +_Photo by [Mazhar Zandsalimi][3] on [Unsplash][4]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-fedora-to-implement-rest-api-in-javascript-part-2/ + +作者:[Vaclav Keil][a] +选题:[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/vaclavk/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/javascript-api-2-816x345.jpg +[2]: https://fedoramagazine.org/using-fedora-to-quickly-implement-rest-api-with-javascript/ +[3]: https://unsplash.com/@m47h4r?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[4]: https://unsplash.com/s/photos/javascript?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From 9bb29f07dfc3b6c63abcbff79ef2412830cae589 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:24:20 +0800 Subject: [PATCH 2163/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200515=20The?= =?UTF-8?q?=20pieces=20of=20Fedora=20Silverblue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200515 The pieces of Fedora Silverblue.md --- ...0200515 The pieces of Fedora Silverblue.md | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 sources/tech/20200515 The pieces of Fedora Silverblue.md diff --git a/sources/tech/20200515 The pieces of Fedora Silverblue.md b/sources/tech/20200515 The pieces of Fedora Silverblue.md new file mode 100644 index 0000000000..04bd4e1643 --- /dev/null +++ b/sources/tech/20200515 The pieces of Fedora Silverblue.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The pieces of Fedora Silverblue) +[#]: via: (https://fedoramagazine.org/pieces-of-fedora-silverblue/) +[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/) + +The pieces of Fedora Silverblue +====== + +![][1] + +Fedora Silverblue provides a useful workstation build on an immutable operating system. In “[What is Silverblue?][2]“, you learned about the benefits that an immutable OS provides. But what pieces go into making it? This article examines some of the technology that powers Silverblue. + +### The filesystem + +Fedora Workstation users may find the idea of an immutable OS to be the most brain-melting part of Silverblue. What does that mean? Find some answers by taking a look at the filesystem. + +At first glance, the layout looks pretty much the same as a regular Fedora file system. It has some differences, like making _/home_ a symbolic link to _/var/home_. And you can get more answers by looking at how libostree works. libostree treats the whole tree like it’s an object, checks it into a code repository, and checks out a copy for your machine to use. + +#### libostree + +The [libostree project][3] supplies the goods for managing Silverblue’s file system. It is an upgrade system that the user can control using [rpm-ostree commands][4]. + +libostree knows nothing about packages—an upgrade means replacing one complete file system with another complete file system. libostree treats the file system tree as one atomic object (an unbreakable unit). In fact, the forerunner to Silverblue was named [Project Atomic][5]. + +The libostree project provides a library and set of tools. It’s an upgrade system that carries out these tasks. + + 1. Pull in a new file system + 2. Store the new file system + 3. Deploy the new file system + + + +##### Pull in a new file system + +Pulling in a new file system means copying an object (the entire file system) from a remote source to its own store. If you’ve worked with virtual machine image files, you already understand the concept of a file system object that you can copy. + +##### Store the new file system + +The libostree store has some source code control qualities—it stores many file system objects, and checks one out to be used as the root file system. libostree’s store has two parts: + + * a repository database at _/sysroot/ostree/repo/_ + * file systems in _/sysroot/ostree/deploy/fedora/deploy/_ + + + +libostree keeps track of what’s been checked in using commit IDs. Each commit ID can be found in a directory name, nested deep inside _/sysroot_ .A libostree commit ID is a long checksum, and looks similar to a git commit ID. + +``` +$ ls -d /sysroot/ostree/deploy/fedora/deploy/*/ +/sysroot/ostree/deploy/fedora/deploy/c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4.0/ +``` + +_rpm-ostree status_ gives a little more information about that commit ID. The output is a little confusing; it can take a while to see this file system is Fedora 31. + +``` +$ rpm-ostree status +State: idle +AutomaticUpdates: disabled +Deployments: +● ostree://fedora:fedora/31/x86_64/silverblue + Version: 31.1.9 (2019-10-23T21:44:48Z) + Commit: c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4 + GPGSignature: Valid signature by 7D22D5867F2A4236474BF7B850CB390B3C3359C4 +``` + +##### Deploy the new filesystem + +libostree deploys a new file system by checking out the new object from its store. libostree doesn’t check out a file system by copying all the files—it uses hard links instead. If you look inside the commit ID directory, you see something that looks suspiciously like the root directory. That’s because it _is_ the root directory. You can see these two directories are pointing to the same place by checking their inodes. + +``` +$ ls -di1 / /sysroot/ostree/deploy/fedora/deploy/*/ +260102 / +260102 /sysroot/ostree/deploy/fedora/deploy/c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4.0/ +``` + +This is a fresh install, so there’s only one commit ID. After a system update, there will be two. If more copies of the file system are checked into libostree’s repo, more commit IDs appear here. + +##### Upgrade process + +Putting the pieces together, the update process looks like this: + + 1. libostree checks out a copy of the file system object from the repository + 2. DNF installs packages into the copy + 3. libostree checks in the copy as a new object + 4. libostree checks out the copy to become the new file system + 5. You reboot to pick up the new system files + + + +In addition to more safety, there is more flexibility. You can do new things with libostree’s repo, like store a few different file systems and check out whichever one you feel like using. + +#### Silverblue’s root file system + +Fedora keeps its system files in all the usual Linux places, such as _/boot_ for boot files, _/etc_ for configuration files, and _/home_ for user home directories. The root directory in Silverblue looks much like the root directory in traditional Fedora, but there are some differences. + + * The filesystem has been checked out by libostree + * Some directories are now symbolic links to new locations. For example, _/home_ is a symbolic link to _/var/home_ + * _/usr_ is a read-only directory + * There’s a new directory named _/sysroot_. This is libostree’s new home + + + +#### Juggling file systems + +You can store many file systems and switch between them. This is called _rebasing_, and it’s similar to git rebasing. In fact, upgrading Silverblue to the next Fedora version is not a big package install—it’s a pull from a remote repository and a rebase. + +You could store three copies with three different desktops: one KDE, one GNOME, and one XFCE. Or three different OS versions: how about keeping the current version, the nightly build, and an old classic? Switching between them is a matter of rebasing to the appropriate file system object. + +Rebasing is also how you upgrade from one Fedora release to the next. See “[How to rebase to Fedora 32 on Silverblue][6]” for more information. + +### Flatpak + +The [Flatpak project][7] provides a way of installing applications like LibreOffice. Applications are pulled from remote repositories like [Flathub][8]. It’s a kind of package manager, although you won’t find the word _package_ in the [docs][9]. Traditional Fedora variants like Fedora Workstation can also use Flatpak, but the sandboxed nature of flatpaks make it particularly good for Silverblue. This way you do not have to do the entire ostree update process every time you wish to install an application. + +Flatpak is well-suited to desktop applications, but also works for command line applications. You can install the [vim][10] editor with the command _flatpak install flathub org.vim.Vim_ and run it with _flatpak run org.vim.Vim_. + +### toolbox + +The [toolbox project][11] provides a traditional operating system inside a container. The idea is that you can mess with the mutable OS inside your toolbox (the Fedora container) as much as you like, and leave the immutable OS outside your toolbox untouched. You pack as many toolboxes as you want on your system, so you can keep work separated. Behind the scenes, the executable _/usr/bin/toolbox_ is a shell script that uses [podman][12]. + +A fresh install does not include a default toolbox. The _toolbox create_ command checks the OS version (by reading _/usr/lib/os-release_), looks for a matching version at the Fedora container registry, and downloads the container. + +``` +$ toolbox create +Image required to create toolbox container. +Download registry.fedoraproject.org/f31/fedora-toolbox:31 (500MB)? [y/N]: y +Created container: fedora-toolbox-31 +Enter with: toolbox enter +``` + +Hundreds of packages are installed inside the toolbox. The _dnf_ command and the usual Fedora repos are set up, ready to install more. The _ostree_ and _rpm-ostree_ commands are not included – no immutable OS here. + +Each user’s home directory is mounted on their toolbox, for storing content files outside the container. + +### Put the pieces together + +Spend some time exploring Fedora Silverblue and it will become clear how these components fit together. Like other Fedora variants, all these of tools come from open source projects. You can get as up close and personal as you want, from reading their docs to contributing code. Or you can [contribute to Silverblue][13] itself. + +Join the Fedora Silverblue conversations on [discussion.fedoraproject.org][14] or in [#silverblue on Freenode IRC][15]. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/pieces-of-fedora-silverblue/ + +作者:[Nick Hardiman][a] +选题:[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/nickhardiman/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/silverblue-pieces-816x345.png +[2]: https://fedoramagazine.org/what-is-silverblue/ +[3]: https://ostree.readthedocs.io/en/latest/ +[4]: https://rpm-ostree.readthedocs.io/en/latest/manual/administrator-handbook/#administering-an-rpm-ostree-based-system +[5]: https://www.projectatomic.io/ +[6]: https://fedoramagazine.org/how-to-rebase-to-fedora-32-on-silverblue/ +[7]: https://github.com/flatpak/flatpak +[8]: https://flathub.org/ +[9]: http://docs.flatpak.org/en/latest/index.html +[10]: https://www.vim.org/ +[11]: https://github.com/containers/toolbox +[12]: https://github.com/containers/libpod +[13]: https://silverblue.fedoraproject.org/contribute +[14]: https://discussion.fedoraproject.org/c/desktop/silverblue +[15]: https://webchat.freenode.net/#silverblue From a4cc8a15aa367e117409b5cfc7d565c150ed0738 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:24:34 +0800 Subject: [PATCH 2164/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200511=20How?= =?UTF-8?q?=20to=20manage=20network=20services=20with=20firewall-cmd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200511 How to manage network services with firewall-cmd.md --- ...nage network services with firewall-cmd.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sources/tech/20200511 How to manage network services with firewall-cmd.md diff --git a/sources/tech/20200511 How to manage network services with firewall-cmd.md b/sources/tech/20200511 How to manage network services with firewall-cmd.md new file mode 100644 index 0000000000..5bfc5d947f --- /dev/null +++ b/sources/tech/20200511 How to manage network services with firewall-cmd.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to manage network services with firewall-cmd) +[#]: via: (https://fedoramagazine.org/how-to-manage-network-services-with-firewall-cmd/) +[#]: author: (dan01 https://fedoramagazine.org/author/dan01/) + +How to manage network services with firewall-cmd +====== + +![][1] + +In a previous article, you explored how to [control the firewall at the command line][2] in Fedora. + +Now you are going to see how to see how _add_, _remove_, and _list_ _services_, _protocols_ and _ports_ in order to _block_ or _allow_ them. + +### A short recap + +First, it’s a good idea to check the _status_ of your firewall, see if it’s running or not. You do this, as we previously learned, by using the state option (_firewall-cmd_ ‐‐_state_). + +The next step is to get the zone for the desired network interface. For example, I use a desktop that has two network interfaces: a _physical_ interface (_enp0s3_), representing my actual _network card_ and a _virtual_ interface (_virbr0_) used by virtualization software like _KVM_. To see what zones are active, run _firewall-cmd ‐‐get-active-zones_. + +Now that you know what zone you’re interested in, you can list the rules for the zone with _firewall-cmd ‐‐info-zone=FedoraWorkstation_. + +### Reading zone information + +To display information for a particular _zone_, run _firewall-cmd ‐‐zone=ZoneName ‐‐list-all_, or simply display information for the default zone with: + +``` +[dan@localhost ~]$ firewall-cmd --list-all +FedoraWorkstation (active) +target: default +icmp-block-inversion: no +interfaces: enp0s3 +sources: +services: dhcpv6-client mdns samba-client ssh +ports: 1025-65535/udp 1025-65535/tcp +protocols: +masquerade: no +forward-ports: +source-ports: +icmp-blocks: +rich rules: +``` + +Now, let’s explore the output. The first line is showing which _zone_ the following information applies to and if that zone is currently in use. + +The _target_ : _default_ simply tells us this is the default zone. This can be set or retrieved via the _‐‐set-default-zone=ZoneName_ and _‐‐get-default-zone_. + +_icmp-block-inversion_, indicates if [ICMP][3] requests are blocked. For example if the machine responds to _ping_ requests from other machines on the network. The _interfaces_ field shows all interfaces that adopt this zone. + +### Handling services, ports, and protocols + +Now focus on the _services_, _ports_, and _protocols_ rows. By default, the firewall will block all ports, services and protocols. Only the listed ones will be allowed. + +You can see the allowed services are very basic client services in this case. For example, accessing a shared folder on the network (_samba-client_), to talk to a _DNS_ server or connect to a machine via SSH (the _ssh_ service). You can think of a _service_ as a protocol in combination to a port, for instance the ssh service is using the SSH protocol and, by convention, port 22. By allowing the ssh service, what you’re really doing is allowing incoming connections that use the ssh protocol at default port 22. + +Notice, services that have the _client_ word in their name, as a rule of thumb, refer to outgoing connections, i.e. _connections_ that you make with your IP as source going to the outside, as opposed to the SSH **service, for example, that will accept incoming connections (listening to connection coming from outside at you). + +You can look up services in the file _/etc/services_. For example if you wish to know what port and protocol these service uses: + +``` +[dan@localhost ~]$ cat /etc/services | grep ssh +ssh 22/tcp # The Secure Shell (SSH) Protocol +ssh 22/udp # The Secure Shell (SSH) Protocol +``` + +You can see SSH uses both TCP and UDP port 22. Also, if you wish to see all available services, just use _firewall-cmd ‐‐get-services_. + +#### Opening a port + +If you want to block a port, service, or protocol, all you have to do if make sure it’s not listed here. By extension, if you want to allow a service, you need add it to your list. + +Let’s say you want to open the port _5000_ for _TCP_ ****connection. To do this, run: + +``` +sudo firewall-cmd --zone=FedorwaWorkstation --permanent --add-port=5000/tcp +``` + +Notice that you need to specify the zone for which the rule applies. When you add the rule, you also need to specify if it is a _TCP_ or _UDP_ port via as indicated above. The _permanent_ parameter sets the rule to persist even after a system reboot. + +Look at the information for your zone again: + +``` +[dan@localhost ~]$ firewall-cmd --list-all +FedoraWorkstation (active) +target: default +icmp-block-inversion: no +interfaces: enp0s3 +sources: +services: dhcpv6-client mdns samba-client ssh +ports: 1025-65535/udp 1025-65535/tcp 5000/tcp +protocols: +masquerade: no +forward-ports: +source-ports: +icmp-blocks: +rich rules: +``` + +Similarly, if you wish to remove this port from the list, run: + +``` +sudo firewall-cmd --zone=FedorwaWorkstation --permanent --remove-port=5000/tcp +``` + +The very same _remove_ (_‐‐remove-protocol_, _‐‐remove-service_) and _add_ (_‐‐add-protocol_, _‐‐add-service_) options are also available for _services_ and _protocols_. + +* * * + +_Photo by [T. Kaiser][4] on [Unsplash][5]_. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-manage-network-services-with-firewall-cmd/ + +作者:[dan01][a] +选题:[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/dan01/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/services-firewall-cmd-816x345.jpg +[2]: https://fedoramagazine.org/control-the-firewall-at-the-command-line/ +[3]: https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol +[4]: https://unsplash.com/@tkaiser?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[5]: https://unsplash.com/s/photos/poke-hole?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From 10715ad02a9f2ee0e6aaee6124d19db770a95829 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:28:15 +0800 Subject: [PATCH 2165/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Davi?= =?UTF-8?q?d=20vs=20Goliath!=20Microsoft=20and=20an=20Obscure=20KDE=20Proj?= =?UTF-8?q?ect=20Fight=20Over=20=E2=80=9CMAUI=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md --- ...an Obscure KDE Project Fight Over -MAUI.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/tech/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md diff --git a/sources/tech/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md b/sources/tech/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md new file mode 100644 index 0000000000..4ab2c75f54 --- /dev/null +++ b/sources/tech/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (David vs Goliath! Microsoft and an Obscure KDE Project Fight Over “MAUI”) +[#]: via: (https://itsfoss.com/microsoft-maui-kde-row/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +David vs Goliath! Microsoft and an Obscure KDE Project Fight Over “MAUI” +====== + +Remember the [interview with Uri Herrera][1], the creator of [Nitrux Linux][2]? Uri also works on couple of other Linux-related projects and one of them is Maui project. + +The MauiKit (styled as MAUI) is an acronym for Multi-Adaptable User Interfaces. It is an open source framework for developing cross-platform applications. It’s been in development since 2018 and it is now a [part of KDE’s incubation program KDE Invent][3]. + +Why am I talking about Maui? Because Microsoft has [renamed one of its project (Xamarin.Forms) to .NET MAUI][4]. This MAUI in .NET MAUI stands for Multi-platform App UI. It is also a framework for building cross-platform application. + +You see the confusion here? Both MAUI projects are frameworks for building cross-platform applications. + +### The debate over the use of “MAUI” + +![][5] + +MauiKit developers are obviously [not happy with this move by Microsoft][6]. + +> We like to believe that this an unfortunate event caused by an oversight during the brainstorming session to select a new and appealing name for their product and not an attempt at using the brand weight and marketing-might that a corporation such as Microsoft and their subsidiary Xamarin possess to step over a competing framework. A UI framework that, as of today, is still the first result in Google when searching for the term “Maui UI framework” but that due to the might of GitHub (another Microsoft subsidiary) and Microsoft’s website (specifically, their blog) SEO that will change over time. + +A couple of issues were opened on the GitHub repository of .NET MAUI to bring their attention to this name clash. + +The discussion got heated as some Microsoft MVPs and contributors (not Microsoft employees) started making arguments like MauiKit is a small project with fewer GitHub stars and no big companies use it. + +Microsoft’s Program Manager [David Ortinau][7] closed the thread with the message, “official legal name is .NET Multi-platform App UI and MAUI is an acronym, code name. This has been through legal review”. + +![Microsoft’s official response][8] + +This is the [main thread][9] that you can follow on GitHub if you want. + +### Is it really an issue? + +It may seem like a non-issue at the first glance but two projects with the same aim and same name are bound to create confusion. It would have been best that Microsoft had avoided it altogether. + +By the way, this is not the first time Microsoft has a name clash with a Linux-related project. As [Phoronix noted][10], a few years ago it was GNOME developers frustrated with Microsoft over naming a project GVFS (later renamed to Virtual File System for Git) as it collided with their GVFS (GNOME Virtual File-System) + +By the looks of it, Microsoft is not going to backtrack on MAUI. It could even go ahead and trademark MAUI. They have got all the money and power after all. + +I wonder what would have been the case if an obscure small project used the same name as one of Microsoft’s projects. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/microsoft-maui-kde-row/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/nitrux-linux/ +[2]: https://nxos.org/ +[3]: https://invent.kde.org/maui/mauikit +[4]: https://devblogs.microsoft.com/dotnet/introducing-net-multi-platform-app-ui/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/david-vs-goliath.jpg?ssl=1 +[6]: https://nxos.org/news/official-statement-regarding-xamarin-forms-rebranding-as-maui/ +[7]: https://github.com/davidortinau +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/microsoft-response-maui.png?ssl=1 +[9]: https://github.com/dotnet/maui/issues/35 +[10]: https://www.phoronix.com/scan.php?page=news_item&px=Microsoft-KDE-MAUI From 9207fb03447d80e0434819047af8293002c85caf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:28:50 +0800 Subject: [PATCH 2166/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20to=20Properly=20Install=20and=20Setup=20KDE=20Plasma=20on=20?= =?UTF-8?q?Arch=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md --- ...tall and Setup KDE Plasma on Arch Linux.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md diff --git a/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md b/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md new file mode 100644 index 0000000000..afccc10512 --- /dev/null +++ b/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Properly Install and Setup KDE Plasma on Arch Linux) +[#]: via: (https://itsfoss.com/install-kde-arch-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Properly Install and Setup KDE Plasma on Arch Linux +====== + +I believe you followed the [fantastic It’s FOSS guide on installing Arch Linux][1]. The guide ends with steps mentioning the installation procedure for [GNOME desktop][2]. + +Now, not everyone is a GNOME fan and several readers requested that we show them how to configure the [KDE desktop][3] on [Arch Linux][4]. + +And thus I created this guide to demonstrate the steps for properly installing and configuring KDE desktop (also known as KDE Plasma desktop) on Arch Linux. + +### How to install and setup KDE desktop environment on Arch Linux + +![][5] + +Please keep in mind that KDE doesn’t allow login as root directly. If you have installed Arch Linux and using it as root, you should create a new user and give it sudo rights for running commands as root. + +If you just have a bare minimum installation of Arch Linux, you probably are logging into a TTY terminal. If you are using some other desktop environment, steps remain the same. + +Let’s go! + +#### Step 1: Create a sudo user (if you have only root user) + +You can use the [useradd command][6] for creating a new user. I am creating user named dimitrios (that’s my name). You can use something that matches your name. + +The option -m creates a home directory for the newly created user. + +``` +useradd -m dimitrios +``` + +You should also set a password for this user. Use this command: + +``` +passwd dimitrios +``` + +Now that you have created the user, give it sudo access. First, install sudo and a [command line text editor][7] like [nano][8]: + +``` +pacman -S sudo nano +``` + +The configuration file for sudo is /etc/sudoers. It should always be edited with the visudo command. visudo locks the sudoers file, saves edits to a temporary file, and checks that file’s grammar before copying it to /etc/sudoers. + +To use nano as the visudo editor, use: + +``` +EDITOR=nano visudo +``` + +Add the following line like I do in the example, then save and exit. + +``` +dimitrios ALL=(ALL) ALL +``` + +![Adding Sudoer in Arch Linux][9] + +Save your changes and exit the editor. You now have a sudo user on Arch Linux. + +#### Step 2: Installing KDE Plasma desktop + +To run KDE desktop, you need the following packages: + + * [Xorg][10] group + * [KDE Plasma][3] Desktop Environment + * [Wayland][11] session for KDE Plasma + * [KDE applications][12] group (consists of KDE specific applications including the Dolphin manager and other useful apps) + + + +You can install of the above using the following command: + +``` +pacman -S xorg plasma plasma-wayland-session kde-applications +``` + +Once installed, enable the Display Manager and Network Manager services: + +``` +systemctl enable sddm.service +systemctl enable NetworkManager.service +``` + +Almost there. Shutdown your system: + +``` +shutdown now +``` + +Power on your system and you should see the KDE login. Do you remember the password you set up for your sudo user? Use it to login. + +![Arch KDE Plasma Desktop][13] + +#### What next? + +You may want to explore the [essential pacman commands][14], to know what’s going on with the [Arch User Repository][15] and learn more about [AUR helpers][16]. + +I hope you found this tutorial helpful in installing KDE desktop on Arch Linux. Please let us know in the comments below, if you encountered any obstacle or difficulty during the installation. + +What’s your favourite Desktop environment or Window Manager? Let us know and don’t forget to subscribe on our social media. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-kde-arch-linux/ + +作者:[Dimitrios Savvopoulos][a] +选题:[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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-arch-linux/ +[2]: https://www.gnome.org/ +[3]: https://kde.org/plasma-desktop +[4]: https://www.archlinux.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/install-kde-arch-linux.png?ssl=1 +[6]: https://linuxhandbook.com/useradd-command/ +[7]: https://itsfoss.com/command-line-text-editors-linux/ +[8]: https://www.nano-editor.org/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/adding-sudoer-arch-linux.png?ssl=1 +[10]: https://wiki.archlinux.org/index.php/Xorg +[11]: https://wiki.archlinux.org/index.php/Wayland +[12]: https://www.archlinux.org/groups/x86_64/kde-applications/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-Plasma-desktop.jpg?fit=800%2C450&ssl=1 +[14]: https://itsfoss.com/pacman-command/ +[15]: https://itsfoss.com/aur-arch-linux/ +[16]: https://itsfoss.com/best-aur-helpers/ From ca0dfc6dcb034a7191028ca2ebe2ce527912a9c4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:29:02 +0800 Subject: [PATCH 2167/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20EU?= =?UTF-8?q?=20Parliament=20Strongly=20Recommends=20Developing=20and=20Usin?= =?UTF-8?q?g=20Open=20Source=20Software?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md --- ...veloping and Using Open Source Software.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md diff --git a/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md b/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md new file mode 100644 index 0000000000..bfeb5635ce --- /dev/null +++ b/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (EU Parliament Strongly Recommends Developing and Using Open Source Software) +[#]: via: (https://itsfoss.com/eu-parliament-recommends-open-source/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +EU Parliament Strongly Recommends Developing and Using Open Source Software +====== + +Europe is choosing open source more than ever. Not just limited to [EU Commissions’ decision to use Signal messaging app][1] but also [open science][2] and the [adoption of open source software by European universities][3]. + +Now, in a recent [press release][4] by the [European Pirate Party][5], it looks like the EU Parliament is urging EU institutions to use open-source software. All thanks to the Pirate amendments for encouraging the use of open-source software. + +The EU Parliament not just encourages the use of open-source software, but they have also advised to prioritize development of open-source software by the EU institutions. + +So, not just aiming to adopt using open-source software but to develop open-source software. And, that’s definitely good news! + +More use of open-source software, why not? To give you some more details, here’s what they mentioned in the press release: + +> **In practice, from now on, all IT solutions developed by and for the EU institutions will first need to be assessed against the possibility of using Open Source solutions. Assessments will then have to be reported back to the Budgetary Control Committee of the Parliament on an annual basis, during the discharge procedure. This is a strong call for enhancing our important citizens right to transparent and trustworthy information.** + +### Important decision to remove vendor lock-ins + +![Public Money Public Code Campaign][6] + +No matter who made this happen — this decision of preferring open-source software over proprietary will not just help the open-source community but also helps the EU institutions in a variety of ways. + +Especially, relying on open-source software removes the overhead of vendor lock-ins. In other words, an EU institution does not have to rely on vendor to manage/maintain the software. + +The press release also addressed this by mentioning: + +> It is essential for the European institutions to retain control over its own technical systems, especially in a context of disinformation and foreign interference. Open Source promotes local technical support, leads to rapid development of software and helps to avoid dependency on specific suppliers or vendor lock-in effects, which exist when only one company is in charge of software or even the entire IT infrastructure supply. + +Any responsible local organization can take up the task while the community can still help in any way it can. This could also reduce the cost of maintaining the software among other things like improving the security of a software in a collaborative manner. + +### Is this a big win for open-source community? + +![][7] + +Yes, and no. We’ve seen a lot of recommendations made by the governments (or the EU government in general) to choose open-source software to keep things more secure yet transparent. + +Pirate’s Vice-President of EU Parliament, **Marcel Kolaja**, mentions some advantages of this decision as well: + +_It’s a milestone for transparent and open digitization of the European institutions. From now on, the Open Source ecosystem has a stepping ground for offering Open Source solutions and the Pirates will gladly play the role of the guardians and will try to solve and highlight any attempt to bypass this strong recommendation. It’s a really important step to remove vendor lock-ins in the Parliament“_ + +So, this will definitely help them earn trust of their citizens by providing digital transparency while also encouraging public participation to improve the software as well. Of course, this will also help introduce the concept of open-source software to many who were unaware of it in some way. + +Also, ensuring open-source software for publicly financed software will enhance the meaning of freedom of speech/privacy/press. + +In a nutshell, these decisions do have a positive impact in one way or the other. + +But, the implementations of these decisions will decide how effective it’s going to be to put the words in action. + +### Wrapping Up + +I’m happy with the decision by EU Parliament here — even though I’m not a European. I guess, this should encourage other government bodies to take similar decisions or steps to ensure digital transparency while earning the trust of their citizens. + +To get more details on the decision, you can refer to the [official press release by the European Pirate Party][4]. + +What do you think about it? Let me know your thoughts in the comments below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/eu-parliament-recommends-open-source/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/eu-commission-switches-to-signal/ +[2]: https://ec.europa.eu/research/openscience/index.cfm?pg=openaccess +[3]: https://opensource.com/article/20/5/open-source-higher-education +[4]: https://european-pirateparty.eu/european-parliament-strongly-recommends-any-software-developed-by-and-for-the-eu-institutions-to-be-made-publicly-available-under-free-and-open-source-software-licence/ +[5]: https://en.wikipedia.org/wiki/European_Pirate_Party +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/public-money-public-code.png?resize=800%2C420&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/eu-parliament-open-source.jpg?ssl=1 From 6ba0ab8899cf86263ced1a0be65a9cf6516626fa Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:29:16 +0800 Subject: [PATCH 2168/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Lang?= =?UTF-8?q?uageTool=20Review:=20Free=20and=20Open=20Source=20Grammar=20Che?= =?UTF-8?q?cker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md --- ...w- Free and Open Source Grammar Checker.md | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md diff --git a/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md b/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md new file mode 100644 index 0000000000..afd1a08e49 --- /dev/null +++ b/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LanguageTool Review: Free and Open Source Grammar Checker) +[#]: via: (https://itsfoss.com/languagetool-review/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +LanguageTool Review: Free and Open Source Grammar Checker +====== + +This week’s open source software highlight is [LanguageTool][1]. It is a proofreading software that checks the grammar, style and spelling in more than 20 languages. + +I have been using it for past several days and I feel confident enough to review it and share my experience with it. I have used the popular proofreading tool [Grammarly][2] in the past and I’ll make some comparison between these two tools. + +### LanguageTool: Open source proofreading software + +![][3] + +[LanguageTool][1] grammar checker is available in [multiple formats][4]: + + * You can copy-paste your text on its website. + * You can install browser extension that will check for errors as you type anything, anywhere in the web browser. + * You can install a Java-based desktop application for offline usage. + * You can install add-on for LibreOffice and MS Office. + * Add-ons are also [available for a number of other software][5] like Sublime Text, Thunderbird, Vim, Visual Studio Code etc. + * [Android app][6] is also available. + * API is also available if you want to use LanguageTool in your software or service. API offering comes under premium services. + + + +You can find source code of LanguageTool and its related assets on [their GitHub repository][7]. + +[LanguageTool also has a premium version][8] that you can purchase. The premium version offers additional error checks. + +I am using LanguageTool premium version as a browser extension. Almost all the writing I do is online and thus the browser extension is perfect for me. + +The most convenient way to try LanguageTool is by using its browser extension. Install the browser add-on and next time you type anything in the browser, LanguageTool will start checking your text for grammatical and spelling errors. It will also check for styling errors. + +### Experience with LanguageTool: How good is it? + +LanguageTool leaves a good first impression. It starts checking for errors as you start typing. + +Different types of errors have different color codes. Spelling mistakes are highlighted in red color, grammatical mistakes are in yellow colors and styling errors have a blueish shade. + +Clicking on the error suggestion replaces your text with the suggested one. You may also ignore the suggestion. You’ll also see number of issues identified by LanguageTool in the current text check. + +![Spelling mistake identified by LanguageTool][9] + +#### Personal dictionary + +You can also create your personal directory and add words in it. This is helpful because no proofreading tool can give a green light to technical terms like systemd, iptables and brand names like [WireGuard][10]. To avoid these words labeled as spelling mistakes, add them to your personal dictionary. + +You may edit your personal dictionary from your LanguageTool account. + +![LanguageTool Personal Dictionary][11] + +#### Details on the error suggestion + +If it finds grammatical errors, it also gives a quick explanation of the error. You can get more details by clicking the tool tip which takes you to a reputable external source. + +![You can get additional details on the errors][12] + +#### Synonym suggestion (in beta) + +If you double-click on a word, it will also suggest synonyms. + +![][13] + +#### Are there any privacy issues? + +If you use the online services of LanguageTool, your text is sent to their servers over an **encrypted** connection. All their servers are hosted at Hetzner Online GmbH in Germany. + +LanguageTool states that it doesn’t store any text that you check using its services. You can read their privacy policy [here][14]. + +The free to use languagetool.org website shows ads (there are no third-party ads in the browser add-on). To test their claim of “sending text over an encrypted server”, I typed sample text containing words like vacuum cleaner, laptop etc. + +Thankfully, the displayed ad on their website was nothing related to the text I typed. I haven’t noticed any vacuum cleaner ads on the websites I visit or on Facebook. That’s a good thing. + +#### It doesn’t work flawlessly all the time + +No software is perfect and LanguageTool is not an exception. While it is helpful in finding obvious spelling and grammatical mistakes, it struggles in some simple scenario. + +For example, if a sentence contains several blank spaces together, LanguageTool failed to find an issue with that. + +![Too many whitespaces and yet it went undetected][15] + +This is weird because if I look at their ‘error rules’, I can see a [whitespace repetition rule][16]. I think this rule is applicable only for the Java-based LanguageTool apps, not the browser add-on I am using. + +I also found some other cases where LanguageTool should have identified errors but it didn’t. For example, it didn’t alert for the missing ‘to’ in the text below: + +![LanguageTool fails to find the missing “to”][17] + +When I checked it against the [Grammarly free version][2], it was able to point it out. + +![Grammarly was quick to identify it][18] + +I also found an infinite loop of suggestion. It first suggests using syntaxes as plural of syntax. + +![Suggestion for using ‘syntaxes’][19] + +And then it doesn’t accept ‘syntaxes’ as a valid word. + +![And then it doesn’t accept ‘syntaxes’][20] + +I have seen such “infinite error loop” with Grammarly as well in the past, so I won’t be too hard on LanguageTool for such issues. + +### Conclusion + +Despite some hiccups, I am satisfied with LanguageTool proofreading tool. Both free and premium version are good enough for finding obvious spelling mistakes and grammatical errors. + +The premium version offers over 2500 additional error checks and it costs around $15-$70 per year depending on your geographical region. This is a lot cheaper than [Grammarly][2] which costs $140 per year. + +I opted for the premium version because it will help this open-source project. Premium users also get email support. + +You are not forced to go premium, of course. You can use the free version and if you have some questions or need support, there is a [community forum][21] that you can join for free. + +LanguageTool can certainly be considered one of the [essential open-source tools for writers][22]. I am going to continue using LanguageTool. If you find grammatical or spelling mistakes in It’s FOSS articles in the future, blame LanguageTool, not me. Just kidding :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/languagetool-review/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://languagetool.org/ +[2]: https://itsfoss.com/recommends/grammarly/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool.png?fit=800%2C593&ssl=1 +[4]: https://languagetool.org/compare +[5]: http://wiki.languagetool.org/software-that-supports-languagetool-as-a-plug-in-or-add-on +[6]: https://play.google.com/store/apps/details?id=org.softcatala.corrector +[7]: https://github.com/languagetool-org/ +[8]: https://languagetoolplus.com/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/langaugetool-error-detection.png?ssl=1 +[10]: https://itsfoss.com/wireguard/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-personal-dictionary.png?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-error-explanation.png?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-synonym-suggestion.png?ssl=1 +[14]: https://languagetoolplus.com/legal/privacy +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-whitespaces.png?ssl=1 +[16]: https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang=en +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-3.jpg?fit=800%2C219&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-grammarly.jpg?fit=800%2C272&ssl=1 +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion.png?ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-1.png?ssl=1 +[21]: https://forum.languagetool.org/ +[22]: https://itsfoss.com/open-source-tools-writers/ From 2d30146fe39432d4f01154c8d2e247a0292d66ca Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:29:31 +0800 Subject: [PATCH 2169/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20In?= =?UTF-8?q?=20Free=20Software,=20the=20Community=20is=20the=20Most=20Impor?= =?UTF-8?q?tant=20Ingredient:=20Jerry=20Bezencon=20of=20Linux=20Lite=20[In?= =?UTF-8?q?terview]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md --- ...Jerry Bezencon of Linux Lite -Interview.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 sources/tech/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md diff --git a/sources/tech/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md b/sources/tech/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md new file mode 100644 index 0000000000..b34f3508de --- /dev/null +++ b/sources/tech/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (In Free Software, the Community is the Most Important Ingredient: Jerry Bezencon of Linux Lite [Interview]) +[#]: via: (https://itsfoss.com/linux-lite-interview/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +In Free Software, the Community is the Most Important Ingredient: Jerry Bezencon of Linux Lite [Interview] +====== + +You are probably aware of [Linux Lite][1]. It is a [lightweight Linux distribution][2] based on Ubuntu. If you have an older system with 1 GB of RAM, Linux Lite becomes an excellent choice for you. + +We have covered Linux Lite releases several times on It’s FOSS and if you are a regular reader, you would have come across it. + +![][3] + +We talked to Jerry Bezencon, the creator of Linux Lite project, to know some background details on this project. + +### Interview with Jerry Bezencon of Linux Lite + +Jerry is based in Auckland, New Zealand, and he devotes a good deal of time and effort on Linux Lite project. Jerry shares his vision of the project in this interview. + +_**Tell us about the origins of Linux Lite. When did you create it first and what made you create it in the first place?**_ + +Linux Lite was started in 2012 for 3 important reasons. One, I wanted to dispel myths that a Linux based operating system was hard to use. Two, at that time, there was a shortage of simple, intuitive desktop experiences on Linux that offered long-term support. Three, I had used Linux for over 10 years before starting Linux Lite. + +I felt I needed to give back to a community that had given so much to me. A community that taught me that by sharing code and knowledge, one could have a dramatically positive impact over peoples computing experiences. + +_**How is Linux Lite different from so many other Ubuntu-based distributions?**_ + +Our approach to problem solving and our support. The first sits within the system itself. Lite Tweaks is a good example of this. We try to think of all the things that could possibly go wrong with a computer system, then write applications that fix those problems as easily as possible, should they occur. There is a lot of foresight in the team. + +The second is our approach to support. This mainly comes in 2 forms. Our massive built-in and online Help Manual and [our large forum community][4] full of some of the nicest people I’ve ever dealt with in the free software and open source community. + +_**How do you and your team work on developing Linux Lite?**_ + +There are 24 hours in a day. With 6 – 8 hours for sleep and another 6 – 8 hours for my other job, that’s more than enough time to put towards any project, hobby or job, or all 3. + +I take a more professional approach to code writing. I’ll come up with an idea, mock-up the UI then write the base code, or the whole application myself. If I need help, I prefer to hire and pay via our generous donators, freelancers. + +That way I can set a budget, the user gets a solid, well-written application by a qualified professional who is fluent in that language, and get I exactly what I ask for on time and without the usual flame wars and egos that can exist in some teams. + +By using professional, paid programmers, I avoid all the negativity completely. Application writing has become an extremely peaceful and rewarding exercise. + +_**What are you most proud of about this project?**_ + +![Linux Lite Interview][5] + +I’m most proud of the community that has stayed loyal to us throughout the years. In a business, your staff are your most valuable asset, in free software, the community is the most important ingredient. + +_**What are your future plans with Linux Lite?**_ + +To always strive to look for ways to make a person’s computing experience simpler, faster and trouble free. Our target audience shouldn’t have to dive into the terminal to try and fix things. To continue to build a feature-complete operating system that is light on resources. + +_**What new features can we expect in Linux Lite in upcoming versions?**_ + +Due to tradition, we like to keep those as surprises. I never run out of ideas. Some nights I get no sleep because my mind is buzzing with ideas for our next application, or how to solve an ongoing, difficult bug. + +_**Are there any features that you really want to implement but haven’t been able to do so far?**_ + +You can always do more to enhance an operating system. I’m currently working on our most ambitious application to date. One that doesn’t need a GUI and that sits within the system, anticipates problems and solves them before they are seen by the user. It will have a Reports feature so that those who like to know what is going on, can see for themselves what the code is doing. It will, of course, be free software. My first foray into A.I. that I hope other Linux systems can benefit from in the future. + +_**Have you achieved the goal for which you started the project?**_ + +Goal setting is ongoing. There’s no such thing as the perfect operating system. But there is no harm in aiming for that. + +_**How can the users and readers help the project?**_ + +In the usual ways. Documentation, coding, volunteering on the Forums, buying merchandise, writing blogs, donating, making videos, starting websites like yours – the list goes on. + +* * * + +We hope you like reading about the background of open source projects. You may [read more interviews with various project leaders][6]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-lite-interview/ + +作者:[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.linuxliteos.com/ +[2]: https://itsfoss.com/lightweight-linux-beginners/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Linux_Lite.jpg?ssl=1 +[4]: https://www.linuxliteos.com/forums/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/linux-lite-interview.png?ssl=1 +[6]: https://itsfoss.com/interviews/ From c7da27e4e28b56d43e13959b004d917019004109 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:29:49 +0800 Subject: [PATCH 2170/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20to=20Install=20Linux=20Mint=20in=20VirtualBox=20[Screenshot?= =?UTF-8?q?=20Tutorial]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md --- ...Mint in VirtualBox -Screenshot Tutorial.md | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md diff --git a/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md b/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md new file mode 100644 index 0000000000..1fc324e817 --- /dev/null +++ b/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Linux Mint in VirtualBox [Screenshot Tutorial]) +[#]: via: (https://itsfoss.com/install-linux-mint-in-virtualbox/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Install Linux Mint in VirtualBox [Screenshot Tutorial] +====== + +_**Brief: One of safest and easiest ways to try Linux Mint is inside a virtual machine. Your real system doesn’t change at all. Learn how to install Linux Mint in VirtualBox in this tutorial.**_ + +[Linux Mint][1] is considered one of the [best distributions for new Linux users][2]. Its flagship Cinnamon DE is one of the most popular desktop environment giving your system a look and feel of classic Window-styled desktop. + +If you want to try Linux Mint and see if it fits your need, you could try installing it in a virtual machine. This way, you run Linux Mint inside your current system without changing your system’s partition or boot order. One of the safest way out there as you get to run Linux like a regular desktop application inside your current operating system. + +![][3] + +Oracle’s open source virtualization tool [VirtualBox][4] is available for free on all major desktop operating systems i.e. Windows, Linux and macOS. + +In this beginner’s tutorial, I’ll show you the steps for installing Linux Mint in VirtualBox. I am including the screenshots for each step so that you can easily follow the tutorial. + +### Installing Linux Mint in VirtualBox + +You can follow the steps on any operating system be it Windows, Linux or macOS. You just need to install VirtualBox on your operating system and rest of the steps remain the same. + +**Step 1:** [Download VirtualBox from its website][4] and install it by double-clicking on the downloaded file. + +![][5] + +Next, install the latest version of Linux Mint’s ISO file from its website. + +[Download Linux Mint ISO][6] + +**Step 2:** Once your virtual Box is up & running we are ready to get started. Click the New button, click Next on the virtual machine wizard. + +![Create a new Virtual Machine][7] + +Initially you need to specify the following: + + * Name: Any preferred name for your VM like Linux Mint + * Type: Linux + * Version: Ubuntu (64 bit) as Linux Mint is an Ubuntu-based distribution + + + +Before configuring any hardware resource value, please make sure that are aware of the [system requirements][8]. + +2 GB RAM would be okay but won’t give you a good experience. 3 GB is a comfortable amount if your system has 8 GB of RAM. I choose to set my Virtual Machine to 4096 MB (4 GB) because my system has plenty of RAM. + +RAM consumption + +One of the common confusion is regarding the RAM consumption. Let’s say your Windows system has 8 GB of RAM and you assign 3 GB of RAM to Linux Mint in VirtualBox. + +If you are running Linux Mint inside VirtualBox, your real system (called host system) will have 5 GB of RAM available for consumption. + +If you are not running Linux Mint inside VirtualBox, at that moment, the entire 8 GB will be available to the host system. + +**Step 3:** Next, choose a Virtual Hard disk now option and click create. + +Choose the virtual storage allocation method (Recommended Dynamically allocated). Set your storage location for virtual hard disk by browsing drive and then specify the size of virtual hard disk (it could be anything from 12-20 GB). + +![Dynamic allocation can save you space if you don’t need the maximum allowance][9] + +**Step (4 (optional advanced settings):** Once Virtual machine has been created, click on the settings button in menu: + +![][10] + +Now, go to the Display section. Specify the Video memory (128 MB) and check “Enable 3D Acceleration”. + +![Don’t forget to enable the 3D Acceleration][11] + +Then click on System Tab → Processor and choose how many threads would you like to allocate. + +My system is a 4 core/4 thread system and I choose to assign half of the CPU capability i.e. 2 threads. + +![Select CPU cores as per the distribution requirements][12] + +Once you have configured everything click ok. + +**Step 5:** In the System settings, go to Storage (from the left sidebar). Click on the [Optical Drive] Empty as shown in the image below. + +You’ll be asked to browse to the Linux Mint ISO file you had downloaded earlier. + +![][13] + +Once you select your ISO, click on the start button and that’s it! Now the ISO will start running as if you are booting from a live USB. + +Next, you need to press enter whilst your option is start Linux Mint as per the picture below. + +![][14] + +**Step 6:** Let’s start the installation procedure. + +Choose the language you want for your Linux Mint virtual machine. + +![Choose your native language][15] + +I’m based in the UK, so I have a UK keyboard layout. You can choose the one you want. + +![Choose your keyboard layout according to your hardware configuration][16] + +You may check the box to download and install any third-party software during the installation. + +![You may install media codecs while installing Linux Mint][17] + +You can proceed to erase the disk and install Linux Mint. + +Erase disk? Really? + +This step may seem scary because you may think that it will harm your real system. + +Let me assure you that it won’t do any damage to your actual disk. Remember you created 10-20 GB of virtual disk in step 3? Now you are inside that disk. + +When it asks for erasing the disk, it is erasing the virtual disk created for it. It doesn’t impact your real system disk and its data. + +![It is safe to erase your disk only at a Virtual Machine level][18] + +Next, select your time zone and click continue. You may [change time zone in Linux][19] later as well. + +![][20] + +You will be prompted to create your user account, your host name (computer’s name) and to choose a password. Once done, click continue to finalize the installation. + +![][21] + +Please wait a few minutes for the process to complete. + +![Wait a few minutes for the process to finish][22] + +The installation has now finished. Click on “Restart now”. + +![Well done! You have successfully installed Linux Mint][23] + +When you reach this step, Linux Mint will be installed and ready to use! + +![][24] + +You don’t have an installation medium so just power off the virtual machine. + +![][25] + +Now to use your virtual machine, click on the start button. + +![][26] + +You can explore a fully functional system, and at this time if you shut down Linux Mint like it was physically installed, it will automatically power off the virtual machine. + +![][27] + +Enjoy Linux Mint in VirtualBox. I hope you were able to install Linux Mint in VirtualBox. If you face any issues, please let me know in the comment section. I’ll try to help you out. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-linux-mint-in-virtualbox/ + +作者:[Dimitrios Savvopoulos][a] +选题:[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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxmint.com/ +[2]: https://itsfoss.com/best-linux-beginners/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/install-linux-mint-in-virtualbox.png?ssl=1 +[4]: https://www.virtualbox.org/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?ssl=1 +[6]: https://www.linuxmint.com/download.php +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/1.-Create-new.jpg?ssl=1 +[8]: https://blog.linuxmint.com/?p=3832 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/2.-Create-virtual-hard-disk.jpg?resize=800%2C472&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/3.-settings.jpg?resize=800%2C470&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/4.-display.jpg?resize=800%2C472&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/5.-cpu.jpg?resize=800%2C468&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/6.-choose-iso.jpg?resize=800%2C472&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/7.-boot.jpg?resize=800%2C459&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/8.-choose-language.png?resize=800%2C679&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/9.-English-UK.png?resize=800%2C679&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/10.-install-third-party-software.png?resize=800%2C679&ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/11.-installation-type.png?resize=800%2C679&ssl=1 +[19]: https://itsfoss.com/change-timezone-ubuntu/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/12.-timezone.png?resize=800%2C679&ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/13.-user-account.png?resize=800%2C679&ssl=1 +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/14.-installation-screen.png?resize=800%2C679&ssl=1 +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/15.-installation-finish.png?resize=800%2C679&ssl=1 +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/16.-remove-the-media.png?resize=800%2C679&ssl=1 +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/17.-power-off.png?resize=800%2C678&ssl=1 +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/18.-init-the-fresh-installed-mint.png?resize=800%2C476&ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/19.-Linux-mint-19.3-final.png?resize=800%2C469&ssl=1 From 4f6126afefe8cb23c222b5872e9014ae825860ed Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:30:11 +0800 Subject: [PATCH 2171/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Trac?= =?UTF-8?q?k=20Your=20Screen=20Time=20in=20Linux=20with=20ActivityWatch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Track Your Screen Time in Linux with ActivityWatch.md --- ...Screen Time in Linux with ActivityWatch.md | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 sources/tech/20200525 Track Your Screen Time in Linux with ActivityWatch.md diff --git a/sources/tech/20200525 Track Your Screen Time in Linux with ActivityWatch.md b/sources/tech/20200525 Track Your Screen Time in Linux with ActivityWatch.md new file mode 100644 index 0000000000..ddf6b2e9cc --- /dev/null +++ b/sources/tech/20200525 Track Your Screen Time in Linux with ActivityWatch.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Track Your Screen Time in Linux with ActivityWatch) +[#]: via: (https://itsfoss.com/activitywatch/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Track Your Screen Time in Linux with ActivityWatch +====== + +_**Brief: ActivityWatch is an open-source privacy-friendly app that tracks how you spend your time on a desktop computer or on a mobile device.**_ + +### ActivityWatch: An open-source app to track how much time you spend on which application + +![ActivityWatch lets you check the time spent on various applications][1] + +[ActivityWatch][2] is a cross-platform open-source app that helps you track time to gauge your productivity. It lets you track the time you spent on applications, browsers, and if you were AFK (away from keyboard) or the system was hibernating. + +Not just limited to tracking time, but it offers a bunch of useful features with visualizations that help you easily analyze how you spent time to potentially improve your productivity. + +![][3] + +It’s a great alternative to proprietary options like [RescueTime][4] and [ManicTime][5]. + +ActivityWatch is available for Linux, Windows, macOS and [Android][6]. It also offers browser extensions for both Chrome and Firefox. As of now, there’s no app available for iOS on the App Store. + +![][7] + +It’s fairly new to the scene and is being actively developed to address any existing issues and introduce new features like the ability to sync your activity data across multiple devices. + +_**For privacy-focused users, I should mention that the data collected is stored locally on your device. That’s a good thing as you can track your spent time without being tracked by someone else.**_ + +### Features of ActivityWatch + +![][8] + +Basically, ActivityWatch lets you monitor your activity to analyze bad screen time or improve the time management for what you do on your device. + +To break it down, it offers several useful options that I’d like to highlight here: + + * Summary of your daily activity with apps/programs sorted as per the time spent using it. + * Track the time of your browser activity using the extension to get the exact data on time spent on every active tab. + * Tracks AFK and not-AFK time. (AFK — abbreviation for “Away From Keyboard” i.e. you’re not in front of your computer) + * Offers different visualizations of timelines to monitor your activity + * Ability to track the time you spend writing code on an editor using [watchers][9]. + * History of your activity to analyze your productivity + * Categorize the time spent to help you analyze in detail + * Lets you add more categories and tweak the duration of timeline. + * Ability to export/import your data as [JSON][10] file. + * Experimental stopwatch feature + * Stores data locally to respect user privacy. + + + +### Installing ActivityWatch on Linux + +_**Note:** If your Linux distribution does not support system tray icons, you will have to follow the [documentation][11] for a workaround._ + +Unfortunately, you won’t find an AppImage, Flatpak or Snap for it. + +However, you do get an [AUR][12] package to install for Manjaro or Arch Linux. + +For all other Linux distributions, you get a ZIP file which includes an **aw-qt** application to run. + +To do that, you have to [extract the zip archive file][13] and then run the binary to install it by double-clicking on the aw-qt application. + +![Aw Qt][14] + +You can also use the terminal as follows: + +``` +cd activitywatch-v0.9.2-linux-x86_64 +sudo ./aw-qt +``` + +The location and filename of the extracted folder might differ – so make sure you navigate to the correct directory and then use the commands above. Once done, you can access ActivityWatch from the system tray icon or simply head to [localhost:5600][15] to access it. + +You can also check out their [GitHub page][16] or the [official website][2] to explore more about it. + +[Download ActivityWatch][2] + +Just for your information, if you plan on using ActivityWatch regularly, you should move the downloaded files to the /opt directory and create a link to aw-qt executable in /usr/share/bin directory. This way, the application will be available as a regular command for all the users on the system. A similar method has been demonstrated in the [PopcornTime installation tutorial][17]. + +### My Thoughts On ActivityWatch + +![][18] + +The time tracking works perfectly fine on [Pop!_OS 20.04][19] with the system tray icon support. You might encounter a bug that doesn’t let you access ActivityWatch from your system tray icon (which is also a [known issue on GitHub][20]). In that case, you need to access it through [localhost:5600][15]. + +Personally, I’m quite satisfied with the features offered considering that I use it on my desktop and have no plans to use it on my smartphone. + +I’d definitely recommend you try this nice open-source project and support them along the way. If you like the project, feel free to show your appreciation by adding a star or sponsoring [their GitHub repository][21]. + +Feel free to let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/activitywatch/ + +作者:[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/2020/05/activitywatch.png?fit=800%2C607&ssl=1 +[2]: https://activitywatch.net/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-afk.jpg?ssl=1 +[4]: https://itsfoss.com/recommends/rescuetime/ +[5]: https://www.manictime.com/ +[6]: https://play.google.com/store/apps/details?id=net.activitywatch.android +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-timeline.jpg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-settings.jpg?ssl=1 +[9]: https://docs.activitywatch.net/en/latest/watchers.html +[10]: https://en.wikipedia.org/wiki/JSON +[11]: https://docs.activitywatch.net/en/latest/getting-started.html +[12]: https://aur.archlinux.org/packages/activitywatch-bin/ +[13]: https://itsfoss.com/unzip-linux/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/aw-qt.jpg?ssl=1 +[15]: https://itsfoss.com/activitywatch/5600 +[16]: https://github.com/ActivityWatch +[17]: https://itsfoss.com/popcorn-time-ubuntu-linux/ +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-screenshot.jpg?ssl=1 +[19]: https://itsfoss.com/pop-os-20-04-review/ +[20]: https://github.com/ActivityWatch/activitywatch/issues/208 +[21]: https://github.com/ActivityWatch/activitywatch From 9a6e76ae7a9261fcac0b177f4f59bf4e20b93767 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:30:32 +0800 Subject: [PATCH 2172/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20to=20Assign=20Static=20IP=20Address=20on=20Ubuntu=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md --- ...ssign Static IP Address on Ubuntu Linux.md | 179 ++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md diff --git a/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md b/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md new file mode 100644 index 0000000000..87ddb6b839 --- /dev/null +++ b/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md @@ -0,0 +1,179 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Assign Static IP Address on Ubuntu Linux) +[#]: via: (https://itsfoss.com/static-ip-ubuntu/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Assign Static IP Address on Ubuntu Linux +====== + +_**Brief: In this tutorial, you’ll learn how to assign static IP address on Ubuntu and other Linux distributions. Both command line and GUI methods have been discussed.**_ + +IP addresses on Linux Systems in most cases are assigned by [Dynamic Host Configuration Protocol][1] (DHCP) servers. IP addresses assigned this way are dynamic which means that the IP address might change when you [restart your Ubuntu system][2]. It’s not necessary but it may happen. + +_**Dynamic IP is not an issue for normal desktop Linux users in most cases**_. It could become an issue if you have employed some special kind of networking between your computers. + +For example, you can [share your keyboard and mouse between Ubuntu and Raspberry Pi][3]. The configuration uses IP addresses of both system. If the IP address changes dynamically, then your setup won’t work. + +Another use case is with servers or remotely administered desktops. It is easier to set static addresses on those systems for connection stability and consistency between the users and applications. + +In this tutorial, I’ll show you how to set up static IP address on Ubuntu based Linux distributions. Let me show you the command line way first and then I’ll show the graphical way of doing it on desktop. + +### Method 1: Assign static IP in Ubuntu using command line + +![][4] + +**Note for desktop users**: Use static IP only when you need it. Automatic IP saves you a lot of headache in handling network configuration. + +#### Step 1: Get the name of network interface and the default gateway + +The first thing you need to know is the name of the network interface for which you have to set up the static IP. + +You can either use ip command or the network manager CLI like this: + +``` +nmcli d +``` + +In my case, it shows my Ethernet (wired) network is called enp0s25: + +``` +Ubuntu> nmcli d +DEVICE TYPE STATE CONNECTION +enp0s25 ethernet unmanaged -- +lo loopback unmanaged -- +``` + +Next, you should note the [default gateway IP using the Linux command][5] **ip route**: + +``` +ip route +default via 192.168.31.1 dev enp0s25 proto dhcp metric 600 +169.254.0.0/16 dev enp0s25 scope link metric 1000 +192.168.31.0/24 dev enp0s25 proto kernel scope link src 192.168.31.36 metric 600 +``` + +As you can guess, the default gateway is 192.168.31.1 for me. + +#### Step 2: Locate Netplan configuration + +Ubuntu 18.04 LTS and later versions use [Netplan][6] for managing the network configuration. Netplan configuration are driven by .yaml files located in **/etc/netplan** directory. + +By default, you should see a .yaml file named something like 01-network-manager-all.yaml, 50-cloud-init.yaml, 01-netcfg.yaml. + +Whatever maybe the name, its content should look like this: + +``` +# Let NetworkManager manage all devices on this system +network: + version: 2 + renderer: NetworkManager +``` + +You need to edit this file for using static IP. + +#### Step 3: Edit Netplan configuration for assigning static IP + +_**Just for the sake of it, make a backup of your yaml file.**_ + +Please make sure to use the correct yaml file name in the commands from here onward. + +Use nano editor with sudo to open the yaml file like this: + +``` +sudo nano /etc/netplan/01-netcfg.yaml +``` + +Please note that _**yaml files use spaces for indentation**_. If you use tab or incorrect indention, your changes won’t be saved. + +You should edit the file and make it look like this by providing the actual details of your IP address, gateway, interface name etc. + +``` +network: + version: 2 + renderer: networkd + ethernets: + enp0s25: + dhcp4: no + addresses: + - 192.168.31.16/24 + gateway4: 192.168.31.1 + nameservers: + addresses: [8.8.8.8, 1.1.1.1] +``` + +In the above file, I have set the static IP to 192.168.31.16. + +Save the file and apply the changes with this command: + +``` +sudo netplan apply +``` + +You can verify it by [displaying your ip address in the terminal][7] with ‘ip a’ command. + +Revert the changes and go back to dynamic IP + +If you don’t want to use the static IP address anymore, you can revert easily. + +If you have backed up the original yaml file, you can delete the new one and use the backup one. + +Otherwise, you can change the yaml file again and make it look like this: + +``` +network: + version: 2 + renderer: networkd + ethernets: + enp0s25: + dhcp4: yes +``` + +### Method 2: Switch to static IP address in Ubuntu graphically + +If you are on desktop, using the graphical method is easier and faster. + +Go to the settings and look for network settings. Click the gear symbol adjacent to your network connection. + +![][8] + +Next, you should go to the IPv4 tab. Under the IPv4 Method section, click on Manual. + +In the Addresses section, enter the IP static IP address you want, netmask is usually 24 and you already know your gateway IP with the ip route command. + +You may also change the DNS server if you want. You can keep Routes section to Automatic. + +![][9] + +Once everything is done, click on Apply button. See, how easy it is to set a static IP address graphically. + +If you haven’t read my previous article on [how to change MAC Address][10], you may want to read in conjunction with this one. + +More networking related articles will be rolling out, let me know your thoughts at the comments below and stay connected to our social media. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/static-ip-ubuntu/ + +作者:[Dimitrios Savvopoulos][a] +选题:[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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol +[2]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[3]: https://itsfoss.com/keyboard-mouse-sharing-between-computers/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/static-ip-ubuntu.jpg?ssl=1 +[5]: https://linuxhandbook.com/find-gateway-linux/ +[6]: https://netplan.io/ +[7]: https://itsfoss.com/check-ip-address-ubuntu/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/assign-static-ip-1.jpg?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/assign-static-ip-2.jpg?ssl=1 +[10]: https://itsfoss.com/change-mac-address-linux/ From b100e995321d9fe3acf42f57cc723c62e6ded7c9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:30:53 +0800 Subject: [PATCH 2173/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Encr?= =?UTF-8?q?ypt=20Your=20Files=20Before=20Uploading=20it=20to=20Cloud=20Wit?= =?UTF-8?q?h=20Cryptomator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md --- ... Uploading it to Cloud With Cryptomator.md | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md diff --git a/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md b/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md new file mode 100644 index 0000000000..eda3a2990e --- /dev/null +++ b/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Encrypt Your Files Before Uploading it to Cloud With Cryptomator) +[#]: via: (https://itsfoss.com/cryptomator/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Encrypt Your Files Before Uploading it to Cloud With Cryptomator +====== + +_**Open source software highlight of this week is Cryptomator. It is a unique free and open-source encryption software that lets you encrypt your data before uploading it to the cloud.**_ + +There are several [cloud services available for Linux][1] and almost all of them do not offer [end to end encryption][2], at least not by default. + +Usually, the connection between your device and the server is secure. But your data stored on the server is not encrypted. Employees with direct access to the infrastructure at your cloud service providers may access this data. + +Of course, these companies have strict policies against such intrusion but a rogue employee can do a lot of damage. Remember the incident when a [departing Twitter employee deactivated the account of US President Donald Trump][3]. + +If you are one of the privacy cautious people, you would want the ease of cloud storage but with the added security layer of encrypted storage. + +Now some [services like pCloud do provide end to end encryption][4] but that comes at an additional cost. If you could afford that, well and good. If not, you can use a free and open source tool like [Cryptomator][5]. + +Cryptomator helps you secure your data by encrypting it before uploading it to any cloud storage services. In this article, I’m going to highlight the key features of Cryptomator along with instructions to use it. + +### Cryptomator: Add an encryption layer to your cloud data + +![][6] + +Cryptomator is a solution to encrypt your data locally before uploading it to the cloud. + +With this, you can create vaults locally and sync them to the cloud storage services you use. + +It’s very easy to use and you don’t need to have any specific technical knowledge to encrypt your data – that’s what Cryptomator is tailored for. + +### Features of Cryptomator + +Cryptomator is a simple encryption tool with the essential features. Here’s what it offers: + + * [AES][7] and 256-bit Encryption for files. + * Ability to create a vault and sync it with the cloud storage service + * Optional recovery key for your master password of the vault + * Cross-platform support (Linux, Windows, macOS, Android, and iOS) + * Supports the dark theme for a one-time license fee. + * Supports [WebDAV][8], [FUSE][9], and [Dokany][10] for easy integration with your operating system. + + + +Do note that the [Android][11] and [iOS][12] apps are paid apps that you have to purchase separately while the desktop program is completely free to use. Also, you need to purchase a one-time license to unlock the dark mode. Don’t blame them please. They need to make some money in order to develop this open source software. + +### Installing Cryptomator on Linux + +Cryptomater provides an AppImage file that you can download to get started on any Linux distribution. + +You can get it from its [official download page][13]. In case you don’t know, please read [how to use an AppImage file][14] to get started. + +[Download Cryptomator][5] + +### How To Use Cryptomator? + +Attention! + +Encryption is a double-edged sword. It can protect you and it can hurt you as well. +If you are encrypting your data and you forgot your encryption key, you’ll lose access to that data forever. +Cryptomator provides a recovery key option so please be careful with both password and the recovery key. Don’t forget it or lose the recovery key. + +Once you have installed Cryptomator, it’s really easy to use it following the user interface or the [official documentation][15]. + +But, to save you some time, I’ll highlight a few important things that you should know: + +#### Setup Your Vault + +![][16] + +After launching Cryptomator, you need to create the vault where you want to have your encrypted data. + +This can be an existing location or a new custom directory as per your requirements. + +Now that you proceed creating a new vault, you will also observe that you can open an existing vault as well (if you had one already). So, always have a backup of your vault, just in case. + +![][17] + +Here, I am assuming that you are a new user. So, obviously, proceed to create a new vault and give it a name: + +![][18] + +Next, you need to specify a storage location. If you already use OneDrive, Dropbox, Google Drive, or something similar, it might detect it automatically. + +![][19] + +However, if it doesn’t, like in my case (I use [pCloud][20]), you can select the cloud-synced directory or any other custom location manually. + +Once you select the location, you just need to create a password for it. It’s best to create a strong password that you can remember. + +![][21] + +Also, I’d suggest you to opt for the recovery key and store it in a separate USB drive or just print it on a paper. + +![][22] + +And, that’s it. You’re done creating your secure vault that you can sync with the cloud. + +![][23] + +Now, how do you add files to it? Let’s take a look: + +#### Adding Files To A Vault + +_**Note:** You can’t just go into the folder that you created from the file manager and files there. Follow the steps below to add files properly in your encrypted vault._ + +Once you’ve created your vault, you just need to unlock it by typing the password as shown in the image below. If you’re on your personal computer, you can choose to save the password without needing to enter it every time you access the vault. However, I advise not to do that. Manually entering the password help in remembering it. + +![][24] + +Next, after unlocking the vault, you just need to click on “**Reveal Vault**” or reveal drive to open it using **File Manager** where you can access/modify or add files to it. + +#### Backup / Recover Your Vault + +You should simply copy-paste the folder you create to another USB drive or somewhere else other than your cloud storage folder to ensure that you have a backup of your vault. + +![][25] + +It’s important to have the **masterkey.cryptomator** file of the vault in order to open it. + +#### Upgrades, Preferences & Settings + +Note + +You should enable the auto-updates feature to ensure that you will have the most stable and error-free version automatically. + +Apart from the most important functions of the Cryptomator app, you will get a couple of other features to tweak, such as: + + * Change the type of your virtual drive + * Tweak the vault to read-only mode + + + +You can explore the **Vault options** and the settings on Cryptomator to know about what else you can do. + +**Wrapping Up** + +Now that you know about Cryptomator, you can easily encrypt your important data locally before uploading them to the cloud. + +What do you think about Cryptomator? Let us know your thoughts in the comments down below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cryptomator/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/cloud-services-linux/ +[2]: https://en.wikipedia.org/wiki/End-to-end_encryption +[3]: https://www.theverge.com/2017/11/2/16600732/donald-trump-twitter-account-gone-realdonaldtrump +[4]: https://partner.pcloud.com/r/22317 +[5]: https://cryptomator.org/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-ft.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard +[8]: https://en.wikipedia.org/wiki/WebDAV +[9]: https://en.wikipedia.org/wiki/Filesystem_in_Userspace +[10]: https://en.wikipedia.org/wiki/Dokan_Library +[11]: https://play.google.com/store/apps/details?id=org.cryptomator&hl=en_US +[12]: https://apps.apple.com/us/app/cryptomator/id953086535 +[13]: https://cryptomator.org/downloads/ +[14]: https://itsfoss.com/use-appimage-linux/ +[15]: https://docs.cryptomator.org +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-add-vault.jpg?ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-create-open-vault.jpg?ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-add-vault-name.jpg?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-vault-location.jpg?ssl=1 +[20]: https://itsfoss.com/recommends/pcloud/ +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-pass.jpg?ssl=1 +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-recovery.jpg?ssl=1 +[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-vault-success.jpg?ssl=1 +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-unlock.jpg?ssl=1 +[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-master.jpg?ssl=1 From ac5ac32ce713162b310dac9e128b587373705ce8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:31:14 +0800 Subject: [PATCH 2174/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Debi?= =?UTF-8?q?an=E2=80=99s=20Decision=20to=20Drop=20Old=20Drivers=20has=20Ups?= =?UTF-8?q?et=20Vintage=20Hardware=20Users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md --- ...rivers has Upset Vintage Hardware Users.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md diff --git a/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md b/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md new file mode 100644 index 0000000000..fb2b9005ea --- /dev/null +++ b/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Debian’s Decision to Drop Old Drivers has Upset Vintage Hardware Users) +[#]: via: (https://itsfoss.com/debian-dropping-old-drivers/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Debian’s Decision to Drop Old Drivers has Upset Vintage Hardware Users +====== + +It is always a tough decision to drop support for older hardware for the latest Linux distribution releases. Just like [Ubuntu decided to drop support for 32-bit systems][1], Debian’s X Strike Force (XFS) team decided to drop a list of input and video drivers. + +### Debian is considering to drop support for really old hardware + +![][2] + +In case you didn’t know, the XFS team is responsible for maintaining packages the [X Window System][3] in [Debian][4]. And, the list of drivers that [they want to remove][5] are: + + * xserver-xorg-input-aiptek + * xserver-xorg-input-elographics + * xserver-xorg-input-mtrack + * xserver-xorg-input-mutouch + * xserver-xorg-input-void + * server-xorg-video-ast + * xserver-xorg-video-mach64 + + + * xserver-xorg-video-neomagic + * xserver-xorg-video-r128 + * xserver-xorg-video-savage + * xserver-xorg-video-siliconmotion + * xserver-xorg-video-sisusb + * xserver-xorg-video-tdfx + * xserver-xorg-video-trident + + + +So, Mach 64, [ATI Rage R128][6], Savage, Silicon Motion, SiS, Trident, and NeoMagic are some of the graphics chipsets that would be affected. The reason (as stated by them) to drop these drivers is: + +> They are either unmaintained upstream or provide no value to the distribution. + +Now, that could make sense, if the packages are no longer maintained. But, upstream some of these X.org drivers are still **maintained** even if there are no frequent updates to them. For instance, in 2018, a [new display driver update was released for the ATI RAGE 128][7], as reported by Phoronix. + +### Vintage hardware owners are going to be upset + +Obviously, the vintage hardware users aren’t quite happy with the decision because a handful of people still own (or actively use) old hardware i.e. around 20 years older. + +From the original list of drivers mentioned in the [bug report][5], **Geode display driver** was initially decided to be removed but wasn’t dropped. + +It was also reported that the “**xserver-xorg-video-r128**” driver is required for older Apple hardware (iMac). And, a user reported about the missing video driver on his iMac. + +For most of the users, this decision may not actually affect any “production” systems because I don’t think anyone is probably going to utilize 20-year old hardware for commercial purposes. + +The hobbyists and collectors who like to preserve older tech are surely going to be impacted by this decision. + +### Wrapping Up + +In my opinion, dropping the support for incredibly dated hardware is not entirely a bad move. + +But, if there is a demand for the support of vintage hardware, the fair share of users who want the drivers to be added in Debian should help maintain those packages. If not, I don’t think it won’t be a wise choice to have an unmaintained piece of code in Debian. + +What do you think about this? Feel free to share your thoughts in the comments below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/debian-dropping-old-drivers/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-drops-32-bit-desktop/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/debian-bug-report-driver-drop.jpg?ssl=1 +[3]: https://en.wikipedia.org/wiki/X_Window_System +[4]: https://www.debian.org/ +[5]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955603 +[6]: https://en.wikipedia.org/wiki/ATI_Rage_series +[7]: https://www.phoronix.com/scan.php?page=news_item&px=ATI-RAGE-128-DDX-6.11.0 From ee5cb891e1be650e339460d43f7e511f3a758f2c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:31:49 +0800 Subject: [PATCH 2175/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Foli?= =?UTF-8?q?ate:=20A=20Modern=20eBook=20Reader=20App=20for=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Foliate- A Modern eBook Reader App for Linux.md --- ...te- A Modern eBook Reader App for Linux.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 sources/tech/20200525 Foliate- A Modern eBook Reader App for Linux.md diff --git a/sources/tech/20200525 Foliate- A Modern eBook Reader App for Linux.md b/sources/tech/20200525 Foliate- A Modern eBook Reader App for Linux.md new file mode 100644 index 0000000000..fed582f7d9 --- /dev/null +++ b/sources/tech/20200525 Foliate- A Modern eBook Reader App for Linux.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Foliate: A Modern eBook Reader App for Linux) +[#]: via: (https://itsfoss.com/foliate-ebook-viewer/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Foliate: A Modern eBook Reader App for Linux +====== + +_**Brief: Foliate is simple and elegant open source eBook viewer that provides a Kindle-like reading experience on Linux desktop.**_ + +### Foliate provides modern reading experience on Linux desktop + +![][1] + +While we already have a list of [best eBook readers for Linux][2], I recently came across another eBook viewer for Linux. It is called [Foliate][3]. + +Foliate is a modern GTK eBook viewer that offers quite a lot of essential features. If you own an Amazon Kindle or some other eBook reader, you probably miss that kind of reading experience on the desktop. + +Foliate addresses those complaints. Foliate shows an estimate of remaining reading time and pages in the book. You can add bookmarks, highlight text and add notes. You can export this data or sync them easily. + +![Foliate Ebook Viewer Features][4] + +You can also look up for words using Wiktionary and Wikipedia. You can switch between two page view and scroll view. It also has several themes to suit you reading preference. + +![][5] + +And the best thing is that it is being actively maintained and developed. + +### Features of Foliate + +![][6] + +Let’s take a look at all the features Foliate offers: + + * Supports .epub, .mobi, .azw, and .azw3 files. It DOES NOT support PDF files. + * It lets you read the eBook on a two-page view mode and offers a scroll view mode as well. + * Ability to customize font, line-spacing, margins, and brightness + * Default themes include Light, sepia, dark, Solarized dark/light, Gruvbox light/dark, Grey, Nord, and invert mode. + * You can also add custom themes to tweak the appearance of the eBook viewer + * Reading progress slider with chapter marks + * Bookmarks and annotations support + * Ability to find a text in the book + * Ability to zoom in and zoom out + * Enable/Disable sidebar for navigation + * Quick dictionary lookup using [Wiktionary][7] and [Wikipedia][8] + * Translation of text using Google Translate + * Touchpad gestures—use a two-finger swipe to turn the page + * Text-to-Speech support with [eSpeak NG][9] and [Festival][10] + + + +**Recommended Read:** + +![][11] + +#### [What Amazon Kindle? Here’s an Open Source eBook Reader][12] + +Open Book is an open source eBook reader that you can tweak to your liking. Free from proprietary stuff, Open Book is a dream come true for open source enthusiasts. + +### Installing Foliate on Linux + +For Ubuntu and Debian based Linux distributions, you can get the .deb file from its [GitHub releases section][13] to download the. [Installing applications from deb file][14] is as easy as double clicking on it. + +For other Linux distributions like Fedora, Arch, SUSE etc, Foliate is available as [Flatpak][15] and [Snap][16] package. In if you don’t know how to use them, you may follow our guide on [using flatpak][17] and using [snap packages][18] in Linux to get started with it. + +You can explore its [GitHub page][19] to build from source if you need it. + +[Download Foliate App][20] + +**Wrapping Up** + +I tried it on **Pop!_OS 19.10** using the latest **.deb** file available on GitHub and it worked well. I liked its features though I don’t read a lot on my desktop. + +Have you tried Foliate yet? Feel free to share your experience with it. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/foliate-ebook-viewer/ + +作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-app.jpg?ssl=1 +[2]: https://itsfoss.com/best-ebook-readers-linux/ +[3]: https://johnfactotum.github.io/foliate/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-ebook-viewer-features.jpg?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-screenshot.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-options.jpg?ssl=1 +[7]: https://en.wiktionary.org/wiki/Wiktionary:Main_Page +[8]: https://en.wikipedia.org/wiki/Main_Page +[9]: https://github.com/espeak-ng/espeak-ng +[10]: http://www.cstr.ed.ac.uk/projects/festival/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/open-book-under-development-feature.jpeg?fit=800%2C450&ssl=1 +[12]: https://itsfoss.com/open-book/ +[13]: https://github.com/johnfactotum/foliate/releases +[14]: https://itsfoss.com/install-deb-files-ubuntu/ +[15]: https://flathub.org/apps/details/com.github.johnfactotum.Foliate +[16]: https://snapcraft.io/foliate +[17]: https://itsfoss.com/flatpak-guide/ +[18]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[19]: https://github.com/johnfactotum/foliate +[20]: tmp.6FO70BtAuy From 50d57652952aaff599d39e1631f4ff77e6cd335c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:32:05 +0800 Subject: [PATCH 2176/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20Linu?= =?UTF-8?q?x=20Mint=2020:=20Release=20Date,=20Features=20and=20Everything?= =?UTF-8?q?=20Important=20Associated=20With=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md --- ...Everything Important Associated With it.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/tech/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md diff --git a/sources/tech/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md b/sources/tech/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md new file mode 100644 index 0000000000..ffd052c4c7 --- /dev/null +++ b/sources/tech/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Mint 20: Release Date, Features and Everything Important Associated With it) +[#]: via: (https://itsfoss.com/linux-mint-20/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Mint 20: Release Date, Features and Everything Important Associated With it +====== + +_**A continually updated article that lists all the new features in the upcoming Linux Mint 20 release.**_ + +[Ubuntu 20.04 LTS release][1] is just around the corner. This is a good news for Linux Mint users as well. A new Ubuntu LTS release means that a new major Linux Mint release will follow soon. + +Why? Because Linux Mint is based on the long term support (LTS) release of Ubuntu. Mint 18 series was based on Ubuntu 16.04 LTS, Mint 19 was based on Ubuntu 18.04 LTS and Linux Mint is going + +Unlike Ubuntu, [Linux Mint][2] doesn’t have a set release schedule. Keeping the past trends in mind, I can make an intelligent guess that Linux Mint 20 should be releasing in June this year. + +### New Features Coming in Linux Mint 20 “Ulyana” + +![][3] + +Let’s take a look at some of the main proposed new features and changes in Linux Mint 20, code-named Ulyana. + +#### Performance improvement to Nemo file manager + +One of the planned performance improvement in the Nemo file manager is the way it handles the thumbnails. You might not have realized but thumbnail generations takes considerable system resources (and disk space as well). Try opening a folder with a few thousands images and you’ll notice that CPU consumption goes up. + +In Linux Mint 20, the aim is to prioritize content and navigation and to delay thumbnails as much as possible. This means that the content of folders shows up with generic icons before the thumbnails are rendered. It won’t be pleasing to the eyes, but you’ll notice the improvement in performance. + +#### Two refreshed color variants + +By default Linux Mint has a green/mint accent. There are a few more color accents available. Linux Mint 20 refreshes the pink and blue colors in its kitty. + +Here’s the new Aqua accent color: + +![Linux Mint Aqua][4] + +And the new Pink accent color: + +![Linux Mint Pink][5] + +#### Sharing files across network becomes simple with this new tool + +Linux Mint 20 will feature a [new GUI tool][6] for easily sharing files on the local network without any additional configuration. + +![New tool for sharing files across the network][7] + +#### Better desktop integration for Electron apps + +[Electron][8] is an open source framework that allows to build cross-platform desktop applications using web technologies. Some people call it the lazy approach because the application runs on top of Chromium web browser. However, this allows developers to easily make their applications available for Linux (and macOS). [Slack on Linux][9] is one of many such examples. + +Linux Mint 20 will have better support for Electron applications with improved integration of system tray and desktop notifications. + +#### Fractional scaling with improved multi-monitor support + +![][10] + +A proposed change is to include fractional scaling in Linux Mint 20 that too with multi-monitor support. If you have a combination of HiDPI and non-HiDPI monitors, you should be able to select the different resolution, refresh rate and different fractional scaling for each of them. + +#### No more 32 bit + +Though Ubuntu 18.04 dropped 32-bit ISO 2 years ago, Linux Mint 19 series kept on providing 32-bit ISO to download and install. + +This changes in Linux Mint 20. There is no 32-bit version of Linux Mint 20 anymore. This is because 32-bit support completely disappears from Ubuntu 20.04. + +#### What else? + +A lot of visual changes come with the release of Cinnamon 4.6 desktop version. + +There should be a few ‘under the hood’ changes coming from Ubuntu 20.04 such as Linux Kernel 5.4, removal of Python 2 support, inclusion of [Wireguard VPN][11] etc. + +I’ll update this article with more features as the development progresses. Stay tuned! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-mint-20/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-20-04-release-features/ +[2]: https://www.linuxmint.com/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Linux-Mint-20.png?ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-aqua.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-pink-1.jpg?ssl=1 +[6]: https://blog.linuxmint.com/?p=3863 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-warpinator-1.png?ssl=1 +[8]: https://www.electronjs.org/ +[9]: https://itsfoss.com/slack-use-linux/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/monitor_display_Linux_mint_20.png?ssl=1 +[11]: https://itsfoss.com/wireguard/ From a074eda472b1debee67d373a41ade208afe36f78 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:32:56 +0800 Subject: [PATCH 2177/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200516=20Fati?= =?UTF-8?q?h=E2=80=99s=20question?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200516 Fatih-s question.md --- sources/tech/20200516 Fatih-s question.md | 214 ++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 sources/tech/20200516 Fatih-s question.md diff --git a/sources/tech/20200516 Fatih-s question.md b/sources/tech/20200516 Fatih-s question.md new file mode 100644 index 0000000000..1225c624a8 --- /dev/null +++ b/sources/tech/20200516 Fatih-s question.md @@ -0,0 +1,214 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fatih’s question) +[#]: via: (https://dave.cheney.net/2020/05/16/fatihs-question) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Fatih’s question +====== + +A few days ago Fatih posted [this question][1] on twitter. + +I’m going to attempt to give my answer, however to do that I need to apply some simplifications as my previous attempts to answer it involved a lot of phrases like _a pointer to a pointer_, and other unhelpful waffling. Hopefully my simplified answer can be useful in building a mental framework to answer Fatih’s original question. + +### Restating the question + +Fatih’s original tweet showed [four different variations][2] of `json.Unmarshal`. I’m going to focus on the last two, which I’ll rewrite a little: + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +type Result struct { + Foo string `json:"foo"` +} + +func main() { + content := []byte(`{"foo": "bar"}`) + var result1, result2 *Result + + err := json.Unmarshal(content, &result1) + fmt.Println(result1, err) // &{bar} + + err = json.Unmarshal(content, result2) + fmt.Println(result2, err) // json: Unmarshal(nil *main.Result) +} +``` + +Restated in words, `result1` and `result2` are the same type; `*Result`. Decoding into `result1` works as expected, whereas decoding into `result2` causes the `json` package to complain that the value passed to `Unmarshal` is `nil`. However, both values were declared without an initialiser so both would have taken on the type’s zero value, `nil`. + +Eagle eyed readers will have spotted that the reason for the difference is the first` `invocation is passed `&result1`, while the second is passed `result2`, but this explanation is unsatisfactory because the documentation for `json.Unmarshal` states: + +> Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. **If v is nil or not a pointer**, Unmarshal returns an InvalidUnmarshalError. + +Which is confusing because `result1` and `result2` _are_ pointers. Furthermore, without initialisation, both _are_ `nil`. Now, the documentation is correct (as you’d expect from a package that has been hammered on for a decade), but explaining _why_ takes a little more investigation. + +### Functions receive a copy of their arguments + +Every assignment in Go is a copy, this includes function arguments and return values. + +``` +package main + +import ( + "fmt" +) + +func increment(v int) { + v++ +} + +func main() { + v := 1 + increment(v) + fmt.Println(v) // 1 +} +``` + +In this example, `increment` is operating on a _copy_ of `main`‘s `v`. This is because the `v` declared in `main` and `increment`‘s `v` parameter have different addresses in memory. Thus changes to `increment`‘s `v` cannot affect the contents of `main`‘s `v`. + +``` +package main + +import ( + "fmt" +) + +func increment(v *int) { + *v++ +} + +func main() { + v := 1 + increment(&v) + fmt.Println(v) // 2 +} +``` + +If we wanted to write `increment` in a way that it could affect the contents of its caller we would need to pass a reference, a pointer, to `main.v`.[1][3] This example demonstrates why `json.Unmarshal` needs a pointer to the value to decode JSON into. + +### Pointers to pointers + +Returning to the original question, both `result1` and `result2` are declared as `*Result`, that is, pointers to a `Result` value. We established that you have to pass the address of caller’s value to `json.Unmarshal` otherwise it won’t be able to alter the contents of the caller’s value. Why then must we pass the address of `result1`, a `**Result`, a pointer to a pointer to a `Result`, for the operation to succeed. + +To explain this another detour is required. Consider this code: + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +type Result struct { + Foo *string `json:"foo"` +} + +func main() { + content := []byte(`{"foo": "bar"}`) + var result1 *Result + + err := json.Unmarshal(content, &result1) + fmt.Printf("%#v %v", result1, err) // &main.Result{Foo:(*string)(0xc0000102f0)} +} +``` + +In this example `Result` contains a pointer typed field, `Foo *string`. During JSON decoding `Unmarshal` allocated a new `string` value, stored the value `bar` in it, then placed the address of the string in `Result.Foo`. This behaviour is quite handy as it frees the caller from having to initialise `Result.Foo` and makes it easier to detect when a field was not initialised because the JSON did not contain a value. Beyond the convenience this offers for simple examples it would be prohibitively difficult for the caller to properly initialise all the reference type fields in a structure before decoding unknown JSON without first inspecting the incoming JSON which itself may be problematic if the input is coming from an `io.Reader` without the ability to rewind the input. + +> To unmarshal JSON into a pointer, Unmarshal first handles the case of the JSON being the JSON literal null. In that case, Unmarshal sets the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into the value pointed at by the pointer. **If the pointer is nil, Unmarshal allocates a new value for it to point to**. + +`json.Unmarshal`‘s handling of pointer fields is clearly documented, and works as you would expect, allocating a new value whenever there is a need to decode into a pointer shaped field. It is this behaviour that gives us a hint to what is happening in the original example. + +We’ve seen that when `json.Unmarshal` encounters a field which points to `nil` it will allocate a new value of the correct type and assign its address the field before proceeding. Not only is does behaviour is applied recursively–for example in the case of a complex structure which contains pointers to other structures–but it also applies to the _value passed to `Unmarshal`._ + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +func main() { + content := []byte(`1`) + var result *int + + err := json.Unmarshal(content, &result) + fmt.Println(*result, err) // 1 +} +``` + +In this example `result` is not a struct, but a simple `*int` which, lacking an initialiser, defaults to `nil`. After JSON decoding, `result` now points to an `int` with the value `1`. + +### Putting the pieces together + +Now I think I’m ready to take a shot at answering Fatih’s question. + +`json.Unmarshal` requires the address of the variable you want to decode into, otherwise it would decode into a temporary copy which would be discard on return. Normally this is done by declaring a value, then passing its address, or explicitly initialising the the value + +``` +var result1 Result +err := json.Unmarshal(content, &result1) // this is fine + +var result2 = new(Result) +err = json.Unmarshal(content, result2) // and this + +var result3 = &Result{} +err = json.Unmarshal(content, result3) // this is also fine +``` + +In all three cases the address that the `*Result` points too is not `nil`, it points to initialised memory that `json.Unmarshal` decodes into. + +Now consider what happens when `json.Unmarshal` encounters this + +``` +var result4 *Result +err = json.Unmarshal(content, result4) // err json: Unmarshal(nil *main.Result) +``` + +`result2`, `result3`, and the expression `&result1` point to a `Result`. However `result4`, even though it has the same type as the previous three, does not point to initialised memory, it points to `nil`. Thus, according to the examples we saw previously, before `json.Unmarshal` can decode into it, the memory `result4` points too must be initialised. + +However, because each function receives a copy of its arguments, the caller’s `result4` variable and the copy inside `json.Unmarshal` are unique. `json.Unmarshal` can allocate a new `Result` value and decode into it, but it cannot alter `result4` to point to this new value because it was not provided with a reference to `result4`, only a copy of its contents. + + 1. This does not violate the _everything is a copy_ rule, a copy of a pointer to `main.v` still points to `main.v`.[][4] + + + +#### Related posts: + + 1. [Should methods be declared on T or *T][5] + 2. [Ice cream makers and data races][6] + 3. [Understand Go pointers in less than 800 words or your money back][7] + 4. [Slices from the ground up][8] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/16/fatihs-question + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/fatih/status/1260683136842608640 +[2]: https://play.golang.org/p/g2yUIYrV67F +[3]: tmp.dRxkHxYRQS#easy-footnote-bottom-1-4153 (This does not violate the everything is a copy rule, a copy of a pointer to main.v still points to main.v.) +[4]: tmp.dRxkHxYRQS#easy-footnote-1-4153 +[5]: https://dave.cheney.net/2016/03/19/should-methods-be-declared-on-t-or-t (Should methods be declared on T or *T) +[6]: https://dave.cheney.net/2014/06/27/ice-cream-makers-and-data-races (Ice cream makers and data races) +[7]: https://dave.cheney.net/2017/04/26/understand-go-pointers-in-less-than-800-words-or-your-money-back (Understand Go pointers in less than 800 words or your money back) +[8]: https://dave.cheney.net/2018/07/12/slices-from-the-ground-up (Slices from the ground up) From 85223b7b6fc6efa04dd9bc3fade491f9e0890128 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:33:33 +0800 Subject: [PATCH 2178/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200223=20The?= =?UTF-8?q?=20Zen=20of=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200223 The Zen of Go.md --- sources/tech/20200223 The Zen of Go.md | 414 +++++++++++++++++++++++++ 1 file changed, 414 insertions(+) create mode 100644 sources/tech/20200223 The Zen of Go.md diff --git a/sources/tech/20200223 The Zen of Go.md b/sources/tech/20200223 The Zen of Go.md new file mode 100644 index 0000000000..c4143aed32 --- /dev/null +++ b/sources/tech/20200223 The Zen of Go.md @@ -0,0 +1,414 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Zen of Go) +[#]: via: (https://dave.cheney.net/2020/02/23/the-zen-of-go) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +The Zen of Go +====== + +_This article was derived from my [GopherCon Israel 2020][1] presentation. It’s also quite long. If you’d prefer a shorter version, head over to [the-zen-of-go.netlify.com][2]_. + +_A recording of the presentation is available on [YouTube][3]._ + +* * * + +### How should I write good code? + +Something that I’ve been thinking about a lot recently, when reflecting on the body of my own work, is a common subtitle, _how should I write good code?_ Given nobody actively seeks to write _bad_ code, this leads to the question; _how do you know when you’ve written good Go code?_ + +If there’s a continuum between good and bad, how to do we know what the good parts are? What are its properties, its attributes, its hallmarks, its patterns, and its idioms? + +### Idiomatic Go + +![][4] + +Which brings me to idiomatic Go. To say that something is idiomatic is to say that it follows the style of the time. If something is not idiomatic, it is not following the prevailing style. It is unfashionable. + +More importantly, to say to someone that their code is not idiomatic does not explain _why_ it’s not idiomatic. Why is this? Like all truths, the answer is found in the dictionary. + +> idiom (noun): a group of words established by usage as having a meaning not deducible from those of the individual words. + +Idioms are hallmarks of shared values. Idiomatic Go is not something you learn from a book, it’s something that you acquire by being part of a community. + +![][5] + +My concern with the mantra of idiomatic Go is, in many ways, it can be exclusionary. It’s saying “you can’t sit with us.” After all, isn’t that what we mean when critique of someone’s work as non-idiomatic? They didn’t do It right. It doesn’t look right. It doesn’t follow the style of time. + +I offer that idiomatic Go is not a suitable mechanism for teaching how to write good Go code because it is defined, fundamentally, by telling someone they did it wrong. Wouldn’t it be better if the advice we gave didn’t alienate the author right at the point they were most willing to accept it? + +### Proverbs + +Stepping away problematic idioms, what other cultural artefacts do Gophers have? Perhaps we can turn to Rob Pike’s wonderful [Go Proverbs][6]. Are these suitable teaching tools? Will these tell newcomers how to write good Go code? + +In general, I don’t think so. This is not to dismiss Pike’s work, it is just that the Go Proverbs, like Segoe Kensaku’s original, are observations, not statements of value. Again, the dictionary comes to the rescue: + +> proverb (noun): a short, well-known pithy saying, stating a general truth or piece of advice. + +The goal of the Go Proverbs are to reveal a deeper truth about the design of the language, but how useful is advice like the _empty interface says nothing_ to a novice from a language that doesn’t have structural typing? + +It’s important to recognise that, in a growing community, at any time the people learning Go far outnumber those who claim to have mastered the language. Thus proverbs are perhaps not the best teaching tool in this scenario. + +### Engineering Values + +Dan Luu found [an old presentation][7] by Mark Lucovsky about the engineering culture of the windows team around the windows NT-windows 2000 timeframe. The reason I mention it is Lukovsky’s description of a culture as a common way of evaluating designs and making tradeoffs. + +![][8] + +There are many ways of discussing culture, but with respect to an engineering culture Lucovsky’s description is apt. The central idea is _values guide decisions in an unknown design space_. The values of the NT team were; portability, reliability, security, and extensibility. Engineering values are, crudely translated, the way things are done around here. + +### Go’s values + +What are the explicit values of Go? What are the core beliefs or philosophy that define the way a Go programmer interprets the world? How are they promulgated? How are they taught? How are they enforced? How do they change over time? + +How will you, as a newly minted Go programmer, inculcate the engineering values of Go? Or, how will you, a seasoned Go professional promulgate your values to a future generations? And just so we’re clear, this process of knowledge transfer is not optional. Without new blood and new ideas, our community become myopic and wither. + +#### The values of other languages + +To set the scene for what I’m getting at we can look to other languages we see examples of their engineering values. + +For example, C++ (and by extension Rust) believe that a programmer _should not have to pay for a feature they do not use_. If a program does not use some computationally expensive feature of the language, then it shouldn’t be forced to shoulder the cost of that feature. This value extends from the language, to its standard library, and is used as a yardstick for judging the design of all code written in C++. + +In Java, and Ruby, and Smalltalk, the core value that _everything is an object_ drives the design of programs around message passing, information hiding, and polymorphism. Designs that shoehorn a procedural style, or even a functional style, into these languages are considered to be wrong–or as Gophers would say, non idiomatic. + +Turning to our own community, what are the engineering values that bind Go programmers? Discourse in our community is often fractious, so deriving a set of values from first principles would be a formidable challenge. Consensus is critical, but exponentially more difficult as the number of contributors to the discussion increases. But what if someone had done the hard work for us. + +### The Zen of ~~Python~~ Go + +Several decades ago Tim Peters sat down and penned _[PEP-20][9]_, the Zen of Python. Peters’ attempted to document the engineering values that he saw Guido van Rossum apply in his role as BDFL for Python. + +For the remainder of this article, I’m going to look towards the Zen of Python and ask, is there anything that can inform the engineering values of Go programmers? + +### A good package starts with a good name + +Let’s start with something spicy, + +> “Namespaces are one honking great idea–let’s do more of those!” + +The Zen of Python, Item 19 + +This is pretty unequivocal, Python programmers should use namespaces. Lots of them. + +In Go parlance a namespace is a package. I doubt there is any question that grouping things into packages is good for design and potentially reuse. But there might be some confusion, especially if you’re coming with a decade of experience in another language, about the right way to do this. + +In Go each package should have a purpose, and the best way to know a package’s purpose is by its name—a noun. A package’s name describes what it provides. So too reinterpret Peters’ words, every Go package should have a single purpose. + +This is not a new idea, [I’ve been saying this a while][10], but why should you do this rather than approach where packages are used for fine grained taxonomy? Why, because change. + +> “Design is the art of arranging code to work today, and be changeable forever.” + +Sandi Metz + +Change is the name of the game we’re in. What we do as programmers is manage change. When we do that well we call it design, or architecture. When we do it badly we call it technical debt, or legacy code. + +If you are writing a program that works perfectly, one time, for one fixed set of inputs then nobody cares if the code is good or bad because ultimately the output of the program is all the business cares about. + +But this is _never_ true. Software has bugs, requirements change, inputs change, and very few programs are written solely to be executed once, thus your program _will_ change over time. Maybe it’s you who’ll be tasked with this, more likely it will be someone else, but someone has to change that code. Someone has to maintain that code. + +So, how can we make it easy to for programs to change? Interfaces everywhere? Make everything mockable? Pernicious dependency injection? Well, maybe, for some classes of programs, but not many, those techniques will be useful. However, for the majority of programs, designing something to be flexible up front is over engineering. + +What if, instead, we take a position that rather than enhancing components, we replace them. Then the best way to know when something needs to be replaced, is when it doesn’t do what it says on the tin. + +A good package starts with choosing a good name. Think of your package’s name as an elevator pitch, using just one word, to describe what it provides. When the name no longer matches the requirement, find a replacement. + +### Simplicity matters + +> “Simple is better than complex.” + +The Zen of Python, Item 3 + +PEP-20 says simple is better than complex, I couldn’t agree more. A couple of years ago I made this tweet; + +> Most programming languages start out aiming to be simple, but end up just settling for being powerful. +> +> — Dave Cheney (@davecheney) [December 2, 2014][11] + +My observation, at least at the time, was that I couldn’t think of a language introduced in my life time that didn’t purport to be simple. Each new language offered as a justification, and an enticement, their inherent simplicity. But as I researched, I found that simplicity was not a core value of the many of the languages considered Go’s contemporaries. [1][12] Maybe this is just a cheap shot, but could it be that either these languages aren’t simple, or they don’t _think_ of themselves as being simple. They don’t consider simplicity to be a core value. + +Call me old fashioned, but when did being simple fall out of style? Why does the commercial software development industry continually, gleefully, forget this fundamental truth? + +> “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” + +C. A. R. Hoare, The Emperor’s Old Clothes, 1980 Turing Award Lecture + +Simple does not mean easy, we know that. Often it is more work to make something simple to use, than easy to build. + +> “Simplicity is prerequisite for reliability.” + +Edsger W Dijkstra, EWD498, 18 June 1975 + +Why should we strive for simplicity? Why is important that Go programs be simple? Simple doesn’t mean crude, it means readable and maintainable. Simple doesn’t mean unsophisticated, it means reliable, relatable, and understandable. + +> “Controlling complexity is the essence of computer programming.” + +Brian W. Kernighan, _Software Tools_ (1976) + +Whether Python abides by its mantra of simplicity is a matter for debate, but Go holds simplicity as a core value. I think that we can all agree that when it comes to Go, simple code is preferable to clever code. + +### Avoid package level state + +> “Explicit is better than implicit.” + +_The Zen of Python, Item_ 2 + +This is a place where I think Peters’ was more aspirational than factual. Many things in Python are not explicit; decorators, dunder methods, and so on. Without doubt they are powerful, there’s a reason those features exists. Each feature is something someone cared enough about to do the work to implement it, especially the complicated ones. But heavy use of those features makes is harder for the reader to predict the cost of an operation. + +The good news is we have a choice, as Go programmers, to choose to make our code explicit. Explicit could mean many things, perhaps you may be thinking explicit is just a nice way of saying bureaucratic and long winded, but that’s a superficial interpretation. It’s a misnomer to focus only on the syntax on the page, to fret about line lengths and DRYing up expressions. The more valuable, in my opinon, place to be explicit are to do with coupling and with state. + +Coupling is a measure of the amount one thing depends on another. If two things are tightly coupled, they move together. An action that affects one is directly reflected in another. Imagine a train, each carriage joined–ironically the correct word is coupled–together; where the engine goes, the carriages follow. + +Another way to describe coupling is the word cohesion. Cohesion measures how well two things naturally belong together. We talk about a cohesive argument, or a cohesive team; all their parts fit together as if they were designed that way. + +Why does coupling matter? Because just like trains, when you need to change a piece of code, all the code that is tightly coupled to it must change. A prime example, someone release a new version of their API and now your code doesn’t compile. + +APIs are an unavoidable source of coupling but there are more insidious forms of coupling. Clearly everyone knows that if an API’s signature changes the data passing into and out of that call changes. It’s right there in the signature of the function; I take values of these types and return values of other types. But what if the API passed data another way? What if every time you called this API the result was based on the previous time you called that API even though you didn’t change your parameters. + +This is state, and management of state is _the_ problem in computer science. + +``` +package counter + +var count int + +func Increment(n int) int { + count += n + return count +} +``` + +Suppose we have this simple `counter` package. You can call `Increment` to increment the counter, you can even get the value back if you `Increment` with a value of zero. + +Suppose you had to test this code, how would you reset the counter after each test? Suppose you wanted to run those tests in parallel, could you do it? Now suppose that you wanted to count more than one thing per program, could you do it? + +No, of course not. Clearly the answer is to encapsulate the `count` variable in a type. + +``` +package counter + +type Counter struct { + count int +} + +func (c *Counter) Increment(n int) int { + c.count += n + return c.count +} +``` + +Now imagine that this problem isn’t restricted to just counters, but your applications main business logic. Can you test it in isolation? Can you test it in parallel? Can you use more than one instance at a time? If the answer those question is _no_, the reason is package level state. + +Avoid package level state. Reduce coupling and spooky action at a distance by providing the dependencies a type needs as fields on that type rather than using package variables. + +### Plan for failure, not success + +> “Errors should never pass silently.” + +_The Zen of Python, Item 1_0 + +It’s been said of languages that favour exception handling follow the Samurai principle; _return victorious or not at all_. In exception based languages functions only return valid results. If they don’t succeed then control flow takes an entirely different path. + +Unchecked exceptions are clearly an unsafe model to program in. How can you possibly write code that is robust in the presence of errors when you don’t know which statements could throw an exception? Java tried to make exceptions safer by introducing the notion of a checked exception which, to the best of my knowledge, has not been repeated in another mainstream language. There are plenty of languages which use exceptions but they all, with the singular exception of Java, do so in the unchecked variety. + +Obviously Go chose a different path. Go programmers believe that robust programs are composed from pieces that handle the failure cases _before_ they handle the happy path. In the space that Go was designed for; server programs, multi threaded programs, programs that handle input over the network, dealing with unexpected data, timeouts, connection failures and corrupted data must be front and centre of the programmer’s mind if they are to produce robust programs. + +> “I think that error handling should be explicit, this should be a core value of the language.” + +Peter Bourgon, [GoTime #91][13] + +I want to echo Peter’s assertion, as it was the impetus for this article. I think so much of the success of Go is due to the explicit way errors are handled. Go programmers thinks about the failure case first. We solve the “what if…​” case first. This leads to programs where failures are handled at the point of writing, rather than the point they occur in production. + +The verbosity of + +``` +if err != nil { + return err +} +``` + +is outweighed by the value of deliberately handling each failure condition at the point at which they occur. Key to this is the cultural value of handling each and every error explicitly. + +### Return early rather than nesting deeply + +> “Flat is better than nested.” + +The Zen of Python, Item 5 + +This is sage advice coming from a language where indentation is the primary form of control flow. How can we interpret this advice in terms of Go? `gofmt` controls the overall whitespace of a Go program so there’s not thing doing there. + +I wrote earlier about package names, and there is probably some advice here about avoiding a complicated package hierarchy. In my experience the more a programmer tries to subdivide and taxonimise their Go codebase the more they risk hitting the dead end that is package import loops. + +I think the best application of item 5’s advice is the control flow _within_ a function. Simply put, avoid control flow that requires deep indentation. + +> “Line of sight is a straight line along which an observer has unobstructed vision.” + +May Ryer, [Code: Align the happy path to the left edge][14] + +Mat Ryer describes this idea as line of sight coding. Light of sight coding means things like: + + * Using guard clauses to return early if a precondition is not met. + * Placing the successful return statement at the end of the function rather than inside a conditional block. + * Reducing the overall indentation level of the function by extracting functions and methods. + + + +Key to this advice is the thing that you care about, the thing that the function does, is never in danger of sliding out of sight to the right of your screen. This style has a bonus side effect that you’ll avoid pointless arguments about line lengths on your team. + +Every time you indent you add another precondition to the programmers stack, consuming one of their 7 ±2 short term memory slots. Rather than nesting deeply, keep the successful path of the function close to the left hand side of your screen. + +### If you think it’s slow, prove it with a benchmark + +> “In the face of ambiguity, refuse the temptation to guess.” + +The Zen of Python, Item 12 + +Programming is based on mathematics and logic, two concepts which rarely involve the element of chance. But there are many things we, as programmers, guess about every day. What does this variable do? What does this parameter do? What happens if I pass `nil` here? What happens if I call `Register` twice? There’s actually a lot of guesswork in modern programming, especially when it comes to using libraries you didn’t write. + +> “APIs should be easy to use and hard to misuse.” + +Josh Bloch + +One of the best ways I know to help a programmer avoid having to guess is to, when building an API, [focus on the default use case][15]. Make it as easy as you can for the caller to do the most common thing. However, I’ve written and talked a lot about API design in the past, so instead my interpretation of item 12 is; _don’t guess about performance_. + +Despite how you may feel about Knuth’s advice, one of the drivers of Go’s success is its efficient execution. You can write efficient programs in Go and thus people _will_ choose Go because of this. There are a lot of misconceptions about performance, so my request is, when you’re looking to performance tune your code or you’re facing some dogmatic advice like defer is slow, CGO is expensive, or always use atomics not mutexes, don’t guess. + +Don’t complicate your code because of outdated dogma, and, if you think something is slow, first prove it with a benchmark. Go has excellent benchmarking and profiling tools that come in the distribution for free. Use them to find your bottlenecks. + +### Before you launch a goroutine, know when it will stop + +At this point I think I think I’ve mined the valuable points from PEP-20 and possibly stretched its reinterpretation beyond the point of good taste. I think that’s fine, because although this was a useful rhetorical device, ultimately we are talking about two different languages. + +> “You type g o, a space, and then a function call. Three keystrokes, you can’t make it much shorter than that. Three keystrokes and you’ve just started a sub process.” + +Rob Pike, [Simplicity is Complicated][16], dotGo 2015 + +The next two suggestions I’ll dedicate to goroutines. Goroutines are the signature feature of the language, our answer for first class concurrency. They are so easy to use, just put the word `go` in front of the statement and you’ve launched that function asynchronously. It’s so simple, no threads, no stack sizes, no thread pool executors, no ID’s, no tracking completion status. + +Goroutines are cheap. Because of the runtime’s ability to multiplex goroutines onto a small pool of threads (which you don’t have to manage), hundreds of thousands, millions of goroutines are easily accommodated. This opens up designs that would be not be practical under competing concurrency models like threads or evented callbacks. + +But as cheap as goroutines are, they’re not free. At a minimum there’s a few kilobytes for their stack, which, when you’re getting up into the 10^6 goroutines, does start to add up. This is not to say you shouldn’t use millions of goroutines if that is what the design calls for, but when you do, it’s critical that you keep track of them because 10^6 of anything can consume a non trivial amount of resources in aggregate. + +Goroutines are the key to resource ownership in Go. To be useful a goroutine has to do something, and that means it almost always holds reference to, or ownership of, a resource; a lock, a network connection, a buffer with data, the sending end of a channel. While that goroutine is alive, the lock is held, the network connection remains open, the buffer retained and the receivers of the channel will continue to wait for more data. + +The simplest way to free those resources is to tie them to the lifetime of the goroutine–when the goroutine exits, the resource has been freed. So while it’s near trivial to start a goroutine, before you write those three letters, g o and a space, make sure you have an answer to these questions: + + * **Under what condition will a goroutine stop?** Go doesn’t have a way to tell a goroutine to exit. There is no stop or kill function, for good reason. If we cannot command a goroutine to stop, we must instead ask it, politely. Almost always this comes down to a channel operation. Range loops over a channel exit when the channel is closed. A channel will become selectable if it is closed. The signal from one goroutine to another is best expressed as a closed channel. + * **What is required for that condition to arise?** If channels are both the vehicle to communicate between goroutines and the mechanism for them to signal completion, the next question to the programmer becomes, who will close the channel, when will that happen? + * **What signal will you use to know the goroutine has stopped?** When you signal a goroutine to stop, that stopping will happen at some time in the future relative to the goroutine’s frame of reference. It might happen quickly in terms of human perception, but computers execute billions of instructions every second, and from the point of view of each goroutine, their execution of instructions is unsynchronised. The solution is often to use a channel to signal back or a waitgroup where a fan in approach is needed. + + + +### Leave concurrency to the caller + +It is likely that in any serious Go program you write there will be concurrency involved. This raises the problem, many of the libraries and code that we write fall into this a one goroutine per connection, or worker pattern. How will you manage the lifetime of those goroutines? + +`net/http` is a prime example. Shutting down the server owning the listening socket is relatively straight forward, but what about a goroutines spawned from that accepting socket? `net/http` does provide a context object inside the request object which can be used to signal–to code that is listening–that the request should be canceled, thereby terminating the goroutine, however it is less clear how to know when all of these things have been done. It’s one thing to call `context.Cancel`, its another to know that the cancellation has completed.[2][17] + +The point I want to make about `net/http` is that its a counter example to good practice. Because each connection is handled by a goroutine spawned inside the `net/http.Server` type, the program, living outside the `net/http` package, does not have an ability to control the goroutines spawned for the accepting socket. + +This is an area of design that is still evolving, with efforts like go-kit’s `run.Group` and the Go team’s [`ErrGroup`][18] which provide a framework to execute, cancel and wait on functions run asynchronously. + +The bigger design maxim here is for library writers, or anyone writing code that could be run asynchronously, leave the responsibility of starting to goroutine to your caller. Let the caller choose how they want to start, track, and wait on your functions execution. + +### Write tests to lock in the behaviour of your package’s API + +Perhaps you were hoping to read an article from me where I didn’t rant about testing. Sadly, today is not that day. + +Your tests are the contract about what your software does and does not do. Unit tests at the package level should lock in the behaviour of the package’s API. They describe, in code, what the package promises to do. If there is a unit test for each input permutation, you have defined the contract for what the code will do _in code_, not documentation. + +This is a contract you can assert as simply as typing `go test`. At any stage, you can _know_ with a high degree of confidence, that the behaviour people relied on before your change continues to function after your change. + +Tests lock in api behaviour. Any change that adds, modifies or removes a public api must include changes to its tests. + +### Moderation is a virtue + +Go is a simple language, only 25 keywords. In some ways this makes the features that are built into the language stand out. Equally these are the features that the language sells itself on, lightweight concurrency, structural typing. + +I think all of us have experienced the confusion that comes from trying to use all of Go’s features at once. Who was so excited to use channels that they used them as much as they could, as often as they could? Personally for me I found the result was hard to test, fragile, and ultimately overcomplicated. Am I alone? + +I had the same experience with goroutines, attempting to break the work into tiny units I created a hard to manage hurd of Goroutines and ultimately missed the observation that most of my goroutines were always blocked waiting for their predecessor– the code was ultimately sequential and I had added a lot of complexity for little real world benefit. Who has experienced something like this? + +I had the same experience with embedding. Initially I mistook it for inheritance. Then later I recreated the fragile base class problem by composing complicated types, which already had several responsibilities, into more complicated mega types. + +This is potentially the least actionable piece of advice, but one I think is important enough to mention. The advice is always the same, all things in moderation, and Go’s features are no exception. If you can, don’t reach for a goroutine, or a channel, or embed a struct, anonymous functions, going overboard with packages, interfaces for everything, instead prefer simpler approach rather than the clever approach. + +### Maintainability counts + +I want to close with one final item from PEP-20, + +> “Readability Counts.” + +The Zen of Python, Item 7 + +So much has been said, about the importance of readability, not just in Go, but all programming languages. People like me who stand on stages advocating for Go use words like simplicity, readability, clarity, productivity, but ultimately they are all synonyms for one word–_maintainability_. + +The real goal is to write maintainable code. Code that can live on after the original author. Code that can exist not just as a point in time investment, but as a foundation for future value. It’s not that readability doesn’t matter, maintainability matters _more_. + +Go is not a language that optimises for clever one liners. Go is not a language which optimises for the least number of lines in a program. We’re not optimising for the size of the source code on disk, nor how long it takes to type the program into an editor. Rather, we want to optimise our code to be clear to the reader. Because its the reader who’s going to have to maintain this code. + +If you’re writing a program for yourself, maybe it only has to run once, or you’re the only person who’ll ever see it, then do what ever works for you. But if this is a piece of software that more than one person will contribute to, or that will be used by people over a long enough time that requirements, features, or the environment it runs in may change, then your goal must be for your program to be maintainable. If software cannot be maintained, then it will be rewritten; and that could be the last time your company will invest in Go. + +Can the thing you worked hard to build be maintained after you’re gone? What can you do today to make it easier for someone to maintain your code tomorrow? + +##### [the-zen-of-go.netlify.com][2] + + 1. This part of the talk had several screenshots of the landing pages for the websites for [Ruby][19], [Swift][20], [Elm][21], [Go][22], [NodeJS][23], [Python][24], [Rust][25], highlighting how the language described itself.[][26] + 2. I tend to pick on `net/http` a lot, and this is not because it is bad, in fact it is the opposite, it is the most successful, oldest, most used API in the Go codebase. And because of that its design, evolution, and shortcoming have been thoroughly picked over. Think of this as flattery, not criticism.[][27] + + + +#### Related posts: + + 1. [Never start a goroutine without knowing how it will stop][28] + 2. [Simplicity Debt][29] + 3. [Curious Channels][30] + 4. [Let’s talk about logging][31] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/02/23/the-zen-of-go + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://www.gophercon.org.il +[2]: https://the-zen-of-go.netlify.com +[3]: https://www.youtube.com/watch?v=yd_rtwYaXps +[4]: https://dave.cheney.net/wp-content/uploads/2020/02/1011226.jpg +[5]: https://dave.cheney.net/wp-content/uploads/2020/02/mean-girls-you-cant-sit-with-us-main.jpg +[6]: http://go-proverbs.github.io +[7]: https://danluu.com/microsoft-culture/ +[8]: https://dave.cheney.net/wp-content/uploads/2020/02/Lucovsky.001.jpeg +[9]: https://www.python.org/dev/peps/pep-0020/ +[10]: https://dave.cheney.net/2019/01/08/avoid-package-names-like-base-util-or-common +[11]: https://twitter.com/davecheney/status/539576755254611968?ref_src=twsrc%5Etfw +[12]: tmp.iUoDiQyXMU#easy-footnote-bottom-1-3936 (This part of the talk had several screenshots of the landing pages for the websites for Ruby, Swift, Elm, Go, NodeJS, Python, Rust, highlighting how the language described itself.) +[13]: https://changelog.com/gotime/91 +[14]: https://medium.com/@matryer/line-of-sight-in-code-186dd7cdea88 +[15]: http://sweng.the-davies.net/Home/rustys-api-design-manifesto +[16]: https://www.youtube.com/watch?v=rFejpH_tAHM +[17]: tmp.iUoDiQyXMU#easy-footnote-bottom-2-3936 (I tend to pick on net/http a lot, and this is not because it is bad, in fact it is the opposite, it is the most successful, oldest, most used API in the Go codebase. And because of that its design, evolution, and shortcoming have been thoroughly picked over. Think of this as flattery, not criticism.) +[18]: https://godoc.org/golang.org/x/sync/errgroup +[19]: https://www.ruby-lang.org/en/ +[20]: https://swift.org +[21]: https://elm-lang.org +[22]: https://golang.org +[23]: https://nodejs.org/en/ +[24]: https://www.python.org +[25]: https://www.rust-lang.org +[26]: tmp.iUoDiQyXMU#easy-footnote-1-3936 +[27]: tmp.iUoDiQyXMU#easy-footnote-2-3936 +[28]: https://dave.cheney.net/2016/12/22/never-start-a-goroutine-without-knowing-how-it-will-stop (Never start a goroutine without knowing how it will stop) +[29]: https://dave.cheney.net/2017/06/15/simplicity-debt (Simplicity Debt) +[30]: https://dave.cheney.net/2013/04/30/curious-channels (Curious Channels) +[31]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging (Let’s talk about logging) From a82f1747f4854b20a2eafb9462cbfade8d976f8e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:36:07 +0800 Subject: [PATCH 2179/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200525=20How?= =?UTF-8?q?=20Cloud-init=20can=20be=20used=20for=20your=20Raspberry=20Pi?= =?UTF-8?q?=20homelab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md --- ...n be used for your Raspberry Pi homelab.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/tech/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md diff --git a/sources/tech/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md b/sources/tech/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md new file mode 100644 index 0000000000..32d5026812 --- /dev/null +++ b/sources/tech/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Cloud-init can be used for your Raspberry Pi homelab) +[#]: via: (https://opensource.com/article/20/5/cloud-init-raspberry-pi-homelab) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +How Cloud-init can be used for your Raspberry Pi homelab +====== +Automate adding new devices and users to your homelab while getting to +know a cloud-industry standard. +![gears and lightbulb to represent innovation][1] + +[Cloud-init][2] is a standard—it would not be a stretch to say it is _the_ standard—that cloud providers use to provide initialization and configuration data to cloud instances. It is used most often on the first boot of a new instance to automate network setup, account creation, and SSH (secure shell) key installation—anything required to bring a new system online so that it is accessible by the user. + +In a previous article, [_Modify a disk image to create a Raspberry Pi-based homelab_][3], I showed how to customize the operating system image for single-board computers like the Raspberry Pi to accomplish a similar goal. With Cloud-init, there is no need to add custom data to the image. Once it is enabled in your images, your virtual machines, physical servers, even tiny Raspberry Pis can behave like cloud instances in your own "private cloud at home." New machines can just be plugged in, turned on, and automatically become part of your [homelab][4]. + +To be honest, Cloud-init is not designed with homelabs in mind. As I mentioned, you can easily modify the disk image for a given set of systems to enable SSH access and configure them after the first boot. Cloud-init is designed for large-scale cloud providers that need to accommodate many customers, maintain a small set of images, and provide a mechanism for those customers to access instances without customizing an image for each of them. A homelab with a single administrator does not face the same challenges. + +Cloud-init is not without merit in the homelab, though. Education is one of my goals for the private cloud at home project, and setting up Cloud-init for your homelab is a great way to gain experience with a technology used heavily by cloud providers, large and small. Cloud-init is also an alternative to other initial-configuration options. Rather than customizing each image, ISO, etc. for every device in your homelab and face tedious updates when you want to make changes, you can just enable Cloud-init. This reduces technical debt—and is there anything worse than _personal_ technical debt? Finally, using Cloud-init in your homelab allows your private cloud instances to behave the same as any public cloud instances you have or may have in the future—a true [hybrid cloud][5]. + +### About Cloud-init + +When an instance configured for Cloud-init boots up and the service (actually, four services in systemd implementations to handle dependencies during the boot process) starts, it checks its configuration for a [datasource][6] to determine what type of cloud it is running in. Each major cloud provider has a datasource configuration that tells the instance where and how to retrieve configuration information. The instance then uses the datasource information to retrieve configuration information provided by the cloud provider, such as networking information and instance-identification information, and configuration data provided by the customer, such as authorized keys to be copied, user accounts to be created, and many other possible tasks. + +After retrieving the data, Cloud-init then configures the instance: setting up networking, copying the authorized keys, etc., and finally completing the boot process. Then it is accessible to the remote user, ready for further configuration with tools like [Ansible][7] or [Puppet][8] or prepared to receive a workload and begin its assigned tasks. + +### Configuration data + +As mentioned above, the configuration data used by Cloud-init comes from two potential sources: the cloud provider and the instance user. In a homelab, you fill both roles: providing networking and instance information as the cloud provider and providing configuration information as the user. + +#### The cloud provider metadata file + +In your cloud provider role, your homelab datasource will offer your private cloud instances a metadata file. The [metadata][9] file contains information such as the instance ID, cloud type, Python version (Cloud-init is written in and uses Python), or a public SSH key to be assigned to the host. The metadata file may also contain networking information if you're not using DHCP (or the other mechanisms Cloud-init supports, such as a config file in the image or kernel parameters). + +#### The user-provided user-data file + +The real meat of Cloud-init's value is in the user-data file. Provided by the user to the cloud provider and included in the datasource, the [user-data][10] file is what turns an instance from a generic machine into a member of the user's fleet. The user-data file can come in the form of an executable script, working the same as the script would in normal circumstances, or as a cloud-config YAML file, which makes use of [Cloud-init's modules][11] to perform configuration tasks. + +### Datasource + +The datasource is a service provided by the cloud provider that offers the metadata and user-data files to the instances. Instance images or ISOs are configured to tell the instance what datasource is being used. + +For example, Amazon AWS provides a [link-local][12] file that will respond to HTTP requests from an instance with the instance's custom data. Other cloud providers have their own mechanisms, as well. Luckily for the private cloud at home project, there are also NoCloud data sources. + +[NoCloud][13] datasources allow configuration information to be provided via the kernel command as key-value pairs or as user-data and metadata files provided as mounted ISO filesystems. These are useful for virtual machines, especially paired with automation to create the virtual machines. + +There is also a NoCloudNet datasource that behaves similarly to the AWS EC2 datasource, providing an IP address or DNS name from which to retrieve user data and metadata via HTTP. This is most helpful for the physical machines in your homelab, such as Raspberry Pis, [NUCs][14], or surplus server equipment. While NoCloud could work, it requires more manual attention—an anti-pattern for cloud instances. + +### Cloud-init for the homelab + +I hope this gives you an idea of what Cloud-init is and how it may be helpful in your homelab. It is an incredible tool that is embraced by major cloud providers, and using it at home can be educational and fun and help you automate adding new physical or virtual servers to your lab. Future articles will detail how to create both simple static and more complex dynamic Cloud-init services and guide you in incorporating them into your private cloud at home. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/cloud-init-raspberry-pi-homelab + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M (gears and lightbulb to represent innovation) +[2]: https://cloudinit.readthedocs.io/ +[3]: https://opensource.com/article/20/5/disk-image-raspberry-pi +[4]: https://opensource.com/article/19/3/home-lab +[5]: https://www.redhat.com/en/topics/cloud-computing/what-is-hybrid-cloud +[6]: https://cloudinit.readthedocs.io/en/latest/topics/datasources.html +[7]: https://www.ansible.com/ +[8]: https://puppet.com/ +[9]: https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html# +[10]: https://cloudinit.readthedocs.io/en/latest/topics/format.html +[11]: https://cloudinit.readthedocs.io/en/latest/topics/modules.html +[12]: https://en.wikipedia.org/wiki/Link-local_address +[13]: https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html +[14]: https://en.wikipedia.org/wiki/Next_Unit_of_Computing From 98102bb5eb81c9f644b86f244656f4216853fe6c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:39:14 +0800 Subject: [PATCH 2180/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170112=20Writ?= =?UTF-8?q?ing=20Advanced=20Web=20Applications=20with=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20170112 Writing Advanced Web Applications with Go.md --- ...iting Advanced Web Applications with Go.md | 658 ++++++++++++++++++ 1 file changed, 658 insertions(+) create mode 100644 sources/tech/20170112 Writing Advanced Web Applications with Go.md diff --git a/sources/tech/20170112 Writing Advanced Web Applications with Go.md b/sources/tech/20170112 Writing Advanced Web Applications with Go.md new file mode 100644 index 0000000000..f46521e8a7 --- /dev/null +++ b/sources/tech/20170112 Writing Advanced Web Applications with Go.md @@ -0,0 +1,658 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Writing Advanced Web Applications with Go) +[#]: via: (https://www.jtolio.com/2017/01/writing-advanced-web-applications-with-go) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Writing Advanced Web Applications with Go +====== + +Web development in many programming environments often requires subscribing to some full framework ethos. With [Ruby][1], it’s usually [Rails][2] but could be [Sinatra][3] or something else. With [Python][4], it’s often [Django][5] or [Flask][6]. With [Go][7], it’s… + +If you spend some time in Go communities like the [Go mailing list][8] or the [Go subreddit][9], you’ll find Go newcomers frequently wondering what web framework is best to use. [There][10] [are][11] [quite][12] [a][13] [few][14] [Go][15] [frameworks][16] ([and][17] [then][18] [some][19]), so which one is best seems like a reasonable question. Without fail, though, the strong recommendation of the Go community is to [avoid web frameworks entirely][20] and just stick with the standard library as long as possible. Here’s [an example from the Go mailing list][21] and here’s [one from the subreddit][22]. + +It’s not bad advice! The Go standard library is very rich and flexible, much more so than many other languages, and designing a web application in Go with just the standard library is definitely a good choice. + +Even when these Go frameworks call themselves minimalistic, they can’t seem to help themselves avoid using a different request handler interface than the default standard library [http.Handler][23], and I think this is the biggest source of angst about why frameworks should be avoided. If everyone standardizes on [http.Handler][23], then dang, all sorts of things would be interoperable! + +Before Go 1.7, it made some sense to give in and use a different interface for handling HTTP requests. But now that [http.Request][24] has the [Context][25] and [WithContext][26] methods, there truly isn’t a good reason any longer. + +I’ve done a fair share of web development in Go and I’m here to share with you both some standard library development patterns I’ve learned and some code I’ve found myself frequently needing. The code I’m sharing is not for use instead of the standard library, but to augment it. + +Overall, if this blog post feels like it’s predominantly plugging various little standalone libraries from my [Webhelp non-framework][27], that’s because it is. It’s okay, they’re little standalone libraries. Only use the ones you want! + +If you’re new to Go web development, I suggest reading the Go documentation’s [Writing Web Applications][28] article first. + +### Middleware + +A frequent design pattern for server-side web development is the concept of _middleware_, where some portion of the request handler wraps some other portion of the request handler and does some preprocessing or routing or something. This is a big component of how [Express][29] is organized on [Node][30], and how Express middleware and [Negroni][17] middleware works is almost line-for-line identical in design. + +Good use cases for middleware are things such as: + + * making sure a user is logged in, redirecting if not, + * making sure the request came over HTTPS, + * making sure a session is set up and loaded from a session database, + * making sure we logged information before and after the request was handled, + * making sure the request was routed to the right handler, + * and so on. + + + +Composing your web app as essentially a chain of middleware handlers is a very powerful and flexible approach. It allows you to avoid a lot of [cross-cutting concerns][31] and have your code factored in very elegant and easy-to-maintain ways. By wrapping a set of handlers with middleware that ensures a user is logged in prior to actually attempting to handle the request, the individual handlers no longer need mistake-prone copy-and-pasted code to ensure the same thing. + +So, middleware is good. However, if Negroni or other frameworks are any indication, you’d think the standard library’s `http.Handler` isn’t up to the challenge. Negroni adds its own `negroni.Handler` just for the sake of making middleware easier. There’s no reason for this. + +Here is a full middleware implementation for ensuring a user is logged in, assuming a `GetUser(*http.Request)` function but otherwise just using the standard library: + +``` +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if user == nil { + http.Error(w, "unauthorized", http.StatusUnauthorized) + return + } + h.ServeHTTP(w, req) + }) +} +``` + +Here’s how it’s used (just wrap another handler!): + +``` +func main() { + http.ListenAndServe(":8080", RequireUser(http.HandlerFunc(myHandler))) +} +``` + +Express, Negroni, and other frameworks expect this kind of signature for a middleware-supporting handler: + +``` +type Handler interface { + // don't do this! + ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc) +} +``` + +There’s really no reason for adding the `next` argument - it reduces cross-library compatibility. So I say, don’t use `negroni.Handler` (or similar). Just use `http.Handler`! + +### Composability + +Hopefully I’ve sold you on middleware as a good design philosophy. + +Probably the most commonly-used type of middleware is request routing, or muxing (seems like we should call this demuxing but what do I know). Some frameworks are almost solely focused on request routing. [gorilla/mux][32] seems more popular than any other part of the [Gorilla][33] library. I think the reason for this is that even though the Go standard library is completely full featured and has a good [ServeMux][34] implementation, it doesn’t make the right thing the default. + +So! Let’s talk about request routing and consider the following problem. You, web developer extraordinaire, want to serve some HTML from your web server at `/hello/` but also want to serve some static assets from `/static/`. Let’s take a quick stab. + +``` +package main + +import ( + "net/http" +) + +func hello(w http.ResponseWriter, req *http.Request) { + w.Write([]byte("hello, world!")) +} + +func main() { + mux := http.NewServeMux() + mux.Handle("/hello/", http.HandlerFunc(hello)) + mux.Handle("/static/", http.FileServer(http.Dir("./static-assets"))) + http.ListenAndServe(":8080", mux) +} +``` + +If you visit `http://localhost:8080/hello/`, you’ll be rewarded with a friendly “hello, world!” message. + +If you visit `http://localhost:8080/static/` on the other hand (assuming you have a folder of static assets in `./static-assets`), you’ll be surprised and frustrated. This code tries to find the source content for the request `/static/my-file` at `./static-assets/static/my-file`! There’s an extra `/static` in there! + +Okay, so this is why `http.StripPrefix` exists. Let’s fix it. + +``` +mux.Handle("/static/", http.StripPrefix("/static", + http.FileServer(http.Dir("./static-assets")))) +``` + +`mux.Handle` combined with `http.StripPrefix` is such a common pattern that I think it should be the default. Whenever a request router processes a certain amount of URL elements, it should strip them off the request so the wrapped `http.Handler` doesn’t need to know its absolute URL and only needs to be concerned with its relative one. + +In [Russ Cox][35]’s recent [TiddlyWeb backend][36], I would argue that every time `strings.TrimPrefix` is needed to remove the full URL from the handler’s incoming path arguments, it is an unnecessary cross-cutting concern, unfortunately imposed by `http.ServeMux`. (An example is [line 201 in tiddly.go][37].) + +I’d much rather have the default `mux` behavior work more like a directory of registered elements that by default strips off the ancestor directory before handing the request to the next middleware handler. It’s much more composable. To this end, I’ve written a simple muxer that works in this fashion called [whmux.Dir][38]. It is essentially `http.ServeMux` and `http.StripPrefix` combined. Here’s the previous example reworked to use it: + +``` +package main + +import ( + "net/http" + + "gopkg.in/webhelp.v1/whmux" +) + +func hello(w http.ResponseWriter, req *http.Request) { + w.Write([]byte("hello, world!")) +} + +func main() { + mux := whmux.Dir{ + "hello": http.HandlerFunc(hello), + "static": http.FileServer(http.Dir("./static-assets")), + } + http.ListenAndServe(":8080", mux) +} +``` + +There are other useful mux implementations inside the [whmux][39] package that demultiplex on various aspects of the request path, request method, request host, or pull arguments out of the request and place them into the context, such as a [whmux.IntArg][40] or [whmux.StringArg][41]. This brings us to [contexts][42]. + +### Contexts + +Request contexts are a recent addition to the Go 1.7 standard library, but the idea of [contexts has been around since mid-2014][43]. As of Go 1.7, they were added to the standard library ([“context”][42]), but are available for older Go releases in the original location ([“golang.org/x/net/context”][44]). + +First, here’s the definition of the `context.Context` type that `(*http.Request).Context()` returns: + +``` +type Context interface { + Done() <-chan struct{} + Err() error + Deadline() (deadline time.Time, ok bool) + + Value(key interface{}) interface{} +} +``` + +Talking about `Done()`, `Err()`, and `Deadline()` are enough for an entirely different blog post, so I’m going to ignore them at least for now and focus on `Value(interface{})`. + +As a motivating problem, let’s say that the `GetUser(*http.Request)` method we assumed earlier is expensive, and we only want to call it once per request. We certainly don’t want to call it once to check that a user is logged in, and then again when we actually need the `*User` value. With `(*http.Request).WithContext` and `context.WithValue`, we can pass the `*User` down to the next middleware precomputed! + +Here’s the new middleware: + +``` +type userKey int + +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if user == nil { + http.Error(w, "unauthorized", http.StatusUnauthorized) + return + } + ctx := r.Context() + ctx = context.WithValue(ctx, userKey(0), user) + h.ServeHTTP(w, req.WithContext(ctx)) + }) +} +``` + +Now, handlers that are protected by this `RequireUser` handler can load the previously computed `*User` value like this: + +``` +if user, ok := req.Context().Value(userKey(0)).(*User); ok { + // there's a valid user! +} +``` + +Contexts allow us to pass optional values to handlers down the chain in a way that is relatively type-safe and flexible. None of the above context logic requires anything outside of the standard library. + +#### Aside about context keys + +There was a curious piece of code in the above example. At the top, we defined a `type userKey int`, and then always used it as `userKey(0)`. + +One of the possible problems with contexts is the `Value()` interface lends itself to a global namespace where you can stomp on other context users and use conflicting key names. Above, we used `type userKey` because it’s an unexported type in your package. It will never compare equal (without a cast) to any other type, including `int`, in Go. This gives us a way to namespace keys to your package, even though the `Value()` method is still a sort of global namespace. + +Because the need for this is so common, the `webhelp` package defines a [GenSym()][45] helper that will create a brand new, never-before-seen, unique value for use as a context key. + +If we used [GenSym()][45], then `type userKey int` would become `var userKey = webhelp.GenSym()` and `userKey(0)` would simply become `userKey`. + +#### Back to whmux.StringArg + +Armed with this new context behavior, we can now present a `whmux.StringArg` example: + +``` +package main + +import ( + "fmt" + "net/http" + + "gopkg.in/webhelp.v1/whmux" +) + +var ( + pageName = whmux.NewStringArg() +) + +func page(w http.ResponseWriter, req *http.Request) { + name := pageName.Get(req.Context()) + + fmt.Fprintf(w, "Welcome to %s", name) +} + +func main() { + // pageName.Shift pulls the next /-delimited string out of the request's + // URL.Path and puts it into the context instead. + pageHandler := pageName.Shift(http.HandlerFunc(page)) + + http.ListenAndServe(":8080", whmux.Dir{ + "wiki": pageHandler, + }) +} +``` + +### Pre-Go-1.7 support + +Contexts let you do some pretty cool things. But let’s say you’re stuck with something before Go 1.7 (for instance, App Engine is currently Go 1.6). + +That’s okay! I’ve backported all of the neat new context features to Go 1.6 and earlier in a forwards compatible way! + +With the [whcompat][46] package, `req.Context()` becomes `whcompat.Context(req)`, and `req.WithContext(ctx)` becomes `whcompat.WithContext(req, ctx)`. The `whcompat` versions work with all releases of Go. Yay! + +There’s a bit of unpleasantness behind the scenes to make this happen. Specifically, for pre-1.7 builds, a global map indexed by `req.URL` is kept, and a finalizer is installed on `req` to clean up. So don’t change what `req.URL` points to and this will work fine. In practice it’s not a problem. + +`whcompat` adds additional backwards-compatibility helpers. In Go 1.7 and on, the context’s `Done()` channel is closed (and `Err()` is set), whenever the request is done processing. If you want this behavior in Go 1.6 and earlier, just use the [whcompat.DoneNotify][47] middleware. + +In Go 1.8 and on, the context’s `Done()` channel is closed when the client goes away, even if the request hasn’t completed. If you want this behavior in Go 1.7 and earlier, just use the [whcompat.CloseNotify][48] middleware, though beware that it costs an extra goroutine. + +### Error handling + +How you handle errors can be another cross-cutting concern, but with good application of context and middleware, it too can be beautifully cleaned up so that the responsibilities lie in the correct place. + +Problem statement: your `RequireUser` middleware needs to handle an authentication error differently between your HTML endpoints and your JSON API endpoints. You want to use `RequireUser` for both types of endpoints, but with your HTML endpoints you want to return a user-friendly error page, and with your JSON API endpoints you want to return an appropriate JSON error state. + +In my opinion, the right thing to do is to have contextual error handlers, and luckily, we have a context for contextual information! + +First, we need an error handler interface. + +``` +type ErrHandler interface { + HandleError(w http.ResponseWriter, req *http.Request, err error) +} +``` + +Next, let’s make a middleware that registers the error handler in the context: + +``` +var errHandler = webhelp.GenSym() // see the aside about context keys + +func HandleErrWith(eh ErrHandler, h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + ctx := context.WithValue(whcompat.Context(req), errHandler, eh) + h.ServeHTTP(w, whcompat.WithContext(req, ctx)) + }) +} +``` + +Last, let’s make a function that will use the registered error handler for errors: + +``` +func HandleErr(w http.ResponseWriter, req *http.Request, err error) { + if handler, ok := whcompat.Context(req).Value(errHandler).(ErrHandler); ok { + handler.HandleError(w, req, err) + return + } + log.Printf("error: %v", err) + http.Error(w, "internal server error", http.StatusInternalServerError) +} +``` + +Now, as long as everything uses `HandleErr` to handle errors, our JSON API can handle errors with JSON responses, and our HTML endpoints can handle errors with HTML responses. + +Of course, the [wherr][49] package implements this all for you, and the [whjson][49] package even implements a friendly JSON API error handler. + +Here’s how you might use it: + +``` +var userKey = webhelp.GenSym() + +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + wherr.Handle(w, req, wherr.InternalServerError.New("failed to get user")) + return + } + if user == nil { + wherr.Handle(w, req, wherr.Unauthorized.New("no user found")) + return + } + ctx := r.Context() + ctx = context.WithValue(ctx, userKey, user) + h.ServeHTTP(w, req.WithContext(ctx)) + }) +} + +func userpage(w http.ResponseWriter, req *http.Request) { + user := req.Context().Value(userKey).(*User) + w.Header().Set("Content-Type", "text/html") + userpageTmpl.Execute(w, user) +} + +func username(w http.ResponseWriter, req *http.Request) { + user := req.Context().Value(userKey).(*User) + w.Header().Set("Content-Type", "application/json") + json.NewEncoder(w).Encode(map[string]interface{}{"user": user}) +} + +func main() { + http.ListenAndServe(":8080", whmux.Dir{ + "api": wherr.HandleWith(whjson.ErrHandler, + RequireUser(whmux.Dir{ + "username": http.HandlerFunc(username), + })), + "user": RequireUser(http.HandlerFunc(userpage)), + }) +} +``` + +#### Aside about the spacemonkeygo/errors package + +The default [wherr.Handle][50] implementation understands all of the [error classes defined in the wherr top level package][51]. + +These error classes are implemented using the [spacemonkeygo/errors][52] library and the [spacemonkeygo/errors/errhttp][53] extensions. You don’t have to use this library or these errors, but the benefit is that your error instances can be extended to include HTTP status code messages and information, which once again, provides for a nice elimination of cross-cutting concerns in your error handling logic. + +See the [spacemonkeygo/errors][52] package for more details. + +_**Update 2018-04-19:** After a few years of use, my friend condensed some lessons we learned and the best parts of `spacemonkeygo/errors` into a new, more concise, better library, over at [github.com/zeebo/errs][54]. Consider using that instead!_ + +### Sessions + +Go’s standard library has great support for cookies, but cookies by themselves aren’t usually what a developer thinks of when she thinks about sessions. Cookies are unencrypted, unauthenticated, and readable by the user, and perhaps you don’t want that with your session data. + +Further, sessions can be stored in cookies, but could also be stored in a database to provide features like session revocation and querying. There’s lots of potential details about the implementation of sessions. + +Request handlers, however, probably don’t care too much about the implementation details of the session. Request handlers usually just want a bucket of keys and values they can store safely and securely. + +The [whsess][55] package implements middleware for registering an arbitrary session store (a default cookie-based session store is provided), and implements helpers for retrieving and saving new values into the session. + +The default cookie-based session store implements encryption and authentication via the excellent [nacl/secretbox][56] package. + +Usage is like this: + +``` +func handler(w http.ResponseWriter, req *http.Request) { + ctx := whcompat.Context(req) + sess, err := whsess.Load(ctx, "namespace") + if err != nil { + wherr.Handle(w, req, err) + return + } + if loggedIn, _ := sess.Values["logged_in"].(bool); loggedIn { + views, _ := sess.Values["views"].(int64) + sess.Values["views"] = views + 1 + sess.Save(w) + } +} + +func main() { + http.ListenAndServe(":8080", whsess.HandlerWithStore( + whsess.NewCookieStore(secret), http.HandlerFunc(handler))) +} +``` + +### Logging + +The Go standard library by default doesn’t log incoming requests, outgoing responses, or even just what port the HTTP server is listening on. + +The [whlog][57] package implements all three. The [whlog.LogRequests][58] middleware will log requests as they start. The [whlog.LogResponses][59] middleware will log requests as they end, along with status code and timing information. [whlog.ListenAndServe][60] will log the address the server ultimately listens on (if you specify “:0” as your address, a port will be randomly chosen, and [whlog.ListenAndServe][60] will log it). + +[whlog.LogResponses][59] deserves special mention for how it does what it does. It uses the [whmon][61] package to instrument the outgoing `http.ResponseWriter` to keep track of response information. + +Usage is like this: + +``` +func main() { + whlog.ListenAndServe(":8080", whlog.LogResponses(whlog.Default, handler)) +} +``` + +#### App engine logging + +App engine logging is unconventional crazytown. The standard library logger doesn’t work by default on App Engine, because App Engine logs _require_ the request context. This is unfortunate for libraries that don’t necessarily run on App Engine all the time, as their logging information doesn’t make it to the App Engine request-specific logger. + +Unbelievably, this is fixable with [whgls][62], which uses my terrible, terrible (but recently improved) [Goroutine-local storage library][63] to store the request context on the current stack, register a new log output, and fix logging so standard library logging works with App Engine again. + +### Template handling + +Go’s standard library [html/template][64] package is excellent, but you’ll be unsurprised to find there’s a few tasks I do with it so commonly that I’ve written additional support code. + +The [whtmpl][65] package really does two things. First, it provides a number of useful helper methods for use within templates, and second, it takes some friction out of managing a large number of templates. + +When writing templates, one thing you can do is call out to other registered templates for small values. A good example might be some sort of list element. You can have a template that renders the list element, and then your template that renders your list can use the list element template in turn. + +Use of another template within a template might look like this: + +``` +
    + {{ range .List }} + {{ template "list_element" . }} + {{ end }} +
+``` + +You’re now rendering the `list_element` template with the list element from `.List`. But what if you want to also pass the current user `.User`? Unfortunately, you can only pass one argument from one template to another. If you have two arguments you want to pass to another template, with the standard library, you’re out of luck. + +The [whtmpl][65] package adds three helper functions to aid you here, `makepair`, `makemap`, and `makeslice` (more docs under the [whtmpl.Collection][66] type). `makepair` is the simplest. It takes two arguments and constructs a [whtmpl.Pair][67]. Fixing our example above would look like this now: + +``` +
    + {{ $user := .User }} + {{ range .List }} + {{ template "list_element" (makepair . $user) }} + {{ end }} +
+``` + +The second thing [whtmpl][65] does is make defining lots of templates easy, by optionally automatically naming templates after the name of the file the template is defined in. + +For example, say you have three files. + +Here’s `pkg.go`: + +``` +package views + +import "gopkg.in/webhelp.v1/whtmpl" + +var Templates = whtmpl.NewCollection() +``` + +Here’s `landing.go`: + +``` +package views + +var _ = Templates.MustParse(`{{ template "header" . }} + +

Landing!

`) +``` + +And here’s `header.go`: + +``` +package views + +var _ = Templates.MustParse(`My website!`) +``` + +Now, you can import your new `views` package and render the `landing` template this easily: + +``` +func handler(w http.ResponseWriter, req *http.Request) { + views.Templates.Render(w, req, "landing", map[string]interface{}{}) +} +``` + +### User authentication + +I’ve written two Webhelp-style authentication libraries that I end up using frequently. + +The first is an OAuth2 library, [whoauth2][68]. I’ve written up [an example application that authenticates with Google, Facebook, and Github][69]. + +The second, [whgoth][70], is a wrapper around [markbates/goth][71]. My portion isn’t quite complete yet (some fixes are still necessary for optional App Engine support), but will support more non-OAuth2 authentication sources (like Twitter) when it is done. + +### Route listing + +Surprise! If you’ve used [webhelp][27] based handlers and middleware for your whole app, you automatically get route listing for free, via the [whroute][72] package. + +My web serving code’s `main` method often has a form like this: + +``` +switch flag.Arg(0) { +case "serve": + panic(whlog.ListenAndServe(*listenAddr, routes)) +case "routes": + whroute.PrintRoutes(os.Stdout, routes) +default: + fmt.Printf("Usage: %s \n", os.Args[0]) +} +``` + +Here’s some example output: + +``` +GET /auth/_cb/ +GET /auth/login/ +GET /auth/logout/ +GET / +GET /account/apikeys/ +POST /account/apikeys/ +GET /project// +GET /project//control// +POST /project//control//sample/ +GET /project//control/ + Redirect: f(req) +POST /project//control/ +POST /project//control_named//sample/ +GET /project//control_named/ + Redirect: f(req) +GET /project//sample// +GET /project//sample//similar[/<*>] +GET /project//sample/ + Redirect: f(req) +POST /project//search/ +GET /project/ + Redirect: / +POST /project/ +``` + +### Other little things + +[webhelp][27] has a number of other subpackages: + + * [whparse][73] assists in parsing optional request arguments. + * [whredir][74] provides some handlers and helper methods for doing redirects in various cases. + * [whcache][75] creates request-specific mutable storage for caching various computations and database loaded data. Mutability helps helper functions that aren’t used as middleware share data. + * [whfatal][76] uses panics to simplify early request handling termination. Probably avoid this package unless you want to anger other Go developers. + + + +### Summary + +Designing your web project as a collection of composable middlewares goes quite a long way to simplify your code design, eliminate cross-cutting concerns, and create a more flexible development environment. Use my [webhelp][27] package if it helps you. + +Or don’t! Whatever! It’s still a free country last I checked. + +#### Update + +Peter Kieltyka points me to his [Chi framework][77], which actually does seem to do the right things with respect to middleware, handlers, and contexts - certainly much more so than all the other frameworks I’ve seen. So, shoutout to Peter and the team at Pressly! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2017/01/writing-advanced-web-applications-with-go + +作者:[jtolio.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.ruby-lang.org/ +[2]: http://rubyonrails.org/ +[3]: http://www.sinatrarb.com/ +[4]: https://www.python.org/ +[5]: https://www.djangoproject.com/ +[6]: http://flask.pocoo.org/ +[7]: https://golang.org/ +[8]: https://groups.google.com/d/forum/golang-nuts +[9]: https://www.reddit.com/r/golang/ +[10]: https://revel.github.io/ +[11]: https://gin-gonic.github.io/gin/ +[12]: http://iris-go.com/ +[13]: https://beego.me/ +[14]: https://go-macaron.com/ +[15]: https://github.com/go-martini/martini +[16]: https://github.com/gocraft/web +[17]: https://github.com/urfave/negroni +[18]: https://godoc.org/goji.io +[19]: https://echo.labstack.com/ +[20]: https://medium.com/code-zen/why-i-don-t-use-go-web-frameworks-1087e1facfa4 +[21]: https://groups.google.com/forum/#!topic/golang-nuts/R_lqsTTBh6I +[22]: https://www.reddit.com/r/golang/comments/1yh6gm/new_to_go_trying_to_select_web_framework/ +[23]: https://golang.org/pkg/net/http/#Handler +[24]: https://golang.org/pkg/net/http/#Request +[25]: https://golang.org/pkg/net/http/#Request.Context +[26]: https://golang.org/pkg/net/http/#Request.WithContext +[27]: https://godoc.org/gopkg.in/webhelp.v1 +[28]: https://golang.org/doc/articles/wiki/ +[29]: https://expressjs.com/ +[30]: https://nodejs.org/en/ +[31]: https://en.wikipedia.org/wiki/Cross-cutting_concern +[32]: https://github.com/gorilla/mux +[33]: https://github.com/gorilla/ +[34]: https://golang.org/pkg/net/http/#ServeMux +[35]: https://swtch.com/~rsc/ +[36]: https://github.com/rsc/tiddly +[37]: https://github.com/rsc/tiddly/blob/8f9145ac183e374eb95d90a73be4d5f38534ec47/tiddly.go#L201 +[38]: https://godoc.org/gopkg.in/webhelp.v1/whmux#Dir +[39]: https://godoc.org/gopkg.in/webhelp.v1/whmux +[40]: https://godoc.org/gopkg.in/webhelp.v1/whmux#IntArg +[41]: https://godoc.org/gopkg.in/webhelp.v1/whmux#StringArg +[42]: https://golang.org/pkg/context/ +[43]: https://blog.golang.org/context +[44]: https://godoc.org/golang.org/x/net/context +[45]: https://godoc.org/gopkg.in/webhelp.v1#GenSym +[46]: https://godoc.org/gopkg.in/webhelp.v1/whcompat +[47]: https://godoc.org/gopkg.in/webhelp.v1/whcompat#DoneNotify +[48]: https://godoc.org/gopkg.in/webhelp.v1/whcompat#CloseNotify +[49]: https://godoc.org/gopkg.in/webhelp.v1/wherr +[50]: https://godoc.org/gopkg.in/webhelp.v1/wherr#Handle +[51]: https://godoc.org/gopkg.in/webhelp.v1/wherr#pkg-variables +[52]: https://godoc.org/github.com/spacemonkeygo/errors +[53]: https://godoc.org/github.com/spacemonkeygo/errors/errhttp +[54]: https://github.com/zeebo/errs +[55]: https://godoc.org/gopkg.in/webhelp.v1/whsess +[56]: https://godoc.org/golang.org/x/crypto/nacl/secretbox +[57]: https://godoc.org/gopkg.in/webhelp.v1/whlog +[58]: https://godoc.org/gopkg.in/webhelp.v1/whlog#LogRequests +[59]: https://godoc.org/gopkg.in/webhelp.v1/whlog#LogResponses +[60]: https://godoc.org/gopkg.in/webhelp.v1/whlog#ListenAndServe +[61]: https://godoc.org/gopkg.in/webhelp.v1/whmon +[62]: https://godoc.org/gopkg.in/webhelp.v1/whgls +[63]: https://godoc.org/github.com/jtolds/gls +[64]: https://golang.org/pkg/html/template/ +[65]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl +[66]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl#Collection +[67]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl#Pair +[68]: https://godoc.org/gopkg.in/go-webhelp/whoauth2.v1 +[69]: https://github.com/go-webhelp/whoauth2/blob/v1/examples/group/main.go +[70]: https://godoc.org/gopkg.in/go-webhelp/whgoth.v1 +[71]: https://github.com/markbates/goth +[72]: https://godoc.org/gopkg.in/webhelp.v1/whroute +[73]: https://godoc.org/gopkg.in/webhelp.v1/whparse +[74]: https://godoc.org/gopkg.in/webhelp.v1/whredir +[75]: https://godoc.org/gopkg.in/webhelp.v1/whcache +[76]: https://godoc.org/gopkg.in/webhelp.v1/whfatal +[77]: https://github.com/pressly/chi From cf932f8491c9912993e8f0cb7fca8f71264c1beb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:39:40 +0800 Subject: [PATCH 2181/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020160302=20Go?= =?UTF-8?q?=20channels=20are=20bad=20and=20you=20should=20feel=20bad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20160302 Go channels are bad and you should feel bad.md --- ...hannels are bad and you should feel bad.md | 443 ++++++++++++++++++ 1 file changed, 443 insertions(+) create mode 100644 sources/tech/20160302 Go channels are bad and you should feel bad.md diff --git a/sources/tech/20160302 Go channels are bad and you should feel bad.md b/sources/tech/20160302 Go channels are bad and you should feel bad.md new file mode 100644 index 0000000000..0ad2a5ed97 --- /dev/null +++ b/sources/tech/20160302 Go channels are bad and you should feel bad.md @@ -0,0 +1,443 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go channels are bad and you should feel bad) +[#]: via: (https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Go channels are bad and you should feel bad +====== + +_Update: If you’re coming to this blog post from a compendium titled “Go is not good,” I want to make it clear that I am ashamed to be on such a list. Go is absolutely the least worst programming language I’ve ever used. At the time I wrote this, I wanted to curb a trend I was seeing, namely, overuse of one of the more warty parts of Go. I still think channels could be much better, but overall, Go is wonderful. It’s like if your favorite toolbox had [this][1] in it; the tool can have uses (even if it could have had more uses), and it can still be your favorite toolbox!_ + +_Update 2: I would be remiss if I didn’t point out this excellent survey of real issues: [Understanding Real-World Concurrency Bugs In Go][2]. A significant finding of this survey is that… Go channels cause lots of bugs._ + +I’ve been using Google’s [Go programming language][3] on and off since mid-to-late 2010, and I’ve had legitimate product code written in Go for [Space Monkey][4] since January 2012 (before Go 1.0!). My initial experience with Go was back when I was researching Hoare’s [Communicating Sequential Processes][5] model of concurrency and the [π-calculus][6] under [Matt Might][7]’s [UCombinator research group][8] as part of my ([now redirected][9]) PhD work to better enable multicore development. Go was announced right then (how serendipitous!) and I immediately started kicking tires. + +It quickly became a core part of Space Monkey development. Our production systems at Space Monkey currently account for over 425k lines of pure Go (_not_ counting all of our vendored libraries, which would make it just shy of 1.5 million lines), so not the most Go you’ll ever see, but for the relatively young language we’re heavy users. We’ve [written about our Go usage][10] before. We’ve open-sourced some fairly heavily used libraries; many people seem to be fans of our [OpenSSL bindings][11] (which are faster than [crypto/tls][12], but please keep openssl itself up-to-date!), our [error handling library][13], [logging library][14], and [metric collection library/zipkin client][15]. We use Go, we love Go, we think it’s the least bad programming language for our needs we’ve used so far. + +Although I don’t think I can talk myself out of mentioning my widely avoided [goroutine-local-storage library][16] here either (which even though it’s a hack that you shouldn’t use, it’s a beautiful hack), hopefully my other experience will suffice as valid credentials that I kind of know what I’m talking about before I explain my deliberately inflamatory post title. + +![][17] + +### Wait, what? + +If you ask the proverbial programmer on the street what’s so special about Go, she’ll most likely tell you that Go is most known for channels and goroutines. Go’s theoretical underpinnings are heavily based in Hoare’s CSP model, which is itself incredibly fascinating and interesting and I firmly believe has much more to yield than we’ve appropriated so far. + +CSP (and the π-calculus) both use communication as the core synchronization primitive, so it makes sense Go would have channels. Rob Pike has been fascinated with CSP (with good reason) for a [considerable][18] [while][19] [now][20]. + +But from a pragmatic perspective (which Go prides itself on), Go got channels wrong. Channels as implemented are pretty much a solid anti-pattern in my book at this point. Why? Dear reader, let me count the ways. + +#### You probably won’t end up using just channels. + +Hoare’s Communicating Sequential Processes is a computational model where essentially the only synchronization primitive is sending or receiving on a channel. As soon as you use a mutex, semaphore, or condition variable, bam, you’re no longer in pure CSP land. Go programmers often tout this model and philosophy through the chanting of the [cached thought][21] “[share memory by communicating][22].” + +So let’s try and write a small program using just CSP in Go! Let’s make a high score receiver. All we will do is keep track of the largest high score value we’ve seen. That’s it. + +First, we’ll make a `Game` struct. + +``` +type Game struct { + bestScore int + scores chan int +} +``` + +`bestScore` isn’t going to be protected by a mutex! That’s fine, because we’ll simply have one goroutine manage its state and receive new scores over a channel. + +``` +func (g *Game) run() { + for score := range g.scores { + if g.bestScore < score { + g.bestScore = score + } + } +} +``` + +Okay, now we’ll make a helpful constructor to start a game. + +``` +func NewGame() (g *Game) { + g = &Game{ + bestScore: 0, + scores: make(chan int), + } + go g.run() + return g +} +``` + +Next, let’s assume someone has given us a `Player` that can return scores. It might also return an error, cause hey maybe the incoming TCP stream can die or something, or the player quits. + +``` +type Player interface { + NextScore() (score int, err error) +} +``` + +To handle the player, we’ll assume all errors are fatal and pass received scores down the channel. + +``` +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.scores <- score + } +} +``` + +Yay! Okay, we have a `Game` type that can keep track of the highest score a `Player` receives in a thread-safe way. + +You wrap up your development and you’re on your way to having customers. You make this game server public and you’re incredibly successful! Lots of games are being created with your game server. + +Soon, you discover people sometimes leave your game. Lots of games no longer have any players playing, but nothing stopped the game loop. You are getting overwhelmed by dead `(*Game).run` goroutines. + +**Challenge:** fix the goroutine leak above without mutexes or panics. For real, scroll up to the above code and come up with a plan for fixing this problem using just channels. + +I’ll wait. + +For what it’s worth, it totally can be done with channels only, but observe the simplicity of the following solution which doesn’t even have this problem: + +``` +type Game struct { + mtx sync.Mutex + bestScore int +} + +func NewGame() *Game { + return &Game{} +} + +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.mtx.Lock() + if g.bestScore < score { + g.bestScore = score + } + g.mtx.Unlock() + } +} +``` + +Which one would you rather work on? Don’t be deceived into thinking that the channel solution somehow makes this more readable and understandable in more complex cases. Teardown is very hard. This sort of teardown is just a piece of cake with a mutex, but the hardest thing to work out with Go-specific channels only. Also, if anyone replies that channels sending channels is easier to reason about here it will cause me an immediate head-to-desk motion. + +Importantly, this particular case might actually be _easily_ solved _with channels_ with some runtime assistance Go doesn’t provide! Unfortunately, as it stands, there are simply a surprising amount of problems that are solved better with traditional synchronization primitives than with Go’s version of CSP. We’ll talk about what Go could have done to make this case easier later. + +**Exercise:** Still skeptical? Try making both solutions above (channel-only vs. mutex-only) stop asking for scores from `Players` once `bestScore` is 100 or greater. Go ahead and open your text editor. This is a small, toy problem. + +The summary here is that you will be using traditional synchronization primitives in addition to channels if you want to do anything real. + +#### Channels are slower than implementing it yourself + +One of the things I assumed about Go being so heavily based in CSP theory is that there should be some pretty killer scheduler optimizations the runtime can make with channels. Perhaps channels aren’t always the most straightforward primitive, but surely they’re efficient and fast, right? + +![][23] + +As [Dustin Hiatt][24] points out on [Tyler Treat’s post about Go][25], + +> Behind the scenes, channels are using locks to serialize access and provide threadsafety. So by using channels to synchronize access to memory, you are, in fact, using locks; locks wrapped in a threadsafe queue. So how do Go’s fancy locks compare to just using mutex’s from their standard library `sync` package? The following numbers were obtained by using Go’s builtin benchmarking functionality to serially call Put on a single set of their respective types. + +``` +> BenchmarkSimpleSet-8 3000000 391 ns/op +> BenchmarkSimpleChannelSet-8 1000000 1699 ns/o +> +``` + +It’s a similar story with unbuffered channels, or even the same test under contention instead of run serially. + +Perhaps the Go scheduler will improve, but in the meantime, good old mutexes and condition variables are very good, efficient, and fast. If you want performance, you use the tried and true methods. + +#### Channels don’t compose well with other concurrency primitives + +Alright, so hopefully I have convinced you that you’ll at least be interacting with primitives besides channels sometimes. The standard library certainly seems to prefer traditional synchronization primitives over channels. + +Well guess what, it’s actually somewhat challenging to use channels alongside mutexes and condition variables correctly! + +One of the interesting things about channels that makes a lot of sense coming from CSP is that channel sends are synchronous. A channel send and channel receive are intended to be synchronization barriers, and the send and receive should happen at the same virtual time. That’s wonderful if you’re in well-executed CSP-land. + +![][26] + +Pragmatically, Go channels also come in a buffered variety. You can allocate a fixed amount of space to account for possible buffering so that sends and receives are disparate events, but the buffer size is capped. Go doesn’t provide a way to have arbitrarily sized buffers - you have to allocate the buffer size in advance. _This is fine_, I’ve seen people argue on the mailing list, _because memory is bounded anyway._ + +Wat. + +This is a bad answer. There’s all sorts of reasons to use an arbitrarily buffered channel. If we knew everything up front, why even have `malloc`? + +Not having arbitrarily buffered channels means that a naive send on _any_ channel could block at any time. You want to send on a channel and update some other bookkeeping under a mutex? Careful! Your channel send might block! + +``` +// ... +s.mtx.Lock() +// ... +s.ch <- val // might block! +s.mtx.Unlock() +// ... +``` + +This is a recipe for dining philosopher dinner fights. If you take a lock, you should quickly update state and release it and not do anything blocking under the lock if possible. + +There is a way to do a non-blocking send on a channel in Go, but it’s not the default behavior. Assume we have a channel `ch := make(chan int)` and we want to send the value `1` on it without blocking. Here is the minimum amount of typing you have to do to send without blocking: + +``` +select { +case ch <- 1: // it sent +default: // it didn't +} +``` + +This isn’t what naturally leaps to mind for beginning Go programmers. + +The summary is that because many operations on channels block, it takes careful reasoning about philosophers and their dining to successfully use channel operations alongside and under mutex protection, without causing deadlocks. + +#### Callbacks are strictly more powerful and don’t require unnecessary goroutines. + +![][27] + +Whenever an API uses a channel, or whenever I point out that a channel makes something hard, someone invariably points out that I should just spin up a goroutine to read off the channel and make whatever translation or fix I need as it reads of the channel. + +Um, no. What if my code is in a hotpath? There’s very few instances that require a channel, and if your API could have been designed with mutexes, semaphores, and callbacks and no additional goroutines (because all event edges are triggered by API events), then using a channel forces me to add another stack of memory allocation to my resource usage. Goroutines are much lighter weight than threads, yes, but lighter weight doesn’t mean the lightest weight possible. + +As I’ve formerly [argued in the comments on an article about using channels][28] (lol the internet), your API can _always_ be more general, _always_ more flexible, and take drastically less resources if you use callbacks instead of channels. “Always” is a scary word, but I mean it here. There’s proof-level stuff going on. + +If someone provides a callback-based API to you and you need a channel, you can provide a callback that sends on a channel with little overhead and full flexibility. + +If, on the other hand, someone provides a channel-based API to you and you need a callback, you have to spin up a goroutine to read off the channel _and_ you have to hope that no one tries to send more on the channel when you’re done reading so you cause blocked goroutine leaks. + +For a super simple real-world example, check out the [context interface][29] (which incidentally is an incredibly useful package and what you should be using instead of [goroutine-local storage][16]): + +``` +type Context interface { + ... + // Done returns a channel that closes when this work unit should be canceled. + Done() <-chan struct{} + + // Err returns a non-nil error when the Done channel is closed + Err() error + ... +} +``` + +Imagine all you want to do is log the corresponding error when the `Done()` channel fires. What do you have to do? If you don’t have a good place you’re already selecting on a channel, you have to spin up a goroutine to deal with it: + +``` +go func() { + <-ctx.Done() + logger.Errorf("canceled: %v", ctx.Err()) +}() +``` + +What if `ctx` gets garbage collected without closing the channel `Done()` returned? Whoops! Just leaked a goroutine! + +Now imagine we changed `Done`’s signature: + +``` +// Done calls cb when this work unit should be canceled. +Done(cb func()) +``` + +First off, logging is so easy now. Check it out: `ctx.Done(func() { log.Errorf("canceled: %v", ctx.Err()) })`. But lets say you really do need some select behavior. You can just call it like this: + +``` +ch := make(chan struct{}) +ctx.Done(func() { close(ch) }) +``` + +Voila! No expressiveness lost by using a callback instead. `ch` works like the channel `Done()` used to return, and in the logging case we didn’t need to spin up a whole new stack. I got to keep my stack traces (if our log package is inclined to use them); I got to avoid another stack allocation and another goroutine to give to the scheduler. + +Next time you use a channel, ask yourself if there’s some goroutines you could eliminate if you used mutexes and condition variables instead. If the answer is yes, your code will be more efficient if you change it. And if you’re trying to use channels just to be able to use the `range` keyword over a collection, I’m going to have to ask you to put your keyboard away or just go back to writing Python books. + +![more like Zooey De-channel, amirite][30] + +#### The channel API is inconsistent and just cray-cray + +Closing or sending on a closed channel panics! Why? If you want to close a channel, you need to either synchronize its closed state externally (with mutexes and so forth that don’t compose well!) so that other writers don’t write to or close a closed channel, or just charge forward and close or write to closed channels and expect you’ll have to recover any raised panics. + +This is such bizarre behavior. Almost every other operation in Go has a way to avoid a panic (type assertions have the `, ok =` pattern, for example), but with channels you just get to deal with it. + +Okay, so when a send will fail, channels panic. I guess that makes some kind of sense. But unlike almost everything else with nil values, sending to a nil channel won’t panic. Instead, it will block forever! That’s pretty counter-intuitive. That might be useful behavior, just like having a can-opener attached to your weed-whacker might be useful (and found in Skymall), but it’s certainly unexpected. Unlike interacting with nil maps (which do implicit pointer dereferences), nil interfaces (implicit pointer dereferences), unchecked type assertions, and all sorts of other things, nil channels exhibit actual channel behavior, as if a brand new channel was just instantiated for this operation. + +Receives are slightly nicer. What happens when you receive on a closed channel? Well, that works - you get a zero value. Okay that makes sense I guess. Bonus! Receives allow you to do a `, ok =`-style check if the channel was open when you received your value. Thank heavens we get `, ok =` here. + +But what happens if you receive from a nil channel? _Also blocks forever!_ Yay! Don’t try and use the fact that your channel is nil to keep track of if you closed it! + +### What are channels good for? + +Of course channels are good for some things (they are a generic container after all), and there are certain things you can only do with them (`select`). + +#### They are another special-cased generic datastructure + +Go programmers are so used to arguments about generics that I can feel the PTSD coming on just by bringing up the word. I’m not here to talk about it so wipe the sweat off your brow and let’s keep moving. + +Whatever your opinion of generics is, Go’s maps, slices, and channels are data structures that support generic element types, because they’ve been special-cased into the language. + +In a language that doesn’t allow you to write your own generic containers, _anything_ that allows you to better manage collections of things is valuable. Here, channels are a thread-safe datastructure that supports arbitrary value types. + +So that’s useful! That can save some boilerplate I suppose. + +I’m having trouble counting this as a win for channels. + +#### Select + +The main thing you can do with channels is the `select` statement. Here you can wait on a fixed number of inputs for events. It’s kind of like epoll, but you have to know upfront how many sockets you’re going to be waiting on. + +This is truly a useful language feature. Channels would be a complete wash if not for `select`. But holy smokes, let me tell you about the first time you decide you might need to select on multiple things but you don’t know how many and you have to use `reflect.Select`. + +### How could channels be better? + +It’s really tough to say what the most tactical thing the Go language team could do for Go 2.0 is (the Go 1.0 compatibility guarantee is good but hand-tying), but that won’t stop me from making some suggestions. + +#### Select on condition variables! + +We could just obviate the need for channels! This is where I propose we get rid of some sacred cows, but let me ask you this, how great would it be if you could select on any custom synchronization primitive? (A: So great.) If we had that, we wouldn’t need channels at all. + +#### GC could help us? + +In the very first example, we could easily solve the high score server cleanup with channels if we were able to use directionally-typed channel garbage collection to help us clean up. + +![][31] + +As you know, Go has directionally-typed channels. You can have a channel type that only supports reading (`<-chan`) and a channel type that only supports writing (`chan<-`). Great! + +Go also has garbage collection. It’s clear that certain kinds of book keeping are just too onerous and we shouldn’t make the programmer deal with them. We clean up unused memory! Garbage collection is useful and neat. + +So why not help clean up unused or deadlocked channel reads? Instead of having `make(chan Whatever)` return one bidirectional channel, have it return two single-direction channels (`chanReader, chanWriter := make(chan Type)`). + +Let’s reconsider the original example: + +``` +type Game struct { + bestScore int + scores chan<- int +} + +func run(bestScore *int, scores <-chan int) { + // we don't keep a reference to a *Game directly because then we'd be holding + // onto the send side of the channel. + for score := range scores { + if *bestScore < score { + *bestScore = score + } + } +} + +func NewGame() (g *Game) { + // this make(chan) return style is a proposal! + scoreReader, scoreWriter := make(chan int) + g = &Game{ + bestScore: 0, + scores: scoreWriter, + } + go run(&g.bestScore, scoreReader) + return g +} + +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.scores <- score + } +} +``` + +If garbage collection closed a channel when we could prove no more values are ever coming down it, this solution is completely fixed. Yes yes, the comment in `run` is indicative of the existence of a rather large gun aimed at your foot, but at least the problem is easily solveable now, whereas it really wasn’t before. Furthermore, a smart compiler could probably make appropriate proofs to reduce the damage from said foot-gun. + +#### Other smaller issues + + * **Dup channels?** \- If we could use an equivalent of the `dup` syscall on channels, then we could also solve the multiple producer problem quite easily. Each producer could close their own `dup`-ed channel without ruining the other producers. + * **Fix the channel API!** \- Close isn’t idempotent? Send on closed channel panics with no way to avoid it? Ugh! + * **Arbitrarily buffered channels** \- If we could make buffered channels with no fixed buffer size limit, then we could make channels that don’t block. + + + +### What do we tell people about Go then? + +If you haven’t yet, please go take a look at my current favorite programming post: [What Color is Your Function][32]. Without being about Go specifically, this blog post much more eloquently than I could lays out exactly why goroutines are Go’s best feature (and incidentally one of the ways Go is better than Rust for some applications). + +If you’re still writing code in a programming language that forces keywords like `yield` on you to get high performance, concurrency, or an event-driven model, you are living in the past, whether or not you or anyone else knows it. Go is so far one of the best entrants I’ve seen of languages that implement an M:N threading model that’s not 1:1, and dang that’s powerful. + +So, tell folks about goroutines. + +If I had to pick one other leading feature of Go, it’s interfaces. Statically-typed [duck typing][33] makes extending and working with your own or someone else’s project so fun and amazing it’s probably worth me writing an entirely different set of words about it some other time. + +### So… + +I keep seeing people charge in to Go, eager to use channels to their full potential. Here’s my advice to you. + +**JUST STAHP IT** + +When you’re writing APIs and interfaces, as bad as the advice “never” can be, I’m pretty sure there’s never a time where channels are better, and every Go API I’ve used that used channels I’ve ended up having to fight. I’ve never thought “oh good, there’s a channel here;” it’s always instead been some variant of _**WHAT FRESH HELL IS THIS?**_ + +So, _please, please use channels where appropriate and only where appropriate._ + +In all of my Go code I work with, I can count on one hand the number of times channels were really the best choice. Sometimes they are. That’s great! Use them then. But otherwise just stop. + +![][34] + +_Special thanks for the valuable feedback provided by my proof readers Jeff Wendling, [Andrew Harding][35], [George Shank][36], and [Tyler Treat][37]._ + +If you want to work on Go with us at Space Monkey, please [hit me up][38]! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad + +作者:[jtolio.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://blog.codinghorror.com/content/images/uploads/2012/06/6a0120a85dcdae970b017742d249d5970d-800wi.jpg +[2]: https://songlh.github.io/paper/go-study.pdf +[3]: https://golang.org/ +[4]: http://www.spacemonkey.com/ +[5]: https://en.wikipedia.org/wiki/Communicating_sequential_processes +[6]: https://en.wikipedia.org/wiki/%CE%A0-calculus +[7]: http://matt.might.net +[8]: http://www.ucombinator.org/ +[9]: https://www.jtolio.com/writing/2015/11/research-log-cell-states-and-microarrays/ +[10]: https://www.jtolio.com/writing/2014/04/go-space-monkey/ +[11]: https://godoc.org/github.com/spacemonkeygo/openssl +[12]: https://golang.org/pkg/crypto/tls/ +[13]: https://godoc.org/github.com/spacemonkeygo/errors +[14]: https://godoc.org/github.com/spacemonkeygo/spacelog +[15]: https://godoc.org/gopkg.in/spacemonkeygo/monitor.v1 +[16]: https://github.com/jtolds/gls +[17]: https://www.jtolio.com/images/wat/darth-helmet.jpg +[18]: https://en.wikipedia.org/wiki/Newsqueak +[19]: https://en.wikipedia.org/wiki/Alef_%28programming_language%29 +[20]: https://en.wikipedia.org/wiki/Limbo_%28programming_language%29 +[21]: https://lesswrong.com/lw/k5/cached_thoughts/ +[22]: https://blog.golang.org/share-memory-by-communicating +[23]: https://www.jtolio.com/images/wat/jon-stewart.jpg +[24]: https://twitter.com/HiattDustin +[25]: http://bravenewgeek.com/go-is-unapologetically-flawed-heres-why-we-use-it/ +[26]: https://www.jtolio.com/images/wat/obama.jpg +[27]: https://www.jtolio.com/images/wat/yael-grobglas.jpg +[28]: http://www.informit.com/articles/article.aspx?p=2359758#comment-2061767464 +[29]: https://godoc.org/golang.org/x/net/context +[30]: https://www.jtolio.com/images/wat/zooey-deschanel.jpg +[31]: https://www.jtolio.com/images/wat/joel-mchale.jpg +[32]: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ +[33]: https://en.wikipedia.org/wiki/Duck_typing +[34]: https://www.jtolio.com/images/wat/michael-cera.jpg +[35]: https://github.com/azdagron +[36]: https://twitter.com/taterbase +[37]: http://bravenewgeek.com +[38]: https://www.jtolio.com/contact/ From 39ba921cc8748fe8018338e0b1faf3e03636a4c8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:39:55 +0800 Subject: [PATCH 2182/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020151127=20Rese?= =?UTF-8?q?arch=20log:=20gene=20signatures=20and=20connectivity=20map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20151127 Research log- gene signatures and connectivity map.md --- ...g- gene signatures and connectivity map.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20151127 Research log- gene signatures and connectivity map.md diff --git a/sources/tech/20151127 Research log- gene signatures and connectivity map.md b/sources/tech/20151127 Research log- gene signatures and connectivity map.md new file mode 100644 index 0000000000..f4e7faa4bc --- /dev/null +++ b/sources/tech/20151127 Research log- gene signatures and connectivity map.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Research log: gene signatures and connectivity map) +[#]: via: (https://www.jtolio.com/2015/11/research-log-gene-signatures-and-connectivity-map) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Research log: gene signatures and connectivity map +====== + +Happy Thanksgiving everyone! + +### Context + +This is the third post in my continuing series on my attempts at research. Previously we talked about: + + * [what I’m doing, cell states, and microarrays][1] + * and then [more about microarrays and R][2]. + + + +By the end of last week we had discussed how to get a table of normalized gene expression intensities that looks like this: + +``` +ENSG00000280099_at 0.15484421 +ENSG00000280109_at 0.16881395 +ENSG00000280178_at -0.19621641 +ENSG00000280316_at 0.08622216 +ENSG00000280401_at 0.15966256 +ENSG00000281205_at -0.02085352 +... +``` + +The reason for doing this is to figure out which genes are related, and perhaps more importantly, what a cell is even doing. + +_Summary:_ new post, also, I’m bringing back the short section summaries. + +### Cell lines + +The first thing to do when trying to figure out what cells are doing is to choose a cell. There’s all sorts of cells. Healthy brain cells, cancerous blood cells, bruised skin cells, etc. + +For any experiment, you’ll need a control to eliminate noise and apply statistical tests for validity. If you don’t use a control, the effect you’re seeing may not even exist, and so for any experiment with cells, you will need a control cell. + +Cells often divide, which means that a cell, once chosen, will duplicate itself for you in the presence of the appropriate resources. Not all cells divide ad nauseam which provides some challenges, but many cells under study luckily do. + +So, a _cell line_ is simply a set of cells that have all replicated from a specific chosen initial cell. Any set of cells from a cell line will be as identical as possible (unless you screwed up! geez). They will be the same type of cell with the same traits and behaviors, at least, as much as possible. + +_Summary:_ a cell line is a large amount of cells that are as close to being the same as possible. + +### Perturbagens + +There are many things that might affect what a cell is doing. Drugs, agitation, temperature, disease, cancer, gene splicing, small molecules (maybe you give a cell more iron or calcium or something), hormones, light, Jello, ennui, etc. Given any particular cell line, giving a cell from that cell line one of these _perturbagens_, or, perturbing the cell in a specific way, when compared to a control will say what that cell does differently in the face of that perturbagen. + +If you’d like to find out what exactly a certain type of cell does when you give it lemon lime soda, then you choose the right cell line, leave out some control cells and give the rest of the cells soda. + +Then, you measure gene expression intensities for both the control cells and the perturbed cells. The _differential expression_ of genes between the perturbed cells and the controls cells is likely due to the introduction of the lemon lime soda. + +Genes that end up getting expressed _more_ in the presence of the soda are considered _up-regulated_, whereas genes that end up getting expressed _less_ are considered _down-regulated_. The degree to which a gene is up or down regulated constitutes how much of an effect the soda may have had on that gene. + +Of course, all of this has such a significant amount of experimental noise that you could find pretty much anything. You’ll need to replicate your experiment independently a few times before you publish that lemon lime soda causes increased expression in the [Sonic hedgehog gene][3]. + +_Summary:_ A perturbagen is something you introduce/do to a cell to change its behavior, such as drugs or throwing it at a wall or something. The wall perturbagen. + +### Gene signature + +For a given change or perturbagen to a cell, we now have enough to compute lists of up-regulated and down-regulated genes and the magnitude change in expression for each gene. + +This gene expression pattern for some subset of important genes (perhaps the most changed in expression) is called a _gene signature_, and gene signatures are very useful. By comparing signatures, you can: + + * identify or compare cell states + * find sets of positively or negatively correlated genes + * find similar disease signatures + * find similar drug signatures + * find drug signatures that might counteract opposite disease signatures. + + + +(That last bullet point is essentially where I’m headed with my research.) + +_Summary:_ a gene signature is a short summary of the most important gene expression differences a perturbagen causes in a cell. + +### Drugs! + +The pharmaceutical industry is constantly on the lookout for new breakthrough drugs that might represent huge windfalls in cash, and drugs don’t always work as planned. Many drugs spend years in research and development, only to ultimately find poor efficacy or adoption. Sometimes drugs even become known [much more for their side-effects than their originally intended therapy][4]. + +The practical upshot is that there’s countless FDA-approved drugs that represent decades of work that are simply underused or even unused entirely. These drugs have already cleared many challenging regulatory hurdles, but are simply and quite literally cures looking for a disease. + +If even just one of these drugs can be given a new lease on life for some yet-to-be-cured disease, then perhaps we can give some people new leases on life! + +_Summary:_ instead of developing new drugs, there’s already lots of drugs that aren’t being used. Maybe we can find matching diseases! + +### The Connectivity Map project + +The [Broad Institute’s Connectivity Map project][5] isn’t particularly new anymore, but it represents a ground breaking and promising idea - we can dump a bunch of signatures into a database and construct all sorts of new hypotheses we might not even have thought to check before. + +To prove out the usefulness of this idea, the Connectivity Map (or cmap) project chose 5 different cell lines (all cancer cells, which are easy to get to replicate!) and a library of FDA approved drugs, and then gave some cells these drugs. + +They then constructed a database of all of the signatures they computed for each possible perturbagen they measured. Finally, they constructed a web interface where a user can upload a gene signature and get a result list back of all of the signatures they collected, ordered by the most to least similar. You can totally go sign up and [try it out][5]. + +This simple tool is surprisingly powerful. It allows you to find similar drugs to a drug you know, but it also allows you to find drugs that might counteract a disease you’ve created a signature for. + +Ultimately, the project led to [a number of successful applications][6]. So useful was it that the Broad Institute has doubled down and created the much larger and more comprehensive [LINCS Project][7] that targets an order of magnitude more cell lines (77) and more perturbagens (42,532, compared to cmap’s 6100). You can sign up and use that one too! + +_Summary_: building a system that supports querying signature connections has already proved to be super useful. + +### Whew + +Alright, I wrote most of this on a plane yesterday but since I should now be spending time with family I’m going to cut it short here. + +Stay tuned for next week! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2015/11/research-log-gene-signatures-and-connectivity-map + +作者:[jtolio.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.jtolio.com/writing/2015/11/research-log-cell-states-and-microarrays/ +[2]: https://www.jtolio.com/writing/2015/11/research-log-r-and-more-microarrays/ +[3]: https://en.wikipedia.org/wiki/Sonic_hedgehog +[4]: https://en.wikipedia.org/wiki/Sildenafil#History +[5]: https://www.broadinstitute.org/cmap/ +[6]: https://www.broadinstitute.org/cmap/publications.jsp +[7]: http://www.lincscloud.org/ From 6d25c49ab978db7131288c0cefb1d2f377540c09 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:44:52 +0800 Subject: [PATCH 2183/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200519=20How?= =?UTF-8?q?=20to=20use=20Windows=20Subsystem=20for=20Linux=20to=20open=20L?= =?UTF-8?q?inux=20on=20Windows=2010=20machines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md --- ...ux to open Linux on Windows 10 machines.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md diff --git a/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md b/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md new file mode 100644 index 0000000000..e610f7eb2f --- /dev/null +++ b/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Windows Subsystem for Linux to open Linux on Windows 10 machines) +[#]: via: (https://www.networkworld.com/article/3543845/how-to-use-windows-subsystem-for-linux-to-open-linux-on-windows-10-machines.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to use Windows Subsystem for Linux to open Linux on Windows 10 machines +====== +Opening a Linux terminal on a Windows 10 desktop can help you practice your Linux skills and explore Windows from an entirely different point of view. In this post, we look at Ubuntu 18.04 running through Windows Subsystem for Linux (WSL). +[Nicolas Solerieu modified by IDG Comm. / Linux][1] [(CC0)][2] + +Believe it or not, it's possible to open a Linux terminal on a Windows 10 system and you might be surprised how much Linux functionality you’ll be able to get by doing so. + +You can run Linux commands, traipse around the provided Linux file system and even take a novel look at Windows files. The experience isn’t altogether different than opening a terminal window on a Linux desktop, with a few interesting exceptions. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +What is needed to make this happen is something called the Windows Subsystem for Linux (WSL) and a Windows 10 x86 PC. + +### Linux versions for WSL + +There are a number of options for running Linux on top of Windows. The Linux OS choices include: + + * [Ubuntu 16.04 LTS][4] + * [Ubuntu 18.04 LTS][5] + * [openSUSE Leap 15.1][6] + * [SUSE Linux Enterprise Server 12 SP5][7] + * [SUSE Linux Enterprise Server 15 SP1][8] + * [Kali Linux][9] + * [Debian GNU/Linux][10] + * [Fedora Remix for WSL][11] + * [Pengwin][12] + * [Pengwin Enterprise][13] + * [Alpine WSL][14] + + + +Ubuntu 18.04 LTS is just one option and, in this post, we’ll take a look at how the terminal runs on Windows using this particular distribution and how much it feels like working on a Linux system directly. + +If you want to look into the process of putting an Ubuntu distribution on your Windows system, you can start with this page: + + + +As part of the initial setup of installing your Linux on Windows terminal, you’ll be asked to create your user account. Once you do that and open the terminal, you can start to explore. One of the most noticeable differences between your Linux-on-Windows terminal and a terminal window on a Linux system is that examining processes isn’t going to show you much. After all, Windows will be providing the bulk of the required OS support. You’re likely to see something like this: + +``` +myacct@hostname:~$ ps -ef +UID PID PPID C STIME TTY TIME CMD +root 1 0 0 12:45 ? 00:00:00 /init +root 7 1 0 12:45 tty1 00:00:00 /init +shs 8 7 0 12:45 tty1 00:00:00 -bash +shs 166 8 0 13:32 tty1 00:00:00 ps -ef +``` + +Yes, that's it. + +If you’re anything like me, one of your next moves might be to get a handle on the available commands. If you just count the files in the **/bin** and **/usr/bin** directories, you should see that there are a lot of commands: + +``` +myacct@hostname:~$ ls /bin | wc -l +171 +myacct@hostname:~$ ls /usr/bin | wc -l +707 +``` + +You can list available commands with commands like these (output truncated for this post): + +``` +myacct@hostname:~$ ls /bin | head -25 | column +bash btrfs-map-logical bunzip2 bzegrep bzip2recover +btrfs btrfs-select-super busybox bzexe bzless +btrfs-debug-tree btrfs-zero-log bzcat bzfgrep bzmore +btrfs-find-root btrfsck bzcmp bzgrep cat +btrfs-image btrfstune bzdiff bzip2 chacl + +myacct@hostname:~$ ls /usr/bin | head -25 | column +NF aa-exec apport-cli apt apt-extracttempl* +VGAuthService acpi_listen apport-collect apt-add-repository apt-ftparchive +X11 add-apt-repository apport-unpack apt-cache apt-get +[ addpart appres apt-cdrom apt-key +aa-enabled apport-bug apropos apt-config apt-mark +``` + +You can update the system with **apt** commands (sudo apt update, sudo apt upgrade). You can even use Linux commands to move to the Windows disk partitions as you like and . Notice the last three entries in the output below. These represent several drives on the system. + +``` +myacct@hostname:~$ df -k +Filesystem 1K-blocks Used Available Use% Mounted on +rootfs 973067784 326920584 646147200 34% / +none 973067784 326920584 646147200 34% /dev +none 973067784 326920584 646147200 34% /run +none 973067784 326920584 646147200 34% /run/lock +none 973067784 326920584 646147200 34% /run/shm +none 973067784 326920584 646147200 34% /run/user +cgroup 973067784 326920584 646147200 34% /sys/fs/cgroup +C:\ 973067784 326920584 646147200 34% /mnt/c <== C drive +I:\ 976760000 231268208 745491792 24% /mnt/I <== external drive +L:\ 409599996 159240 409440756 1% /mnt/l <== USB thumb drive +``` + +If you’re interested in moving out of the Linux space and into the Windows portion of the file system within your **WSL** session, you can do that easily. Replace “myname” with your Windows account name and a **cd /mnt/c/Users/_myname_/Desktop** will take you to your Windows desktop. From there, don’t be surprised if in listing your files you see **WRL####.tmp** files that don’t seem to exist when you look at your desktop and don’t show up if you look at your files by opening a command prompt. These appear to be temporary files used by Windows for document management. You might also see files listed that look like **‘~$nux notes.docx’** – perhaps ghosts of files that were once located on your desktop. You won’t see those files when you look at your desktop on Windows – even using a **cmd** window. + +Note that you’ll also see Windows directories such as **‘Program Files’** in single quotes when listed in your Linux terminal as you would any file with blanks included in their names. You can even start a Windows executable from your Linux terminal. For example: + +``` +myacct@hostname: $ cd /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0 +myacct@hostname: $ powershell.exe +``` + +If you do this, type **exit** when you want to end the **powershell** session. + +Linux commands all seem to work as expected, though I don’t get any output when I run the **who** command. + +Windows **.txt** files will display with **cat** commands, but the last line in a file will likely be displayed on the same line as the following shell prompt. This is because these files won’t end with a linefeed as Linux text files do. + +You can create other accounts and switch user to them (e.g., **su – nemo**) if you like, but not log into them directly. + +You can also update the system with apt commands (**sudo apt update**, **sudo apt upgrade**). + +Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543845/how-to-use-windows-subsystem-for-linux-to-open-linux-on-windows-10-machines.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://unsplash.com/photos/4gRNmhGzYZE +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.microsoft.com/store/apps/9pjn388hp8c9 +[5]: https://www.microsoft.com/store/apps/9N9TNGVNDL3Q +[6]: https://www.microsoft.com/store/apps/9NJFZK00FGKV +[7]: https://www.microsoft.com/store/apps/9MZ3D1TRP8T1 +[8]: https://www.microsoft.com/store/apps/9PN498VPMF3Z +[9]: https://www.microsoft.com/store/apps/9PKR34TNCV07 +[10]: https://www.microsoft.com/store/apps/9MSVKQC78PK6 +[11]: https://www.microsoft.com/store/apps/9n6gdm4k2hnc +[12]: https://www.microsoft.com/store/apps/9NV1GV1PXZ6P +[13]: https://www.microsoft.com/store/apps/9N8LP0X93VCP +[14]: https://www.microsoft.com/store/apps/9p804crf0395 +[15]: https://www.facebook.com/NetworkWorld/ +[16]: https://www.linkedin.com/company/network-world From 70325ef88dc85d76131aa8ef7e1d332abea9d4a5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:46:05 +0800 Subject: [PATCH 2184/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200515=20How?= =?UTF-8?q?=20to=20examine=20processes=20running=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200515 How to examine processes running on Linux.md --- ...w to examine processes running on Linux.md | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 sources/tech/20200515 How to examine processes running on Linux.md diff --git a/sources/tech/20200515 How to examine processes running on Linux.md b/sources/tech/20200515 How to examine processes running on Linux.md new file mode 100644 index 0000000000..0659ab04f9 --- /dev/null +++ b/sources/tech/20200515 How to examine processes running on Linux.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to examine processes running on Linux) +[#]: via: (https://www.networkworld.com/article/3543232/how-to-examine-processes-running-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to examine processes running on Linux +====== + +Thinkstock + +There are quite a number of ways to look at running processes on Linux systems – to see what’s running, the resources that processes are using, how the system is affected by the load and how memory is being used. Each command gives you a different view, and the range of details is considerable. In this post, we’ll run through a series of commands that can help you view process details in a number of different ways. + +### ps + +While the **ps** command is the most obvious command for examining processes, the arguments that you use when running **ps** will make a big difference in how much information will be provided. With no arguments, **ps** will only show processes associated with your current login session. Add a **-u** and you'll see extended details. + +Here is a comparison: + +``` +nemo$ ps + PID TTY TIME CMD + 45867 pts/1 00:00:00 bash + 46140 pts/1 00:00:00 ps +nemo$ ps -u +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +nemo 45867 0.0 0.0 11232 5636 pts/1 Ss 19:04 0:00 -bash +nemo 46141 0.0 0.0 11700 3648 pts/1 R+ 19:16 0:00 ps -u +``` + +Using **ps -ef** will display details on all of the processes running on the system but **ps -eF** will add some additional details. + +``` +$ ps -ef | head -2 +UID PID PPID C STIME TTY TIME CMD +root 1 0 0 May10 ? 00:00:06 /sbin/init splash +$ ps -eF | head -2 +UID PID PPID C SZ RSS PSR STIME TTY TIME CMD +root 1 0 0 42108 12524 0 May10 ? 00:00:06 /sbin/init splash +``` + +Both commands show who is running the process, the process and parent process IDs, process start time, accumulated run time and the task being run. The additional fields shown when you use **F** instead of **f** include: + + * SZ: the process **size** in physical pages for the core image of the process + * RSS: the **resident set size** which shows how much memory is allocated to those parts of the process in RAM. It does not include memory that is swapped out, but does include memory from shared libraries as long as the pages from those libraries are currently in memory. It also includes stack and heap memory. + * PSR: the **processor** the process is using + + + +##### ps -fU + +You can list processes for some particular user with a command like "ps -ef | grep USERNAME", but with **ps -fU** command, you’re going to see considerably more data. This is because details of processes that are being run on the user's behalf are also included. In fact, nearly all these processes shown have been kicked off by system simply to support this user’s online session. Nemo has only just logged in and is not yet running any commands or scripts. + +``` +$ ps -fU nemo +UID PID PPID C STIME TTY TIME CMD +nemo 45726 1 0 19:04 ? 00:00:00 /lib/systemd/systemd --user +nemo 45732 45726 0 19:04 ? 00:00:00 (sd-pam) +nemo 45738 45726 0 19:04 ? 00:00:00 /usr/bin/pulseaudio --daemon +nemo 45740 45726 0 19:04 ? 00:00:00 /usr/libexec/tracker-miner-f +nemo 45754 45726 0 19:04 ? 00:00:00 /usr/bin/dbus-daemon --sessi +nemo 45829 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd +nemo 45856 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd-fuse /run +nemo 45862 45706 0 19:04 ? 00:00:00 sshd: nemo@pts/1 +nemo 45864 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-udisks2-vo +nemo 45867 45862 0 19:04 pts/1 00:00:00 -bash +nemo 45878 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-afc-volume +nemo 45883 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-goa-volume +nemo 45887 45726 0 19:04 ? 00:00:00 /usr/libexec/goa-daemon +nemo 45895 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-mtp-volume +nemo 45896 45726 0 19:04 ? 00:00:00 /usr/libexec/goa-identity-se +nemo 45903 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-gphoto2-vo +nemo 45946 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd-metadata +``` + +Note that the only process with an assigned TTY is Nemo's shell and that the parent of all of the other processes is **systemd**. + +You can supply a comma-separated list of usernames instead of a single name. Just be prepared to be looking at quite a bit more data. + +#### top and ntop + +The **top** and **ntop** commands will help when you want to get an idea which processes are using the most resources and allow you to reorder your view depending on what criteria you want to use to rank the processes (e.g., highest CPU or memory use). + +``` +top - 11:51:27 up 1 day, 21:40, 1 user, load average: 0.08, 0.02, 0.01 +Tasks: 211 total, 1 running, 210 sleeping, 0 stopped, 0 zombie +%Cpu(s): 5.0 us, 0.5 sy, 0.0 ni, 94.3 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5944.4 total, 3527.4 free, 565.1 used, 1851.9 buff/cache +MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 5084.3 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 999 root 20 0 394660 14380 10912 S 8.0 0.2 0:46.54 udisksd + 65224 shs 20 0 314268 9824 8084 S 1.7 0.2 0:00.34 gvfs-ud+ + 2034 gdm 20 0 314264 9820 7992 S 1.3 0.2 0:06.25 gvfs-ud+ + 67909 root 20 0 0 0 0 I 0.3 0.0 0:00.09 kworker+ + 1 root 20 0 168432 12532 8564 S 0.0 0.2 0:09.93 systemd + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd +``` + +Use **shift+m** to sort by memory use and **shift+p** to go back to sorting by CPU usage (the default). + +#### /proc + +A tremendous amount of information is available on running processes in the **/proc** directory. In fact, if you haven't visited **/proc** quite a few times, you might be astounded by the amount of details available. Just keep in mind that **/proc** is a very different kind of file system. As an interface to kernel data, it provides a view of process details that are currently being used by the system. + +Some of the more useful **/proc** files for viewing include **cmdline**, **environ**, **fd**, **limits** and **status**. The following views provide some samples of what you might see. + +The **status** file shows the process that is running (bash), its status, the user and group ID for the person running bash, a full list of the groups the user is a member of and the process ID and parent process ID. + +``` +$ head -11 /proc/65333/status +Name: bash +Umask: 0002 +State: S (sleeping) +Tgid: 65333 +Ngid: 0 +Pid: 65333 +PPid: 65320 +TracerPid: 0 +Uid: 1000 1000 1000 1000 +Gid: 1000 1000 1000 1000 +FDSize: 256 +Groups: 4 11 24 27 30 46 118 128 500 1000 +... +``` + +The **cmdline** file shows the command line used to start the process. + +``` +$ cat /proc/65333/cmdline +-bash +``` + +The **environ** file shows the environment variables that are in effect. + +``` +$ cat environ +USER=shsLOGNAME=shsHOME=/home/shsPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/gamesSHELL=/bin/bashTERM=xtermXDG_SESSION_ID=626XDG_RUNTIME_DIR=/run/user/1000DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/busXDG_SESSION_TYPE=ttyXDG_SESSION_CLASS=userMOTD_SHOWN=pamLANG=en_US.UTF-8SSH_CLIENT=192.168.0.19 9385 22SSH_CONNECTION=192.168.0.19 9385 192.168.0.11 22SSH_TTY=/dev/pts/0$ +``` + +The **fd** file shows the file descriptors. Note how they reflect the pseudo-tty that is being used (pts/0). + +``` +$ ls -l /proc/65333/fd +total 0 +lrwx------ 1 shs shs 64 May 12 09:45 0 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:45 1 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:45 2 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:56 255 -> /dev/pts/0 +$ who +shs pts/0 2020-05-12 09:45 (192.168.0.19) +``` + +The **limits** file contains information about the limits imposed on the process. + +``` +$ cat limits +Limit Soft Limit Hard Limit Units +Max cpu time unlimited unlimited seconds +Max file size unlimited unlimited bytes +Max data size unlimited unlimited bytes +Max stack size 8388608 unlimited bytes +Max core file size 0 unlimited bytes +Max resident set unlimited unlimited bytes +Max processes 23554 23554 processes +Max open files 1024 1048576 files +Max locked memory 67108864 67108864 bytes +Max address space unlimited unlimited bytes +Max file locks unlimited unlimited locks +Max pending signals 23554 23554 signals +Max msgqueue size 819200 819200 bytes +Max nice priority 0 0 +Max realtime priority 0 0 +Max realtime timeout unlimited unlimited us +``` + +#### pmap + +The **pmap** command takes you in an entirely different direction when it comes to memory use. It provides a detailed map of a process’s memory usage. To make sense of this, you need to keep in mind that processes do not run entirely on their own. Instead, they make use of a wide range of system resources. The truncated **pmap** output below shows a portion of the memory map for a single user’s bash login along with some memory usage totals at the bottom. + +``` +$ pmap -x 43120 +43120: -bash +Address Kbytes RSS Dirty Mode Mapping +000055887655b000 180 180 0 r---- bash +0000558876588000 708 708 0 r-x-- bash +0000558876639000 220 148 0 r---- bash +0000558876670000 16 16 16 r---- bash +0000558876674000 36 36 36 rw--- bash +000055887667d000 40 28 28 rw--- [ anon ] +0000558876b96000 1328 1312 1312 rw--- [ anon ] +00007f0bd9a7e000 28 28 0 r---- libpthread-2.31.so +00007f0bd9a85000 68 68 0 r-x-- libpthread-2.31.so +00007f0bd9a96000 20 0 0 r---- libpthread-2.31.so +00007f0bd9a9b000 4 4 4 r---- libpthread-2.31.so +00007f0bd9a9c000 4 4 4 rw--- libpthread-2.31.so +00007f0bd9a9d000 16 4 4 rw--- [ anon ] +00007f0bd9aa1000 20 20 0 r---- libnss_systemd.so.2 +00007f0bd9aa6000 148 148 0 r-x-- libnss_systemd.so.2 +... +ffffffffff600000 4 0 0 --x-- [ anon ] +---------------- ------- ------- ------- +total kB 11368 5664 1656 + +Kbytes: size of map in kilobytes +RSS: resident set size in kilobytes +Dirty: dirty pages (both shared and private) in kilobytes +``` +``` + +``` + +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/3543232/how-to-examine-processes-running-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world From 9b199190171789c69144973eba35515ecb3cee59 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:47:12 +0800 Subject: [PATCH 2185/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200514=20What?= =?UTF-8?q?=20is=20IoT=3F=20The=20internet=20of=20things=20explained?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200514 What is IoT- The internet of things explained.md --- ...s IoT- The internet of things explained.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/talk/20200514 What is IoT- The internet of things explained.md diff --git a/sources/talk/20200514 What is IoT- The internet of things explained.md b/sources/talk/20200514 What is IoT- The internet of things explained.md new file mode 100644 index 0000000000..fdbbfcea93 --- /dev/null +++ b/sources/talk/20200514 What is IoT- The internet of things explained.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is IoT? The internet of things explained) +[#]: via: (https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html) +[#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/) + +What is IoT? The internet of things explained +====== +The internet of things (IoT) is a network of connected smart devices providing rich data, but it can also be a security nightmare. +Thinkstock + +The internet of things (IoT) is a catch-all term for the growing number of electronics that aren't traditional computing devices, but are connected to the internet to send data, receive instructions or both. + +There's an incredibly broad range of things that fall under that umbrella: Internet-connected "smart" versions of traditional appliances like refrigerators and light bulbs; gadgets that could only exist in an internet-enabled world like Alexa-style digital assistants; internet-enabled sensors that are transforming factories, healthcare, transportation, distribution centers and farms. + +### What is the internet of things? + +The IoT brings the power of the internet, data processing and analytics to the real world of physical objects. For consumers, this means interacting with the global information network without the intermediary of a keyboard and screen; many of their everyday objects and appliances can take instructions from that network with minimal human intervention. + +**[ [More IoT coverage of Network World][1] ]** + +In enterprise settings, IoT can bring the same efficiencies to physical manufacturing and distribution that the internet has long delivered for knowledge work. Millions if not billions of embedded internet-enabled sensors worldwide are providing an incredibly rich set of data that companies can use to gather data about their safety of their operations, track assets and reduce manual processes. Researchers can also use the IoT to gather data about people's preferences and behavior, though that can have serious implications for privacy and security. + +### How big is it? + +In a word: enormous. [Priceonomics breaks it down][2]: There are more than 50 billion IoT devices as of 2020, and those devices will generate 4.4 zettabytes of data this year. (A zettabyte is a trillion gigabytes.) By comparison, in 2013 IoT devices generated a mere 100 billion gigabytes. The amount of money to be made in the IoT market is similarly staggering; estimates on the value of the market in 2025 range from $1.6 trillion to $14.4 trillion. + +### History of IoT + +A world of omnipresent connected devices and sensors is one of the oldest tropes of science fiction. IoT lore has dubbed a [vending machine at Carnegie Mellon][3] that was connected to APRANET in 1970 as the first Internet of Things device, and many technologies have been touted as enabling "smart" IoT-style characteristics to give them a futuristic sheen. But the term Internet of Things was coined in 1999 by British technologist [ Kevin Ashton][4]. + +At first, the technology lagged behind the vision. Every internet-connected thing needed a processor and a means to communicate with other things, preferably wirelessly, and those factors imposed costs and power requirements that made widespread IoT rollouts impractical, at least until Moore's Law caught up in the mid '00s. + +One important milestone was [widespread adoption of RFID tags][5], cheap minimalist transponders that could be stuck on any object to connect it to the larger internet world. Omnipresent Wi-Fi and 4G made it possible to for designers to simply assume wireless connectivity anywhere. And the rollout of IPv6 means that connecting billions of gadgets to the internet won't exhaust the store of IP addresses, which was a real concern. (Related story: [Can IoT networking drive adoption of IPv6?][6]) + +### How does the IoT work? + +The basic elements of the IoT are devices that gather data. Broadly speaking, they are internet-connected devices, so they each have an IP address. They range in complexity from autonomous vehicles that haul products around factory floors to simple sensors that monitor the temperature in buildings. They also include personal devices like fitness trackers that monitor the number of steps individuals take each day. To make that data useful it needs to be collected, processed, filtered and analyzed, each of which can be handled in a variety of ways. + +Collecting the data is done by transmitting it from the devices to a gathering point. Moving the data can be done wirelessly using a range of technologies or on wired networks. The data can be sent over the internet to a data center or a cloud that has storage and compute power or the transfer can be staged, with intermediary devices aggregating the data before sending it along. + +Processing the data can take place in data centers or cloud, but sometimes that’s not an option. In the case of critical devices such as shutoffs in industrial settings, the delay of sending data from the device to a remote data center is too great. The round-trip time for sending data, processing it, analyzing it and returning instructions (close that valve before the pipes burst) can take too long. In such cases edge-computing can come into play, where a smart edge device can aggregate data, analyze it and fashion responses if necessary, all within relatively close physical distance, thereby reducing delay. Edge devices also have upstream connectivity for sending data to be further processed and stored. + +[][7] Network World / IDG + +How the internet of things works.  + +### **Examples of IoT devices** + +Essentially, anything that's capable of gathering some information about the physical world and sending it back home can participate in the IoT ecosystem. Smart home appliances, RFID tags, and industrial sensors are a few examples. These sensors can monitor a range of factors including temperature and pressure in industrial systems, status of critical parts in machinery, patient vital signs, and use of water and electricity, among many, many other possibilities. + +Entire factory robots can be considered IoT devices, as can autonomous vehicles that move products around industrial settings and warehouses. + +Other examples include fitness wearables and home security systems. There are also more generic devices, like the [Raspberry Pi][8] or [Arduino][9], that let you build your own IoT end points. Even though you might think of your smartphone as a pocket-sized computer, it may well also be beaming data about your location and behavior to back-end services in very IoT-like ways. + +#### **Device management** + +In order to work together, all those devices need to be authenticated, provisioned, configured, and monitored, as well as patched and updated as necessary. Too often, all this happens within the context of a single vendor's proprietary systems – or, it doesn't happen at all, which is even more risky. But the industry is starting to transition to a [standards-based device management model][10], which allows IoT devices to interoperate and will ensure that devices aren't orphaned. + +#### **IoT communication standards and protocols** + +When IoT gadgets talk to other devices, they can use a wide variety of communications standards and protocols, many tailored to devices with limited processing capabilities or not much electrical power. Some of these you've definitely heard of — some devices use Wi-Fi or Bluetooth, for instance — but many more are specialized for the world of IoT. ZigBee, for instance, is a wireless protocol for low-power, short-distance communication, while message queuing telemetry transport (MQTT) is a publish/subscribe messaging protocol for devices connected by unreliable or delay-prone networks. (See Network World’s glossary of [IoT standards and protocols][11].) + +The increased speeds and bandwidth of the coming 5G standard for cellular networks will also benefit IoT, though that usage will [lag behind ordinary cell phones][12]. + +### IoT, edge computing and the cloud + +[][13] Network World / IDG + +How edge computing enables IoT. + +For many IoT systems, there's a lot of data coming in fast and furious, which has given rise to a new technology category, [edge computing][14]_,_ consisting of appliances placed relatively close to IoT devices, fielding the flow of data from them. These machines process that data and send only relevant material back to a more centralized system for analysis. For instance, imagine a network of dozens of IoT security cameras. Instead of bombarding the building's security operations center (SoC) with simultaneous live-streams, edge-computing systems can analyze the incoming video and only alert the SoC when one of the cameras detects movement. + +And where does that data go once it’s been processed? Well, it might go to your centralized data center, but more often than not it will end up in the cloud. + +The elastic nature of cloud computing is great for IoT scenarios where data might come in intermittently or asynchronously. And many of the big cloud heavy hitters — including [Google][15], [Microsoft][16], and [Amazon][17] — have IoT offerings.  + +### IoT platforms + +The cloud giants are trying to sell more than just a place to stash the data your sensors have collected. They're offering full IoT platforms*,* which bundle together much of the functionality to coordinate the elements that make up IoT systems. In essence, an IoT platform serves as middleware that connects the IoT devices and edge gateways with the applications you use to deal with the IoT data. That said, every platform vendor seems to have a slightly different definition of what an IoT platform is, the better to [distance themselves from the competition][18]. + +### IoT and data + +As mentioned, there are zettabytes of data being collected by all those IoT devices, funneled through edge gateways, and sent to a platform for processing. In many scenarios, this data is the reason IoT has been deployed in the first place. By collecting information from sensors in the real world, organizations can make nimble decisions in real time. + +Oracle, for instance, [imagines a scenario][19] where people at a theme park are encouraged to download an app that offers information about the park. At the same time, the app sends GPS pings back to the park's management to help predict wait times in lines. With that information, the park can take action in the short term (by adding more staff to increase the capacity of some attractions, for instance) and the long term (by learning which rides are the most and least popular at the park). + +These decisions can be made without human intervention. For example, data gathered from pressure sensors in a chemical-factory pipeline could be analyzed by software in an edge device that spots the threat of a pipeline rupture, and that information can trigger a signal to shut valves to avert a spill.  + +### IoT and big data analytics + +The theme park example is easy to get your head around, but is small potatoes compared to many real-world IoT data-harvesting operations. Many big data operations use information harvested from IoT devices, correlated with other data points, to get insight into human behavior. _Software Advice_ gives [a few examples][20], including a service from Birst that matches coffee brewing information collected from internet-connected coffeemakers with social media posts to see if customers are talking about coffee brands online. + +Another dramatic example came recently when X-Mode released a map based on tracking location data of people who partied at spring break in Ft. Lauderdale in March of 2020, even as the coronavirus pandemic was gaining speed in the United States, showing [where all those people ended up across the country][21]. The map was shocking not only because it showed the potential spread of the virus, but also because it illustrated just how closely IoT devices can track us. (For more on IoT and analytics, click [here][22]. + +### IoT data and AI + +The volume of data IoT devices can gather is far larger than any human can deal with in a useful way, and certainly not in real time. We've already seen that edge computing devices are needed just to make sense of the raw data coming in from the IoT endpoints. There's also the need to detect and deal with data that might [be just plain wrong][23]. + +Many IoT providers are offering machine learning and artificial intelligence capabilities to make sense of the collected data. IBM's Jeopardy!-winning Watson platform, for instance, can be [trained on IoT data sets][24] to produce useful results in the field of predicative maintenance — analyzing data from drones to distinguish between trivial damage to a bridge and cracks that need attention, for instance. Meanwhile, Arm is working on [low-power chips][25] that can provide AI capabilities on the IoT endpoints themselves.    ** **  + +### IoT and business + +Business uses for IoT include keeping track of customers, inventory, and the status of important components. [IoT for All][26] flags four industries that have been transformed by IoT: + + * **Oil and gas**: Isolated drilling sites can be better monitored with IoT sensors than by human intervention + * A**griculture**: Granular data about crops growing in fields derived from IoT sensors can be used to increase yields + * **HVAC**: Climate control systems across the country can be monitored by manufacturers + * **Brick-and-mortar retail**: Customers can be microtargeted with offers on their phones as they linger in certain parts of a store + + + +More generally, enterprises are looking for IoT solutions that can help in [four areas][27]: energy use, asset tracking, security, and the customer experience. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html + +作者:[Josh Fruhlinger][a] +选题:[lujun9972][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/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/category/internet-of-things/ +[2]: https://priceonomics.com/the-iot-data-explosion-how-big-is-the-iot-data/ +[3]: https://www.machinedesign.com/automation-iiot/article/21836968/iot-started-with-a-vending-machine +[4]: https://www.visioncritical.com/blog/kevin-ashton-internet-of-things +[5]: https://www.networkworld.com/article/2319384/rfid-readers-route-tag-traffic.html +[6]: https://www.networkworld.com/article/3338106/can-iot-networking-drive-adoption-of-ipv6.html +[7]: https://images.idgesg.net/images/article/2020/05/nw_how_iot_works_diagram-100840757-orig.jpg +[8]: https://www.networkworld.com/article/3176091/10-killer-raspberry-pi-projects-collection-1.html +[9]: https://www.networkworld.com/article/3075360/arduino-targets-the-internet-of-things-with-primo-board.html +[10]: https://www.networkworld.com/article/3258812/the-future-of-iot-device-management.html +[11]: https://www.networkworld.com/article/3235124/internet-of-things-definitions-a-handy-guide-to-essential-iot-terms.html +[12]: https://www.networkworld.com/article/3291778/what-s-so-special-about-5g-and-iot.html +[13]: https://images.idgesg.net/images/article/2017/09/nw_how_edge_computing_works_diagram_1400x1717-100736111-orig.jpg +[14]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[15]: https://cloud.google.com/solutions/iot +[16]: https://azure.microsoft.com/en-us/overview/iot/ +[17]: https://aws.amazon.com/iot/ +[18]: https://www.networkworld.com/article/3336166/why-are-iot-platforms-so-darn-confusing.html +[19]: https://blogs.oracle.com/bigdata/how-big-data-powers-the-internet-of-things +[20]: https://www.softwareadvice.com/resources/iot-data-analytics-use-cases/ +[21]: https://www.cnn.com/2020/04/04/tech/location-tracking-florida-coronavirus/index.html +[22]: https://www.networkworld.com/article/3311919/iot-analytics-guide-what-to-expect-from-internet-of-things-data.html +[23]: https://www.networkworld.com/article/3396230/when-iot-systems-fail-the-risk-of-having-bad-iot-data.html +[24]: https://www.networkworld.com/article/3449243/watson-iot-chief-ai-can-broaden-iot-services.html +[25]: https://www.networkworld.com/article/3532094/ai-everywhere-iot-chips-coming-from-arm.html +[26]: https://www.iotforall.com/4-unlikely-industries-iot-changing/ +[27]: https://www.networkworld.com/article/3396128/the-state-of-enterprise-iot-companies-want-solutions-for-these-4-areas.html From 5cf9b279af8e1193026c092957167aa197021ff7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:47:41 +0800 Subject: [PATCH 2186/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200514=20How?= =?UTF-8?q?=20IoT=20will=20rescue=20aviation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200514 How IoT will rescue aviation.md --- .../20200514 How IoT will rescue aviation.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/talk/20200514 How IoT will rescue aviation.md diff --git a/sources/talk/20200514 How IoT will rescue aviation.md b/sources/talk/20200514 How IoT will rescue aviation.md new file mode 100644 index 0000000000..3dc9570dff --- /dev/null +++ b/sources/talk/20200514 How IoT will rescue aviation.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How IoT will rescue aviation) +[#]: via: (https://www.networkworld.com/article/3543318/how-iot-will-rescue-aviation.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How IoT will rescue aviation +====== +European airplane maker Airbus is one company exploring virus-spotting IoT sensors in an attempt to keep COVID-19-infected passengers off planes. +[Stéphan Valentin][1] [(CC0)][2] + +A biotech company that develops sensors to detect explosives and other chemicals on planes and in airports is teaming up with Airbus to create a sensor that could detect passengers who are positive for COVID-19. + +California-based Koniku and Airbus, which have been working since 2017 on contactless equipment that sniffs out chemicals, are trying to adapt that technology to sniff out pathogens, says Osh Agabi, founder and CEO of Koniku, [in a blog post][3]. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +They hope to identify odors in breath or sweat that are chemical markers indicating the presence of COVID-19 infection. "Most infections and diseases cause slight changes to the composition of our breath and sweat, which then produce distinct odors," Agabi writes. "If we can detect those odors, we can detect the presence of those infections." + +The companies hope to identify markers specific to the novel coronavirus and an IOT sensor equipped with genetically engineered odoroant receptors that can detect them. "Those receptors screen molecules in the air and produce a signal when they come into contact with the molecular compounds of the hazard or threat that they have been programmed to detect," he writes. + +He says that passengers would be screened by walking through an enclosed corridor where the sensors are deployed. "By programming the DNA of the cells that make up these receptors to react to the compounds that appear in infected people’s breath or sweat, we believe we will be able to quickly and reliably screen for COVID-19 and determine whether a person is infected," he writes. + +Other types of contactless detectors are already in use, including elevated-skin-temperature (EST) cameras. + +Italy's main airport, Leonardo da Vinci, acquired three thermal-imaging helmets with the intent to use them to spot persons with fevers. The airport already had fixed thermal scanners and has ordered more. Passengers detected with potentially high temperatures are made to take a further medical exam, [according to regional publication Fiumicino Online][5]. + +KC Wearable, the Shenzhen, China, company that makes the helmets, says they can be worn by staff and used at a distance from passengers. + +FLIR Systems, which makes thermal cameras, says there’s been increased demand for them to be used in EST screening, the company says in this month in its [financial results][6]. + +"Although these thermal cameras cannot detect or diagnose any type of medical condition, the cameras do serve as an effective tool to identify elevated skin temperatures," it says. + +"Many companies are looking to install this technology in their facilities in anticipation of lifting the shelter-in-place orders," FLIR CEO Jim Cannon [said in an earnings call][7] this month. General Motors is one of them, [according to Reuters][8]. + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543318/how-iot-will-rescue-aviation.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/s7NGQU2Nt8k +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.linkedin.com/pulse/what-happens-when-airports-open-back-up-osh-agabi/?src=aff-lilpar&veh=aff_src.aff-lilpar_c.partners_pkw.10078_plc.Skimbit%20Ltd._pcrid.449670_learning&trk=aff_src.aff-lilpar_c.partners_pkw.10078_plc.Skimbit%20Ltd._pcrid.449670_learning&clickid=WNmzMlyalxyOUI7wUx0Mo34HUkiwwpy%3APQ3X1Y0&irgwc=1 +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.fiumicino-online.it/articoli/cronaca-2/fase-2-all-aeroporto-di-fiumicino-lo-smart-helmet-per-controllare-la-febbre-a-distanza +[6]: https://flir.gcs-web.com/news-releases/news-release-details/flir-systems-announces-first-quarter-2020-financial-results +[7]: https://www.fool.com/earnings/call-transcripts/2020/05/06/flir-systems-inc-flir-q1-2020-earnings-call-transc.aspx +[8]: https://uk.reuters.com/article/us-flir-systems-gm/general-motors-taps-flir-systems-for-fever-check-cameras-at-factories-idUKKBN22J02B +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world From 055509370cbeeb236eb94b544780ab6bfc110e49 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:47:53 +0800 Subject: [PATCH 2187/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200514=20Ethe?= =?UTF-8?q?rnet=20Alliance=20study=20finds=20Power=20over=20Ethernet=20iss?= =?UTF-8?q?ues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md --- ... study finds Power over Ethernet issues.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md diff --git a/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md b/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md new file mode 100644 index 0000000000..983c11dac6 --- /dev/null +++ b/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ethernet Alliance study finds Power over Ethernet issues) +[#]: via: (https://www.networkworld.com/article/3543258/ethernet-alliance-study-finds-power-over-ethernet-issues.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Ethernet Alliance study finds Power over Ethernet issues +====== +Reliability, connection issues, failure to deliver power traced to interoperability issues with Power over Ethernet. +Martyn Williams/IDGNS + +Four out five users experience challenges with power over Ethernet (PoE) deployments, according to a new survey of nearly 800 Ethernet designers, manufacturers, resellers, system integrators, network operators and others. + +Conducted by the Ethernet Alliance in January, the study  found a number of key PoE insights, including: + + * Four out of five users experienced issues, including support, reliability, or connection challenges. + * The top three PoE installations are cameras and phones, as well as computing and storage devices; + * Of customers planning to implement PoE 63% said they would need 30w; 47% would need between 30-60w and 27% need greater than 60w. + + + +**[ Now see [7 free network tools you must have][1]. ]** + +With the global market projected to grow to $2 billion by 2025, PoE remains a wellspring of lucrative opportunities for designers, systems integrators, and solutions providers, David Tremblay, chair of the alliance's PoE Subcommittee, and system architect for Aruba, said in a statement. “Despite this good news, there are significant challenges that could threaten PoE’s growing adoption.” + +According to the survey those chief PoE challenges include, vendor support, unreliable power or operation, long repair times, and first-time connection issues. + +The Alliance reported that while 78% of respondents experienced difficulties with PoE deployments, 72% expect improvement with products certified through the Ethernet Alliance’s [PoE Certification Program][2]. The study found 84% said they expect certified PoE devices would be more likely to work the first time, and 85% expect those devices to be more reliable. + +“Lacking a registered trademark, the use of the term ‘PoE’ is not formally regulated, allowing any vendor to freely describe products and solutions as PoE-enabled. Additionally, terminologies such as ‘PoE+’, as well as non-standard PoE implementations are causing confusion with device interoperability among technicians, designers, and end users,” the Alliance stated. + +[Experts say][3] the single greatest challenge for PoE  is assuring interoperability.  Multivendor interoperability is Ethernet’s hallmark and it's an important consideration for consumers who want to know the gear will just work, while industry players need a way to find new partnership opportunities with companies offering certified equipment, the Dell’Oro Group said. + +“With the diversity of application, come interoperability problems which dictate the need for testing and certification,” said Sameh Boujelbene, Senior Research Director for Ethernet Switch market research at Dell’Oro. + +Certified Ethernet Alliance products range from component level Ethernet evaluation boards, to power-sourcing equipment, enterprise switches, and adapters. + +Ultimately the Ethernet Alliance’s Power over Ethernet (PoE) Certification Program is the place customers should look to enable faster PoE installations with zero interoperability issues, Tremblay said. + +A number of key Ethernet vendors including Cisco, Hewlett Packard Enterprise, Huawei, Analog Devices, Texas Instruments, Microsemi and others are part of the certification program. + +Details about certified products are available via the [program’s public registry][4]. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543258/ethernet-alliance-study-finds-power-over-ethernet-issues.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/2825879/7-free-open-source-network-monitoring-tools.html +[2]: https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbit.ly%2FEA_PoECertification&data=02%7C01%7C%7Ca67fc55074c748affa8408d7f74fc98e%7C3aedb78fc8e04326888a74230d1978ff%7C0%7C0%7C637249794373724526&sdata=2QDd6oO2Yu6EiCj6m7i%2BtbVJD1wHxmNwtDr2oMe9TgQ%3D&reserved=0 +[3]: https://www.networkworld.com/article/2328615/the-power-over-ethernet.html +[4]: https://ea-poe-cert.iol.unh.edu/?utm_source=General%20Distribution&utm_medium=Press%20Release&utm_campaign=October%20PoE%20Certification%20Press%20Release +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 5f65b5dc3c03bad96a357cfd6980b96b18ca5de4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:51:55 +0800 Subject: [PATCH 2188/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190331=20Code?= =?UTF-8?q?cademy=20vs.=20The=20BBC=20Micro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20190331 Codecademy vs. The BBC Micro.md --- .../20190331 Codecademy vs. The BBC Micro.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/talk/20190331 Codecademy vs. The BBC Micro.md diff --git a/sources/talk/20190331 Codecademy vs. The BBC Micro.md b/sources/talk/20190331 Codecademy vs. The BBC Micro.md new file mode 100644 index 0000000000..a85aadad46 --- /dev/null +++ b/sources/talk/20190331 Codecademy vs. The BBC Micro.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Codecademy vs. The BBC Micro) +[#]: via: (https://twobithistory.org/2019/03/31/bbc-micro.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +Codecademy vs. The BBC Micro +====== + +In the late 1970s, the computer, which for decades had been a mysterious, hulking machine that only did the bidding of corporate overlords, suddenly became something the average person could buy and take home. An enthusiastic minority saw how great this was and rushed to get a computer of their own. For many more people, the arrival of the microcomputer triggered helpless anxiety about the future. An ad from a magazine at the time promised that a home computer would “give your child an unfair advantage in school.” It showed a boy in a smart blazer and tie eagerly raising his hand to answer a question, while behind him his dim-witted classmates look on sullenly. The ad and others like it implied that the world was changing quickly and, if you did not immediately learn how to use one of these intimidating new devices, you and your family would be left behind. + +In the UK, this anxiety metastasized into concern at the highest levels of government about the competitiveness of the nation. The 1970s had been, on the whole, an underwhelming decade for Great Britain. Both inflation and unemployment had been high. Meanwhile, a series of strikes put London through blackout after blackout. A government report from 1979 fretted that a failure to keep up with trends in computing technology would “add another factor to our poor industrial performance.”[1][1] The country already seemed to be behind in the computing arena—all the great computer companies were American, while integrated circuits were being assembled in Japan and Taiwan. + +In an audacious move, the BBC, a public service broadcaster funded by the government, decided that it would solve Britain’s national competitiveness problems by helping Britons everywhere overcome their aversion to computers. It launched the _Computer Literacy Project_, a multi-pronged educational effort that involved several TV series, a few books, a network of support groups, and a specially built microcomputer known as the BBC Micro. The project was so successful that, by 1983, an editor for BYTE Magazine wrote, “compared to the US, proportionally more of Britain’s population is interested in microcomputers.”[2][2] The editor marveled that there were more people at the Fifth Personal Computer World Show in the UK than had been to that year’s West Coast Computer Faire. Over a sixth of Great Britain watched an episode in the first series produced for the _Computer Literacy Project_ and 1.5 million BBC Micros were ultimately sold.[3][3] + +[An archive][4] containing every TV series produced and all the materials published for the _Computer Literacy Project_ was put on the web last year. I’ve had a huge amount of fun watching the TV series and trying to imagine what it would have been like to learn about computing in the early 1980s. But what’s turned out to be more interesting is how computing was _taught_. Today, we still worry about technology leaving people behind. Wealthy tech entrepreneurs and governments spend lots of money trying to teach kids “to code.” We have websites like Codecademy that make use of new technologies to teach coding interactively. One would assume that this approach is more effective than a goofy ’80s TV series. But is it? + +### The Computer Literacy Project + +The microcomputer revolution began in 1975 with the release of [the Altair 8800][5]. Only two years later, the Apple II, TRS-80, and Commodore PET had all been released. Sales of the new computers exploded. In 1978, the BBC explored the dramatic societal changes these new machines were sure to bring in a documentary called “Now the Chips Are Down.” + +The documentary was alarming. Within the first five minutes, the narrator explains that microelectronics will “totally revolutionize our way of life.” As eerie synthesizer music plays, and green pulses of electricity dance around a magnified microprocessor on screen, the narrator argues that the new chips are why “Japan is abandoning its ship building, and why our children will grow up without jobs to go to.” The documentary goes on to explore how robots are being used to automate car assembly and how the European watch industry has lost out to digital watch manufacturers in the United States. It castigates the British government for not doing more to prepare the country for a future of mass unemployment. + +The documentary was supposedly shown to the British Cabinet.[4][6] Several government agencies, including the Department of Industry and the Manpower Services Commission, became interested in trying to raise awareness about computers among the British public. The Manpower Services Commission provided funds for a team from the BBC’s education division to travel to Japan, the United States, and other countries on a fact-finding trip. This research team produced a report that cataloged the ways in which microelectronics would indeed mean major changes for industrial manufacturing, labor relations, and office work. In late 1979, it was decided that the BBC should make a ten-part TV series that would help regular Britons “learn how to use and control computers and not feel dominated by them.”[5][7] The project eventually became a multimedia endeavor similar to the _Adult Literacy Project_, an earlier BBC undertaking involving both a TV series and supplemental courses that helped two million people improve their reading. + +The producers behind the _Computer Literacy Project_ were keen for the TV series to feature “hands-on” examples that viewers could try on their own if they had a microcomputer at home. These examples would have to be in BASIC, since that was the language (really the entire shell) used on almost all microcomputers. But the producers faced a thorny problem: Microcomputer manufacturers all had their own dialects of BASIC, so no matter which dialect they picked, they would inevitably alienate some large fraction of their audience. The only real solution was to create a new BASIC—BBC BASIC—and a microcomputer to go along with it. Members of the British public would be able to buy the new microcomputer and follow along without worrying about differences in software or hardware. + +The TV producers and presenters at the BBC were not capable of building a microcomputer on their own. So they put together a specification for the computer they had in mind and invited British microcomputer companies to propose a new machine that met the requirements. The specification called for a relatively powerful computer because the BBC producers felt that the machine should be able to run real, useful applications. Technical consultants for the _Computer Literacy Project_ also suggested that, if it had to be a BASIC dialect that was going to be taught to the entire nation, then it had better be a good one. (They may not have phrased it exactly that way, but I bet that’s what they were thinking.) BBC BASIC would make up for some of BASIC’s usual shortcomings by allowing for recursion and local variables.[6][8] + +The BBC eventually decided that a Cambridge-based company called Acorn Computers would make the BBC Micro. In choosing Acorn, the BBC passed over a proposal from Clive Sinclair, who ran a company called Sinclair Research. Sinclair Research had brought mass-market microcomputing to the UK in 1980 with the Sinclair ZX80. Sinclair’s new computer, the ZX81, was cheap but not powerful enough for the BBC’s purposes. Acorn’s new prototype computer, known internally as the Proton, would be more expensive but more powerful and expandable. The BBC was impressed. The Proton was never marketed or sold as the Proton because it was instead released in December 1981 as the BBC Micro, also affectionately called “The Beeb.” You could get a 16k version for £235 and a 32k version for £335. + +In 1980, Acorn was an underdog in the British computing industry. But the BBC Micro helped establish the company’s legacy. Today, the world’s most popular microprocessor instruction set is the ARM architecture. “ARM” now stands for “Advanced RISC Machine,” but originally it stood for “Acorn RISC Machine.” ARM Holdings, the company behind the architecture, was spun out from Acorn in 1990. + +![Picture of the BBC Micro.][9] _A bad picture of a BBC Micro, taken by me at the Computer History Museum +in Mountain View, California._ + +### The Computer Programme + +A dozen different TV series were eventually produced as part of the _Computer Literacy Project_, but the first of them was a ten-part series known as _The Computer Programme_. The series was broadcast over ten weeks at the beginning of 1982. A million people watched each week-night broadcast of the show; a quarter million watched the reruns on Sunday and Monday afternoon. + +The show was hosted by two presenters, Chris Serle and Ian McNaught-Davis. Serle plays the neophyte while McNaught-Davis, who had professional experience programming mainframe computers, plays the expert. This was an inspired setup. It made for [awkward transitions][10]—Serle often goes directly from a conversation with McNaught-Davis to a bit of walk-and-talk narration delivered to the camera, and you can’t help but wonder whether McNaught-Davis is still standing there out of frame or what. But it meant that Serle could voice the concerns that the audience would surely have. He can look intimidated by a screenful of BASIC and can ask questions like, “What do all these dollar signs mean?” At several points during the show, Serle and McNaught-Davis sit down in front of a computer and essentially pair program, with McNaught-Davis providing hints here and there while Serle tries to figure it out. It would have been much less relatable if the show had been presented by a single, all-knowing narrator. + +The show also made an effort to demonstrate the many practical applications of computing in the lives of regular people. By the early 1980s, the home computer had already begun to be associated with young boys and video games. The producers behind _The Computer Programme_ sought to avoid interviewing “impressively competent youngsters,” as that was likely “to increase the anxieties of older viewers,” a demographic that the show was trying to attract to computing.[7][11] In the first episode of the series, Gill Nevill, the show’s “on location” reporter, interviews a woman that has bought a Commodore PET to help manage her sweet shop. The woman (her name is Phyllis) looks to be 60-something years old, yet she has no trouble using the computer to do her accounting and has even started using her PET to do computer work for other businesses, which sounds like the beginning of a promising freelance career. Phyllis says that she wouldn’t mind if the computer work grew to replace her sweet shop business since she enjoys the computer work more. This interview could instead have been an interview with a teenager about how he had modified _Breakout_ to be faster and more challenging. But that would have been encouraging to almost nobody. On the other hand, if Phyllis, of all people, can use a computer, then surely you can too. + +While the show features lots of BASIC programming, what it really wants to teach its audience is how computing works in general. The show explains these general principles with analogies. In the second episode, there is an extended discussion of the Jacquard loom, which accomplishes two things. First, it illustrates that computers are not based only on magical technology invented yesterday—some of the foundational principles of computing go back two hundred years and are about as simple as the idea that you can punch holes in card to control a weaving machine. Second, the interlacing of warp and weft threads is used to demonstrate how a binary choice (does the weft thread go above or below the warp thread?) is enough, when repeated over and over, to produce enormous variation. This segues, of course, into a discussion of how information can be stored using binary digits. + +Later in the show there is a section about a steam organ that plays music encoded in a long, segmented roll of punched card. This time the analogy is used to explain subroutines in BASIC. Serle and McNaught-Davis lay out the whole roll of punched card on the floor in the studio, then point out the segments where it looks like a refrain is being repeated. McNaught-Davis explains that a subroutine is what you would get if you cut out those repeated segments of card and somehow added an instruction to go back to the original segment that played the refrain for the first time. This is a brilliant explanation and probably one that stuck around in people’s minds for a long time afterward. + +I’ve picked out only a few examples, but I think in general the show excels at demystifying computers by explaining the principles that computers rely on to function. The show could instead have focused on teaching BASIC, but it did not. This, it turns out, was very much a conscious choice. In a retrospective written in 1983, John Radcliffe, the executive producer of the _Computer Literacy Project_, wrote the following: + +> If computers were going to be as important as we believed, some genuine understanding of this new subject would be important for everyone, almost as important perhaps as the capacity to read and write. Early ideas, both here and in America, had concentrated on programming as the main route to computer literacy. However, as our thinking progressed, although we recognized the value of “hands-on” experience on personal micros, we began to place less emphasis on programming and more on wider understanding, on relating micros to larger machines, encouraging people to gain experience with a range of applications programs and high-level languages, and relating these to experience in the real world of industry and commerce…. Our belief was that once people had grasped these principles, at their simplest, they would be able to move further forward into the subject. + +Later, Radcliffe writes, in a similar vein: + +> There had been much debate about the main explanatory thrust of the series. One school of thought had argued that it was particularly important for the programmes to give advice on the practical details of learning to use a micro. But we had concluded that if the series was to have any sustained educational value, it had to be a way into the real world of computing, through an explanation of computing principles. This would need to be achieved by a combination of studio demonstration on micros, explanation of principles by analogy, and illustration on film of real-life examples of practical applications. Not only micros, but mini computers and mainframes would be shown. + +I love this, particularly the part about mini-computers and mainframes. The producers behind _The Computer Programme_ aimed to help Britons get situated: Where had computing been, and where was it going? What can computers do now, and what might they do in the future? Learning some BASIC was part of answering those questions, but knowing BASIC alone was not seen as enough to make someone computer literate. + +### Computer Literacy Today + +If you google “learn to code,” the first result you see is a link to Codecademy’s website. If there is a modern equivalent to the _Computer Literacy Project_, something with the same reach and similar aims, then it is Codecademy. + +“Learn to code” is Codecademy’s tagline. I don’t think I’m the first person to point this out—in fact, I probably read this somewhere and I’m now ripping it off—but there’s something revealing about using the word “code” instead of “program.” It suggests that the important thing you are learning is how to decode the code, how to look at a screen’s worth of Python and not have your eyes glaze over. I can understand why to the average person this seems like the main hurdle to becoming a professional programmer. Professional programmers spend all day looking at computer monitors covered in gobbledygook, so, if I want to become a professional programmer, I better make sure I can decipher the gobbledygook. But dealing with syntax is not the most challenging part of being a programmer, and it quickly becomes almost irrelevant in the face of much bigger obstacles. Also, armed only with knowledge of a programming language’s syntax, you may be able to _read_ code but you won’t be able to _write_ code to solve a novel problem. + +I recently went through Codecademy’s “Code Foundations” course, which is the course that the site recommends you take if you are interested in programming (as opposed to web development or data science) and have never done any programming before. There are a few lessons in there about the history of computer science, but they are perfunctory and poorly researched. (Thank heavens for [this noble internet vigilante][12], who pointed out a particularly egregious error.) The main focus of the course is teaching you about the common structural elements of programming languages: variables, functions, control flow, loops. In other words, the course focuses on what you would need to know to start seeing patterns in the gobbledygook. + +To be fair to Codecademy, they offer other courses that look meatier. But even courses such as their “Computer Science Path” course focus almost exclusively on programming and concepts that can be represented in programs. One might argue that this is the whole point—Codecademy’s main feature is that it gives you little interactive programming lessons with automated feedback. There also just isn’t enough room to cover more because there is only so much you can stuff into somebody’s brain in a little automated lesson. But the producers at the BBC tasked with kicking off the _Computer Literacy Project_ also had this problem; they recognized that they were limited by their medium and that “the amount of learning that would take place as a result of the television programmes themselves would be limited.”[8][13] With similar constraints on the volume of information they could convey, they chose to emphasize general principles over learning BASIC. Couldn’t Codecademy replace a lesson or two with an interactive visualization of a Jacquard loom weaving together warp and weft threads? + +I’m banging the drum for “general principles” loudly now, so let me just explain what I think they are and why they are important. There’s a book by J. Clark Scott about computers called _But How Do It Know?_ The title comes from the anecdote that opens the book. A salesman is explaining to a group of people that a thermos can keep hot food hot and cold food cold. A member of the audience, astounded by this new invention, asks, “But how do it know?” The joke of course is that the thermos is not perceiving the temperature of the food and then making a decision—the thermos is just constructed so that cold food inevitably stays cold and hot food inevitably stays hot. People anthropomorphize computers in the same way, believing that computers are digital brains that somehow “choose” to do one thing or another based on the code they are fed. But learning a few things about how computers work, even at a rudimentary level, takes the homunculus out of the machine. That’s why the Jacquard loom is such a good go-to illustration. It may at first seem like an incredible device. It reads punch cards and somehow “knows” to weave the right pattern! The reality is mundane: Each row of holes corresponds to a thread, and where there is a hole in that row the corresponding thread gets lifted. Understanding this may not help you do anything new with computers, but it will give you the confidence that you are not dealing with something magical. We should impart this sense of confidence to beginners as soon as we can. + +Alas, it’s possible that the real problem is that nobody wants to learn about the Jacquard loom. Judging by how Codecademy emphasizes the professional applications of what it teaches, many people probably start using Codecademy because they believe it will help them “level up” their careers. They believe, not unreasonably, that the primary challenge will be understanding the gobbledygook, so they want to “learn to code.” And they want to do it as quickly as possible, in the hour or two they have each night between dinner and collapsing into bed. Codecademy, which after all is a business, gives these people what they are looking for—not some roundabout explanation involving a machine invented in the 18th century. + +The _Computer Literacy Project_, on the other hand, is what a bunch of producers and civil servants at the BBC thought would be the best way to educate the nation about computing. I admit that it is a bit elitist to suggest we should laud this group of people for teaching the masses what they were incapable of seeking out on their own. But I can’t help but think they got it right. Lots of people first learned about computing using a BBC Micro, and many of these people went on to become successful software developers or game designers. [As I’ve written before][14], I suspect learning about computing at a time when computers were relatively simple was a huge advantage. But perhaps another advantage these people had is shows like _The Computer Programme_, which strove to teach not just programming but also how and why computers can run programs at all. After watching _The Computer Programme_, you may not understand all the gobbledygook on a computer screen, but you don’t really need to because you know that, whatever the “code” looks like, the computer is always doing the same basic thing. After a course or two on Codecademy, you understand some flavors of gobbledygook, but to you a computer is just a magical machine that somehow turns gobbledygook into running software. That isn’t computer literacy. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][15] on Twitter or subscribe to the [RSS feed][16] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> FINALLY some new damn content, amirite? +> +> Wanted to write an article about how Simula bought us object-oriented programming. It did that, but early Simula also flirted with a different vision for how OOP would work. Wrote about that instead! +> +> — TwoBitHistory (@TwoBitHistory) [February 1, 2019][17] + + 1. Robert Albury and David Allen, Microelectronics, report (1979). [↩︎][18] + + 2. Gregg Williams, “Microcomputing, British Style”, Byte Magazine, 40, January 1983, accessed on March 31, 2019, . [↩︎][19] + + 3. John Radcliffe, “Toward Computer Literacy,” Computer Literacy Project Achive, 42, accessed March 31, 2019, [https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards Computer Literacy.pdf][20]. [↩︎][21] + + 4. David Allen, “About the Computer Literacy Project,” Computer Literacy Project Archive, accessed March 31, 2019, . [↩︎][22] + + 5. ibid. [↩︎][23] + + 6. Williams, 51. [↩︎][24] + + 7. Radcliffe, 11. [↩︎][25] + + 8. Radcliffe, 5. [↩︎][26] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2019/03/31/bbc-micro.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: tmp.05mfBL4kP8#fn:1 +[2]: tmp.05mfBL4kP8#fn:2 +[3]: tmp.05mfBL4kP8#fn:3 +[4]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/ +[5]: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html +[6]: tmp.05mfBL4kP8#fn:4 +[7]: tmp.05mfBL4kP8#fn:5 +[8]: tmp.05mfBL4kP8#fn:6 +[9]: https://twobithistory.org/images/beeb.jpg +[10]: https://twitter.com/TwoBitHistory/status/1112372000742404098 +[11]: tmp.05mfBL4kP8#fn:7 +[12]: https://twitter.com/TwoBitHistory/status/1111305774939234304 +[13]: tmp.05mfBL4kP8#fn:8 +[14]: https://twobithistory.org/2018/09/02/learning-basic.html +[15]: https://twitter.com/TwoBitHistory +[16]: https://twobithistory.org/feed.xml +[17]: https://twitter.com/TwoBitHistory/status/1091148050221944832?ref_src=twsrc%5Etfw +[18]: tmp.05mfBL4kP8#fnref:1 +[19]: tmp.05mfBL4kP8#fnref:2 +[20]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards%20Computer%20Literacy.pdf +[21]: tmp.05mfBL4kP8#fnref:3 +[22]: tmp.05mfBL4kP8#fnref:4 +[23]: tmp.05mfBL4kP8#fnref:5 +[24]: tmp.05mfBL4kP8#fnref:6 +[25]: tmp.05mfBL4kP8#fnref:7 +[26]: tmp.05mfBL4kP8#fnref:8 From 3c52822b21e10a39f37ae25fb7cc4a902cfc9a70 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 May 2020 19:52:22 +0800 Subject: [PATCH 2189/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200421=20What?= =?UTF-8?q?=20is=20a=20High=20Traffic=20Website=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200421 What is a High Traffic Website.md --- ...20200421 What is a High Traffic Website.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 sources/talk/20200421 What is a High Traffic Website.md diff --git a/sources/talk/20200421 What is a High Traffic Website.md b/sources/talk/20200421 What is a High Traffic Website.md new file mode 100644 index 0000000000..d9207af7dd --- /dev/null +++ b/sources/talk/20200421 What is a High Traffic Website.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is a High Traffic Website?) +[#]: via: (https://theartofmachinery.com/2020/04/21/what_is_high_traffic.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +What is a High Traffic Website? +====== + +Terms like “high traffic” are hazardous when designing online services because salespeople, business analysts and engineers all have different perspectives about what they mean. If we’re talking about, say, a high-stakes online poker room, then “high traffic” for the business side will be very low compared to what it is for the technical side. However, all these people will be in a meeting room together making decisions, using the same words to mean different things. It’s obvious how that can lead to bad (and sometimes expensive) choices. + +A lot of my day job is talking to business stakeholders and figuring out the technical solutions they need, so this is a problem I have to deal with. So I’ve got my own purely technical way to think about traffic levels for online services. + +### Scalability vs performance + +First, let’s be clear about two concepts that come up a lot in online service design. + +For online services, performance is all about how well (usually how fast) the system can handle a single request or unit of work. Scalability is about the volume or size of work that can be handled. For online services, scalability is usually about the number of user requests that can be handled within a timeframe, while for batch jobs we typically care about the size of the dataset we can process. Sometimes we want the system capacity to grow and shrink based on demand, but sometimes we don’t care as long as we can handle the full range of workloads we expect. + +Scalability and performance often get confused because they commonly work together. For example, suppose you have some online service using a slow algorithm and you improve perfomance by replacing the algorithm with another that does the same job with less work. Primarily that’s a performance gain, but as long as the new algorithm doesn’t use more memory or something, you’ll be able to handle more requests in the same time. + +There’s a counterexample I’ve discussed before: [internal caches versus external cache servers][1]. Using an external cache server like Redis means your app has to make network calls to do cache lookups, so it has performance overhead. On the other hand, if your app is replicated across multiple machines, a shared, external cache is more effective than a per-app, in-memory cache. The external cache is more scalable. + +### Response time + +When designing systems, it’s helpful to start by thinking about latency or response time requirements, even if we have to make some up and revise them later. Adding more RAM, more caches, more machines or more disk can solve a lot of problems, but latency problems tend to be fundamental to the system design. For example, suppose you’re designing an online game, and you want latencies of under 100ms for all users. Straight away, the speed of light limit means you can’t have one central server supporting a global game, regardless of whatever algorithms or hardware you throw at the problem. + +There’s another reason it’s useful to focus on server response time in practice. If you have a simple, single-function website, such as a mortgage calculator, then the response time can be estimated based on technical things like the hardware specs and code quality. But that’s not how typical online services are built. The online service industry tends to emphasise adding more and more features for less development cost. That means [webpages tend to expand in complexity][2] using the easiest code possible, and only get optimised when they become too slow and users churn. Even the typical mortgage calculator site will end up bloated with advertising and tracking functionality. So the response time of a website in my day job depends mostly on the client’s budget and priorities, not on technical factors, regardless of whether it’s an ecommerce site or a cutting-edge data application. + +### Looking at a single worker + +Okay, so now imagine a simple web app that gets about one request an hour that takes about 5s to process (ignoring static assets because they’re not the bottleneck). That app has an obvious performance problem because many users will give up before 5s. But there’s no scaling problem because the server will practically never hit capacity limits and drop requests. Even if traffic rises, the performance problem is the bottleneck that takes priority over any hypothetical scalability problems. + +That’s a simple insight that we can take further. Lets say we target 100ms per request, and our simple web app processes requests one at a time serially (i.e., no scaling). With 86,400 seconds in a day, a naïve calculation says we can handle 86,400 / 0.1 = 864,000 requests per day before we have scaling problems. + +Of course, the real world isn’t that simple. + +First, there will be slower and faster requests, and [requests that arrive at random won’t balance themselves nicely][3]. They’ll come in clusters that fill up queues, and the backlog will cause large spikes in response time. (There’s a handy rule that says [if you want to keep response time under control, you should target about 80% usage of theoretical total capacity][4].) + +Then there’s diurnal variation. Some local websites get nearly all of their traffic during business hours, or about a third of the day. Even a very global website can easily have 2-3 times more traffic at peak than at trough because populations aren’t distributed evenly around the world (a lot of internet users live in East Asia and North/South America, but not in the huge Pacific ocean). The actual ratio depends on many factors that are hard to predict. + +But even if we can’t easily get exact capacity estimates, this simple model is the justification for splitting websites into three traffic levels. + +### The three traffic levels + +The first level is for sites that get well under 100k dynamic requests a day. Most websites are at this level, and a lot will stay that way while being totally useful and successful. They can also pose complex technical challenges, both for performance and functionality, and a lot of my work is on sites this size. But they don’t have true scalability problems (as opposed to problems that can be solved purely by improving performance). + +If a website gets bigger, it can get into the “growing pains” level, which is roughly around 100k-1M dynamic requests a day. This is where scalability problems start to appear. Often the site is at least a bit scalable (thanks to, e.g., async or multithreaded programming), but Web developers scaling a site through this level keep discovering new surprise pain points. Things that a smaller site can get away with start turning into real problems in this level. Some of the biggest challenges are actually sociotechnical, with the team that builds and manages the site needing to learn to think about it in new ways. + +The next level is after leaving the 1M dynamic requests a day boundary behind. I think of sites at this level as being high traffic. Let me stress that that’s a technical line, not a value judgment or ego statement. The world’s biggest websites are orders of magnitude bigger than that, while most of the world’s useful websites are smaller. But the line matters because you simply can’t run a site at that scale without treating it like a high traffic site. You can get away with it at low traffic levels, you can fumble through it at the growing pains level, but at high traffic levels you just have to work differently. Coincidentally, it’s around this traffic level where it makes more sense to talk about requests per second than requests per day. + +By the way, don’t focus too much on the exact traffic levels above. They’re very rough and honestly I picked them because they’re convenient round numbers that happen to be reasonable for typical websites. The real values depend on the target response time and all the other factors, of course. What I’m trying to explain is 1) that these levels exist, 2) why they exist and 3) what to expect if you’re trying to grow an online service. + +### Going to more levels + +What happens with sites that get even bigger? Once the problems at one set of bottlenecks are fixed, the site should just scale until it hits a new set of bottlenecks, either because the application has changed significantly, or just because of a very large increase in traffic. For example, once the application servers are scalable, the next scaling bottleneck could be database reads, followed by database writes. However, the basic ideas are the same, just applied to a different part of the system. + +Working on a very high-traffic site can be a lot less “exciting” than working on a plain high-traffic site, simply because most major problems need to be solved to get to very high traffic levels in the first place. + +### Scaling when you don’t have scaling problems + +Some developers try to make online services scalable long before they have any scalability problems on the horizon, usually by adding exotic databases or broker servers or something. In particular, startup founders are often especially concerned that their technical assets might not scale to meet their business ambitions. It’s understandable, but it’s a dangerous trap for a couple of reasons. + +One is that Paul Graham’s classic [Do Things That Don’t Scale][5] essay applies to your technology stack, too. You can’t beat bigger companies with scale, but your competitive advantage is that you can choose to _not_ solve the scalability problems that bigger companies are forced to with every step they take. That’s what makes smaller companies agile, and a startup that worries too much about scalability is just a big enterprise without the big to back it up. + +The other problem is that premature scalability solutions can easily backfire. If you don’t have real scalability problems to test your solutions against, it’s hard to be sure you’re correctly solving a real problem. In fact, rapidly growing services tend to change requirements rapidly, too, so the risk of a scalability “solution” turning into technical debt is high. If you keep trying to add scalability to a part of the system that’s already scalable enough, chances are the next scaling bottleneck will appear somewhere else, anyway. + +Architectures that err on the side of too simple are easier to scale in the long run than architectures that are too complex. + +To be more concrete, I personally can’t think of a low-traffic online service I’ve worked on that couldn’t have been implemented cleanly enough using a simple, monolithic web app (in whatever popular language) in front of [a boring relational database][6], maybe with a search index like Xapian or Elasticsearch. [Many major websites aren’t much different from that.][7] It’s not the only valid architecture, but it’s a tried-and-tested one. + +Having said all that, sometimes low-traffic sites need things that are sometimes sold as scalability solutions. For example, replicating an app behind a load balancer can help you deploy whenever you want without downtime. One fintech service I worked on split credit card code into its own service, making PCI DSS compliance simpler. In all these cases there’s a clear problem other than scalability that’s being solved, and that’s what avoids overengineering. + +I often wish I had a systematic way to just figure out all the technical requirements for an online service in my head. But the real world is complicated and messy, and sometimes the only practical way to be sure is to experiment. However, every piece of software starts with ideas, and this is how I think about scalability for online service ideas during the early design phase. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/04/21/what_is_high_traffic.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://theartofmachinery.com/2016/07/30/server_caching_architectures.html +[2]: https://mobiforge.com/research-analysis/the-web-is-doom +[3]: https://theartofmachinery.com/2020/01/27/systems_programming_probability.html +[4]: https://www.johndcook.com/blog/2009/01/30/server-utilization-joel-on-queuing/ +[5]: http://www.paulgraham.com/ds.html +[6]: https://theartofmachinery.com/2017/10/28/rdbs_considered_useful.html +[7]: https://nickcraver.com/blog/2016/02/17/stack-overflow-the-architecture-2016-edition/ From 7cf8e428ddf974846be3582184e567c36930ea59 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 May 2020 22:35:01 +0800 Subject: [PATCH 2190/3057] PRF @geekpi --- ...t 5- Here-s How to Install it on Ubuntu.md | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md b/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md index 8493ff968c..aa75824e7c 100644 --- a/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md +++ b/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu) [#]: via: (https://itsfoss.com/audacious-4-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -使用 Qt 5 的 Audacious 4.0 发布:以下是在 Ubuntu 上安装它的方法 +如何安装使用 Qt 5 的音频播放器 Audacious 4.0 ====== -[Audacious][1]是用于包括 Linux 在内的多个平台的开源音频播放器。继上次发布主版本将近 2 年后,Audacious 4.0 带来了一些重大变化。 +[Audacious][1] 是一个开源音频播放器,可用于包括 Linux 在内的多个平台。继上次发布主版本将近 2 年后,Audacious 4.0 带来了一些重大变化。 -最新版本的 Audacious 4.0 默认带 [Qt 5][2] UI。你仍然可以从源中使用旧的 GTK2 UI,但是,新功能仅会添加到 Qt UI 中。 +最新版本的 Audacious 4.0 默认带 [Qt 5][2] 用户界面。你仍然可以和以前一样使用旧的 GTK2 UI,但是,新功能仅会添加到 Qt UI 中。 -让我们看下发生了什么变化以及如何在 Linux 系统上安装最新的 Audacious。 +让我们看下发生了什么变化,以及如何在 Linux 系统上安装最新的 Audacious。 ### Audacious 4.0 关键变化和功能 @@ -22,25 +22,24 @@ 当然,主要的变化是默认使用 Qt 5 UI。除此之外,他们的[官方公告][4]中提到了许多改进和功能补充,它们是: - * 单击播放列表列头可对播放列表进行排序 -  * 拖动播放列表列头会更改列顺序 -  * 应用中的音量和时间步长设置 -  * 隐藏播放列表标签的新选项 -  * 按路径对播放列表排序现在将文件夹排序在文件后面 -  * 实现了额外的 MPRIS 调用,以与 KDE 5.16+ 兼容 -  * 新的基于 OpenMPT 的跟踪器模块插件 -  * 新的 VU Meter 可视化插件 -  * 添加了使用 SOCKS 网络代理的选项 -  * Song Change 插件现在可在 Windows 上使用 -  * 新的“下一张专辑”和“上一张专辑”命令 -  * Qt UI 中的标签编辑器现在可以一次编辑多个文件 -  * 为 Qt UI 实现均衡器预设窗口 -  * 歌词插件获得了在本地保存和加载歌词的功能 -  * 模糊范围和频谱分析器可视化已移植到 Qt -  * MIDI 插件 SoundFont 选择已移植到 Qt -  * JACK 输出插件获得了一些新选项 -  * 添加了无限循环 PSF 文件的选项 - +* 单击播放列表列头可对播放列表进行排序 +* 拖动播放列表列头会更改列顺序 +* 应用中的音量和时间步长设置 +* 隐藏播放列表标签的新选项 +* 按路径对播放列表排序,现在将文件夹排序在文件后面 +* 实现了额外的 MPRIS 调用,以与 KDE 5.16+ 兼容 +* 新的基于 OpenMPT 的跟踪器模块插件 +* 新的 VU Meter 可视化插件 +* 添加了使用 SOCKS 网络代理的选项 +* 换歌插件现在可在 Windows 上使用 +* 新的“下一张专辑”和“上一张专辑”命令 +* Qt UI 中的标签编辑器现在可以一次编辑多个文件 +* 为 Qt UI 实现均衡器预设窗口 +* 歌词插件获得了在本地保存和加载歌词的能力 +* 模糊范围和频谱分析器可视化已移植到 Qt +* MIDI 插件 “SoundFont 选择”已移植到 Qt +* JACK 输出插件获得了一些新选项 +* 添加了无限循环 PSF 文件的选项 如果你以前不了解它,你可以轻松安装它,并使用均衡器和 [LADSP][5] 效果器来调整音乐体验。 @@ -48,15 +47,15 @@ ### 如何在 Ubuntu 上安装 Audacious 4.0 -值得注意的是,[UbuntuHandbook][8] 提供了[非官方 PPA][7]。你可以按照以下说明在 Ubuntu 16.04、18.04、19.10 和 20.04 上进行安装。 +值得注意的是,[非官方 PPA][7] 是由 [UbuntuHandbook][8] 提供的。你可以按照以下说明在 Ubuntu 16.04、18.04、19.10 和 20.04 上进行安装。 -1\. 首先,你必须在终端中输入以下命令将 PPA 添加到系统中: +1、首先,你必须在终端中输入以下命令将 PPA 添加到系统中: ``` sudo add-apt-repository ppa:ubuntuhandbook1/apps ``` -2\. 接下来,你需要从仓库/源码中更新/刷新软件包信息,然后继续安装该应用。方法如下: +2、接下来,你需要从仓库中更新(刷新)软件包信息,然后继续安装该应用。方法如下: ``` sudo apt update @@ -72,7 +71,7 @@ sudo apt remove --autoremove audacious audacious-plugins 你也可以在它的 GitHub 页面上查看有关源码的更多信息,并根据需要在其他 Linux 发行版上进行安装。 -[Audacious Source Code][10] +- [Audacious 源代码][10] ### 总结 @@ -87,7 +86,7 @@ via: https://itsfoss.com/audacious-4-release/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From af5c9374aa7c5d837699d051177d6a25ca44d5eb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 May 2020 22:35:33 +0800 Subject: [PATCH 2191/3057] PUB @geekpi https://linux.cn/article-12250-1.html --- ... Released With Qt 5- Here-s How to Install it on Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md (98%) diff --git a/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md b/published/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md similarity index 98% rename from translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md rename to published/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md index aa75824e7c..8b46842802 100644 --- a/translated/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md +++ b/published/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12250-1.html) [#]: subject: (Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu) [#]: via: (https://itsfoss.com/audacious-4-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 19461ecc009ae4cb371f3150926d0638bef32984 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 May 2020 01:05:24 +0800 Subject: [PATCH 2192/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200526=20Free?= =?UTF-8?q?FileSync:=20Open=20Source=20File=20Synchronization=20Tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200526 FreeFileSync- Open Source File Synchronization Tool.md --- ...- Open Source File Synchronization Tool.md | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sources/tech/20200526 FreeFileSync- Open Source File Synchronization Tool.md diff --git a/sources/tech/20200526 FreeFileSync- Open Source File Synchronization Tool.md b/sources/tech/20200526 FreeFileSync- Open Source File Synchronization Tool.md new file mode 100644 index 0000000000..549751e002 --- /dev/null +++ b/sources/tech/20200526 FreeFileSync- Open Source File Synchronization Tool.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (FreeFileSync: Open Source File Synchronization Tool) +[#]: via: (https://itsfoss.com/freefilesync/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +FreeFileSync: Open Source File Synchronization Tool +====== + +_**Brief: FreeFileSync is an open-source folder comparison and sync tool with which you can back up your data to an external disk, a cloud service like Google Drive or any other storage path.**_ + +### FreeFileSync: A Free & Open-Source Tool To Sync Files + +![][1] + +[FreeFileSync][2] is an impressive open-source tool that can help you back up your data to a different location. + +This different location can be an external USB disk, Google Drive or to any of your cloud storage locations using **SFTP or FTP** connections. + +You might have read our tutorial on [how to use Google Drive on Linux][3] before. Unfortunately, there’s no proper FOSS solution to use Google Drive natively on Linux. There is [Insync][4] but it is a premium, non open source software. + +FreeFileSync can be used to sync files with your Google Drive account. In fact, I’m using it to sync my files to Google Drive and to a separate hard drive. + +### Features of FreeFileSync + +![][5] + +Even though the UI of FreeFileSync might look old school — it offers a ton of useful features for average users and advanced users as well. + +I’ll highlight all the features I can here: + + * Cross-platform support (Windows, macOS & Linux) + * Compare folders before synchronizing + * Supports Google Drive, [SFTP][6], and FTP connections + * Offers the ability to sync your files on a different storage path (or an external storage device) + * Multiple synchronization options available (Update files to the target from source or Mirror the files between target and source) + * Two-way synchronization supported (changes will be synced if there’s any modification on the target folder or the source folder) + * Version control available for advanced users + * Real-Time Sync option available + * Ability to schedule batch jobs + * Get notified via email when sync completes (paid) + * Portable edition (paid) + * Parallel file copy (paid) + + + +So, if you take a look at the features it offers, it’s not just any ordinary sync tool but offers so much more for free. + +Also, to give you an idea, you can also tweak how to compare the files before syncing them. For instance, you can compare the file content / file time or simply compare the file size of both source and target folder. + +![][7] + +You also get numerous synchronization options to mirror or update your data. Here’s how it looks like: + +![][8] + +However, it does give you the option to opt for a donation key which unlocks some special features like the ability to notify you via email when the sync completes and so on. + +Here’s what different between the free and paid version: + +![][9] + +So, most of the essential features is available for free. The premium features are mostly for advanced users and of course, if you want to support them (please do if you find it useful). + +Also, do note that the donation edition can be used by a single user on up to 3 devices. So, that is definitely not bad! + +### Installing FreeFileSync on Linux + +You can simply head on to its [official download page][10] and grab the **tar.gz** file for Linux. If you like you can download the source as well. + +![][11] + +Next, you just need to extract the archive and run the executable file to get started (as shown in the image above) + +[Download FreeFileSync][2] + +### How To Get Started With FreeFileSync? + +While I haven’t tried successfully creating an automatic sync job, it is pretty easy to use. + +The [official documentation][12] should be more than enough to get what you want using the software. + +But, just to give you a head start, here are a few things that you should keep in mind. + +![][13] + +As you can see in the screenshot above, you just have to select a source folder and the target folder to sync. You can choose a local folder or a cloud storage location. + +Once you do that, you need to tweak the type of folder comparison you want to do (usually the file time & size) for the synchronization process and on the right-side, you get to tweak the type of sync that you want to perform. + +#### Types of synchronization in FreeFileSync + +When you select **“Update” method for sync**, it simply copies your new data from the source folder to the target folder. So, even if you delete something from your source folder, it won’t get deleted on your target folder. + +In case you want the target folder to have the same file copies of your same folder, you can choose the **“Mirror”** **synchronization method**. So, here, if you delete something from your source, it gets deleted from your target folder as well. + +There’s also a **“Two-way” sync method** which detects changes on both source and target folder (instead of monitoring just the source folder). So, if you make any changes on the source/target folder, the modification will be synchronized. + +For more advanced usage, I suggest you to refer the [documentation][12] available. + +### Wrapping Up + +Another [open source file synchronization tool is Syncthing][14] that you might want to look at. + +FreeFileSync is a pretty underrated folder comparison and sync tool available for Linux users who utilize Google Drive, SFTP, or FTP connections along with separate storage locations for backup. + +And, all of that — with cross-platform support for Windows, macOS, and Linux available for free. + +Isn’t that exciting? Let me know your thoughts on FreeFileSync in the comments down below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/freefilesync/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/free-file-sync.jpg?ssl=1 +[2]: https://freefilesync.org/ +[3]: https://itsfoss.com/use-google-drive-linux/ +[4]: https://itsfoss.com/recommends/insync/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/FreeFileSync.jpg?ssl=1 +[6]: https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/freefilesync-comparison.png?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/freefilesync-synchronization.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/free-file-sync-donation-edition.jpg?ssl=1 +[10]: https://freefilesync.org/download.php +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/freefilesync-run.jpg?ssl=1 +[12]: https://freefilesync.org/manual.php +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/freefilesync-tips.jpg?ssl=1 +[14]: https://itsfoss.com/syncthing/ From 82b5ac6c3d17fa81ced49ff0dde7bd13578a957e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 May 2020 03:50:17 +0800 Subject: [PATCH 2193/3057] Revert "translating" This reverts commit afec8c0d69883d1c4e836eb4e7df909e31c8c5c6. --- sources/tech/20180710 Building a Messenger App- Messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180710 Building a Messenger App- Messages.md b/sources/tech/20180710 Building a Messenger App- Messages.md index 577d7324a3..55e596df64 100644 --- a/sources/tech/20180710 Building a Messenger App- Messages.md +++ b/sources/tech/20180710 Building a Messenger App- Messages.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (Zioyi) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c65fb8680e78f9d72c2fa8fcd170543c816aafe6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 26 May 2020 08:41:57 +0800 Subject: [PATCH 2194/3057] translated --- ...nguages you should (probably) never use.md | 180 ------------------ ...nguages you should (probably) never use.md | 179 +++++++++++++++++ 2 files changed, 179 insertions(+), 180 deletions(-) delete mode 100644 sources/tech/20200401 3 Python templating languages you should (probably) never use.md create mode 100644 translated/tech/20200401 3 Python templating languages you should (probably) never use.md diff --git a/sources/tech/20200401 3 Python templating languages you should (probably) never use.md b/sources/tech/20200401 3 Python templating languages you should (probably) never use.md deleted file mode 100644 index 7d73216ea5..0000000000 --- a/sources/tech/20200401 3 Python templating languages you should (probably) never use.md +++ /dev/null @@ -1,180 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (3 Python templating languages you should (probably) never use) -[#]: via: (https://opensource.com/article/20/4/python-templating-languages) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -3 Python templating languages you should (probably) never use -====== -Python has accumulated a lot of templating languages, including these -three that are perfect for April Fools' Day. -![Hands on a keyboard with a Python book ][1] - -When reaching for a templating language for writing a [Python][2] web application, there are an abundance of robust solutions.  - -There are [Jinja2][3], [Genshi, and Mako][4]. There are even solutions like [Chameleon][5], which are a bit older, but still recommended by the [Pyramid][6] framework. - -Python has been around for a long time. In that time, deep in the corners of its system, it has accumulated some almost forgotten templating languages that are well worth poking at. - -Like cute koalas on top of a eucalyptus tree, happy in their ecological niche, and sometimes as dangerous to work with, these are the templating languages few have heard of—and even fewer should use. - -### 3\. string.Template - -Have you ever wondered, "How can I get a templating language with no features, but also without needing to **pip install** anything?" The Python standard library has you covered. While it does no looping or conditionals, the **string.Template** class is a minimal templating language. - -Using it is simplicity itself. - - -``` ->>> import string ->>> greeting = string.Template("Hello, $name, good $time!") ->>> greeting.substitute(name="OpenSource.com", time="afternoon") -'Hello, OpenSource.com, good afternoon!' -``` - -### 2\. twisted.web.template - -What gift do you give the library that has everything? - -Not a templating language, certainly, because it already has one. Nestled in **twisted.web.template** are two templating languages. One is XML-based and has a [great tutorial][7]. - -But there is another one, one that is based on using Python as a domain-specific language to produce HTML documents. - -It is based on two primitives: **twisted.web.template.tags**, which contains tag objects, and **twisted.web.template.flattenString**, which will render them. Because it is part of Twisted, it has built-in support for rendering async results efficiently. - -This example will render a silly little page: - - -``` -async def render(reactor): -    my_title = "A Fun page" -    things = ["one", "two", "red", "blue"] -    template = tags.html( -            tags.head( -                tags.title(my_title), -            ), -            tags.body( -                tags.h1(my_title), -                tags.ul( -                    [tags.li(thing) for thing in things], -                ), -                tags.p( -                    task.deferLater(reactor, 3, lambda: "Hello "), -                    task.deferLater(reactor, 3, lambda: "world!"), -                ) -            ) -    ) -    res = await flattenString(None, template) -    res = res.decode('utf-8') -    with open("hello.html", 'w') as fpout: -        fpout.write(res) -``` - -The template is regular Python code that uses the **tags.<TAGNAME>** to indicate the hierarchy. It natively supports strings as renderables, so any string is fine. - -To render it, the only things you need to do are to add a preamble: - - -``` -from twisted.internet import task, defer -from twisted.web.template import tags, flattenString - -def main(reactor): -    return defer.ensureDeferred(render(reactor)) -``` - -and an epilogue to run the whole thing: - - -``` -`task.react(main)` -``` - -In just _three_ seconds (and not _six_), it will render a nice HTML page. In real-life, those **deferLater**s can be, for example, calls to an HTTP API: they will be sent and processed in parallel, without having to put in any effort. I recommend you instead read about a [far better use for Twisted][8]. But still, this works. - -### 1\. Quixote - -You will say, "But Python is not _optimized_ for being an HTML-spouting domain-specific language." What if, instead of settling for Python-as-is, there was a language that [transpiles][9] to Python, but is better at defining templates? A "Python template language" (PTL), if you will. - -Writing your own language is sometimes said to be a dreamer's project for someone who tilts at windmills. Irony was not lost on the creators of Quixote (available on [PyPI][10]) when they decided to do exactly that. - -The following will render an equivalent template to the one done with Twisted above. _Warning: the following is not valid Python_: - - -``` -import time - -def render [html] (): -    my_title = "A Fun page" -    things = ["one", "two", "red", "blue"] -    "<html><head><title>" -    my_title -    "</head></title><body><h1>" -    my_title -    "</h1>" -    "<ul>" -    for thing in things: -        "<li>" -        thing -        "</li>" -    "<p>" -    time.sleep(3) -    (lambda: "Hello ")() -    time.sleep(3) -    (lambda: "world!")() -    "</p>" -    "</body></html>" - -def write(): -    result = render() -    with open("hello.html", 'w') as fpout: -        fpout.write(str(result)) -``` - -However, if you put it in a file called **template.ptl**, you can make it importable to Quixote and write out the rendered version of the template: - - -``` ->>> from quixote import enable_ptl ->>> enable_ptl() ->>> import template ->>> template.write() -``` - -Quixote installs an import hook that will cause PTL files to transpile into Python. Note that this render takes _six_ seconds, not _three_; you no longer gain free asynchronicity. - -### So many templates in Python - -Python has a long and winding history of libraries, some of which can achieve the same outcomes in more or less similar ways (for example, Python [package management][11]). - -On this April Fools' Day, I hope you enjoyed exploring three ways you _can_ create templates in Python. Instead, I recommend starting with [one of these libraries][4] for ways you _should_ template. - -Do you have another esoteric way to template? Share it in the comments below! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/4/python-templating-languages - -作者:[Moshe Zadka][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) -[2]: https://opensource.com/resources/python -[3]: https://opensource.com/article/20/2/jinja2-cheat-sheet -[4]: https://opensource.com/resources/python/template-libraries -[5]: https://chameleon.readthedocs.io/en/latest/ -[6]: https://opensource.com/article/18/5/pyramid-framework -[7]: https://twistedmatrix.com/documents/13.1.0/web/howto/twisted-templates.html -[8]: https://opensource.com/article/20/3/treq-python -[9]: https://en.wikipedia.org/wiki/Source-to-source_compiler -[10]: https://pypi.org/project/Quixote/ -[11]: https://opensource.com/article/19/4/managing-python-packages diff --git a/translated/tech/20200401 3 Python templating languages you should (probably) never use.md b/translated/tech/20200401 3 Python templating languages you should (probably) never use.md new file mode 100644 index 0000000000..b28d03f589 --- /dev/null +++ b/translated/tech/20200401 3 Python templating languages you should (probably) never use.md @@ -0,0 +1,179 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 Python templating languages you should (probably) never use) +[#]: via: (https://opensource.com/article/20/4/python-templating-languages) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +你应该(或许)没使用过的 3 种 Python 模板语言 +====== +Python 积累了许多模板语言,包括这 3 个适合在愚人节介绍的模板语言 +![Hands on a keyboard with a Python book ][1] + +当使用一种模板语言来编写 [Python][2] Web 应用时,它有很多健壮的解决方案。 + +有 [Jinja2][3]、[Genshi 和 Mako][4]。甚至还有 [Chameleon][5] 之类的解决方案,虽然有些陈旧,但仍被 [Pyramid][6] 框架推荐。 + +Python 已经存在了很长时间。此时,在系统的深处,它积累了一些几乎被遗忘的模板语言,它们都是值得一试的。 + +就像桉树顶上的可爱考拉一样,在它们的生态位中不错,有时用它们工作会危险,这些都是很少有人听说过的模板语言,使用过的应该更少。 + +### 3\. string.Template + +你是否曾经想过:“如何获得一种没有任何特性但同时也不需要 **pip install** 的模板语言?” Python 标准库已经涵盖。虽然没有循环和条件,但 **string.Template** 类是一种最小的模板语言。 + +使用它很简单。 + + +``` +>>> import string +>>> greeting = string.Template("Hello, $name, good $time!") +>>> greeting.substitute(name="OpenSource.com", time="afternoon") +'Hello, OpenSource.com, good afternoon!' +``` + +### 2\. twisted.web.template + +你会给一个有所有东西的库什么礼物? + +当然,它不是一种模板语言,因为已经有一种。 嵌套在 twisted.web.template 中的是两种模板语言。 一种是基于 XML 的,并有一个[很棒的文档][7]。 + +但是还有另一种,一种基于使用 Python 作为领域特定语言来生成 HTML 文档。 + +它基于两个原语:包含标签对象的 **twisted.web.template.tags** 和渲染它们的 **twisted.web.template.flattenString**。由于它是 Twisted 的一部分,因此它内置支持高效异步渲染。 + +此例将渲染一个小页面: + + +``` +async def render(reactor): +    my_title = "A Fun page" +    things = ["one", "two", "red", "blue"] +    template = tags.html( +            tags.head( +                tags.title(my_title), +            ), +            tags.body( +                tags.h1(my_title), +                tags.ul( +                    [tags.li(thing) for thing in things], +                ), +                tags.p( +                    task.deferLater(reactor, 3, lambda: "Hello "), +                    task.deferLater(reactor, 3, lambda: "world!"), +                ) +            ) +    ) +    res = await flattenString(None, template) +    res = res.decode('utf-8') +    with open("hello.html", 'w') as fpout: +        fpout.write(res) +``` + +该模板是使用 **tags.<TAGNAME>** 来指示层次结构的常规 Python 代码。原生支持渲染字符串,因此任何字符串都正常。 + +要渲染它,你需要做的是添加调用: + + +``` +from twisted.internet import task, defer +from twisted.web.template import tags, flattenString + +def main(reactor): +    return defer.ensureDeferred(render(reactor)) +``` + +最后写上: + + +``` +`task.react(main)` +``` + +只需 _3_ 秒(而不是 _6_ 秒),它将渲染一个不错的 HTML 页面。在实际中,这些 **deferLater** 可以是对 HTTP API 的调用:它们将并行发送和处理,而无需花费精力。我建议你阅读关于[更好地使用 Twisted][8]。但是,这仍可以工作。 + +### 1\. Quixote + +你会说:“但是 Python 并不是针对 HTML 输入而优化的领域特定语言。” 如果有一种语言可以[转化][9]到 Python,但是更适合定义模板,而不是像 Python 那样按原样解决呢? 如果可以的话,请使用“Python 模板语言”(PTL)。 + +对于攻击假想敌的人来说,写自己的语言有时被认为是梦想家的项目。当 Quixote (可用于 [PyPI][10])的创造者决定这样做时,并没有受此影响。 + +以下将渲染与上面 Twisted 相同的模板。 _警告:以下是无效的 Python_: + + +``` +import time + +def render [html] (): +    my_title = "A Fun page" +    things = ["one", "two", "red", "blue"] +    "<html><head><title>" +    my_title +    "</head></title><body><h1>" +    my_title +    "</h1>" +    "<ul>" +    for thing in things: +        "<li>" +        thing +        "</li>" +    "<p>" +    time.sleep(3) +    (lambda: "Hello ")() +    time.sleep(3) +    (lambda: "world!")() +    "</p>" +    "</body></html>" + +def write(): +    result = render() +    with open("hello.html", 'w') as fpout: +        fpout.write(str(result)) +``` + +但是,如果将它放到 **template.ptl** 文件中,那么可以将其导入到 Quixote 并写出可以渲染模板的版本: + + +``` +>>> from quixote import enable_ptl +>>> enable_ptl() +>>> import template +>>> template.write() +``` + +Quixote 安装一个导入钩子,它会将 PTL 文件转换为 Python。请注意,此渲染需要 _6_ 秒,而不是 _3_ 秒。你不再能自由异步。 + +### Python 中的模板太多 + +Python 的库历史悠久且曲折,其中一些库可以或多或少以类似的方式实现相同的结果(例如,Python [包管理][11])。 + +在这个愚人节,我希望你喜欢探索这三种_可以_用 Python 创建模板的方式。另外,我建议从[这三个库之一][4]开始了解。 + +你是否有另一种深奥的模板方法?请在下面的评论中分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-templating-languages + +作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://opensource.com/resources/python +[3]: https://opensource.com/article/20/2/jinja2-cheat-sheet +[4]: https://opensource.com/resources/python/template-libraries +[5]: https://chameleon.readthedocs.io/en/latest/ +[6]: https://opensource.com/article/18/5/pyramid-framework +[7]: https://twistedmatrix.com/documents/13.1.0/web/howto/twisted-templates.html +[8]: https://opensource.com/article/20/3/treq-python +[9]: https://en.wikipedia.org/wiki/Source-to-source_compiler +[10]: https://pypi.org/project/Quixote/ +[11]: https://opensource.com/article/19/4/managing-python-packages From be40624291dd6d121f37a0ad503a3eeb43aad3b3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 26 May 2020 08:46:49 +0800 Subject: [PATCH 2195/3057] translating --- .../20200520 How to configure your router using VTY shell.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200520 How to configure your router using VTY shell.md b/sources/tech/20200520 How to configure your router using VTY shell.md index 29a427583a..36e9f951b8 100644 --- a/sources/tech/20200520 How to configure your router using VTY shell.md +++ b/sources/tech/20200520 How to configure your router using VTY shell.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From eaf17ac0bf333797469a322cb0e86b856fc359a0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 May 2020 10:19:40 +0800 Subject: [PATCH 2196/3057] PUB @wxy https://linux.cn/article-12251-1.html --- ...20200429 Why strace doesn-t work in Docker.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename {translated/tech => published}/20200429 Why strace doesn-t work in Docker.md (86%) diff --git a/translated/tech/20200429 Why strace doesn-t work in Docker.md b/published/20200429 Why strace doesn-t work in Docker.md similarity index 86% rename from translated/tech/20200429 Why strace doesn-t work in Docker.md rename to published/20200429 Why strace doesn-t work in Docker.md index dfd17d0fca..57e5a5b42e 100644 --- a/translated/tech/20200429 Why strace doesn-t work in Docker.md +++ b/published/20200429 Why strace doesn-t work in Docker.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12251-1.html) [#]: subject: (Why strace doesn't work in Docker) [#]: via: (https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/) [#]: author: (Julia Evans https://jvns.ca/) @@ -10,7 +10,7 @@ 为什么 strace 在 Docker 中不起作用? ====== -在编辑“容器如何工作”杂志的能力页面时,我想试着解释一下为什么 `strace` 在 Docker 容器中无法工作。 +在编辑“容器如何工作”爱好者杂志的能力页面时,我想试着解释一下为什么 `strace` 在 Docker 容器中无法工作。 这里的问题是 —— 如果我在笔记本上的 Docker 容器中运行 `strace`,就会出现这种情况: @@ -27,7 +27,7 @@ strace: ptrace(PTRACE_TRACEME, ...): Operation not permitted docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash ``` -但我对如何修复它不感兴趣,我想知道为什么会出现这种情况。那么,为什么 `strace` 不能工作,为什么`--cap-add=SYS_PTRACE` 可以解决这个问题? +但我对如何修复它不感兴趣,我想知道为什么会出现这种情况。为什么 `strace` 不能工作,为什么`--cap-add=SYS_PTRACE` 可以解决这个问题? ### 假设 1:容器进程缺少 `CAP_SYS_PTRACE` 能力。 @@ -49,13 +49,13 @@ CAP_SYS_PTRACE * Trace arbitrary processes using ptrace(2); ``` -所以,`CAP_SYS_PTRACE` 的作用是让你像 root 一样,可以对任何用户拥有的**任意**进程进行 `ptrace` 。你不需要用它来只是对一个由你的用户拥有的普通进程进行 `ptrace ` 。 +所以,`CAP_SYS_PTRACE` 的作用是让你像 root 一样,可以对任何用户拥有的**任意**进程进行 `ptrace`。你不需要用它来对一个只是由你的用户拥有的普通进程进行 `ptrace` 。 -我用第三种方法测试了一下 —— 我用 `docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash` 运行了一个 Docker 容器,去掉了 `CAP_SYS_PTRACE` 能力,但我仍然可以跟踪进程,虽然我已经没有这个能力了。什么?为什么? +我用第三种方法测试了一下(LCTT 译注:此处可能原文有误) —— 我用 `docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash` 运行了一个 Docker 容器,去掉了 `CAP_SYS_PTRACE` 能力,但我仍然可以跟踪进程,虽然我已经没有这个能力了。什么?为什么?! ### 假设 2:关于用户命名空间的事情? -我的下一个(没有那么充分的依据的)假设是“嗯,也许这个过程是在不同的用户命名空间里,而 `strace` 不能工作,因为某种原因而行不通?”这个问题其实并不连贯,但这是我观察时想到的。 +我的下一个(没有那么充分的依据的)假设是“嗯,也许这个过程是在不同的用户命名空间里,而 `strace` 不能工作,因为某种原因而行不通?”这个问题其实并不相关,但这是我观察时想到的。 容器进程是否在不同的用户命名空间中?嗯,在容器中: @@ -111,7 +111,7 @@ execve("/bin/ls", ["ls"], 0x7ffc69a65580 /* 8 vars */) = 0 Go 语言的好处是,因为依赖关系通常是在一个 Go 仓库里,你可以通过 `grep` 来找出做某件事的代码在哪里。所以我克隆了 `github.com/moby/moby`,然后对一些东西进行 `grep`,比如 `rg CAP_SYS_PTRACE`。 -我认为是这样的。在 `containerd` 的 seccomp 实现中,在 [contrib/seccomp/seccomp/seccomp_default.go][3] 中,有一堆代码确保如果一个进程有一个能力,那么它也会(通过 seccomp 规则)获得访问权限,以使用与该能力相关的系统调用。 +我认为是这样的。在 `containerd` 的 seccomp 实现中,在 [contrib/seccomp/seccomp/seccomp_default.go][3] 中,有一堆代码来确保如果一个进程有一个能力,那么它也会(通过 seccomp 规则)获得访问权限,以使用与该能力相关的系统调用。 ``` case "CAP_SYS_PTRACE": From 8e8d27079d588e349b3966d207c2ef0a02a18922 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 May 2020 11:02:36 +0800 Subject: [PATCH 2197/3057] PRF @geekpi --- ...nguages you should (probably) never use.md | 154 +++++++++--------- 1 file changed, 76 insertions(+), 78 deletions(-) diff --git a/translated/tech/20200401 3 Python templating languages you should (probably) never use.md b/translated/tech/20200401 3 Python templating languages you should (probably) never use.md index b28d03f589..9e9cfd2485 100644 --- a/translated/tech/20200401 3 Python templating languages you should (probably) never use.md +++ b/translated/tech/20200401 3 Python templating languages you should (probably) never use.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (3 Python templating languages you should (probably) never use) @@ -9,74 +9,73 @@ 你应该(或许)没使用过的 3 种 Python 模板语言 ====== -Python 积累了许多模板语言,包括这 3 个适合在愚人节介绍的模板语言 -![Hands on a keyboard with a Python book ][1] -当使用一种模板语言来编写 [Python][2] Web 应用时,它有很多健壮的解决方案。 +> 包括这 3 个模板语言在内,Python 积累了许多模板语言。 + +![](https://img.linux.net.cn/data/attachment/album/202005/26/110220lxie9osmd592m5ee.jpg) + +当需要使用模板语言来编写 [Python][2] Web 应用时,有很多健壮的解决方案。 有 [Jinja2][3]、[Genshi 和 Mako][4]。甚至还有 [Chameleon][5] 之类的解决方案,虽然有些陈旧,但仍被 [Pyramid][6] 框架推荐。 Python 已经存在了很长时间。此时,在系统的深处,它积累了一些几乎被遗忘的模板语言,它们都是值得一试的。 -就像桉树顶上的可爱考拉一样,在它们的生态位中不错,有时用它们工作会危险,这些都是很少有人听说过的模板语言,使用过的应该更少。 +这些语言就像桉树上可爱的考拉一样,在自己的生态圈里快乐地生活着,有时也会有危险的工作,这些都是很少有人听说过的模板语言,使用过的应该更少。 -### 3\. string.Template +### 3、string.Template -你是否曾经想过:“如何获得一种没有任何特性但同时也不需要 **pip install** 的模板语言?” Python 标准库已经涵盖。虽然没有循环和条件,但 **string.Template** 类是一种最小的模板语言。 +你是否曾经想过:“如何获得一种没有任何特性的模板语言,而且同时也不需要 `pip install` 安装任何东西?” Python 标准库已经为你提供了答案。虽然没有循环和条件,但 `string.Template` 类是一种最小的模板语言。 使用它很简单。 - ``` ->>> import string ->>> greeting = string.Template("Hello, $name, good $time!") ->>> greeting.substitute(name="OpenSource.com", time="afternoon") +>>> import string +>>> greeting = string.Template("Hello, $name, good $time!") +>>> greeting.substitute(name="OpenSource.com", time="afternoon") 'Hello, OpenSource.com, good afternoon!' ``` -### 2\. twisted.web.template +### 2、twisted.web.template -你会给一个有所有东西的库什么礼物? +你会给一个包罗万象的库送什么礼物? -当然,它不是一种模板语言,因为已经有一种。 嵌套在 twisted.web.template 中的是两种模板语言。 一种是基于 XML 的,并有一个[很棒的文档][7]。 +当然,不是模板语言,因为它已经有了。twisted.web.template 中嵌套了两种模板语言。一种是基于 XML 的,并有一个[很棒的文档][7]。 -但是还有另一种,一种基于使用 Python 作为领域特定语言来生成 HTML 文档。 +但是它还有另一种,一种基于使用 Python 作为领域特定语言(DSL)来生成 HTML 文档。 -它基于两个原语:包含标签对象的 **twisted.web.template.tags** 和渲染它们的 **twisted.web.template.flattenString**。由于它是 Twisted 的一部分,因此它内置支持高效异步渲染。 +它基于两个原语:包含标签对象的 `twisted.web.template.tags` 和渲染它们的 `twisted.web.template.flattenString`。由于它是 Twisted 的一部分,因此它内置支持高效异步渲染。 此例将渲染一个小页面: - ``` async def render(reactor): -    my_title = "A Fun page" -    things = ["one", "two", "red", "blue"] -    template = tags.html( -            tags.head( -                tags.title(my_title), -            ), -            tags.body( -                tags.h1(my_title), -                tags.ul( -                    [tags.li(thing) for thing in things], -                ), -                tags.p( -                    task.deferLater(reactor, 3, lambda: "Hello "), -                    task.deferLater(reactor, 3, lambda: "world!"), -                ) -            ) -    ) -    res = await flattenString(None, template) -    res = res.decode('utf-8') -    with open("hello.html", 'w') as fpout: -        fpout.write(res) + my_title = "A Fun page" + things = ["one", "two", "red", "blue"] + template = tags.html( + tags.head( + tags.title(my_title), + ), + tags.body( + tags.h1(my_title), + tags.ul( + [tags.li(thing) for thing in things], + ), + tags.p( + task.deferLater(reactor, 3, lambda: "Hello "), + task.deferLater(reactor, 3, lambda: "world!"), + ) + ) + ) + res = await flattenString(None, template) + res = res.decode('utf-8') + with open("hello.html", 'w') as fpout: + fpout.write(res) ``` -该模板是使用 **tags.<TAGNAME>** 来指示层次结构的常规 Python 代码。原生支持渲染字符串,因此任何字符串都正常。 +该模板是使用 `tags.` 来指示层次结构的常规 Python 代码。原生支持渲染字符串,因此任何字符串都正常。 要渲染它,你需要做的是添加调用: - ``` from twisted.internet import task, defer from twisted.web.template import tags, flattenString @@ -89,67 +88,66 @@ def main(reactor): ``` -`task.react(main)` +task.react(main) ``` -只需 _3_ 秒(而不是 _6_ 秒),它将渲染一个不错的 HTML 页面。在实际中,这些 **deferLater** 可以是对 HTTP API 的调用:它们将并行发送和处理,而无需花费精力。我建议你阅读关于[更好地使用 Twisted][8]。但是,这仍可以工作。 +只需 3 秒(而不是 6 秒),它将渲染一个不错的 HTML 页面。在实际中,这些 `deferLater` 可以是对 HTTP API 的调用:它们将并行发送和处理,而无需付出任何努力。我建议你阅读关于[更好地使用 Twisted][8]。不过,这已经可以工作了。 -### 1\. Quixote +### 1、Quixote -你会说:“但是 Python 并不是针对 HTML 输入而优化的领域特定语言。” 如果有一种语言可以[转化][9]到 Python,但是更适合定义模板,而不是像 Python 那样按原样解决呢? 如果可以的话,请使用“Python 模板语言”(PTL)。 +你会说:“但是 Python 并不是针对 HTML 领域而优化的领域特定语言。” 如果有一种语言可以[转化][9]到 Python,但是更适合定义模板,而不是像 Python 那样按原样解决呢?如果可以的话,请使用“Python 模板语言”(PTL)。 -对于攻击假想敌的人来说,写自己的语言有时被认为是梦想家的项目。当 Quixote (可用于 [PyPI][10])的创造者决定这样做时,并没有受此影响。 - -以下将渲染与上面 Twisted 相同的模板。 _警告:以下是无效的 Python_: +编写自己的语言,有时被说成是一个攻击假想敌人的唐吉坷德项目。当 Quixote(可在 [PyPI][10] 中找到)的创造者决定这样做时,并没有受此影响。 +以下将渲染与上面 Twisted 相同的模板。*警告:以下不是有效的 Python 代码*: ``` import time def render [html] (): -    my_title = "A Fun page" -    things = ["one", "two", "red", "blue"] -    "<html><head><title>" -    my_title -    "</head></title><body><h1>" -    my_title -    "</h1>" -    "<ul>" -    for thing in things: -        "<li>" -        thing -        "</li>" -    "<p>" -    time.sleep(3) -    (lambda: "Hello ")() -    time.sleep(3) -    (lambda: "world!")() -    "</p>" -    "</body></html>" + my_title = "A Fun page" + things = ["one", "two", "red", "blue"] + "" + my_title + "</head>

" + my_title + "

" + "
    " + for thing in things: + "
  • " + thing + "
  • " + "

    " + time.sleep(3) + (lambda: "Hello ")() + time.sleep(3) + (lambda: "world!")() + "

    " + "" def write(): -    result = render() -    with open("hello.html", 'w') as fpout: -        fpout.write(str(result)) + result = render() + with open("hello.html", 'w') as fpout: + fpout.write(str(result)) ``` -但是,如果将它放到 **template.ptl** 文件中,那么可以将其导入到 Quixote 并写出可以渲染模板的版本: +但是,如果将它放到 `template.ptl` 文件中,那么可以将其导入到 Quixote 中,并写出可以渲染模板的版本: ``` ->>> from quixote import enable_ptl ->>> enable_ptl() ->>> import template ->>> template.write() +>>> from quixote import enable_ptl +>>> enable_ptl() +>>> import template +>>> template.write() ``` -Quixote 安装一个导入钩子,它会将 PTL 文件转换为 Python。请注意,此渲染需要 _6_ 秒,而不是 _3_ 秒。你不再能自由异步。 +Quixote 安装了一个导入钩子,它会将 PTL 文件转换为 Python。请注意,此渲染需要 6 秒,而不是 3 秒。你不再获得自由的异步性。 ### Python 中的模板太多 -Python 的库历史悠久且曲折,其中一些库可以或多或少以类似的方式实现相同的结果(例如,Python [包管理][11])。 +Python 库的历史悠久且曲折,其中一些库可以或多或少都能达到类似结果(例如,Python [包管理][11])。 -在这个愚人节,我希望你喜欢探索这三种_可以_用 Python 创建模板的方式。另外,我建议从[这三个库之一][4]开始了解。 +我希望你喜欢探索这三种*可以*用 Python 创建模板的方式。另外,我建议从[这三个库之一][4]开始了解。 你是否有另一种深奥的模板方法?请在下面的评论中分享! @@ -160,7 +158,7 @@ via: https://opensource.com/article/20/4/python-templating-languages 作者:[Moshe Zadka][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 94530587164ef48d14b732d40e668337f1b86bf9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 May 2020 11:03:11 +0800 Subject: [PATCH 2198/3057] PUB @geekpi https://linux.cn/article-12252-1.html --- ...on templating languages you should (probably) never use.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200401 3 Python templating languages you should (probably) never use.md (98%) diff --git a/translated/tech/20200401 3 Python templating languages you should (probably) never use.md b/published/20200401 3 Python templating languages you should (probably) never use.md similarity index 98% rename from translated/tech/20200401 3 Python templating languages you should (probably) never use.md rename to published/20200401 3 Python templating languages you should (probably) never use.md index 9e9cfd2485..a5a7502767 100644 --- a/translated/tech/20200401 3 Python templating languages you should (probably) never use.md +++ b/published/20200401 3 Python templating languages you should (probably) never use.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12252-1.html) [#]: subject: (3 Python templating languages you should (probably) never use) [#]: via: (https://opensource.com/article/20/4/python-templating-languages) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 8c15fcdbf698dd2d0a3ad643c7ece908ecdf84f9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 May 2020 16:52:49 +0800 Subject: [PATCH 2199/3057] Rename sources/tech/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md to sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md --- ...portant Ingredient- Jerry Bezencon of Linux Lite -Interview.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md (100%) diff --git a/sources/tech/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md b/sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md similarity index 100% rename from sources/tech/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md rename to sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md From b9f686ca250a1fb5cd337acfa7f6d40329f59738 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 May 2020 17:00:33 +0800 Subject: [PATCH 2200/3057] Rename sources/tech/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md to sources/news/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md --- ...iath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md (100%) diff --git a/sources/tech/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md b/sources/news/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md similarity index 100% rename from sources/tech/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md rename to sources/news/20200525 David vs Goliath- Microsoft and an Obscure KDE Project Fight Over -MAUI.md From 85a3575adf52ccd023fc0f13e9ab664ca265d98f Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Tue, 26 May 2020 17:09:42 +0800 Subject: [PATCH 2201/3057] translated --- ...n Linux Apps in Windows (Thanks to WSL).md | 103 ----------------- ...n Linux Apps in Windows (Thanks to WSL).md | 104 ++++++++++++++++++ 2 files changed, 104 insertions(+), 103 deletions(-) delete mode 100644 sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md create mode 100644 translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md diff --git a/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md b/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md deleted file mode 100644 index 77e3ba785a..0000000000 --- a/sources/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lnrCoder) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Now You Can Run Linux Apps in Windows (Thanks to WSL)) -[#]: via: (https://itsfoss.com/run-linux-apps-windows-wsl/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Now You Can Run Linux Apps in Windows (Thanks to WSL) -====== - -Microsoft’s recent “[Build 2020][1]” developer conference involved some interesting announcements. I’m not sure if it’s something to be excited about or skeptical about — but Microsoft you have our attention now more than ever. - -And, among all the announcements, the ability to run GUI apps on WSL (Windows Subsystem for Linux) gained the spotlight. - -Not to forget the [fiasco with Xamrin.Forms rebranding as MAUI][2] which conflicts with an existing open-source project ([Maui Project][3]) by Uri Herrera of [Nitrux Linux.][4] - -In case you didn’t know, WSL is an environment that lets you have a console-only Linux experience from within Windows 10. It is also one of the [best ways to run Linux commands in Windows.][5] - -While the announcement through a blog post ([DirectX ❤ Linux][6]) may have been a PR bait as [Liam Dawe thinks][7]. But, it’s still something worth talking about. - -### Support for Linux GUI Apps On WSL - -![][8] - -Recently, Microsoft announced a bunch of new features coming to WSL (a.k.a. WSL 2) during the online developer conference. - -The introduction of [Windows Package Manager][9], [Windows Terminal 1.0][10], and a couple others were some its highlights. - -But, the support for GPU hardware acceleration to **Windows Subsystem for Linux 2** was something significant. - -So, does this mean that you can run Linux apps on Windows using WSL? Looks like it… - -Microsoft plans to make it happen using a brand-new Linux kernel driver **dxgkrnl**. To give you a technical brief, I’d quote the description from their announcement here: - -![Linux Kernel Driver Wsl][11] - -> Dxgkrnl is a brand-new kernel driver for Linux that exposes the **/dev/dxg** device to user mode Linux. **/dev/dxg** exposes a set of IOCTL that closely mimic the native WDDM D3DKMT kernel service layer on Windows. Dxgkrnl inside the Linux kernel connects over the VM Bus to its big brother on the Windows host and uses this VM bus connection to communicate with the physical GPU. - -I’m no expert here but it means that the **Linux applications on WSL will have the same access to the GPU as native Windows applications do**. - -The support for GUI apps will be coming later this fall (not with May 2020 update) — so we’ll have to see when that happens. - -Microsoft is specifically targeting the developers who want the comfort of using their Linux IDE on Windows. Google is also targeting the same user base by [bringing GUI Linux apps to Chromebook][12]. - -Well, that’s good news for users who want to stick with Windows. But, is it really? - -### Microsoft Loves Linux — Do They Really? - -![Microsoft Loves Linux][13] - -It is definitely a good thing that they are embracing Linux and its benefits through their efforts of incorporating a Linux environment on Windows. - -But, how is it really going to help the **desktop Linux users**? I don’t see any real-word benefits from it as of now. - -You’re free to have a different opinion here. But, I think there’s no real value to the desktop users of Linux through the development of WSL. At least, none so far. - -It was interesting to notice that someone on [Linux Unplugged podcast][14] highlighted Microsoft’s move as something in the line of EEE (Embrace, extend, and extinguish) for which they’re known for. - -Maybe, who knows? Of course, the effort they’ve put to pull this off is worth appreciating — but it’s exciting and mystifying at the same time. - -### Does this mean Windows users will no longer switch to Linux? - -The reason why Microsoft is embracing Linux on its platform is that they know what it’s capable of and why developers (or users) prefer using. - -But, with the updates to WSL 2, I tend to agree to what Abhishek thinks if this continues: - -> Eventually, desktop Linux will be confined to become a desktop application under Windows… - -Well, of course, the native experience is still superior for the time being. And, it’ll be rare to see that the existing Linux desktop users will use Windows over it. But, that’s still something to worry about. - -What do you think about all this? I’m not ruling the advantages of WSL for users forced to use Windows — but do you think Microsoft’s progress with WSL is going to be something hostile in nature or something that will help Linux in the long run? - -Let me know your thoughts in the comments! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/run-linux-apps-windows-wsl/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[lnrCoder](https://github.com/lnrCoder) -校对:[校对者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://news.microsoft.com/build2020/ -[2]: https://itsfoss.com/microsoft-maui-kde-row/ -[3]: https://mauikit.org/ -[4]: https://itsfoss.com/nitrux-linux/ -[5]: https://itsfoss.com/run-linux-commands-in-windows/ -[6]: https://devblogs.microsoft.com/directx/directx-heart-linux/ -[7]: https://www.gamingonlinux.com/2020/05/microsoft-build-directx-and-linux-plus-more -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Linux-GUI-app-Windows-WSL.png?ssl=1 -[9]: https://devblogs.microsoft.com/commandline/windows-package-manager-preview/ -[10]: https://devblogs.microsoft.com/commandline/windows-terminal-1-0/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/linux-kernel-driver-wsl.png?ssl=1 -[12]: https://itsfoss.com/linux-apps-chromebook/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/microsoft-loves-linux.jpg?ssl=1 -[14]: https://linuxunplugged.com/354 diff --git a/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md b/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md new file mode 100644 index 0000000000..61334d55c0 --- /dev/null +++ b/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (lnrCoder) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Now You Can Run Linux Apps in Windows (Thanks to WSL)) +[#]: via: (https://itsfoss.com/run-linux-apps-windows-wsl/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +现在您可以在 Windows 中运行 Linux 应用(多亏了 WSL) +====== + +微软最近的 “[Build 2020][1]” 开发者大会公布了一些有趣的公告。 我不确定这该令人兴奋还是该令人怀疑 — 但是微软,你现在比以往任何时候都受到我们的关注。 + +同时,在所有公告中,能够在 WSL(Windows Subsystem for Linux)上运行 GUI 应用程序的功能备受关注。 + +别忘了 [Xamrin.Forms 更名为 MAUI 的尴尬结局][2],它与 [Nitrux Linux.][4] 的 Uri Herrera 的现有开源项目([Maui Project][3])相冲突。 + +以为防止你不不清楚,WSL 是一种环境,可让你在 Windows 10 中获得纯控制台 Linux 的体验。它也是在 [Windows 中运行 Linux 命令的最佳方法][5]之一。 + +正如 [Liam Dawe][7] 认为的那样,通过博客文章([DirectX ❤ Linux][6])发布的公告可能是只是个诱饵。但是,仍然值得一提。 + +### WSL 上对 Linux GUI 应用程序的支持 + +![][8] + +最近,Microsoft 在在线开发者大会上宣布了 WSL(又名 WSL 2)的一系列新功能。 + +[Windows Package Manager][9],[Windows Terminal 1.0][10],以及其他一些功能的引入是其亮点。 + +但是,支持 GPU 硬件加速的 Windows 的 Linux 2 子系统非常重要。 + +那么,是否意味着你可以使用 WSL 在 Windows 上运行 Linux 应用程序呢?看起来像是。 + +微软计划通过使用全新的 Linux 内核驱动程序 **dxgkrnl** 来实现。 +Microsoft plans to make it happen using a brand-new Linux kernel driver **dxgkrnl**。 为了给你一个技术简报, 我在这里引用他们的公告中的描述: + +![Linux Kernel Driver Wsl][11] + +> Dxgkrnl 是 Linux 的全新内核驱动程序,它将 **/dev/dxg** 设备暴露给用户模式的 Linux。 **/dev/dxg** 暴露了一组 IOCTL,他们与 Winodws 上的原生 WDDM D3DKMT 内核服务层非常相似。Linux 内核中的 Dxgkrnl 通过 VM 总线连接到 Windows 主机上,并使用此 VM 总线连接与物理 GPU 进行通讯。 + +我不是这方面的专家,但这以为蛇 WSL 上的 Linux 应用程序将具有与本机 Windows 应用程序相同的 GPU 访问权限。 + +针对 GUI 应用程序的支持将在今年秋季的晚些时候提供 (而不是 2020 年 5 月的更新) — 所以我们跌看看什么时候提供。 + +微软专门针对的是那些系统在 Windows 上轻松使用 Linux IDE 的开发人员。Google 还通过 [将 GUI Linux 应用程序引入 Chromebook ][12] 来针对相同的用户群。 + +好吧,对于想要使用 Windows 的用户来说,这是个好消息。但是,这是真的吗? + +### 微软爱上了 Linux — 真的吗? + +![Microsoft Loves Linux][13] + +他们通过努力在 Windows 上整合 Linux 环境来拥抱 Linux 及其优势,绝对是一件好事。 + +但是,如何真正帮助 **Linux 桌面用户**呢?到目前为止,我还没有看到任何实际的好处。 + +你可以在这里随意发表不同意见。但是,我认为 WSL 的开发对于 Linux 桌面用户来说没有实际的价值。至少目前为止没有。 + +有趣的是,[Linux Unplugged podcast][14] 上有人强调了微软的举动,以其闻名的 EEE (Embrace, extend, and extinguish) 为代表。 + +可能,谁知道呢?当然,他们为实现这一目标而付出的努力值得赞赏 — 同时又令人感到兴奋和神秘。 + +### 这是否以为着 Windows 用户将不必再切换到 Linux? + +微软之所以在其平台上集成 Linux,是因为他们知道 Liunx 的功能以及开发人员(或用户)喜欢使用的原因。 + +但是,随着 WSL 2 的更新,如果这种情况持续下去,我倾向于同意 Abhishek 的看法: + +> 最终,桌面 Linux 将被限制为 Windows 下的桌面应用程序。 + +好吧,当然,原生的体验暂时还是比较好的。而且,很难看到现有的 Linux 桌面用户会使用 Windows 来将其替代。但是,这仍然是值得担心的。 + +你如何看待这一切? 我不认为 WSL 对于被迫使用 Windows 的用户有什么好处 — 但是,从长远来看,你认为微软在 WSL 方面的进展本质上是敌意还是对 Linux 有帮助? + +在评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/run-linux-apps-windows-wsl/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[lnrCoder](https://github.com/lnrCoder) +校对:[校对者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://news.microsoft.com/build2020/ +[2]: https://itsfoss.com/microsoft-maui-kde-row/ +[3]: https://mauikit.org/ +[4]: https://itsfoss.com/nitrux-linux/ +[5]: https://itsfoss.com/run-linux-commands-in-windows/ +[6]: https://devblogs.microsoft.com/directx/directx-heart-linux/ +[7]: https://www.gamingonlinux.com/2020/05/microsoft-build-directx-and-linux-plus-more +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Linux-GUI-app-Windows-WSL.png?ssl=1 +[9]: https://devblogs.microsoft.com/commandline/windows-package-manager-preview/ +[10]: https://devblogs.microsoft.com/commandline/windows-terminal-1-0/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/linux-kernel-driver-wsl.png?ssl=1 +[12]: https://itsfoss.com/linux-apps-chromebook/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/microsoft-loves-linux.jpg?ssl=1 +[14]: https://linuxunplugged.com/354 From 90d88566ca4c6ade091ae191e74d3d7c559ce2e0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 May 2020 17:22:57 +0800 Subject: [PATCH 2202/3057] APL --- ...ow to Properly Install and Setup KDE Plasma on Arch Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md b/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md index afccc10512..5643d483e8 100644 --- a/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md +++ b/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 25bb894f1d57b6e51c1b76f128376553aa0e36cb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 May 2020 18:19:00 +0800 Subject: [PATCH 2203/3057] TSL&PRF --- ...tall and Setup KDE Plasma on Arch Linux.md | 139 ------------------ ...tall and Setup KDE Plasma on Arch Linux.md | 137 +++++++++++++++++ 2 files changed, 137 insertions(+), 139 deletions(-) delete mode 100644 sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md create mode 100644 translated/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md diff --git a/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md b/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md deleted file mode 100644 index 5643d483e8..0000000000 --- a/sources/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md +++ /dev/null @@ -1,139 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Properly Install and Setup KDE Plasma on Arch Linux) -[#]: via: (https://itsfoss.com/install-kde-arch-linux/) -[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) - -How to Properly Install and Setup KDE Plasma on Arch Linux -====== - -I believe you followed the [fantastic It’s FOSS guide on installing Arch Linux][1]. The guide ends with steps mentioning the installation procedure for [GNOME desktop][2]. - -Now, not everyone is a GNOME fan and several readers requested that we show them how to configure the [KDE desktop][3] on [Arch Linux][4]. - -And thus I created this guide to demonstrate the steps for properly installing and configuring KDE desktop (also known as KDE Plasma desktop) on Arch Linux. - -### How to install and setup KDE desktop environment on Arch Linux - -![][5] - -Please keep in mind that KDE doesn’t allow login as root directly. If you have installed Arch Linux and using it as root, you should create a new user and give it sudo rights for running commands as root. - -If you just have a bare minimum installation of Arch Linux, you probably are logging into a TTY terminal. If you are using some other desktop environment, steps remain the same. - -Let’s go! - -#### Step 1: Create a sudo user (if you have only root user) - -You can use the [useradd command][6] for creating a new user. I am creating user named dimitrios (that’s my name). You can use something that matches your name. - -The option -m creates a home directory for the newly created user. - -``` -useradd -m dimitrios -``` - -You should also set a password for this user. Use this command: - -``` -passwd dimitrios -``` - -Now that you have created the user, give it sudo access. First, install sudo and a [command line text editor][7] like [nano][8]: - -``` -pacman -S sudo nano -``` - -The configuration file for sudo is /etc/sudoers. It should always be edited with the visudo command. visudo locks the sudoers file, saves edits to a temporary file, and checks that file’s grammar before copying it to /etc/sudoers. - -To use nano as the visudo editor, use: - -``` -EDITOR=nano visudo -``` - -Add the following line like I do in the example, then save and exit. - -``` -dimitrios ALL=(ALL) ALL -``` - -![Adding Sudoer in Arch Linux][9] - -Save your changes and exit the editor. You now have a sudo user on Arch Linux. - -#### Step 2: Installing KDE Plasma desktop - -To run KDE desktop, you need the following packages: - - * [Xorg][10] group - * [KDE Plasma][3] Desktop Environment - * [Wayland][11] session for KDE Plasma - * [KDE applications][12] group (consists of KDE specific applications including the Dolphin manager and other useful apps) - - - -You can install of the above using the following command: - -``` -pacman -S xorg plasma plasma-wayland-session kde-applications -``` - -Once installed, enable the Display Manager and Network Manager services: - -``` -systemctl enable sddm.service -systemctl enable NetworkManager.service -``` - -Almost there. Shutdown your system: - -``` -shutdown now -``` - -Power on your system and you should see the KDE login. Do you remember the password you set up for your sudo user? Use it to login. - -![Arch KDE Plasma Desktop][13] - -#### What next? - -You may want to explore the [essential pacman commands][14], to know what’s going on with the [Arch User Repository][15] and learn more about [AUR helpers][16]. - -I hope you found this tutorial helpful in installing KDE desktop on Arch Linux. Please let us know in the comments below, if you encountered any obstacle or difficulty during the installation. - -What’s your favourite Desktop environment or Window Manager? Let us know and don’t forget to subscribe on our social media. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-kde-arch-linux/ - -作者:[Dimitrios Savvopoulos][a] -选题:[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/dimitrios/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/install-arch-linux/ -[2]: https://www.gnome.org/ -[3]: https://kde.org/plasma-desktop -[4]: https://www.archlinux.org/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/install-kde-arch-linux.png?ssl=1 -[6]: https://linuxhandbook.com/useradd-command/ -[7]: https://itsfoss.com/command-line-text-editors-linux/ -[8]: https://www.nano-editor.org/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/adding-sudoer-arch-linux.png?ssl=1 -[10]: https://wiki.archlinux.org/index.php/Xorg -[11]: https://wiki.archlinux.org/index.php/Wayland -[12]: https://www.archlinux.org/groups/x86_64/kde-applications/ -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-Plasma-desktop.jpg?fit=800%2C450&ssl=1 -[14]: https://itsfoss.com/pacman-command/ -[15]: https://itsfoss.com/aur-arch-linux/ -[16]: https://itsfoss.com/best-aur-helpers/ diff --git a/translated/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md b/translated/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md new file mode 100644 index 0000000000..0139cf7a26 --- /dev/null +++ b/translated/tech/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Properly Install and Setup KDE Plasma on Arch Linux) +[#]: via: (https://itsfoss.com/install-kde-arch-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 Arch Linux 上正确安装和设置 KDE Plasma? +====== + +我相信你是按照[这份很棒的指南安装来 Arch Linux][1] 的,这篇指南最后提到了 [GNOME 桌面][2]的安装步骤。 + +但现在,不是每个人都是 GNOME 的粉丝,有几个读者要求我们向他们展示如何在 [Arch Linux][4] 上配置 [KDE 桌面][3]。 + +因此,我创建了这个指南来演示如何在 Arch Linux 上正确安装和配置 KDE 桌面(也被称为 KDE Plasma桌面)的步骤。 + +### 如何在 Arch Linux 上安装和设置 KDE 桌面环境? + +![][5] + +请记住,KDE 不允许直接以 root 身份登录。如果你已经安装了 Arch Linux 并以 root 身份使用,你应该创建一个新的用户,并给它以 root 身份运行命令的 sudo 权限。 + +如果你只是最小化安装了 Arch Linux,那么你可能是以 TTY 终端方式登录的。如果你使用的是其他桌面环境,步骤也是一样的。 + +让我们开始吧! + +#### 步骤 1:创建一个 sudo 用户(如果你只有 root 用户) + +你可以使用 [useradd 命令][6]来创建一个新用户。我创建的用户名为 `dimitrios`(这是我的名字)。你可以使用与你的名字匹配的东西。 + +选项 `-m` 为新创建的用户创建一个主目录。 + +``` +useradd -m dimitrios +``` + +你还应该为这个用户设置一个密码。使用此命令: + +``` +passwd dimitrios +``` + +现在你已经创建了用户,给它 sudo 权限。首先,安装 sudo 和一个像 [nano][8] 这样的[命令行文本编辑器][7]。 + +``` +pacman -S sudo nano +``` + +sudo 的配置文件是 `/etc/sudoers`。该文件应该使用 `visudo` 来编辑,它会锁定 `sudoers` 文件,将编辑的内容保存到一个临时文件中,并在复制到 `/etc/sudoers` 之前检查该文件的语法。 + +要使用 `nano` 作为 `visudo` 编辑器,请这样设置: + +``` +EDITOR=nano visudo +``` + +像我的示例那样添加下面这一行,然后保存并退出。 + +``` +dimitrios ALL=(ALL) ALL +``` + +![Adding Sudoer in Arch Linux][9] + +保存你的更改,然后退出编辑器。你现在在 Arch Linux 上有了一个 sudo 用户。 + +#### 步骤 2 :安装 KDE Plasma 桌面 + +要运行 KDE 桌面,你需要以下软件包。 + + * [Xorg][10] 组 + * [KDE Plasma][3] 桌面环境 + * [Wayland][11] KDE Plasma 的会话 + * [KDE 应用程序][12]组(包括 KDE 特有的应用程序:Dolphin 管理器和其他有用的应用程序)。 + +你可以用下面的命令安装上述部分。 + +``` +pacman -S xorg plasma plasma-wayland-session kde-applications +``` + +安装后,启用显示管理器和网络管理器服务。 + +``` +systemctl enable sddm.service +systemctl enable NetworkManager.service +``` + +快完成了。关闭你的系统。 + +``` +shutdown now +``` + +重新打开系统电源,你应该会看到 KDE 的登录界面。你还记得为你的 sudo 用户设置的密码吗?用它来登录。 + +![Arch KDE Plasma Desktop][13] + +#### 接下来? + +你可能会想探索一下[基本的 pacman 命令][14],了解一下 [Arch 用户资源库][15],了解一下 [AUR 助手][16]。 + +希望这篇教程对你在 Arch Linux 上安装 KDE 桌面有所帮助。如果你在安装过程中遇到任何障碍或困难,请在下面的评论中告诉我们。 + +你最喜欢的桌面环境或窗口管理器是什么?请告诉我们,别忘了在我们的社交媒体上订阅。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-kde-arch-linux/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-arch-linux/ +[2]: https://www.gnome.org/ +[3]: https://kde.org/plasma-desktop +[4]: https://www.archlinux.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/install-kde-arch-linux.png?ssl=1 +[6]: https://linuxhandbook.com/useradd-command/ +[7]: https://itsfoss.com/command-line-text-editors-linux/ +[8]: https://www.nano-editor.org/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/adding-sudoer-arch-linux.png?ssl=1 +[10]: https://wiki.archlinux.org/index.php/Xorg +[11]: https://wiki.archlinux.org/index.php/Wayland +[12]: https://www.archlinux.org/groups/x86_64/kde-applications/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-Plasma-desktop.jpg?fit=800%2C450&ssl=1 +[14]: https://itsfoss.com/pacman-command/ +[15]: https://itsfoss.com/aur-arch-linux/ +[16]: https://itsfoss.com/best-aur-helpers/ From 2e3f7f0e828dec9393f97805573d4086c1757172 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 May 2020 01:07:02 +0800 Subject: [PATCH 2204/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200527=20How?= =?UTF-8?q?=20to=20Format=20a=20USB=20Disk=20as=20exFAT=20on=20Linux=20[Gr?= =?UTF-8?q?aphically=20and=20Command=20Line]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md --- ... on Linux -Graphically and Command Line.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md diff --git a/sources/tech/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md b/sources/tech/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md new file mode 100644 index 0000000000..76fd1159e4 --- /dev/null +++ b/sources/tech/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Format a USB Disk as exFAT on Linux [Graphically and Command Line]) +[#]: via: (https://itsfoss.com/format-exfat-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Format a USB Disk as exFAT on Linux [Graphically and Command Line] +====== + +_**Brief: This tutorial teaches you how to format a USB disk in exFAT format on Linux systems. Both GUI and command line methods have been discussed.**_ + +For a long time [FAT][1] has been the default choice of filesystem for formatting disks. It is compatible with pretty much all the major operating systems. + +The one major problem with FAT filesystem is that you cannot transfer a file larger than 4 GB. This means even if your USB disk has 32 GB of free space, if you try to transfer a ISO image or some other file greater than 4 GB in size, the transfer will fail. + +This creates a problem in situation like when you are [creating a bootable USB of Windows in Linux][2]. You cannot use [NTFS][3] and FAT filesystem has that 4 GB size restrictions. + +To overcome the limitations of FAT filesystem, Microsoft came up with [exFAT filesystem][4]. And in this tutorial, I’ll show you how to format a USB disk in exFAT filesystem. + + * [Format disk as exFAT using graphical tool][5] + * [Format disk as exFAT using command line][6] + + + +P**rerequisite** + +Starting [Linux kernel 5.4][7], exFAT filesystem support is enabled in Linux kernel itself. [Check which Linux kernel version you are running][8]. If it is kernel 5.4 or higher, you should be fine. + +Otherwise, you’ll have to [enable exFAT support][9] explicitly. In Ubuntu-based distributions, you can use these packages for this purpose: + +**sudo apt install exfat-fuse exfat-utils** + +### Method 1: Format disk as exFAT using GNOME Disks tool + +![][10] + +Formatting a drive using [GNOME Disks][11] is a straightforward job. It comes preinstalled in a number of Linux distributions. + +Plug in your external USB disk. Now, look for Disks in menu and open the GNOME Disks application. As a first step choose the drive that you want to format and follow the steps with me. + +_**Warning: Pay attention to the disk you are selecting to format. Don’t format your main disk accidentally.**_ + +![][12] + +The commonly used file systems like Ext4, NTFS, FAT will appear first. To use exFAT, choose “**Other**” and then click on “**Next**“. + +![][13] + +Final step: choose exFAT file system on this screen and then click **Create**. Job done! + +![][14] + +See how easy it was to create a exFAT disk in Linux graphically? Now, let me show you the terminal method as well. + +### Method 2: Format disk as exFAT in Linux command line (for advanced users) + +[fdisk][15] is a dialogue-driven command-line utility that creates and manipulates partition tables and partitions on a hard disk. In fact, it is considered one of the [best partitioning tools for Linux][16]. + +Plug in your external hard disk then type the following command in the terminal: + +``` +sudo fdisk -l +``` + +![][17] + +This will list down all the hard disks and partitions in your computer. Identify the partition that you want to format in your external hard disk. Size of the disks should give you a hint. For me, the USB disk was labelled as /dev/sdb1. + +Once you have identified your USB disk, format it as exfat using the command below. Replace /dev/sdXn with your disk’s device ID. LABEL is basically the name you want to give to your disk like Data, MyUSB etc. + +``` +sudo mkfs.exfat -n LABEL /dev/sdXn +``` + +![][18] + +Optionally, run fsck check to make sure the formatting has been done properly. + +``` +sudo fsck.exfat /dev/sdXn +``` + +That’s it. Enjoy the exFAT disk. + +### Did you succeed to create exFAT disk? + +I hope you find this tutorial simple enough, and a step forward to build a solid partitioning knowledge foundation. + +Sometimes easy and simple tips and tricks will make you a better Linux in the long term. Our frequent readers know that first hand but if you discovered It’s FOSS recently, you may take the opportunity to explore our handy tutorials. + +Don’t forget to subscribe and let me know your questions and suggestions in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/format-exfat-linux/ + +作者:[Dimitrios Savvopoulos][a] +选题:[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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/File_Allocation_Table +[2]: https://itsfoss.com/bootable-windows-usb-linux/ +[3]: https://en.wikipedia.org/wiki/NTFS +[4]: https://en.wikipedia.org/wiki/ExFAT +[5]: tmp.YPwoWNgq9W#graphical-method +[6]: tmp.YPwoWNgq9W#command-line +[7]: https://itsfoss.com/linux-kernel-5-4/ +[8]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[9]: https://itsfoss.com/mount-exfat/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/format-exfat-linux.jpg?ssl=1 +[11]: https://wiki.gnome.org/Apps/Disks +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/1.-gnome-disks-2.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/2.-gnome-disks.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/3.-gnome-disks.jpg?ssl=1 +[15]: https://www.tldp.org/HOWTO/Partition/fdisk_partitioning.html +[16]: https://itsfoss.com/partition-managers-linux/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/sudo-fdisk-l-1.jpg?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/sdXn.jpg?ssl=1 From ae0ebc8687385b97256b6334abfd5194b6431800 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 May 2020 01:07:56 +0800 Subject: [PATCH 2205/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200526=20Crea?= =?UTF-8?q?te=20interactive=20content=20in=20WordPress=20with=20the=20H5P?= =?UTF-8?q?=20plugin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md --- ...ontent in WordPress with the H5P plugin.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md diff --git a/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md b/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md new file mode 100644 index 0000000000..871439e73a --- /dev/null +++ b/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create interactive content in WordPress with the H5P plugin) +[#]: via: (https://opensource.com/article/20/5/h5p-wordpress) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Create interactive content in WordPress with the H5P plugin +====== +Turn your WordPress site into an interactive learning management system +with this open source plugin. +![Family learning and reading together at night in a room][1] + +WordPress is best known as a website content management system, but it also a great [learning management system][2] (LMS) for delivering online courses. If that is what you are looking for out of WordPress, then [H5P][3] should be the top plugin on your list. + +H5P is a way to create and share interactive HTML5 content, including presentations, games, quizzes, forms, and more, in a browser. You can download a wide variety of content types from H5P's [Examples and Downloads][4] page, or you can create unique content to embed in your WordPress site. + +H5P provides plugins and integrations for WordPress, Moodle, Drupal, Canvas, Brightspace, Blackboard, and more. In this article, I will show how to use H5P in WordPress to create a reading comprehension quiz for students. + +### Install the H5P plugin + +The first step is to install the plugin. Log into your WordPress admin panel, go to **Plugins**, select **Add New**, and search for **H5P** in the Plugins field. When you find it, select **Install Now**. + +![Adding the H5P plugin][5] + +(Don Watkins, [CC BY-SA 4.0][6]) + +H5P should now appear in the list of installed plugins. Be sure to **Activate** the plugin by going to the H5P menu at the bottom of your WordPress admin panel and clicking the button. You will see the following display—be sure to consent so you can connect to the H5P Hub. + +![H5P consent option][7] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Now you can begin adding H5P content to your WordPress installation. + +### Create a quiz + +One of my favorite poems is Robert Frost's "The Road Not Taken." Suppose you are teaching a class that is studying this poem, and one of your objectives is for your students to remember the poem's author. First, create a new WordPress post on your site that contains the poem's text and its author. + +![Creating a WordPress post][8] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Now you want to test your students' comprehension with an HTML5 interactive content embedded below the poem. + +In the WordPress admin panel, look near the bottom for the **H5P Content** menu and select it. In the menu that appears, click **Add New**. + +![H5P Content menu][9] + +(Don Watkins, [CC BY-SA 4.0][6]) + +You will see an array of content options that are available. Since you want to create a multiple-choice quiz, look for the **Multiple Choice** option and click **Get** to its right. + +![H5P content types][10] + +(Don Watkins, [CC BY-SA 4.0][6]) + +A form will open for you to start creating the quiz. Fill in the required fields (marked with a red asterisk)—give your quiz a title (e.g., "Road Not Taken Quiz"), enter a question (e.g., "Who wrote, 'The Road Not Taken'?") and correct and incorrect answers, and select the correct answer in the dialog box. When you finish creating the quiz, save the content. + +![H5P quiz][11] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### Embed the quiz in a post + +Now you're ready to insert the quiz exactly where you want it to appear in your post. Open the post where you want to put the quiz (e.g., "The Road Not Taken" post) in your WordPress editor, and you should see an **Add H5P** button near the top of the interface. Place your cursor wherever you want the quiz to appear in the post, and click **Add H5P**. Your H5P content will appear in a dialog box like this: + +![H5P list of interactive content][12] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Select the content you want, and H5P will insert an embed code (e.g., `[h5p id="1"]`) in the post, like this: + +![H5P embed code in a post][13] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Save your post, then open it in your browser. The quiz is exactly where you wanted it to appear in the post: + +![H5P quiz shown in the post][14] + +(Don Watkins, [CC BY-SA 4.0][6]) + +When a student answers this question correctly, they get pleasant visual feedback: + +![Correct answer selection][15] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### The possibilities are endless + +H5P offers a wide range of options to add interactivity to WordPress posts. In this example, you could have created a more complex set of multiple-choice questions. H5P also has lots of other content types, including interactive video, arithmetic quizzes, an audio recorder, image hotspots, fill-in-the-blank quizzes, and [many more][4]. + +H5P also provides [excellent documentation][16] and [great tutorials][17] to help anyone who wants to use the plugin on their WordPress site. H5P software is open source under the [MIT License][18] with the code available on [GitHub][19]. H5P also welcomes contributions to the community; check out the [developer guide][20] for more information. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/h5p-wordpress + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/family_learning_kids_night_reading.png?itok=6K7sJVb1 (Family learning and reading together at night in a room) +[2]: https://en.wikipedia.org/wiki/Learning_management_system +[3]: https://h5p.org/ +[4]: https://h5p.org/content-types-and-applications +[5]: https://opensource.com/sites/default/files/uploads/addplugins-h5p.png (Adding the H5P plugin) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/h5p-consent.png (H5P consent option) +[8]: https://opensource.com/sites/default/files/uploads/wordpress-post.png (WordPress post) +[9]: https://opensource.com/sites/default/files/uploads/h5p-content-menu.png (H5P Content menu) +[10]: https://opensource.com/sites/default/files/uploads/h5p-content-types.png (H5P content types) +[11]: https://opensource.com/sites/default/files/uploads/h5p-multiple-choice-quiz.png (H5P quiz) +[12]: https://opensource.com/sites/default/files/uploads/h5p-insert-interactive-content.png (H5P list of interactive content) +[13]: https://opensource.com/sites/default/files/uploads/h5p-embedded-content.png (H5P embed code in a post) +[14]: https://opensource.com/sites/default/files/uploads/h5p-quiz.png (H5P quiz shown in the post) +[15]: https://opensource.com/sites/default/files/uploads/h5p-correct-answer.png (Correct answer selection) +[16]: https://h5p.org/documentation/setup/wordpress +[17]: https://h5p.org/documentation/for-authors/tutorials +[18]: https://h5p.org/MIT-licensed +[19]: https://github.com/h5p +[20]: https://h5p.org/developers From 8ddce545840e523c48af8bc89112d1bf50ee5157 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 May 2020 01:08:20 +0800 Subject: [PATCH 2206/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200526=20How?= =?UTF-8?q?=20to=20write=20about=20open=20source=20software?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200526 How to write about open source software.md --- ...How to write about open source software.md | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 sources/tech/20200526 How to write about open source software.md diff --git a/sources/tech/20200526 How to write about open source software.md b/sources/tech/20200526 How to write about open source software.md new file mode 100644 index 0000000000..f45215fd0b --- /dev/null +++ b/sources/tech/20200526 How to write about open source software.md @@ -0,0 +1,191 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write about open source software) +[#]: via: (https://opensource.com/article/20/5/write-about-open-source-software) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +How to write about open source software +====== +Become a better writer by following these tips. +![Typewriter in the grass][1] + +One way to get started with an open source community is to write about it. You can contribute to technical documentation, share how you use the software, or write an article for Opensource.com. But getting started writing is easier said than done. The two most common excuses I hear for not writing are: "I have nothing new to say" and "I'm not a good writer." I'm here to dispel both of those myths. + +### What should you write about? + +> "Hunt for the stories that often get left out." +> —Erik Larson + +For some people, the biggest hurdle to writing is generating an idea or topic to write about. It's common to fall into the trap of thinking, "This topic has been written about, so why bother." + +I'm not the first person to write an article on writing, and I won't be the last. What I bring is my unique perspective and things I've learned over the years. I've had people ask me for tips on getting started or how to get better at writing. I decided to turn those suggestions into an article. + +Your writing is a reflection of you. Nobody will tell the story the way you do. Your experiences and perspective may be just what somebody else needs. + +Here are some prompts to help you come up with a topic: + + * What is something you've recently learned? Write about how you learned, what you learned, or what surprised you. + * What questions are you frequently asked? Write up the answer. + * Did you recently search for a how-to article and weren't satisfied with any of the top search results? Write the article you were looking for. + * Did you attend a conference or workshop? Write a post-event summary of what you learned. + * Did you start using a new tool? Write up a how-to or getting-started guide. + + + +### What type of article are you writing? + +There are different types of writing, including: + + * Technical documentation + * How-to guide + * Blog + * White paper or eBook + * Retrospective + + + +The type of content will influence your writing style and tone of voice. A blog is more informal and conversational. Technical documentation is more formal and instructional. + +### Who are you writing for? + +Each piece of writing should have a single audience. The audience is the type of person you are writing for. Before you begin writing, it helps to jot down a few characteristics of your reader. It's important to consider who you are writing for, as well as who you _aren't_ writing for—identifying your target audience will shape what to include and what not to include. + +For example, this is who I envisioned when writing this article: + + * Has basic knowledge of writing and grammar + * Is interested in improving writing skills + * Works in technology as a developer, sales engineer, customer success manager, or similar role + * Is not an experienced or advanced writer, may have a couple of published articles on a personal or work blog, and wants to write more + * Is writing non-fiction + + + +If you have content for multiple audiences, consider breaking it down into different pieces for the different audiences. Some areas to consider in your audience: + + * Level of expertise: novice, intermediate, advanced + * Role: manager, individual contributor + * Goals: why are they reading? + + + +### Words matter + +The words you choose will have an impact on the reader. Difficult words can make an article harder to understand. Unfamiliar words can make the reader feel stupid. Certain words can accidentally offend a reader. Your goal as a writer is to avoid all of these. Here's how. + +#### Use everyday language + +Don't write as a way to show off your vocabulary or the words you've learned from your "Word of the Day" calendar. Write so a reader can understand. There is a reading level associated with every piece of writing. If you're writing technical documentation, aim for about an eighth-grade reading level. This doesn't imply your audience has only an eighth-grade education. It means your writing will be more easily understood. Do you want people to get hung up on the language, or do you want them to walk away feeling like they learned something? Just because you can use big, complicated words doesn't mean you should. Using simple language does not necessarily mean your article will be boring. + +Use tools like [Hemingway App][2] to check the readability of your writing (it's not open source, but it's excellent). For example, after the first draft, this article was assessed at a fifth-grade reading level. Hemingway also provides suggestions on how to improve your writing—identifying hard-to-read sentences or places to alter word choice. + +If you're struggling with coming up with alternative words, check out the suggestions at the [Plain English Campaign][3] or the crowdsourced suggestions at [Power Thesaurus][4]. + +#### Know which words to avoid + +> "Substitute 'damn' every time you're inclined to write 'very'; your editor will delete it and the writing will be just as it should be." +> —Mark Twain + +When writing a tutorial or how-to guide, here are some words to avoid, including "simple," "easy," and "just." You, an expert on the topic you're writing about, may find things easy after years of practice. A beginner may not find things simple or easy. Your readers may get frustrated because they don't find the process or explanation simple. + +Have you ever had to reread a sentence or paragraph multiple times because you couldn't figure out what the writer was saying? Have you ever given up on an article because it wasn't making sense to you? I have. + +As a writer, do you want your readers to feel confused or unintelligent? I hope not. + +Other words to avoid in your writing: + + * That + * Really + * Very + * So + * In order to + + + +Generally, these words can be deleted without changing the meaning of a sentence. + +After I finish writing, I search a document for instances of those words. When I searched through this document, I found the following sentence: + +> "This doesn't imply that your audience only has an eighth-grade education, it means that your writing will be more easily understood." + +Two instances of "that" appear in this sentence. They're not adding value to the sentence. They can be deleted without changing its meaning. Removing those instances shortens the sentence, and shorter sentences are easier to understand. And speaking of shorter sentences, I also re-wrote it as two sentences. + +> "This doesn't imply your audience has only an eighth-grade education. It means your writing will be more easily understood." + +#### Use inclusive language + +The historical context of words and phrases can lead to people feeling excluded or offended. When writing, you want to make the reader feel included. When you use inclusive language, it makes your reader feel understood, respected, and like they belong. I refer to this [guide on using inclusive language][5] from Buffer. + +### Revising and editing + +> "Almost all good writing begins with terrible first efforts. You need to start somewhere." +> —Anne Lamott + +Writing is an iterative process. If you think writers sit down at their desk and, within an hour, have a completed article ready to be published, think again. Some articles take me weeks to complete. Here's a standard process for me: + + * Write a rough first draft. By rough, I mean _rough_. I write without worrying about grammar. The idea is to get words out of my head and onto paper. This step can take anywhere from an hour to a couple of weeks. + * Put the draft away for some time. This can be anywhere from a couple of hours to a couple of days, depending on the publishing timeline. + * Review the draft. Make tweaks and edits. + * Ask for feedback, either from a coworker or a friend. During this phase of feedback, I focus on clarity. Does everything make sense? Is anything confusing, any missing sections? + * Incorporate feedback. No matter how experienced you are at writing, other writers reviewing your work will make it better. + + + +At this stage, I have a pretty solid draft. Now comes my least favorite part of writing—editing. The Hemingway App I mentioned earlier not only tells you the reading level but also provides suggestions to improve your writing. I also use Grammarly to help with grammar edits. For open source alternatives to Grammarly, check out [Language Tool][6] or this article on [open source writing tools][7]. + +One of my writing challenges is using commas appropriately. Grammarly helps me figure out where I miss or misuse a comma. Grammarly identified 43 issues related to the correctness of this article's final draft. The majority were comma errors. + +![Errors identified by Grammarly][8] + +(Dawn Parzych, [CC BY-SA 4.0][9]) + +In addition to grammatical errors, the app also provides suggestions to help with clarity, engagement, and delivery (some of these features may not be available in the free version). This includes things like word choice and using active vs. passive voice. Some suggestions I accept; others I reject. After reviewing all the alerts and suggestions, Grammarly reports back across all dimensions. + +![Grammarly results][10] + +(Dawn Parzych, [CC BY-SA 4.0][9]) + +Don't be afraid to ask for help with your writing. Behind every good writer is a good editor or a good editing app. + +### Style guides + +Style guides provide standards for improving communication in writing. They include aspects such as punctuation, grammar, and word usage. If writing a document for your company, check to see if it uses a style guide. If it doesn't have a style guide, or if you're writing for yourself, here are some common style guides to follow: + + * [Chicago Manual of Style][11] + * [Google Developer Documentation Guide][12] + * [Microsoft Writing Style Guide][13] + * [AP Stylebook][14] + + + +Writing is a way to share your thoughts and knowledge with the community. The only way to get started writing is to start typing. Use these suggestions to fine-tune your writing. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/write-about-open-source-software + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead.png?itok=h3fCkVmU (Typewriter in the grass) +[2]: http://www.hemingwayapp.com/ +[3]: http://www.plainenglish.co.uk/the-a-z-of-alternative-words.html +[4]: https://www.powerthesaurus.org/ +[5]: https://open.buffer.com/inclusive-language-tech/ +[6]: https://languagetool.org/ +[7]: https://opensource.com/article/20/3/open-source-writing-tools +[8]: https://opensource.com/sites/default/files/uploads/grammarlyerrors.png (Errors identified by Grammarly) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://opensource.com/sites/default/files/uploads/grammarlyresults.png (Grammarly results) +[11]: https://www.chicagomanualofstyle.org/home.html +[12]: https://developers.google.com/style +[13]: https://docs.microsoft.com/en-us/style-guide/welcome/ +[14]: https://www.apstylebook.com/ From 58fd261dcea0bc567ddc588d0cc16314981d5d33 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 May 2020 07:59:49 +0800 Subject: [PATCH 2207/3057] APL --- .../tech/20200526 How to write about open source software.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200526 How to write about open source software.md b/sources/tech/20200526 How to write about open source software.md index f45215fd0b..280e442c6e 100644 --- a/sources/tech/20200526 How to write about open source software.md +++ b/sources/tech/20200526 How to write about open source software.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6987eb8fbc7b5dcf85c5bd94eb2a80aa6d48a8b2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 27 May 2020 08:46:09 +0800 Subject: [PATCH 2208/3057] translated --- ...ted with the Gutenberg editor in Drupal.md | 122 ------------------ ...ted with the Gutenberg editor in Drupal.md | 120 +++++++++++++++++ 2 files changed, 120 insertions(+), 122 deletions(-) delete mode 100644 sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md create mode 100644 translated/tech/20200304 Getting started with the Gutenberg editor in Drupal.md diff --git a/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md b/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md deleted file mode 100644 index 84c177f4de..0000000000 --- a/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with the Gutenberg editor in Drupal) -[#]: via: (https://opensource.com/article/20/3/gutenberg-editor-drupal) -[#]: author: (MaciejLukianski https://opensource.com/users/maciejlukianski) - -Getting started with the Gutenberg editor in Drupal -====== -Learn how to use the WYSIWYG editor, made popular in WordPress, with -Drupal. -![Text editor on a browser, in blue][1] - -Since 2017, WordPress has had a really great WYSIWYG editor in the [Gutenberg][2] plugin. But the Drupal community hasn't yet reached consensus on the best approach to the content management system's (CMS) editorial experience. But a strong new option appeared when, with a lot of community effort, [Gutenberg was integrated with Drupal][3]. - -Previously, there were two main approaches to content creation in Drupal 8: - - * In the [**Paragraph-based approach**][4], content is assembled out of entities called paragraphs. Currently, approximately 100,000 websites use the Paragraphs module (according to Drupal). - * The [**Layout-Builder approach**][5] uses an editorial tool shipped with Drupal 8.5. It is still undergoing improvements, but it is the next strong contender because it is really well integrated with the Drupal core. Stats on usage are not available since Layout Builder is part of Drupal. - - - -At the end of 2018, the Drupal community, lead by Fronkom (a Norwegian digital agency strongly focused on open source solutions), ported the WordPress Gutenberg project as a contributed module into Drupal. Let's take a look at how Gutenberg works in Drupal (including some cool Drupal-specific integrations). - -### Installation - -Installing the [Gutenberg module][6] is as straightforward as installing any Drupal module, and it has good [installation documentation][7]. - -### Configuration - -Gutenberg is integrated into Drupal's default content-entity creation workflow. You can use it on any of the content types you choose, provided that the content type has at least one text area field, which is where the Gutenberg editor's output will be saved. - -To enable the Gutenberg project on a content type in Drupal, you have to navigate to its settings: **Structure > Content types** and, from the dropdown next to the content type where you want to use Gutenberg, click **Edit**. - -![Drupal settings][8] - -In the form that appears, scroll down and select the **Gutenberg experience** tab on the left, where you can find the settings described below. Select the **Enable Gutenberg experience** box. - -![Drupal Gutenberg settings][9] - -#### Template - -This is one of the cool features that is not available in WordPress out of the box. It enables you to define a template for a new page in a JSON structure. This will pre-populate all newly created articles with dummy placeholder content, which will help editors structure content correctly. In the screenshot above, I added a heading and a paragraph. Note that any double-quotes have to be escaped. - -#### Template lock - -This setting allows you to define whether users are allowed to delete the placeholder content, add new blocks, or just edit the existing, pre-populated content. - -#### Allowed Gutenberg and Drupal blocks - -This is another super-cool feature on the Drupal side of Gutenberg. Drupal allows users to create various types of blocks to design a page. For example, you could create a block with a list of the five latest blog posts, the most recent comments, or a form to collect users' emails. - -Gutenberg's deep integration with Drupal allows users to select which Drupal blocks are available to users while they are editing (e.g., limit embeds to YouTube) and use blocks as inline content. This is a very handy feature that allows granular control of the user experience. - -There's not much to choose from in a blank Drupal installation, but a live site usually has many blocks that provide various functionalities. In the screenshot below, the **Search form** Drupal block is selected. - -![Drupal Gutenberg blocks][10] - -After you finish the configuration, hit **Save content type**. - -### Publishing content with Drupal Gutenberg - -When Gutenberg is enabled for a content type, it takes over most of the editorial experience. - -![Drupal Gutenberg content screen][11] - -In the main window, you can see the dummy placeholder content I added in the Template configuration above. - -#### Drupal-specific options - -On the right-hand side, there are a few fields and settings that Drupal provides. For example, the **Title** field is a required separate field in Drupal, and therefore it is not on the main Gutenberg screen. - -Underneath the **Title**, there are additional settings that can vary, depending on the modules installed and options set up in Drupal. You can see **Revision log messages**, **Menu settings**, **Comment settings**, and a place to add a **URL alias**. - -Typically, Drupal content types are composed of several text fields, such as tags, categories, checkboxes, image fields for teasers, etc. When you enable Gutenberg for a content type, these additional fields are available in the **More settings** tab. - -You can now add your content—it works the same as it does in WordPress Gutenberg, with the additional option to add Drupal blocks. - -In the screenshot below, you can see what happens when I add some text to replace the placeholder text, a search block from Drupal, a title, tags, and a custom URL alias. - -![Drupal Gutenberg entering text][12] - -After you hit **Save**, your content will be published. - -![Drupal Gutenberg output][13] - -And that is it. It works like a charm! - -### Working together for better software experiences - -Gutenberg in Drupal works well. It is an alternative option that allows editors to control the look and feel of their websites down to the tiniest details. Adoption is growing well, with over 1,000 installations as of this writing and 50 new ones every month. The Drupal integration adds other cool features like fine-grained permissions, placeholder content, and the ability to include Drupal blocks inline, which aren't available in the WordPress plugin. - -It is great to see the communities of two separate projects working together to achieve the common goal of giving people better software. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/gutenberg-editor-drupal - -作者:[MaciejLukianski][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/maciejlukianski -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) -[2]: https://wordpress.org/plugins/gutenberg/ -[3]: https://drupalgutenberg.org/ -[4]: https://www.droptica.com/blog/flexible-and-easy-content-creation-drupal-paragraphs-module/ -[5]: https://www.droptica.com/blog/layout-builder-building-drupal-8-layouts/ -[6]: https://www.drupal.org/project/gutenberg -[7]: https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-modules -[8]: https://opensource.com/sites/default/files/uploads/gutenberg_edit.png (Drupal settings) -[9]: https://opensource.com/sites/default/files/uploads/gutenberg_settings.png (Drupal Gutenberg settings) -[10]: https://opensource.com/sites/default/files/uploads/gutenberg_blocks.png (Drupal Gutenberg blocks) -[11]: https://opensource.com/sites/default/files/uploads/gutenberg_contentwindow.png (Drupal Gutenberg content screen) -[12]: https://opensource.com/sites/default/files/uploads/gutenberg_entry.png (Drupal Gutenberg entering text) -[13]: https://opensource.com/sites/default/files/uploads/gutenberg-demo.png (Drupal Gutenberg output) diff --git a/translated/tech/20200304 Getting started with the Gutenberg editor in Drupal.md b/translated/tech/20200304 Getting started with the Gutenberg editor in Drupal.md new file mode 100644 index 0000000000..2b3abe8bc5 --- /dev/null +++ b/translated/tech/20200304 Getting started with the Gutenberg editor in Drupal.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with the Gutenberg editor in Drupal) +[#]: via: (https://opensource.com/article/20/3/gutenberg-editor-drupal) +[#]: author: (MaciejLukianski https://opensource.com/users/maciejlukianski) + +Drupal 中的 Gutenberg 编辑器入门 +====== +了解如何与 Drupal 一起使用 WordPress 中流行的 WYSIWYG 编辑器。 +![Text editor on a browser, in blue][1] + +自 2017 年以来,WordPress 的 [Gutenberg][2] 插件中就有非常出色的 WYSIWYG 编辑器。但是,Drupal 社区尚未就内容管理系统 (CMS) 编辑体验的最佳方法达成共识。 但是,在社区的大量努力下,出现了一个强有力的新选择,将 [Gutenberg 与 Drupal 集成在一起][3]。 + +以前,Drupal 8 中有两种主要的内容创建方法: + + * 在[**基于段落的方法**][4]中,内容是由称为段落的实体组合而成。 目前,大约有 100,000 个网站使用“段落” (Paragraphs)模块(根据 Drupal)。 + * [**Layout-Builder 方法**][5]使用 Drupal 8.5 附带的编辑工具。 它仍然在改进,但是它是下一个强有力的竞争者,因为它确实与 Drupal 内核很好地集成在一起。由于 Layout Builder 是 Drupal 的一部分,因此无法获得使用情况的统计信息。 + + +在 2018 年底,由 Fronkom(一家专注于开源解决方案的挪威数字机构)领导的 Drupal 社区将 WordPress Gutenberg 项目作为贡献模块移植到了 Drupal 中。让我们看一下 Gutenberg 在 Drupal 中的工作方式(包括一些很酷的 Drupal 特定集成)。 + +### 安装 + +安装 [Gutenberg 模块][6]与安装任何 Drupal 模块一样简单,并且有良好的[安装文档][7]。 + +### 配置 + +Gutenberg 已集成到 Drupal 的默认内容实体创建工作流中。你可以将其用于你选择的任何内容类型,前提是内容类型至少有一个文本区域字段,它是 Gutenberg 编辑器输出的位置。 + +要在 Drupal 中的内容类型启用 Gutenberg 项目,你必须进入设置:**Structure > Content types**,并且,从要你想使用 Gutenberg 的内容类型旁边的下拉框中单击 **Edit**。 + +![Drupal settings][8] + +在出现的窗口中,向下滚动并选择左侧的 **Gutenberg experience** 选项卡,你可以在其中找到下面描述的设置。选择 **Enable Gutenberg experience**。 + +![Drupal Gutenberg settings][9] + +#### 模板 + +这是 WordPress 开箱即用的很酷的功能之一。它能让你用 JSON 结构定义新页面模板。它将使用虚拟占位符内容预填充所有新创建的文章,这将有助于编辑者正确地构造内容。在上面的截图中,我添加了一个标题和一个段落。请注意,必须转义任何双引号。 + +#### 模板锁 + +此设置允许你定义是否允许用户删除占位符内容,添加新块或仅编辑现有的预填充内容。 + +#### 允许的 Gutenberg 和 Drupal 块 + +这是 Gutenberg Drupal 侧的另一个超酷功能。Drupal 允许用户创建各种类型的块来设计页面。例如,你可以创建一个块,其中包含五个最新博客的列表、最新评论或用于收集用户电子邮件的表单。 + +Gutenberg 与 Drupal 的深度集成允许用户在编辑时选择哪些 Drupal 块可供用户使用(例如,有限嵌入 YouTube),并将块用作内联内容。这是一个非常方便的功能,允许对用户体验进行精细控制。 + +在全新安装的 Drupal 中,没有太多的选择,但站点通常有许多提供各种功能的块。在下面的截图中,选择了 **Search form** 的 Drupal 块。 + +![Drupal Gutenberg blocks][10] + +完成配置后,点击 **Save content type**。 + +### 使用 Drupal Gutenberg 发布内容 + +启用 Gutenberg 内容类型后,它将接管大部分编辑体验。 + +![Drupal Gutenberg content screen][11] + +在主窗口中,你可以看到我在上面的模板配置中添加的虚拟占位符内容。 + +#### 特定于 Drupal 的选项 + +在右侧,Drupal 提供了一些字段和设置。例如,“Title” 字段是 Drupal 中所需的单独字段,因此它不在主页面上。 + +在 **Title** 下面,根据在 Drupal 中安装的模块和设置的选项,其他设置可能有所不同。你可以看到 **Revision log messages**、**Menu settings**、**Comment settings** 以及添加 **URL alias**。 + +通常,Drupal 内容类型由多个文本字段组成,如标记、类别、复选框、图像字段等。当你启用 Gutenberg 内容类型时,这些附加字段可在 **More settings** 选项卡中提供。 + +你现在可以添加内容 — 它的工作方式与 WordPress Gutenberg 中的相同,并有额外的添加 Drupal 块的选项。 + +在下面的截图中,你可以看到当我添加一些文本替换占位符文本、来自 Drupal 的搜索块、标题、标记和自定义 URL 别名后发生的情况。 + +![Drupal Gutenberg entering text][12] + +点击 **Save** 后,你的内容将发布。 + +![Drupal Gutenberg output][13] + +就是这样,它工作良好 + +### 共同工作以获得更好的软件体验 + +Drupal 中的 Gutenberg 工作良好。这是一个可供选择的选项,允许编辑者控制网站的外观,直至最细微的细节。采用率正在增长,截至本文撰写时,已有 1,000 多个安装,每月有 50 个新安装。Drupal 集成添加了其他很酷的功能,如细粒度权限、占位符内容,以及内联包含 Drupal 块的功能,这些功能在 WordPress 插件中没有。 + +很高兴看到两个独立项目的社区共同努力实现为人们提供更好的软件的共同目标。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/gutenberg-editor-drupal + +作者:[MaciejLukianski][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/maciejlukianski +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://wordpress.org/plugins/gutenberg/ +[3]: https://drupalgutenberg.org/ +[4]: https://www.droptica.com/blog/flexible-and-easy-content-creation-drupal-paragraphs-module/ +[5]: https://www.droptica.com/blog/layout-builder-building-drupal-8-layouts/ +[6]: https://www.drupal.org/project/gutenberg +[7]: https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-modules +[8]: https://opensource.com/sites/default/files/uploads/gutenberg_edit.png (Drupal settings) +[9]: https://opensource.com/sites/default/files/uploads/gutenberg_settings.png (Drupal Gutenberg settings) +[10]: https://opensource.com/sites/default/files/uploads/gutenberg_blocks.png (Drupal Gutenberg blocks) +[11]: https://opensource.com/sites/default/files/uploads/gutenberg_contentwindow.png (Drupal Gutenberg content screen) +[12]: https://opensource.com/sites/default/files/uploads/gutenberg_entry.png (Drupal Gutenberg entering text) +[13]: https://opensource.com/sites/default/files/uploads/gutenberg-demo.png (Drupal Gutenberg output) From aac72a8fa6b3ef0038d977430bfe2b2c7efe179a Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 27 May 2020 08:53:06 +0800 Subject: [PATCH 2209/3057] translating --- ...5 How to Execute a Command or Script at Reboot or Startup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md b/sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md index 5d81b593de..91e97dbbaf 100644 --- a/sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md +++ b/sources/tech/20200525 How to Execute a Command or Script at Reboot or Startup.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b9c8ce5df3412d0f4d73c297f0d4a3faf68169d0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 May 2020 09:49:00 +0800 Subject: [PATCH 2210/3057] TSL --- ...How to write about open source software.md | 191 ------------------ ...How to write about open source software.md | 175 ++++++++++++++++ 2 files changed, 175 insertions(+), 191 deletions(-) delete mode 100644 sources/tech/20200526 How to write about open source software.md create mode 100644 translated/tech/20200526 How to write about open source software.md diff --git a/sources/tech/20200526 How to write about open source software.md b/sources/tech/20200526 How to write about open source software.md deleted file mode 100644 index 280e442c6e..0000000000 --- a/sources/tech/20200526 How to write about open source software.md +++ /dev/null @@ -1,191 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to write about open source software) -[#]: via: (https://opensource.com/article/20/5/write-about-open-source-software) -[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) - -How to write about open source software -====== -Become a better writer by following these tips. -![Typewriter in the grass][1] - -One way to get started with an open source community is to write about it. You can contribute to technical documentation, share how you use the software, or write an article for Opensource.com. But getting started writing is easier said than done. The two most common excuses I hear for not writing are: "I have nothing new to say" and "I'm not a good writer." I'm here to dispel both of those myths. - -### What should you write about? - -> "Hunt for the stories that often get left out." -> —Erik Larson - -For some people, the biggest hurdle to writing is generating an idea or topic to write about. It's common to fall into the trap of thinking, "This topic has been written about, so why bother." - -I'm not the first person to write an article on writing, and I won't be the last. What I bring is my unique perspective and things I've learned over the years. I've had people ask me for tips on getting started or how to get better at writing. I decided to turn those suggestions into an article. - -Your writing is a reflection of you. Nobody will tell the story the way you do. Your experiences and perspective may be just what somebody else needs. - -Here are some prompts to help you come up with a topic: - - * What is something you've recently learned? Write about how you learned, what you learned, or what surprised you. - * What questions are you frequently asked? Write up the answer. - * Did you recently search for a how-to article and weren't satisfied with any of the top search results? Write the article you were looking for. - * Did you attend a conference or workshop? Write a post-event summary of what you learned. - * Did you start using a new tool? Write up a how-to or getting-started guide. - - - -### What type of article are you writing? - -There are different types of writing, including: - - * Technical documentation - * How-to guide - * Blog - * White paper or eBook - * Retrospective - - - -The type of content will influence your writing style and tone of voice. A blog is more informal and conversational. Technical documentation is more formal and instructional. - -### Who are you writing for? - -Each piece of writing should have a single audience. The audience is the type of person you are writing for. Before you begin writing, it helps to jot down a few characteristics of your reader. It's important to consider who you are writing for, as well as who you _aren't_ writing for—identifying your target audience will shape what to include and what not to include. - -For example, this is who I envisioned when writing this article: - - * Has basic knowledge of writing and grammar - * Is interested in improving writing skills - * Works in technology as a developer, sales engineer, customer success manager, or similar role - * Is not an experienced or advanced writer, may have a couple of published articles on a personal or work blog, and wants to write more - * Is writing non-fiction - - - -If you have content for multiple audiences, consider breaking it down into different pieces for the different audiences. Some areas to consider in your audience: - - * Level of expertise: novice, intermediate, advanced - * Role: manager, individual contributor - * Goals: why are they reading? - - - -### Words matter - -The words you choose will have an impact on the reader. Difficult words can make an article harder to understand. Unfamiliar words can make the reader feel stupid. Certain words can accidentally offend a reader. Your goal as a writer is to avoid all of these. Here's how. - -#### Use everyday language - -Don't write as a way to show off your vocabulary or the words you've learned from your "Word of the Day" calendar. Write so a reader can understand. There is a reading level associated with every piece of writing. If you're writing technical documentation, aim for about an eighth-grade reading level. This doesn't imply your audience has only an eighth-grade education. It means your writing will be more easily understood. Do you want people to get hung up on the language, or do you want them to walk away feeling like they learned something? Just because you can use big, complicated words doesn't mean you should. Using simple language does not necessarily mean your article will be boring. - -Use tools like [Hemingway App][2] to check the readability of your writing (it's not open source, but it's excellent). For example, after the first draft, this article was assessed at a fifth-grade reading level. Hemingway also provides suggestions on how to improve your writing—identifying hard-to-read sentences or places to alter word choice. - -If you're struggling with coming up with alternative words, check out the suggestions at the [Plain English Campaign][3] or the crowdsourced suggestions at [Power Thesaurus][4]. - -#### Know which words to avoid - -> "Substitute 'damn' every time you're inclined to write 'very'; your editor will delete it and the writing will be just as it should be." -> —Mark Twain - -When writing a tutorial or how-to guide, here are some words to avoid, including "simple," "easy," and "just." You, an expert on the topic you're writing about, may find things easy after years of practice. A beginner may not find things simple or easy. Your readers may get frustrated because they don't find the process or explanation simple. - -Have you ever had to reread a sentence or paragraph multiple times because you couldn't figure out what the writer was saying? Have you ever given up on an article because it wasn't making sense to you? I have. - -As a writer, do you want your readers to feel confused or unintelligent? I hope not. - -Other words to avoid in your writing: - - * That - * Really - * Very - * So - * In order to - - - -Generally, these words can be deleted without changing the meaning of a sentence. - -After I finish writing, I search a document for instances of those words. When I searched through this document, I found the following sentence: - -> "This doesn't imply that your audience only has an eighth-grade education, it means that your writing will be more easily understood." - -Two instances of "that" appear in this sentence. They're not adding value to the sentence. They can be deleted without changing its meaning. Removing those instances shortens the sentence, and shorter sentences are easier to understand. And speaking of shorter sentences, I also re-wrote it as two sentences. - -> "This doesn't imply your audience has only an eighth-grade education. It means your writing will be more easily understood." - -#### Use inclusive language - -The historical context of words and phrases can lead to people feeling excluded or offended. When writing, you want to make the reader feel included. When you use inclusive language, it makes your reader feel understood, respected, and like they belong. I refer to this [guide on using inclusive language][5] from Buffer. - -### Revising and editing - -> "Almost all good writing begins with terrible first efforts. You need to start somewhere." -> —Anne Lamott - -Writing is an iterative process. If you think writers sit down at their desk and, within an hour, have a completed article ready to be published, think again. Some articles take me weeks to complete. Here's a standard process for me: - - * Write a rough first draft. By rough, I mean _rough_. I write without worrying about grammar. The idea is to get words out of my head and onto paper. This step can take anywhere from an hour to a couple of weeks. - * Put the draft away for some time. This can be anywhere from a couple of hours to a couple of days, depending on the publishing timeline. - * Review the draft. Make tweaks and edits. - * Ask for feedback, either from a coworker or a friend. During this phase of feedback, I focus on clarity. Does everything make sense? Is anything confusing, any missing sections? - * Incorporate feedback. No matter how experienced you are at writing, other writers reviewing your work will make it better. - - - -At this stage, I have a pretty solid draft. Now comes my least favorite part of writing—editing. The Hemingway App I mentioned earlier not only tells you the reading level but also provides suggestions to improve your writing. I also use Grammarly to help with grammar edits. For open source alternatives to Grammarly, check out [Language Tool][6] or this article on [open source writing tools][7]. - -One of my writing challenges is using commas appropriately. Grammarly helps me figure out where I miss or misuse a comma. Grammarly identified 43 issues related to the correctness of this article's final draft. The majority were comma errors. - -![Errors identified by Grammarly][8] - -(Dawn Parzych, [CC BY-SA 4.0][9]) - -In addition to grammatical errors, the app also provides suggestions to help with clarity, engagement, and delivery (some of these features may not be available in the free version). This includes things like word choice and using active vs. passive voice. Some suggestions I accept; others I reject. After reviewing all the alerts and suggestions, Grammarly reports back across all dimensions. - -![Grammarly results][10] - -(Dawn Parzych, [CC BY-SA 4.0][9]) - -Don't be afraid to ask for help with your writing. Behind every good writer is a good editor or a good editing app. - -### Style guides - -Style guides provide standards for improving communication in writing. They include aspects such as punctuation, grammar, and word usage. If writing a document for your company, check to see if it uses a style guide. If it doesn't have a style guide, or if you're writing for yourself, here are some common style guides to follow: - - * [Chicago Manual of Style][11] - * [Google Developer Documentation Guide][12] - * [Microsoft Writing Style Guide][13] - * [AP Stylebook][14] - - - -Writing is a way to share your thoughts and knowledge with the community. The only way to get started writing is to start typing. Use these suggestions to fine-tune your writing. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/5/write-about-open-source-software - -作者:[Dawn Parzych][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/dawnparzych -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead.png?itok=h3fCkVmU (Typewriter in the grass) -[2]: http://www.hemingwayapp.com/ -[3]: http://www.plainenglish.co.uk/the-a-z-of-alternative-words.html -[4]: https://www.powerthesaurus.org/ -[5]: https://open.buffer.com/inclusive-language-tech/ -[6]: https://languagetool.org/ -[7]: https://opensource.com/article/20/3/open-source-writing-tools -[8]: https://opensource.com/sites/default/files/uploads/grammarlyerrors.png (Errors identified by Grammarly) -[9]: https://creativecommons.org/licenses/by-sa/4.0/ -[10]: https://opensource.com/sites/default/files/uploads/grammarlyresults.png (Grammarly results) -[11]: https://www.chicagomanualofstyle.org/home.html -[12]: https://developers.google.com/style -[13]: https://docs.microsoft.com/en-us/style-guide/welcome/ -[14]: https://www.apstylebook.com/ diff --git a/translated/tech/20200526 How to write about open source software.md b/translated/tech/20200526 How to write about open source software.md new file mode 100644 index 0000000000..c0b0decd3c --- /dev/null +++ b/translated/tech/20200526 How to write about open source software.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write about open source software) +[#]: via: (https://opensource.com/article/20/5/write-about-open-source-software) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +如何写好关于开源软件的文章 +====== + +> 通过以下提示,成为一个更好的作家。 + +![Typewriter in the grass][1] + +开始接触开源社区的一个方法就是写关于它的文章。你可以贡献技术文档,分享你如何使用软件,或者为我们写一篇文章。但是开始写作是说起来容易做起来难。我听到的最常见的两个不写文章的借口是:“我没有什么新东西可说”和“我不是一个好的作家”。我在这里是为了打破这两个误区。 + +### 你应该写什么? + +> “寻找那些经常被遗漏的故事。” +> 埃里克·拉尔森 + +对于一些人来说,写作的最大障碍是产生一个想法或话题,以写出一个想法或话题。很容易就落入了这样的陷阱:“这个话题已经写过了,何必再麻烦。” + +我不是第一个写文章的人,也不会是最后一个。我带来的是我独特的视角和这些年来所学到的东西。曾经有人向我请教过一些关于写作入门的建议,或者是如何让自己的写作更上一层楼。我决定把这些建议变成一篇文章。 + +文如其人,没有人会以你的方式来述事,你的经历和视角可能正是别人所需要的。 + +这里有一些提示,可以帮助你想出一个主题: + +* 你最近学到了什么东西?写出你是如何学习的,你学到了什么,或者是什么事情让你感到惊讶。 +* 你经常被问到的问题是什么?把答案写出来。 +* 你最近是否在搜索一篇怎么做的文章,但在搜索结果中,你对排名靠前的文章不满意?请写出你要找的文章。 +* 你是否参加过一次会议或研讨会?写一篇会后总结,说明你所学到的东西。 +* 你开始使用新工具了吗?写一份操作指南或入门指南。 + +### 你写的是什么类型的文章? + +有不同类型的文章,包括: + +* 技术文档 +* 操作指南 +* 博客 +* 白皮书或电子书 +* 回顾性的文章 + +内容的类型会影响你的写作风格和语气。博客更多的是非正式和对话式的。技术文档更正式,更具有指导性。 + +### 你是为谁而写的? + +每一篇文章都应该有一个受众。受众是指你所写的对象是什么类型的人。在你开始写作之前,写下你的读者的一些特征,这对你的读者有帮助。重要的是要考虑到你要为谁写,以及你**不是为**谁写的 —— 确定你的目标受众将决定你的目标受众,要包括哪些内容和不包括哪些内容。 + +例如,我在写这篇文章的时候,我设想的目标受众是这样的。 + +* 有基本的写作和语法知识 +* 有兴趣提高写作能力 +* 在技术领域担任开发人员、销售工程师、客户经理或类似职位的工作 +* 不是有经验或高级作家,可能在个人或工作博客上发表过几篇文章,想写更多的文章。 +* 非虚构写作 + +如果你有针对多个受众的内容,可以考虑针对不同的受众将其分解成不同的内容。在你的受众中需要考虑的一些部分。 + +* 专业水平:新手、中级、高级 +* 作用:管理人员、个人贡献者 +* 目标:他们为什么要阅读这些? + +### 言语很重要 + +你选择的词语会对读者产生影响。晦涩难懂的词会使文章更难理解,不常见的词会让读者觉得自己很笨,某些词可能会不小心冒犯读者。作为一个作家,你的目标是避免所有这些。下面是怎么做的。 + +#### 使用日常用语 + +不要把写作作为炫耀你的词汇量或你从“每日一字”台历上学到的单词的方式。写作是为了让读者能够理解。每一篇文章都有一个关联的阅读水平。如果你写的是技术文档,那么你的目标大约是初中的阅读水平。这并不意味着你的受众只有初中的教育水平。它意味着你的写作会更容易被人理解。你想让人们对这些言语过目不忘,还是想让他们觉得自己学到了什么?虽然你可以使用长而复杂的词汇,但并不意味着你应该这样做。使用简单的语言不一定意味着你的文章会很无聊。 + +使用 [Hemingway 应用][2]等工具来检查你的作文的可读性(它不是开源的,但很优秀)。比如说,这篇文章经过初稿后,被评定为五级阅读水平。Hemingway 还提供了如何改进写作的建议 —— 找出难读的句子或需要改变选词的地方。 + +如果你正在纠结于想出替代词,可以查看 [Plain English Campaign][3] 的建议或 [Power Thesaurus][4] 的众包建议。 + +#### 知道应该规避哪些词 + +> “每次你想写‘非常’的时候,就用‘该死的’代替;你的编辑会把它删掉,写出来的东西就会像它应该写的那样。” +> 马克·吐温 + +在写教程或指南的时候,这里有一些要避免的词,包括“简单simple”、“容易easy”和“就这样just”。你是你所写的主题的专家,经过多年的实践,可能会觉得事情很简单。而初学者可能会觉得事情不简单,也不容易。你的读者可能会感到沮丧,因为他们觉得过程或解释并不简单。 + +你是否曾经因为无法理解作者的意思而不得不多次重读一个句子或段落?你有没有因为一篇文章对你来说没有意义而放弃过?我有过。 + +作为一个作家,你希望你的读者感到困惑或不理解吗?我希望不会。 + +在你的写作中要避免的其他词语 + +* 这件事That +* 真的Really +* 非常Very +* 所以So +* 为了In order to + +一般来说,这些词可以在不改变句子意思的情况下删除。 + +在我写完之后,我会在一个文档中搜索这些词的实例。当我在这个文档中搜索时,我发现了以下这句话。 + +> “这并不意味着你的受众只有初中的教育水平*这件事*,而意味着你的写作会更容易被理解*这件事*。” + +这句话中出现了两个“这件事That”的例子。它们并没有给句子增加价值。它们可以被删除而不改变其意义。删除这些实例可以缩短句子,而更短的句子更容易理解。而说到短句,我还把它改写成了两句话。 + +> “这并不意味着你的受众只有初中的教育水平。它意味着你的写作会更容易被人理解。” + +#### 使用包容性语言 + +词语和短语的历史背景会让人感到被排斥或反感。在写作时,你要让读者感到被包容。当你使用包容性的语言时,会让读者感到被理解、被尊重,感觉自己是属于他们的。我参考了 Buffer 中的这篇[关于使用包容性语言的指南][5]。 + +### 修订和编辑 + +> “几乎所有好的写作都是从可怕的第一次努力开始的。你需要从某个地方开始。” +> 安妮·拉莫特 + +写作是一个迭代的过程。如果你认为作家们坐在办公桌前,在一个小时内就能完成一篇文章发表,那么请你再想一想。有些文章需要我花几个星期的时间来完成。以下是我的一个标准流程: + +* 写一个粗略的初稿。我说的粗略,我的意思是*草稿*。我写的时候不用担心语法问题。我的想法是让文字从我的脑海中浮现出来,写在纸上。这一步可能需要一个小时到几周的时间。 +* 将草稿放一段时间。这可能需要几个小时到几天的时间,这取决于出版时间线。 +* 审阅草稿。进行调整和编辑。 +* 征求反馈意见,可以是同事或朋友的反馈意见。在这个阶段的反馈中,我的重点是明确性。是否有意义?是否有什么令人困惑的地方,有什么缺失的部分? +* 纳入反馈意见。无论你的写作经验有多丰富,其他作者审阅你的作品,都会让你的作品变得更好。 + +在这个阶段,我有了一个相当扎实的草稿。现在到了我最不喜欢的写作部分 —— 编辑。我之前提到的 Hemingway 应用不仅能告诉你阅读水平,还能提供改进写作的建议。我还使用 Grammarly 来帮助编辑语法。关于 Grammarly 的开源替代工具,请查看[语言工具][6]或这篇文章中的[开源写作工具][7]。 + +我的写作挑战之一就是适当地使用逗号。Grammarly 可以帮助我找出我错过或误用逗号的地方。Grammarly 发现了 43 个与这篇文章的最终草稿的正确性有关的问题。其中大部分是逗号错误。 + +![Errors identified by Grammarly][8] + +除了语法错误之外,该应用程序还提供了一些建议,以帮助提高清晰度、参与度和表达能力(其中一些功能可能在免费版中没有)。这包括单词选择和使用主动语气与被动语气等。有些建议我接受,有些则拒绝。在审查了所有的警报和建议后,Grammarly 会在所有的维度上进行反馈。 + +![Grammarly results][10] + +不要害怕寻求写作上的帮助。每一个好的作家背后都有一个好的编辑或好的编辑应用。 + +### 风格指南 + +文体指南为改进写作中的交流提供了标准。它们包括标点符号、语法和用词等方面。如果是为你的公司撰写文档,请检查一下是否使用了文体指南。如果没有文体指南,或者你是为自己写的,下面是一些常用的文体指南。 + +* [芝加哥文体手册][11] +* [谷歌开发者文档指南][12] +* [微软写作风格指南][13] +* [AP 风格手册] [14] + +写作是一种与社会分享自己的思想和知识的方式。开始写作的唯一方法就是开始打字。用这些建议来微调你的写作。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/write-about-open-source-software + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead.png?itok=h3fCkVmU (Typewriter in the grass) +[2]: http://www.hemingwayapp.com/ +[3]: http://www.plainenglish.co.uk/the-a-z-of-alternative-words.html +[4]: https://www.powerthesaurus.org/ +[5]: https://open.buffer.com/inclusive-language-tech/ +[6]: https://languagetool.org/ +[7]: https://opensource.com/article/20/3/open-source-writing-tools +[8]: https://opensource.com/sites/default/files/uploads/grammarlyerrors.png (Errors identified by Grammarly) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://opensource.com/sites/default/files/uploads/grammarlyresults.png (Grammarly results) +[11]: https://www.chicagomanualofstyle.org/home.html +[12]: https://developers.google.com/style +[13]: https://docs.microsoft.com/en-us/style-guide/welcome/ +[14]: https://www.apstylebook.com/ From 4f1a7f39e5233eb85171d7d324adbe7e04cf90ac Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 May 2020 11:15:05 +0800 Subject: [PATCH 2211/3057] PRF @lnrCoder --- ...n Linux Apps in Windows (Thanks to WSL).md | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md b/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md index 61334d55c0..5511bc55ac 100644 --- a/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md +++ b/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md @@ -1,77 +1,78 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Now You Can Run Linux Apps in Windows (Thanks to WSL)) [#]: via: (https://itsfoss.com/run-linux-apps-windows-wsl/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -现在您可以在 Windows 中运行 Linux 应用(多亏了 WSL) +现在你可以在 Windows 中运行 Linux 应用了 ====== -微软最近的 “[Build 2020][1]” 开发者大会公布了一些有趣的公告。 我不确定这该令人兴奋还是该令人怀疑 — 但是微软,你现在比以往任何时候都受到我们的关注。 +![](https://img.linux.net.cn/data/attachment/album/202005/27/111439z64u19z6ct6r46kb.jpg) -同时,在所有公告中,能够在 WSL(Windows Subsystem for Linux)上运行 GUI 应用程序的功能备受关注。 +微软最近的 “[Build 2020][1]” 开发者大会公布了一些有趣的公告。我不确定这该令人兴奋还是该令人怀疑 —— 但是微软,你现在比以往任何时候都受到我们的关注。 -别忘了 [Xamrin.Forms 更名为 MAUI 的尴尬结局][2],它与 [Nitrux Linux.][4] 的 Uri Herrera 的现有开源项目([Maui Project][3])相冲突。 +同时,在所有的这些公告中,能够在 WSL(Windows Subsystem for Linux)上运行 GUI 应用程序的功能备受关注。 -以为防止你不不清楚,WSL 是一种环境,可让你在 Windows 10 中获得纯控制台 Linux 的体验。它也是在 [Windows 中运行 Linux 命令的最佳方法][5]之一。 +更不要忘了 [Xamrin.Forms 更名为 MAUI 的尴尬结局][2],它与 [Nitrux Linux][4] 的 Uri Herrera 的现有开源项目([Maui Project][3])名字冲突。 -正如 [Liam Dawe][7] 认为的那样,通过博客文章([DirectX ❤ Linux][6])发布的公告可能是只是个诱饵。但是,仍然值得一提。 +以防你不清楚,WSL 是一种环境,可让你在 Windows 10 中获得 Linux 控制台的体验。它也是在 [Windows 中运行 Linux 命令的最佳方法][5]之一。 + +正如 [Liam Dawe][7] 认为的那样,通过博客文章([DirectX ❤ Linux][6])发布的公告可能是只是个公关诱饵。但是,仍然值得一提。 ### WSL 上对 Linux GUI 应用程序的支持 ![][8] -最近,Microsoft 在在线开发者大会上宣布了 WSL(又名 WSL 2)的一系列新功能。 +最近,Microsoft 在在线开发者大会上宣布了 WSL(即 WSL 2)的一系列新功能。 -[Windows Package Manager][9],[Windows Terminal 1.0][10],以及其他一些功能的引入是其亮点。 +[Windows 包管理器][9]、[Windows 终端 1.0][10],以及其他一些功能的引入是其亮点。 -但是,支持 GPU 硬件加速的 Windows 的 Linux 2 子系统非常重要。 +但是, WSL 2 对 GPU 硬件加速的支持非常重要。 那么,是否意味着你可以使用 WSL 在 Windows 上运行 Linux 应用程序呢?看起来像是。 -微软计划通过使用全新的 Linux 内核驱动程序 **dxgkrnl** 来实现。 -Microsoft plans to make it happen using a brand-new Linux kernel driver **dxgkrnl**。 为了给你一个技术简报, 我在这里引用他们的公告中的描述: +微软计划通过使用全新的 Linux 内核驱动程序 `dxgkrnl` 来实现它。为了给你一个技术性的简报, 我在这里引用他们的公告中的描述: ![Linux Kernel Driver Wsl][11] -> Dxgkrnl 是 Linux 的全新内核驱动程序,它将 **/dev/dxg** 设备暴露给用户模式的 Linux。 **/dev/dxg** 暴露了一组 IOCTL,他们与 Winodws 上的原生 WDDM D3DKMT 内核服务层非常相似。Linux 内核中的 Dxgkrnl 通过 VM 总线连接到 Windows 主机上,并使用此 VM 总线连接与物理 GPU 进行通讯。 +> dxgkrnl 是一个全新的 Linux 内核驱动程序,它将 `/dev/dxg` 设备提供给用户模式的 Linux。 `/dev/dxg` 提供了一组 IOCTL,它们与 Winodws 上的原生 WDDM D3DKMT 内核服务层非常相似。Linux 内核中的 dxgkrnl 通过 VM 总线连接到 Windows 主机上,并使用此 VM 总线连接与物理 GPU 进行通讯。 -我不是这方面的专家,但这以为蛇 WSL 上的 Linux 应用程序将具有与本机 Windows 应用程序相同的 GPU 访问权限。 +我不是这方面的专家,但这意味着 WSL 上的 Linux 应用程序将与原生的 Windows 应用程序一样可以访问 GPU。 -针对 GUI 应用程序的支持将在今年秋季的晚些时候提供 (而不是 2020 年 5 月的更新) — 所以我们跌看看什么时候提供。 +针对 GUI 应用程序的支持将在今年秋季的晚些时候提供(而不是 2020 年 5 月的更新) —— 所以我们要看看什么时候提供。 -微软专门针对的是那些系统在 Windows 上轻松使用 Linux IDE 的开发人员。Google 还通过 [将 GUI Linux 应用程序引入 Chromebook ][12] 来针对相同的用户群。 +微软专门针对的是那些希望在 Windows 上轻松使用 Linux IDE 的开发人员。谷歌也在瞄准同样的用户群,[将 GUI Linux 应用程序引入到 Chromebook][12]。 -好吧,对于想要使用 Windows 的用户来说,这是个好消息。但是,这是真的吗? +那么,对于那些坚持使用 Windows 的用户来说,这是个好消息。但是,这是真的吗? -### 微软爱上了 Linux — 真的吗? +### 微软爱上了 Linux —— 真的吗? ![Microsoft Loves Linux][13] -他们通过努力在 Windows 上整合 Linux 环境来拥抱 Linux 及其优势,绝对是一件好事。 +他们在 Windows 上整合 Linux 环境来拥抱 Linux 及其优势的努力,绝对是一件好事。 -但是,如何真正帮助 **Linux 桌面用户**呢?到目前为止,我还没有看到任何实际的好处。 +但是,它真的能给**桌面 Linux 用户**带来什么好处呢?到目前为止,我还没有看到任何实际的好处。 -你可以在这里随意发表不同意见。但是,我认为 WSL 的开发对于 Linux 桌面用户来说没有实际的价值。至少目前为止没有。 +在这里,你可以有不同的看法。但是,我认为 WSL 的开发对于 Linux 桌面用户来说没有真正的价值。至少,到目前为止没有。 -有趣的是,[Linux Unplugged podcast][14] 上有人强调了微软的举动,以其闻名的 EEE (Embrace, extend, and extinguish) 为代表。 +有趣的是,[Linux Unplugged podcast][14] 上有人强调了微软的举动,认为这与他们的 EEE(拥抱、延伸和扑灭Embrace, extend, and extinguish)的思路是一致的。 -可能,谁知道呢?当然,他们为实现这一目标而付出的努力值得赞赏 — 同时又令人感到兴奋和神秘。 +可能吧,谁知道呢?当然,他们为实现这一目标而付出的努力值得赞赏 —— 同时又令人感到兴奋和神秘。 -### 这是否以为着 Windows 用户将不必再切换到 Linux? +### 这是否以为着 Windows 用户将不必再转到 Linux? -微软之所以在其平台上集成 Linux,是因为他们知道 Liunx 的功能以及开发人员(或用户)喜欢使用的原因。 +微软之所以在其平台上集成 Linux,是因为他们知道 Liunx 的能力,也知道开发人员(或用户)喜欢使用它的原因。 但是,随着 WSL 2 的更新,如果这种情况持续下去,我倾向于同意 Abhishek 的看法: -> 最终,桌面 Linux 将被限制为 Windows 下的桌面应用程序。 +> 最终,桌面 Linux 将被限制在 Windows 下,成为桌面应用程序…… -好吧,当然,原生的体验暂时还是比较好的。而且,很难看到现有的 Linux 桌面用户会使用 Windows 来将其替代。但是,这仍然是值得担心的。 +好吧,当然,原生的体验暂时还是比较好的。而且,很难看到现有的 Linux 桌面用户会使用 Windows 来将其替代。但是,这仍然值得担心。 -你如何看待这一切? 我不认为 WSL 对于被迫使用 Windows 的用户有什么好处 — 但是,从长远来看,你认为微软在 WSL 方面的进展本质上是敌意还是对 Linux 有帮助? +你如何看待这一切?我不认为 WSL 对于被迫使用 Windows 的用户有什么好处 —— 但是,从长远来看,你认为微软在 WSL 方面的进展本质上是敌意还是对 Linux 有帮助? 在评论中让我知道你的想法! @@ -82,7 +83,7 @@ via: https://itsfoss.com/run-linux-apps-windows-wsl/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[lnrCoder](https://github.com/lnrCoder) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 574202532de153b96d4684d99b8acba17df7505a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 May 2020 11:21:06 +0800 Subject: [PATCH 2212/3057] PUB @lnrCoder https://linux.cn/article-12254-1.html --- ...5 Now You Can Run Linux Apps in Windows (Thanks to WSL).md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md (98%) diff --git a/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md b/published/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md similarity index 98% rename from translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md rename to published/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md index 5511bc55ac..21173f87f8 100644 --- a/translated/tech/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md +++ b/published/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12254-1.html) [#]: subject: (Now You Can Run Linux Apps in Windows (Thanks to WSL)) [#]: via: (https://itsfoss.com/run-linux-apps-windows-wsl/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 2327b530afc33b19214462a4dd9400887311ead8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 May 2020 12:03:50 +0800 Subject: [PATCH 2213/3057] PRF @lxbwolf --- ... personal file server with SSH on Linux.md | 72 +++++++++---------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/translated/tech/20200323 How to create a personal file server with SSH on Linux.md b/translated/tech/20200323 How to create a personal file server with SSH on Linux.md index 82049848e6..b495ebb3b2 100644 --- a/translated/tech/20200323 How to create a personal file server with SSH on Linux.md +++ b/translated/tech/20200323 How to create a personal file server with SSH on Linux.md @@ -1,46 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to create a personal file server with SSH on Linux) [#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh) [#]: author: (Jim Hall https://opensource.com/users/jim-hall) -怎样在 Linux 下用 SSH 搭建私人文件服务器 +怎样在 Linux 下用 SSH 搭建个人文件服务器 ====== -通过 SSH 连接远程 Linux 系统很简单。下面是教程。 -![Hand putting a Linux file folder into a drawer][1] -使用树莓派可以搭建对很多事物有用的廉价家庭服务器。我的树莓派最常用来做[打印服务器][2],可以在我的家庭网络中共享激光打印机,或作为私人文件服务器保存项目副本和其他数据。 +> 通过 SSH 连接远程 Linux 系统很简单。下面是教程。 -我的文件服务器有很多用途。假设我现在有一个项目,比如一本新书,我想备份我的工作的快照和所有关联的文件。这种场景下,我只需要把 **BookProject** 文件夹复制到文件服务器的 **BookBackup** 文件夹。 +![](https://img.linux.net.cn/data/attachment/album/202005/27/120338v62cakrqnccpjckk.jpg) -或者我现在正在清理我的本地文件,我发现有些文件现在不需要,但是我不确定是否要删除,我会把它们复制到文件服务器的 **KeepForLater** 文件夹。对于清理我日常用的 Linux 系统上杂乱的文件,以及把不常用的文件备份到私人文件服务器,这是一种很方便的方法。 +树莓派是一个有用且价格低廉的家庭服务器,可用于很多事情。我的树莓派最常用来做[打印服务器][2],可以在我的家庭网络中共享激光打印机,或作为个人文件服务器保存项目副本和其他数据。 -用树莓派或其他 Linux 系统搭建私人文件服务器不需要配置 NFS(网络文件系统Network File System>)或 CIFS(通用互联网文件系统Common Internet File System)或改造其他的文件共享系统如 WebDAV。你可以很轻松的使用 SSH 来搭建远程文件服务器。下面是教程。 +我的文件服务器有很多用途。假设说我现在有一个项目,比如一本新书,我想把我的工作和所有相关的文件都复制一份快照。这种场景下,我只需要把 `BookProject` 文件夹复制到文件服务器的 `BookBackup` 文件夹。 + +或者我现在正在清理我的本地文件时,发现一些我不需要的文件,但是我不确定是否要删除,我会把它们复制到文件服务器的 `KeepForLater` 文件夹。这是我日常 Linux 系统中清除杂乱的文件,并将不常用的文件卸载到个人文件服务器上的方便方法。 + +用树莓派或其他 Linux 系统搭建个人文件服务器不需要配置 NFS(网络文件系统Network File System>)或 CIFS(通用互联网文件系统Common Internet File System)或改造其他的文件共享系统如 WebDAV。你可以很轻松的使用 SSH 来搭建远程文件服务器。下面是教程。 ### 在远程服务器上配置 SSHD -你的 Linux 系统可能已经安装了 SSH daemon(sshd),甚至它是默认执行的。如果没有运行,你可以使用你 Linux 发行版本上你想要的任何控制面板来轻松配置 SSH。我在树莓派上运行了 [Fedora ARM][3],通过把树莓派的 web 浏览器指向 9090 端口,我可以远程访问控制面板。(在我的家庭网络中,树莓派的 IP 地址是 **10.0.0.11**,因此我连接的是 **10.0.0.11:9090**。)如果 SSH daemon 默认没有运行,你可以在控制面板的 Services 里把它设置为开机启动。 +你的 Linux 系统可能已经安装了 SSH 守护进程(`sshd`),甚至它已经默认运行了。如果没有,你可以使用你 Linux 发行版本上的任何控制面板来轻松配置 SSH。我在树莓派上运行了 [Fedora ARM][3],通过 Web 浏览器访问树莓派的 9090 端口,我可以远程访问控制面板。(在我的家庭网络中,树莓派的 IP 地址是 `10.0.0.11`,因此我连接的是 `10.0.0.11:9090`。)如果 SSH 守护进程没有默认运行,你可以在控制面板的“服务”里把它设置为开机启动。 ![sshd in the list of system services][4] -你可以在系统服务列表里找到 sshd。 +你可以在系统服务列表里找到 `sshd`。 ![slider to activate sshd][5] -如果 **sshd** 没有开启,点击切换按钮打开它。 +如果 `sshd` 没有开启,点击切换按钮打开它。 ### 你有账号吗? 你需要有个远程系统的账号。它可以与你本地系统的账号相同,也可以不同。 -在流行的 Raspbian 发行版本上,默认的账号名是 **pi**。但是其他的 Linux 发行版本可能需要你在安装系统时就设置一个独一无二的新用户。如果你不知道你的用户名,你可以用系统的控制面板创建一个。在我的树莓派上,我创建了一个 **jhall** 账号,与我日常用的 Linux 桌面机器的用户名相同。 +在流行的 Raspbian 发行版本上,默认的账号名是 `pi`。但是其他的 Linux 发行版本可能需要你在安装系统时就设置一个唯一的新用户。如果你不知道你的用户名,你可以用系统的控制面板创建一个。在我的树莓派上,我创建了一个 `jhall` 账号,与我日常用的 Linux 桌面机器的用户名相同。 ![Set up a new account on Fedora Server][6] -如果你用的是 Fedora 服务器,你可以点击 **Create New Account** 按钮来创建新账号。 +如果你用的是 Fedora 服务器,你可以点击“创建新账号”按钮。 ![Set password or SSH key][7] @@ -50,41 +52,37 @@ 如果你把公钥添加到远程 Linux 系统上,你就可以不使用密码登录。这一步是可选的;如果你愿意,你仍可以用密码登录。 -你可以在下面 Opensource.com 的文章中学到更多关于 SSH key 的信息: +你可以在下面的文章中学到更多关于 SSH 密钥的信息: - * [SSH key 管理工具][8] - * [用 Seahorse 对 SSH key 进行图形化管理][9] - * [如何管理多个 SSH key][10] - * [使用 GPG key 作为鉴权依据开启 SSH 访问][11] +* [SSH 密钥管理工具][8] +* [用 Seahorse 对 SSH 密钥进行图形化管理][9] +* [如何管理多个 SSH 密钥][10] +* [使用 GPG 密钥作为鉴权依据开启 SSH 访问][11] +### 创建文件管理器的快捷方式 - -### 创建文件管理器快捷方式 - -现在你已经在远程系统上启动 SSH daemon 了,也设置了用户名和密码,最后一步就是在你本地的文件管理器中创建一个快捷方式,地址映射到远程 Linux 系统。我的桌面是 GNOME,但是在其他的 Linux 桌面上的基本操作步骤都是一样的。 +现在你已经在远程系统上启动 SSH 守护进程了,也设置了用户名和密码,最后一步就是在你本地的文件管理器中创建一个快捷方式,地址映射到远程 Linux 系统。我的桌面是 GNOME,但是在其他的 Linux 桌面上的基本操作步骤都是一样的。 #### 建立初始连接 -在 GNOME 的文件管理器中,在左边导航栏找到 **+Other Locations** 按钮。点击它会出现一个 **Connect to Server** 提示框。在框中输入远程 Linux 服务器的地址,地址以 SSH 连接协议开头。 +在 GNOME 的文件管理器中,在左边导航栏找到 “+其它位置” 按钮。点击它会出现一个 “连接到服务器” 提示框。在框中输入远程 Linux 服务器的地址,地址以 SSH 连接协议开头。 ![Creating a shortcut in GNOME file manager][12] -GNOME 文件管理器支持多种连接协议。以 **sftp://** 或 **ssh://** 开头的服务器地址,会创建 SSH 连接。 - -如果你远程 Linux 系统的用户名与本地的相同,那么你只需要输入服务器的地址和文件夹路径就可以了。比如要连接到我的树莓派的 **/home/jhall** 目录,我输入: +GNOME 文件管理器支持多种连接协议。要通过 SSH 进行连接,服务器地址请以 `sftp://` 或 `ssh://` 开头。 +如果你远程 Linux 系统的用户名与本地的相同,那么你只需要输入服务器的地址和文件夹路径就可以了。比如要连接到我的树莓派的 `/home/jhall` 目录,我输入: ``` -`sftp://10.0.0.11/home/jhall` +sftp://10.0.0.11/home/jhall ``` ![GNOME file manager Connect to Server][13] -如果你远程 Linux 系统的用户名与本地的不同,你可以在远程系统地址前加 **@** 符号来指定远程系统的用户名。要连接到远程的 Raspbian 系统,你可能要输入: - +如果你远程 Linux 系统的用户名与本地的不同,你可以在远程系统地址前加 `@` 符号来指定远程系统的用户名。要连接到远程的 Raspbian 系统,你可能要输入: ``` -`sftp://pi@10.0.0.11/home/pi` +sftp://pi@10.0.0.11/home/pi ``` ![GNOME file manager Connect to Server][14] @@ -95,15 +93,15 @@ GNOME 文件管理器支持多种连接协议。以 **sftp://** 或 **ssh://** #### 创建一个快捷方式,之后就可以轻松连接服务器 -在 GNOME 文件管理器中,这很简单。右击导航栏中远程系统的名字,选择 **Add Bookmark** 。这一步操作就创建了连接到远程路径的快捷方式。 +在 GNOME 文件管理器中,这很简单。右击导航栏中远程系统的名字,选择“添加书签”。这一步操作就创建了连接到远程路径的快捷方式。 ![GNOME file manager - adding bookmark][16] -如果你想把标签中的快捷方式改成一个更容易记的名字,你可以右击快捷方式选择 **Rename**。 +如果你想把标签中的快捷方式改成一个更容易记的名字,你可以右击快捷方式选择“重命名”。 -### 总结! +### 总结 -通过 SSH 连接到远程 Linux 系统是很简单的事。你可以用相同的方式连接到家庭文件服务器以外的其他系统。我还创建了一个能让我立即访问我的提供商的 web 服务器上的文件的快捷方式和另一个能迅速打开我的项目服务器的文件夹的快捷方式。SSH 保证了它们是安全的连接;所有的传输都是加密的。当我通过 SSH 打开远程的文件时,我可以像在本地操作一样使用 GNOME 文件管理器轻松打开远程文件。 +通过 SSH 连接到远程 Linux 系统是很简单的事。你可以用相同的方式连接到家庭文件服务器以外的其他系统。我还创建了一个能让我立即访问我的提供商 Web 服务器上的文件的快捷方式,和另一个能迅速打开我的项目服务器的文件夹的快捷方式。SSH 使它成为一个安全的连接;所有的传输都是加密的。当我通过 SSH 打开远程的文件时,我可以像在本地操作一样使用 GNOME 文件管理器轻松打开远程文件。 -------------------------------------------------------------------------------- @@ -112,7 +110,7 @@ via: https://opensource.com/article/20/3/personal-file-server-ssh 作者:[Jim Hall][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -125,8 +123,8 @@ via: https://opensource.com/article/20/3/personal-file-server-ssh [5]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd-service.png (slider to activate sshd) [6]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts_create-user.png (Set up a new account on Fedora Server) [7]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts.png (Set password or SSH key) -[8]: https://opensource.com/article/20/2/ssh-tools -[9]: https://opensource.com/article/19/4/ssh-keys-seahorse +[8]: https://linux.cn/article-11947-1.html +[9]: https://linux.cn/article-9451-1.html [10]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage [11]: https://opensource.com/article/19/4/gpg-subkeys-ssh [12]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-locations.png (Creating a shortcut in GNOME file manager) From 39a523ef5c0302bcf28f9570067706f61ff725be Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 May 2020 12:04:56 +0800 Subject: [PATCH 2214/3057] PUB @lxbwolf https://linux.cn/article-12255-1.html --- ... How to create a personal file server with SSH on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200323 How to create a personal file server with SSH on Linux.md (99%) diff --git a/translated/tech/20200323 How to create a personal file server with SSH on Linux.md b/published/20200323 How to create a personal file server with SSH on Linux.md similarity index 99% rename from translated/tech/20200323 How to create a personal file server with SSH on Linux.md rename to published/20200323 How to create a personal file server with SSH on Linux.md index b495ebb3b2..14abf4cc64 100644 --- a/translated/tech/20200323 How to create a personal file server with SSH on Linux.md +++ b/published/20200323 How to create a personal file server with SSH on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12255-1.html) [#]: subject: (How to create a personal file server with SSH on Linux) [#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh) [#]: author: (Jim Hall https://opensource.com/users/jim-hall) From 2890262c95ae4d609974376a74541ac3ebf06ac2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 May 2020 23:40:47 +0800 Subject: [PATCH 2215/3057] PRF @geekpi --- ...w to Handle Automatic Updates in Ubuntu.md | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md b/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md index f86886d82c..5339f1df60 100644 --- a/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md +++ b/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md @@ -1,44 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Handle Automatic Updates in Ubuntu) [#]: via: (https://itsfoss.com/auto-updates-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何在 Ubuntu 中处理自动更新 +如何在 Ubuntu 中处理自动的无人值守升级 ====== -_**简介:本教程教你如何处理无人值守的升级,即 Ubuntu Linux 的自动系统更新。**_ +> 本教程教你如何处理无人值守的升级,即 Ubuntu Linux 的自动系统更新。 + +![](https://img.linux.net.cn/data/attachment/album/202005/27/234040fxb0nkc53pk0nxvx.jpg) 有时,当你尝试[关闭 Ubuntu 系统][1]时,可能看到这个阻止你关闭的页面: -**关机正在进行无人值守升级,请不要关闭计算机。** +> 关机过程中正在进行无人值守升级,请不要关闭计算机。 ![Unattended Upgrade In Progress In Ubuntu][2] -你可能想知道什么是“无人值守的升级”,以及它是如何在你不知情的情况下运行的。 +你可能会问这个“无人值守升级”是什么,怎么会在你不知情的情况下运行呢? -因为 [Ubuntu][3] 非常重视系统的安全性。默认情况下,它会每天自动检查系统更新,如果发现任何安全更新,那么会下载这些更新并自行安装。对于正常的系统和应用更新,它会通过软件更新程序通知你。 +原因是 [Ubuntu][3] 非常重视系统的安全性。默认情况下,它会每天自动检查系统更新,如果发现安全更新,它会下载这些更新并自行安装。对于正常的系统和应用更新,它会通过软件更新程序通知你。 -由于所有这些都是在后台发生的,因此你会直到关机或者尝试自己安装应用时才会意识到。 +由于所有这些都是在后台发生的,所以在你尝试关闭系统或尝试自行安装应用程序之前,你甚至不会意识到这一点。 -在进行这些无人值守的升级时尝试安装新软件会发生[无法获得锁的错误][4]。 +在这些无人值守的升级过程中,尝试安装新软件,会导致著名的[无法获得锁定的错误][4]。 ![][5] 如你所见,自动更新带来了一些小麻烦。你可以选择禁用自动更新,但这意味着你必须一直手动检查并[更新你的 Ubuntu 系统][6]。 -你真的需要禁用自动更新吗? +> **你真的需要禁用自动更新吗?** +> +> 请注意,这是一项安全功能。Linux 实际上允许你禁用系统中的所有功能,甚至禁用这些安全功能。 +> +> 但是我认为,作为普通用户,**你不应该禁用自动更新**。毕竟,它可以确保你的系统安全。 +> +> 为了确保系统的安全性,你可以忍受自动更新所带来的小麻烦。 -请注意,这是一项安全功能。Linux 实际上允许你禁用系统中的所有功能,甚至禁用这些安全功能。 -但是我认为,作为普通用户,_**你不应禁用自动更新**_。毕竟,它可以确保你的系统安全。 -为了确保系统的安全性,你可以忍受自动更新所带来的小麻烦。 +现在,你已经收到警告,还是觉得承担手动更新系统的额外任务更好,那么让我们看看如何处理自动更新。 -现在,你已经收到警告,并认为最好承担手动更新系统的额外任务,让我们看看如何处理自动更新。 - -与往常一样,有两种方法可以做到:GUI 和命令行。 我将向您=你展示两种方法。 +与往常一样,有两种方法可以做到:GUI 和命令行。 我将向你展示两种方法。 我在这里使用 Ubuntu 20.04,但是这些步骤对 Ubuntu 18.04 和任何其他 Ubuntu 版本均有效。 @@ -50,7 +54,7 @@ _**简介:本教程教你如何处理无人值守的升级,即 Ubuntu Linux 在此处,进入“更新”选项卡。查找“自动检查更新”。默认情况下,它设置为“每日”。 -你可以将其更改为“从不”,你的系统将永远不会检查更新。如果不检查更新,它将不会找到要安装的新更新。 +你可以将其更改为“从不”,你的系统将永远不会检查更新。如果不检查更新,它就不会找到要安装的新的更新。 ![Disable Auto Updates in Ubuntu Completely][8] @@ -58,13 +62,13 @@ _**简介:本教程教你如何处理无人值守的升级,即 Ubuntu Linux #### 在 Ubuntu 中处理自动更新的更好方法 -就个人而言,我建议让它自己检查更新。如果你不希望它自动安装更新,那么可以更改该行为以通知有关安全更新的可用性。 +就个人而言,我建议让它自己检查更新。如果你不希望它自动安装更新,那么可以更改该行为,以通知有关安全更新的可用性。 保持“自动检查更新”为“每日”,然后将“有安全更新时”选项更改为“立即显示”,而不是“自动下载并安装”。 ![Get notified for security updates instead of automatically installing them][9] -这样,它会检查是否有更新,而不是在后台自动安装更新,软件更新程序会通知你更新可用于系统。你的系统已经完成正常的系统和软件更新。 +这样,它会检查是否有更新,而不是在后台自动安装更新,软件更新程序会通知你有可用于系统的更新。而你的系统已经完成正常的系统和软件更新。 ![Get notified about security updates][10] @@ -76,13 +80,13 @@ _**简介:本教程教你如何处理无人值守的升级,即 Ubuntu Linux ### 如何在 Ubuntu 中使用命令行禁用自动更新 -你可以在 **/etc/apt/apt.conf.d/20auto-upgrades** 中找到自动升级设置。Ubuntu 终端中的默认文本编辑器是 Nano,因此你可以使用以下命令来编辑此文件: +你可以在 `/etc/apt/apt.conf.d/20auto-upgrades` 中找到自动升级设置。Ubuntu 终端中的默认文本编辑器是 Nano,因此你可以使用以下命令来编辑此文件: ``` sudo nano /etc/apt/apt.conf.d/20auto-upgrades ``` -现在,如果你不希望系统自动检查更新,那么可以将 APT::Periodic::Update-Package-Lists 的值更改为 0。 +现在,如果你不希望系统自动检查更新,那么可以将 `APT::Periodic::Update-Package-Lists` 的值更改为 `"0"`。 ``` APT::Periodic::Update-Package-Lists "0"; @@ -96,9 +100,9 @@ APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "0"; ``` -**最后** +### 最后 -由于某种原因,启用了自动安全更新,建议你保持这种状态。小的烦恼实际上并不值得冒险损害系统安全性。你怎么看? +由于某种原因,启用了自动安全更新,建议你保持这种状态。这个小烦恼实际上并不值得冒险损害系统安全性。你怎么看? -------------------------------------------------------------------------------- @@ -107,7 +111,7 @@ via: https://itsfoss.com/auto-updates-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5c164d055899445559c2bed98b92b3cd457cfaff Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 May 2020 23:46:20 +0800 Subject: [PATCH 2216/3057] PUB @geekpi https://linux.cn/article-12257-1.html --- .../20200501 How to Handle Automatic Updates in Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200501 How to Handle Automatic Updates in Ubuntu.md (98%) diff --git a/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md b/published/20200501 How to Handle Automatic Updates in Ubuntu.md similarity index 98% rename from translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md rename to published/20200501 How to Handle Automatic Updates in Ubuntu.md index 5339f1df60..4339c22494 100644 --- a/translated/tech/20200501 How to Handle Automatic Updates in Ubuntu.md +++ b/published/20200501 How to Handle Automatic Updates in Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12257-1.html) [#]: subject: (How to Handle Automatic Updates in Ubuntu) [#]: via: (https://itsfoss.com/auto-updates-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 2507e47c89adf94a7865152385be7f3fd19b7dc1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 May 2020 01:10:47 +0800 Subject: [PATCH 2217/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200528=20Open?= =?UTF-8?q?=20Source=20YouTube=20Alternative=20PeerTube=20Needs=20Your=20S?= =?UTF-8?q?upport=20to=20Launch=20Version=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200528 Open Source YouTube Alternative PeerTube Needs Your Support to Launch Version 3.md --- ... Needs Your Support to Launch Version 3.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20200528 Open Source YouTube Alternative PeerTube Needs Your Support to Launch Version 3.md diff --git a/sources/tech/20200528 Open Source YouTube Alternative PeerTube Needs Your Support to Launch Version 3.md b/sources/tech/20200528 Open Source YouTube Alternative PeerTube Needs Your Support to Launch Version 3.md new file mode 100644 index 0000000000..ec7ab97e21 --- /dev/null +++ b/sources/tech/20200528 Open Source YouTube Alternative PeerTube Needs Your Support to Launch Version 3.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source YouTube Alternative PeerTube Needs Your Support to Launch Version 3) +[#]: via: (https://itsfoss.com/peertube-v3-campaign/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Open Source YouTube Alternative PeerTube Needs Your Support to Launch Version 3 +====== + +[PeerTube][1] (developed by [Framasoft][2]) is a free and open-source decentralized alternative to YouTube somewhat like [LBRY][3]. As the name suggests, it relies on [peer-to-peer connections][4] to operate the video hosting services. + +You can also choose to self-host your instance and also have access to videos from other instances (a federated network, just like [Mastodon][5]). + +It is being actively developed for a few years now. And, to take it up a notch, they have decided to launch a crowdfunding campaign for the next major release. + +The funding campaign will help them develop v3.0 of PeerTube with some amazing key features planned for the release this fall. + +![PeerTube Instance Example][6] + +### PeerTube: Brief Overview + +In addition to what I just mentioned above, PeerTube is a fully-functional peer to peer video platform. The best thing about it is — it’s open-source and free. So, you can check them out on [GitHub][7] if you want. + +You can watch their official video here: + +**Note:** You need to be cautious about your IP address if you have concerns about that on PeerTube (try using one of the [best VPNs available][8]). + +### PeerTube’s Crowdfunding Campaign For v3 Launch + +You’ll be excited to know that the crowdfunding campaign of **€60,000** already managed to **get 10,000 Euros on Day 1** (at the time of writing this). + +Now, coming to the details. The campaign aims to focus on gathering **funds for the next 6 months of development for a v3 release planned for November 2020.** It looks like a lot of work for a single full-time developer — but no matter whether they reach the funding goal, they intend to release the v3 with the existing funds they have. + +In their [announcement post][9], PeerTube team mentioned: + +> We feel like we need to develop it, that we have to. Imposing a condition stating « if we do not get our 60,000€, then there will not be a v3 » here, would be a lie, marketing manipulation : this is not the kind of relation we want to maintain with you. + +Next, let’s talk about the new features they’ve planned to introduced in the next 6 months: + + * Upon reaching the **€10,000 goal,** they plan to work on introducing a globalized video index to make it easier to search for videos across multiple instances. + * With **€**20,000 goal, PeerTube will dedicate one month on improving the moderation tools to make the best out of it. + * With 40,000 goal, they would work on the UX/UI of playlists. So, it will look better when you try to embed a playlist. In addition to this, the plugin system will be improved to make it easier to contribute to PeerTube’s code. + * With the end of the campaign reaching 60,000 goal, PeerTube’s live-streaming feature will be introduced. + + + +You can also find the details of their [roadmap on their site][10]. + +### Wrapping Up + +The ability to have a global inter-connected video index among multiple instances is something that was needed and it will also allow you to configure your own index. + +The content moderation tool improvement is also a huge deal because it’s not that easy to manage a decentralized network of video hosting services. While they aim to prevent censorship, a strict moderation is required to make PeerTube a comfortable place to watch videos. + +Even though I’m not sure about how useful PeerTube’s live-streaming feature will be, at launch. It is going to be something exciting to keep an eye out for. + +We at It’s FOSS made a token donation of 25 Euro. I would also encourage you to donate and help this open source achieve their financial goal for version 3 development. + +[Support PeerTube][11] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/peertube-v3-campaign/ + +作者:[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://joinpeertube.org +[2]: https://framasoft.org/en/ +[3]: https://itsfoss.com/lbry/ +[4]: https://en.wikipedia.org/wiki/Peer-to-peer +[5]: https://itsfoss.com/mastodon-open-source-alternative-twitter/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/peertube-instance-screenshot.jpg?ssl=1 +[7]: https://github.com/Chocobozzz/PeerTube +[8]: https://itsfoss.com/best-vpn-linux/ +[9]: https://framablog.org/2020/05/26/our-plans-for-peertube-v3-progressive-fundraising-live-streaming-coming-next-fall/ +[10]: https://joinpeertube.org/roadmap +[11]: https://joinpeertube.org/roadmap#support From ab227080a1d3e48e9cec3297088864782f4141ef Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 May 2020 01:11:04 +0800 Subject: [PATCH 2218/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200528=20Gett?= =?UTF-8?q?ing=20Started=20With=20Nano=20Text=20Editor=20[Beginner?= =?UTF-8?q?=E2=80=99s=20Guide]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200528 Getting Started With Nano Text Editor -Beginner-s Guide.md --- ...With Nano Text Editor -Beginner-s Guide.md | 246 ++++++++++++++++++ 1 file changed, 246 insertions(+) create mode 100644 sources/tech/20200528 Getting Started With Nano Text Editor -Beginner-s Guide.md diff --git a/sources/tech/20200528 Getting Started With Nano Text Editor -Beginner-s Guide.md b/sources/tech/20200528 Getting Started With Nano Text Editor -Beginner-s Guide.md new file mode 100644 index 0000000000..90874df3e9 --- /dev/null +++ b/sources/tech/20200528 Getting Started With Nano Text Editor -Beginner-s Guide.md @@ -0,0 +1,246 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting Started With Nano Text Editor [Beginner’s Guide]) +[#]: via: (https://itsfoss.com/nano-editor-guide/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Getting Started With Nano Text Editor [Beginner’s Guide] +====== + +[Nano][1] is the default [terminal-based text editor][2] in Ubuntu and many other Linux distributions. Though it is less complicated to use than the likes of [Vim][3] and [Emacs][4], it doesn’t mean Nano cannot be overwhelming to use. + +In this beginner’s guide, I’ll show you how to use the Nano text editor. I am also going to include a downloadable PDF cheat sheet at the end of the article so that you can refer to it for practicing and mastering Nano editor commands. + +If you are just interested in a quick summary of Nano keyboard shortcuts, please expand the next section. + +Essential Nano keyboard shortcuts (click to expand) + +**Shortcut** | **Description** +---|--- +nano filename | Open file for editing in Nano +Arrow keys | Move cursor up, down, left and right +Ctrl+A, Ctrl+E | Move cursor to start and end of the line +Ctrl+Y/Ctrl+V | Move page up and down +Ctrl+_ | Move cursor to a certain location +Alt+A and then use arrow key | Set a marker and select text +Alt+6 | Copy the selected text +Ctrl+K | Cut the selected text +Ctrl+U | Paste the selected text +Ctrl+6 | Cancel the selection +Ctrl+K | Cut/delete entire line +Alt+U | Undo last action +Alt+E | Redo last action +Ctrl+W, Alt+W | Search for text, move to next match +Ctrl+\ | Search and replace +Ctrl+O | Save the modification +Ctrl+X | Exit the editor + +### How to use Nano text editor + +![][5] + +I presume that you have Nano editor installed on your system already. If not, please your distribution’s package manager to install it. + +#### Getting familiar with the Nano editor interface + +If you’ve ever [used Vim][6] or Emacs, you’ll notice that using Nano is a lot simpler. You can start writing or editing text straightaway. + +Nano editor also shows important keyboard shortcuts you need to use for editing at the bottom of the editor. This way you won’t get stuck at [exiting the editor like Vim][7]. + +The wider your terminal window, the more shortcuts it shows. + +![Nano Editor Interface][8] + +You should get familiar with the symbols in Nano. + + * The caret symbol (^) means Ctrl key + * The M character mean the Alt key + + + +When it says “^X Exit”, it means to use Ctrl+X keys to exit the editor. When it says “M-U Undo”, it means use Alt+U key to undo your last action. + +#### Open or create a file for editing in Nano + +You can open a file for editing in Nano like this: + +``` +nano my_file +``` + +If the file doesn’t exist, it will still open the editor and when you exit, you’ll have the option for saving the text to my_file. + +You may also open a new file without any name (like new document) with Nano like this: + +``` +nano +``` + +#### Basic editing + +You can start writing or modifying the text straightaway in Nano. There are no special insert mode or anything of that sort. It is almost like using a regular text editor, at least for writing and editing. + +As soon as you modify anything in the file, you’ll notice that it reflects this information on the editor. + +![][9] + +Nothing is saved immediately to the file automatically unless you explicitly do so. When you exit the editor using Ctrl+X keyboard shortcut, you’ll be asked whether you want to save your modified text to the file or not. + +#### Moving around in the editor + +Mouse click doesn’t work here. Use the arrow keys to move up and down, left and right. + +You can use the Home key or Ctrl+A to move to the beginning of a line and End key or Ctrl+E to move to the end of a line. Ctrl+Y/Page Up and Ctrl+V/Page Down keys can be used to scroll by pages. + +If you want to go a specific location like last line, first line, to a certain text, use Ctrl+_ key combination. This will show you some options you can use at the bottom of the editor. + +![Jump to a specific line in Nano][10] + +#### Cut, copy and paste in Nano editor + +If you don’t want to spend too much time remembering the shortcuts, use mouse. + +Select a text with mouse and then use the right click menu to copy the text. You may also use the Ctrl+Shift+C [keyboard shortcut in Ubuntu][11] terminal. Similarly, you can use the right click and select paste from the menu or use the Ctrl+Shift+V key combination. + +**Nano specific shortcuts for copy and pasting** + +Nano also provides its own shortcuts for cutting and pasting text but that could become confusing for beginners. + +Move your cursor to the beginning of the text you want to copy. Press Alt+A to set a marker. Now use the arrow keys to highlight the selection. Once you have selected the desired text, you can Alt+6 key to copy the selected text or use Ctrl+K to cut the selected text. Use Ctrl+6 to cancel the selection. + +Once you have copied or cut the selected text, you can use Ctrl+U to paste it. + +![][12] + +#### Delete text or lines in Nano + +There is no dedicated option for deletion in Nano. You may use the Backspace or Delete key to delete one character at a time. Press them repeatedly or hold them to delete multiple characters. + +You can also use the Ctrl+K keys that cuts the entire line. If you don’t paste it anywhere, it’s as good as deleting a line. + +If you want to delete multiple lines, you may use Ctrl+K on all of them one by one. + +Another option is to use the marker (Ctrl+a). Set the marker and move the arrow to select a portion of text. Use Ctrl+K to cut the text. No need to paste it and the selected text will be deleted (in a way). + +#### Undo or redo your last action + +Cut the wrong line? Pasted the wrong text selection? It’s easy to make such silly mistakes and it’s easy to correct those silly mistakes. + +You can undo and redo your last actions using: + + * Alt+U : Undo + * Alt +E : Redo + + + +You can repeat these key combinations to undo or redo multiple times. + +#### Search and replace + +If you want to search for a certain text, use Ctrl+W and then enter the term you want to search and press enter. The cursor will move to the first match. To go to the next match, use Alt+W keys. + +![][13] + +By default, the search is case-insensitive. You can also use regex for the search terms. + +If you want to replace the searched term, use Ctr+\ keys and then enter the search term and press enter key. Next it will ask for the term you want to replace the searched items with. + +![][14] + +The cursor will move to the first match and Nano will ask for your conformation for replacing the matched text. Use Y or N to confirm or deny respectively. Using either of Y or N will move to the next match. You may also use A to replace all matches. + +![][15] + +#### Save your file while editing (without exiting) + +In a graphical editor, you are probable used to of saving your changes from time to time. In Nano, you can use Ctrl+O to save your changes you made to the file. It also works with a new, unnamed file. + +![][16] + +Nano actually shows this keyboard shortcut at the bottom but it’s not obvious. It says “^O Write Out” which actually means to use Ctrl+O (it is letter O, not number zero) to save your current work. Not everyone can figure that out. + +In a graphical text editor, you probably use Ctrl+S to save your changes. Old habits die hard but it could cause trouble. Out of habit, if you accidentally press Ctrl+S to save your file, you’ll notice that the terminal freezes and you can do nothing. + +If you accidentally press Ctrl+S press Ctrl+Q nothing can be more scary than a frozen terminal and losing the work. + +#### Save and exit Nano editor + +To exit the editor, press Ctrl+X keys. When you do that, it will give you the option to save the file, or discard the file or cancel the exit process. + +![][17] + +If you want to save the modified file as a new file (save as function in usual editors), you can do that as well. When you press Ctrl+X to exit and then Y to save the changes, it gives the option to which file it should save the changes. You can change the file name at this point. + +You’ll need to have ‘write permission’ on the file you are editing if you want to save the modifications to the file. + +#### Forgot keyboard shortcut? Use help + +Like any other terminal based text editor, Nano relies heavily on keyboard shortcuts. Though it displays several useful shortcuts on the bottom of the editor, you cannot see all of them. + +It is not possible to remember all the shortcuts, specially in the beginning. What you can do is to use the Ctrl+G keys to bring up the detailed help menu. The help menu lists all the keyboard shortcuts. + +![][18] + +#### Always look at the bottom of the Nano editor + +If you are using Nano, you’ll notice that it displays important information at the bottom. This includes the keyboard shortcuts that will be used in the scenario. It also shows the last action you performed. + +![][19] + +If you get too comfortable with Nano, you can get more screen for editing the text by disabling the shortcuts displayed at the bottom. You can use Alt+X keys for that. I don’t recommend doing it, to be honest. Pressing Alt+X brings the shortcut display back. + +### Download Nano cheatsheet [PDF] + +There are a lot more shortcuts and editing options in Nano. I am not going to overwhelm you by mentioning them all. + +Here’s a quick summary of the important Nano keyboard shortcuts you should rememeber. Download link is under the image. + +![][20] + +[Download Nano Cheat Sheet (free PDF)][21] + +You can download the cheatsheet, print it and keep at your desk. It will help you in remembering and mastering the shortcuts. + +I hope you find this beginner’s guide to Nano text editor helpful. If you liked it, please share it on Reddit, [Hacker News][22] or in various [Linux forums][23] you frequently visit. + +I welcome your questions and suggestions. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/nano-editor-guide/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.nano-editor.org/ +[2]: https://itsfoss.com/command-line-text-editors-linux/ +[3]: https://www.vim.org/ +[4]: https://www.gnu.org/software/emacs/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-guide.png?ssl=1 +[6]: https://itsfoss.com/pro-vim-tips/ +[7]: https://itsfoss.com/how-to-exit-vim/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-interface.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-modified-text.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-jump-to-line.png?ssl=1 +[11]: https://itsfoss.com/ubuntu-shortcuts/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-set-mark.png?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-search-text.png?ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-search-replace.png?ssl=1 +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-search-replace-confirm.png?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-save-while-writing.png?ssl=1 +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-save-and-exit.png?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-help-menu.png?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-hints.png?ssl=1 +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-cheatsheet.png?ssl=1 +[21]: https://itsfoss.com/wp-content/uploads/2020/05/Nano-Cheat-Sheet.pdf +[22]: https://news.ycombinator.com/ +[23]: https://itsfoss.community/ From fe5a14ebd3a403c09d07253fab4dc03cde5ff64a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 May 2020 01:11:33 +0800 Subject: [PATCH 2219/3057] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200527=20Mana?= =?UTF-8?q?ge=20startup=20using=20systemd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200527 Manage startup using systemd.md --- .../20200527 Manage startup using systemd.md | 567 ++++++++++++++++++ 1 file changed, 567 insertions(+) create mode 100644 sources/tech/20200527 Manage startup using systemd.md diff --git a/sources/tech/20200527 Manage startup using systemd.md b/sources/tech/20200527 Manage startup using systemd.md new file mode 100644 index 0000000000..c0ff18a13d --- /dev/null +++ b/sources/tech/20200527 Manage startup using systemd.md @@ -0,0 +1,567 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage startup using systemd) +[#]: via: (https://opensource.com/article/20/5/manage-startup-systemd) +[#]: author: (David Both https://opensource.com/users/dboth) + +Manage startup using systemd +====== +Learn how systemd determines the order services start, even though it is +essentially a parallel system. +![Penguin with green background][1] + +While setting up a Linux system recently, I wanted to know how to ensure that dependencies for services and other units were up and running before those dependent services and units start. Specifically, I needed more knowledge of how systemd manages the startup sequence, especially in determining the order services are started in what is essentially a parallel system. + +You may know that SystemV (systemd's predecessor, as I explained in the [first article][2] in this series) orders the startup sequence by naming the startup scripts with an SXX prefix, where XX is a number from 00 to 99. SystemV then uses the sort order by name and runs each start script in sequence for the desired runlevel. + +But systemd uses unit files, which can be created or modified by a sysadmin, to define subroutines for not only initialization but also for regular operation. In the [third article][3] in this series, I explained how to create a mount unit file. In this fifth article, I demonstrate how to create a different type of unit file—a service unit file that runs a program at startup. You can also change certain configuration settings in the unit file and use the systemd journal to view the location of your changes in the startup sequence. + +### Preparation + +Make sure you have removed `rhgb` and `quiet` from the `GRUB_CMDLINE_LINUX=` line in the `/etc/default/grub` file, as I showed in the [second article][4] in this series. This enables you to observe the Linux startup message stream, which you'll need for some of the experiments in this article. + +### The program + +In this tutorial, you will create a simple program that enables you to observe a message during startup on the console and later in the systemd journal. + +Create the shell program `/usr/local/bin/hello.sh` and add the following content. You want to ensure that the result is visible during startup and that you can easily find it when looking through the systemd journal. You will use a version of the "Hello world" program with some bars around it, so it stands out. Make sure the file is executable and has user and group ownership by root with [700 permissions][5] for security: + + +``` +#!/usr/bin/bash +# Simple program to use for testing startup configurations +# with systemd. +# By David Both +# Licensed under GPL V2 +# +echo "###############################" +echo "######### Hello World! ########" +echo "###############################" +``` + +Run this program from the command line to verify that it works correctly: + + +``` +[root@testvm1 ~]# hello.sh +############################### +######### Hello World! ######## +############################### +[root@testvm1 ~]# +``` + +This program could be created in any scripting or compiled language. The `hello.sh` program could also be located in other places based on the [Linux filesystem hierarchical structure][6] (FHS). I place it in the `/usr/local/bin` directory so that it can be easily run from the command line without having to prepend a path when I type the command. I find that many of the shell programs I create need to be run from the command line and by other tools such as systemd. + +### The service unit file + +Create the service unit file `/etc/systemd/system/hello.service` with the following content. This file does not need to be executable, but for security, it does need user and group ownership by root and [644][7] or [640][8] permissions: + + +``` +# Simple service unit file to use for testing +# startup configurations with systemd. +# By David Both +# Licensed under GPL V2 +# + +[Unit] +Description=My hello shell script + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/hello.sh + +[Install] +WantedBy=multi-user.target +``` + +Verify that the service unit file performs as expected by viewing the service status. Any syntactical errors will show up here: + + +``` +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) +[root@testvm1 ~]# +``` + +You can run this "oneshot" service type multiple times without problems. The oneshot type is intended for services where the program launched by the service unit file is the main process and must complete before systemd starts any dependent process. + +There are seven service types, and you can find an explanation of each (along with the other parts of a service unit file) in the [systemd.service(5)][9] man page. (You can also find more information in the [resources][10] at the end of this article.) + +As curious as I am, I wanted to see what an error might look like. So, I deleted the "o" from the `Type=oneshot` line, so it looked like `Type=neshot`, and ran the command again: + + +``` +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) + +May 06 08:50:09 testvm1.both.org systemd[1]: /etc/systemd/system/hello.service:12: Failed to parse service type, ignoring: neshot +[root@testvm1 ~]# +``` + +These results told me precisely where the error was and made it very easy to resolve the problem. + +Just be aware that even after you restore the `hello.service` file to its original form, the error will persist. Although a reboot will clear the error, you should not have to do that, so I went looking for a method to clear out persistent errors like this. I have encountered service errors that require the command `systemctl daemon-reload` to reset an error condition, but that did not work in this case. The error messages that can be fixed with this command always seem to have a statement to that effect, so you know to run it. + +It is, however, recommended that you run `systemctl daemon-reload` after changing a unit file or creating a new one. This notifies systemd that the changes have been made, and it can prevent certain types of issues with managing altered services or units. Go ahead and run this command. + +After correcting the misspelling in the service unit file, a simple `systemctl restart hello.service` cleared the error. Experiment a bit by introducing some other errors into the `hello.service` file to see what kinds of results you get. + +### Start the service + +Now you are ready to start the new service and check the status to see the result. Although you probably did a restart in the previous section, you can start or restart a oneshot service as many times as you want since it runs once and then exits. + +Go ahead and start the service (as shown below), and then check the status. Depending upon how much you experimented with errors, your results may differ from mine: + + +``` +[root@testvm1 ~]# systemctl start hello.service +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) + +May 10 10:37:49 testvm1.both.org hello.sh[842]: ######### Hello World! ######## +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:54:45 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ######### Hello World! ######## +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:54:45 testvm1.both.org systemd[1]: Finished My hello shell script. +[root@testvm1 ~]# +``` + +Notice in the status command's output that the systemd messages indicate that the `hello.sh` script started and the service completed. You can also see the output from the script. This display is generated from the journal entries of the most recent invocations of the service. Try starting the service several times, and then run the status command again to see what I mean. + +You should also look at the journal contents directly; there are multiple ways to do this. One way is to specify the record type identifier, in this case, the name of the shell script. This shows the journal entries for previous reboots as well as the current session. As you can see, I have been researching and testing for this article for some time now: + + +``` +[root@testvm1 ~]# journalctl -t hello.sh +<snip> +\-- Reboot -- +May 08 15:55:47 testvm1.both.org hello.sh[840]: ############################### +May 08 15:55:47 testvm1.both.org hello.sh[840]: ######### Hello World! ######## +May 08 15:55:47 testvm1.both.org hello.sh[840]: ############################### +\-- Reboot -- +May 08 16:01:51 testvm1.both.org hello.sh[840]: ############################### +May 08 16:01:51 testvm1.both.org hello.sh[840]: ######### Hello World! ######## +May 08 16:01:51 testvm1.both.org hello.sh[840]: ############################### +\-- Reboot -- +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:37:49 testvm1.both.org hello.sh[842]: ######### Hello World! ######## +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ######### Hello World! ######## +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +[root@testvm1 ~]# +``` + +To locate the systemd records for the `hello.service` unit, you can search on systemd. You can use **G+Enter** to page to the end of the journal entries and then scroll back to locate the ones you are interested in. Use the `-b` option to show only the entries for the most recent startup: + + +``` +[root@testvm1 ~]# journalctl -b -t systemd +<snip> +May 10 10:37:49 testvm1.both.org systemd[1]: Starting SYSV: Late init script for live image.... +May 10 10:37:49 testvm1.both.org systemd[1]: Started SYSV: Late init script for live image.. +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:37:50 testvm1.both.org systemd[1]: Starting D-Bus System Message Bus... +May 10 10:37:50 testvm1.both.org systemd[1]: Started D-Bus System Message Bus. +``` + +I copied a few other journal entries to give you an idea of what you might find. This command spews all of the journal lines pertaining to systemd—109,183 lines when I wrote this. That is a lot of data to sort through. You can use the pager's search facility, which is usually `less`, or you can use the built-in `grep` feature. The `-g` (or `--grep=`) option uses Perl-compatible regular expressions: + + +``` +[root@testvm1 ~]# journalctl -b -t systemd -g "hello" +[root@testvm1 ~]# journalctl -b -t systemd -g "hello" +\-- Logs begin at Tue 2020-05-05 18:11:49 EDT, end at Sun 2020-05-10 11:01:01 EDT. -- +May 10 10:37:49 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:54:45 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:54:45 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:54:45 testvm1.both.org systemd[1]: Finished My hello shell script. +[root@testvm1 ~]# +``` + +You could use the standard GNU `grep` command, but that would not show the log metadata in the first line. + +If you do not want to see just the journal entries pertaining to your `hello` service, you can narrow things down a bit by specifying a time range. For example, I will start with the beginning time of `10:54:00` on my test VM, which was the start of the minute the entries above are from. ****Note that the `--since=` option must be enclosed in quotes and that this option can also be expressed as `-S "