From f2303445767ac610fc03b0b1474186e4dca88eb8 Mon Sep 17 00:00:00 2001 From: Beini Gu Date: Mon, 8 Jul 2019 10:38:15 -0400 Subject: [PATCH 01/15] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申领翻译 --- .../tech/20190510 Learn to change history with git rebase.md | 3 +++ 1 file changed, 3 insertions(+) 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 cf8f9351d9..6652a67875 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,3 +1,6 @@ +Translating by Scoutydren.... + + [#]: collector: (lujun9972) [#]: translator: ( ) [#]: reviewer: ( ) From 0b10603846bf28a5ee23e3dfa0dc5d3cdab4515a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 8 Jul 2019 23:53:02 +0800 Subject: [PATCH 02/15] PRF --- translated/tech/20190416 Can schools be agile.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/translated/tech/20190416 Can schools be agile.md b/translated/tech/20190416 Can schools be agile.md index 83f051f11f..2d56cb3cf0 100644 --- a/translated/tech/20190416 Can schools be agile.md +++ b/translated/tech/20190416 Can schools be agile.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Can schools be agile?) @@ -9,7 +9,8 @@ 学校可以变得敏捷吗? ====== -我们一定不会希望用商业的方式运作我们的学校 —— 但是更加注重持续改进的教育机构是可以让我们受益的。 +> 我们一定不会希望用商业的方式运作我们的学校 —— 但是更加注重持续改进的教育机构是可以让我们受益的。 + ![][1] 我们都有过那种感觉一件事情“似曾相识”的经历。在 1980 年代末期我经常会有这种感觉,那时候我刚刚进入工业领域不久。当时正赶上一波组织变革的热潮,美国制造业在尝试各种各样不同的模型,让企业领导、经理人和像我这样的工程师重新思考我们应该如何处理质量、成本、创新以及股东价值这样的问题。我们似乎每一年(有时候更加频繁)都需要通过学习一本书来找到让我们更精简、更扁平、更灵活以及更加能满足顾客需求的“最佳方案”。 @@ -24,7 +25,7 @@ 这种不断改进的文化氛围遇到的第一个阻碍是,教育界普遍不愿意从其它行业借鉴可以为自己所用的思想 —— 特别是来自商界的思想。第二个阻碍是,主导教育界的仍然是一种自上而下的、等级制度森严的领导模式。人们往往只能在小范围内讨论这种系统性的、持续的改进方案,比如包括校长、助理校长、学校监管人(LCTT 译注:美国地方政府下设的一种官职,每个学校监管人管理一定数量的学校,接受学校校长的汇报)等等在内的学校领导和区域领袖。但是一小群人的参与是远远不足以带来整个组织层面的文化改革的。 -在进一步展开观点之前,我想强调一下,上面所做的概括一定是存在例外情况 的(我自己就见到过很多),不过我觉得任何一个教育界的利益相关者都应该会同意以下两点基本假设: +在进一步展开观点之前,我想强调一下,上面所做的概括一定是存在例外情况的(我自己就见到过很多),不过我觉得任何一个教育界的利益相关者都应该会同意以下两点基本假设: 1. 为学生提供高质量的、公平的教育和教学系统的工作所涉及到的任何人都应该将持续不断的改进作为思维方式里的重要部分; 2. 如果学校领导在做决策的时候可以更多地参考那些离学生最近的工作者的意见,那么学生以及学生所在的社区都将更加受益; @@ -37,12 +38,11 @@ 我并不是要呼吁大家像经营商业一样经营我们的学校。我所主张的是,用一种清晰而客观的态度去看待任何行业的任何思想,只要它们有可能帮助我们更好地迎合学生个体的需求。不过,如果想有效率地实现这个目标,我们需要仔细研究这个 100 多年来都停滞不前的领导结构。 - ### 把不断改进作为努力的目标 有一种说法认为教育和其它行业之间存在着巨大的差异,我虽然赞同这种说法,但同时也相信“重新思考组织和领导结构”这件事情对于任何一个希望对利益相关者负责(并且可以及时作出响应)的主体来说都是适用的。大多数其它行业都已经在重新审视它们传统的、封闭的、等级森严的结构,并且采用可以鼓励员工基于共有的优秀目标发挥自主性的组织结构 —— 这种组织结构对于不断改进来说十分关键。我们的学校和行政区是时候放开眼界了,而不应该拘泥于只听到来自内部的声音,因为它们的用意虽然是好的,但都没有脱离现有的范式。 -对于任何希望开始或者加速这个转变过程的学校,我推荐一本很好的书:Jim Whitehurst 的《开放的组织》(这不应该让你感到意外)。这本书不仅可以帮助我们理解教育者如何创造更加开放、覆盖面更广的领导领导结构 —— 在这样的结构下,互相尊重让人们可以基于实时数据作出更加灵活的决策 —— 并且它所使用的语言风格也和教育者们所习惯使用的奇怪的词汇库非常契合(这种词汇库简直是教育者们第二天性)。任何组织都可以借鉴开放组织的思维提供的实用主义方法让组织成员更加开放:分享想法和资源、拥抱以共同协作为核心的文化、通过快速制作原型来开发创新思维、基于价值(而不是提出者的职级)来评估一个想法,以及创造一种融入到组织 DNA 里的很强的社区观念。通过众包的方式,这样的开放组织不仅可以从组织内部,也能够从组织外部收集想法,创造一种可以让本地化的、以学生为中心的创新蓬勃发展的环境。 +对于任何希望开始或者加速这个转变过程的学校,我推荐一本很好的书:Jim Whitehurst 的《开放组织》(这不应该让你感到意外)。这本书不仅可以帮助我们理解教育者如何创造更加开放、覆盖面更广的领导领导结构 —— 在这样的结构下,互相尊重让人们可以基于实时数据作出更加灵活的决策 —— 并且它所使用的语言风格也和教育者们所习惯使用的奇怪的词汇库非常契合(这种词汇库简直是教育者们第二天性)。任何组织都可以借鉴开放组织的思维提供的实用主义方法让组织成员更加开放:分享想法和资源、拥抱以共同协作为核心的文化、通过快速制作原型来开发创新思维、基于价值(而不是提出者的职级)来评估一个想法,以及创造一种融入到组织 DNA 里的很强的社区观念。通过众包的方式,这样的开放组织不仅可以从组织内部,也能够从组织外部收集想法,创造一种可以让本地化的、以学生为中心的创新蓬勃发展的环境。 最重要的事情是:在快速变化的未来,我们在过去所做的事情不一定仍然适用了 —— 认清楚这一点对于创造一个不断改进的文化氛围是十分关键的。对于教育者来说,这意味着我们不能只是简单地依赖在针对工厂模型发展出来的解决方案和实践方式了。我们必须从其它行业(比如说非营利组织、军事、医疗以及商业 —— 没错,甚至是商业)里借鉴数不清的最佳方案,这样至少应该能让我们 *知道* 如何找到让学生受益最大的办法。从教育界传统的陈词滥调里超脱出来,才有机会拥有更广阔的视角。我们可以更好地顾全大局,用更客观地视角看待我们遇到的问题,同时也知道我们在什么方面已经做得很不错。 @@ -50,7 +50,6 @@ 坚持不懈地追求不断改进这件事情,不应该只局限于那种努力在一个全球化的、创新的经济环境中争取竞争力的机构,或者是负责运营学校的少数几个人。当机构里的每一个人都能不断思考怎样才能让今天比昨天做得更好的时候,这就是一个拥有优秀的文化氛围的机构。这种非常有注重协作性和创新的文化氛围,正是我们希望在这些负责改变年轻人命运的机构身上看到的。 - 我非常期待,有朝一日我能在学校里感受到这种精神,然后微笑着对自己说:“这种感觉多么似曾相识啊。” -------------------------------------------------------------------------------- @@ -60,7 +59,7 @@ via: https://opensource.com/open-organization/19/4/education-culture-agile 作者:[Ben Owens][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 aec38cbd607a9c28affb6636f8488132b2783eda Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 8 Jul 2019 23:53:32 +0800 Subject: [PATCH 03/15] PUB @chen-ni https://linux.cn/article-11076-1.html --- .../tech => published}/20190416 Can schools be agile.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190416 Can schools be agile.md (99%) diff --git a/translated/tech/20190416 Can schools be agile.md b/published/20190416 Can schools be agile.md similarity index 99% rename from translated/tech/20190416 Can schools be agile.md rename to published/20190416 Can schools be agile.md index 2d56cb3cf0..1e696ab2cd 100644 --- a/translated/tech/20190416 Can schools be agile.md +++ b/published/20190416 Can schools be agile.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11076-1.html) [#]: subject: (Can schools be agile?) [#]: via: (https://opensource.com/open-organization/19/4/education-culture-agile) [#]: author: (Ben Owens https://opensource.com/users/engineerteacher/users/ke4qqq/users/n8chz/users/don-watkins) From de6bb4920b044b996a59ae9a5502fe63486af6ba Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 9 Jul 2019 00:52:28 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190708=20Command?= =?UTF-8?q?=20line=20quick=20tips:=20Permissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20190708 Command line quick tips- Permissions.md --- ...08 Command line quick tips- Permissions.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20190708 Command line quick tips- Permissions.md diff --git a/sources/tech/20190708 Command line quick tips- Permissions.md b/sources/tech/20190708 Command line quick tips- Permissions.md new file mode 100644 index 0000000000..a52c8f8c79 --- /dev/null +++ b/sources/tech/20190708 Command line quick tips- Permissions.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Command line quick tips: Permissions) +[#]: via: (https://fedoramagazine.org/command-line-quick-tips-permissions/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +Command line quick tips: Permissions +====== + +![][1] + +Fedora, like all Linux based systems, comes with a powerful set of security features. One of the basic features is _permissions_ on files and folders. These permissions allow files and folders to be secured from unauthorized access. This article explains a bit about these permissions, and shows you how to share access to a folder using them. + +### Permission basics + +Fedora is by nature a multi-user operating system. It also has _groups_, which users can be members of. But imagine for a moment a multi-user system with no concept of permissions. Different logged in users could read each other’s content at will. This isn’t very good for privacy or security, as you can imagine. + +Any file or folder on Fedora has three sets of permissions assigned. The first set is for the _user_ who owns the file or folder. The second is for the _group_ that owns it. The third set is for everyone else who’s not the user who owns the file, or in the group that owns the file. Sometimes this is called the _world_. + +### What permissions mean + +Each set of permissions comes in three flavors — _read_, _write_, and _execute_. Each of these has an initial that stands for the permission, thus _r_, _w_, and _x_. + +#### File permissions + +For _files_, here’s what these permissions mean: + + * Read (r): the file content can be read + + * Write (w): the file content can be changed + + * Execute (x): the file can be executed — this is used primarily for programs or scripts that are meant to be run directly + + * + + +You can see the three sets of these permissions when you do a long listing of any file. Try this with the _/etc/services_ file on your system: + +``` +$ ls -l /etc/services +-rw-r--r--. 1 root root 692241 Apr 9 03:47 /etc/services +``` + +Notice the groups of permissions at the left side of the listing. These are provided in three sets, as mentioned above — for the user who owns the file, for the group that owns the file, and for everyone else. The user owner is _root_ and the group owner is the _root_ group. The user owner has read and write access to the file. Anyone in the group _root_ can only read the file. And finally, anyone else can also only read the file. (The dash at the far left shows this is a regular file.) + +By the way, you’ll commonly find this set of permissions on many (but not all) system configuration files. They are only meant to be changed by the system administrator, not regular users. Often regular users need to read the content as well. + +#### Folder (directory) permissions + +For folders, the permissions have slightly different meaning: + + * Read (r): the folder contents can be read (such as the _ls_ command) + * Write (w): the folder contents can be changed (files can be created or erased in this folder) + * Execute (x): the folder can be searched, although its contents cannot be read. (This may sound strange, but the explanation requires more complex details of file systems outside the scope of this article. So just roll with it for now.) + + + +Take a look at the _/etc/grub.d_ folder for example: + +``` +$ ls -ld /etc/grub.d +drwx------. 2 root root 4096 May 23 16:28 /etc/grub.d +``` + +Note the _d_ at the far left. It shows this is a directory, or folder. The permissions show the user owner (_root_) can read, change, and _cd_ into this folder. However, no one else can do so — whether they’re a member of the _root_ group or not. Notice you can’t _cd_ into the folder, either: + +``` +$ cd /etc/grub.d +bash: cd: /etc/grub.d: Permission denied +``` + +Notice how your own home directory is setup: + +``` +$ ls -ld $HOME +drwx------. 221 paul paul 28672 Jul 3 14:03 /home/paul +``` + +Now, notice how no one, other than you as the owner, can access anything in this folder. This is intentional! You wouldn’t want others to be able to read your private content on a shared system. + +### Making a shared folder + +You can exploit this permissions capability to easily make a folder to share within a group. Imagine you have a group called _finance_ with several members who need to share documents. Because these are user documents, it’s a good idea to store them within the _/home_ folder hierarchy. + +To get started, [use][2] _[sudo][2]_ to make a folder for sharing, and set it to be owned by the _finance_ group: + +``` +$ sudo mkdir -p /home/shared/finance +$ sudo chgrp finance /home/shared/finance +``` + +By default the new folder has these permissions. Notice how it can be read or searched by anyone, even if they can’t create or erase files in it: + +``` +drwxr-xr-x. 2 root root 4096 Jul 6 15:35 finance +``` + +That doesn’t seem like a good idea for financial data. Next, use the _chmod_ command to change the mode (permissions) of the shared folder. Note the use of _g_ to change the owning group’s permissions, and _o_ to change other users’ permissions. Similarly, _u_ would change the user owner’s permissions: + +``` +$ sudo chmod g+w,o-rx /home/shared/finance +``` + +The resulting permissions look better. Now, anyone in the _finance_ group (or the user owner _root_) have total access to the folder and its contents: + +``` +drwxrwx---. 2 root finance 4096 Jul 6 15:35 finance +``` + +If any other user tries to access the shared folder, they won’t be able to do so. Great! Now our finance group can put documents in a shared place. + +### Other notes + +There are additional ways to manipulate these permissions. For example, you may want any files in this folder to be set as owned by the group _finance_. This requires additional settings not covered in this article, but stay tuned to the Magazine for more on that topic soon. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/command-line-quick-tips-permissions/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/commandlinequicktips-816x345.jpg +[2]: https://fedoramagazine.org/howto-use-sudo/ From 54ae563ba5dc53dc2224f31e11131e3bdddfa7ce Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 9 Jul 2019 00:53:05 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190708=20Debian?= =?UTF-8?q?=2010=20(Buster)=20Installation=20Steps=20with=20Screenshots?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md --- ...er) Installation Steps with Screenshots.md | 217 ++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 sources/tech/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md diff --git a/sources/tech/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md b/sources/tech/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md new file mode 100644 index 0000000000..b69cb0a76c --- /dev/null +++ b/sources/tech/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md @@ -0,0 +1,217 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Debian 10 (Buster) Installation Steps with Screenshots) +[#]: via: (https://www.linuxtechi.com/debian-10-buster-installation-guide/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +Debian 10 (Buster) Installation Steps with Screenshots +====== + +Debian Project has released its latest and stable operating system as **Debian 10**, code name for Debian 10 is “**Buster**“, this release will get 5 years of support. Debian 10 is available for both 32-bit and 64-bit systems. This release comes with lot of new features, some of them are listed below: + + * Introduction of new Debian 10 theme known as “**FuturePrototype**” + * Updated Desktop GNOME 3.30, Cinnamon 3.8, KDE Plasma 5.14, MATE 1.20 & Xfce 4.12 + * LTS kernel 4.19.0-4 + * New Python 3 (3.7.2), Perl 5.28 & PHP 7.3 + * Iptables are replaced by nftables + * Updated LibreOffice 6.1 & GIMP 2.10.8 + * Updated OpenJDK 11, MariaDB 10.3 and Apache 2.4.38 + * Updated Chromium 73.0 & Firefox 60.7 + * Improved support for UEFI (Unified Extensible Firmware Interface) + + + +In this article we will demonstrate how to install Debian 10 “Buster” workstation on your Laptop & Desktop. + +**Recommended System Requirements for Debian 10** + + * 2 GB RAM + * 2 GHz Dual Core Processor + * 10 GB Free Hard disk space + * Bootable Installation Media (USB/ DVD) + * Internet connectivity (Optional) + + + +Let’s jump into the installation steps of Debian 10 + +### Step:1) Download Debian 10 ISO file + +Download the Debian 10 ISO file from its official portal, + + + +Once the ISO file is downloaded, burn it either into USB or DVD and make it bootable. + +### Step:2) Boot Your System with Installation Bootable Media (USB / DVD) + +Reboot your system in which you will be installing Debian 10 and go to bios settings and set the boot medium as USB or DVD.  Once the system is booted with installation bootable media then we will get the following screen. + + + +Choose the First option “**Graphical Install**” + +### Step:3) Choose Your preferred Language, Location and Keyboard Layout + +In this step you will be asked to choose your preferred language + + + +Click on Continue + +Select your preferred location, based on location, time zone will be automatically set for your system. + + + +Now Choose your keyboard layout that suits to your installation, + + + +Click on Continue to proceed further, + +### Step:4) Set Host name and Domain Name for Debian 10 System + +Set the hostname that suits to your environment and then click on Continue, in my case I am specifying the hostname as “**debian10-buster**” + + + +Specify the domain name that suits to environment and installation and then click on Continue + + + +### Step:5) Specify the root user’s password + +Specify the root password in the screen below and then click on Continue + + + +### Step:6) Create Local User and its password + +In this step you will be prompted to specify local user details like full name, user name and its password, + + + +Click on Continue + + + +Click on Continue and specify the password in the next window + + + +### Step:7) Choose Hard Disk Partitioning Scheme for Debian 10 + +In this step, select partitioning scheme for Debian 10, in my case I have 40 GB hard disk available for OS installation. Partitioning scheme is of two types: + + * Guided Partitioning (Installer will automatically create required partitions) + * Manual Partitioning (As name suggests using this we can create manual partitions scheme) + + + +In this tutorial we will use guided partitions with LVM on my 42 GB hard drive, + + + +Click on Continue to proceed further, + + + +As we can see I have around 42 GB hard disk space, so choose Continue + +In the next screen, you will be asked to choose partitions, if are a new Linux user then choose the first option and in case you want a separate home partition then choose second option and else third option, which will create a separate partition for /home, /var and /tmp. + +In my case I am going to create separate partition for /home, /var and /tmp by choosing the third option. + + + +In the next screen select “**yes**” to write changes to disk and Configure LVM and then click on Continue + + + +In the next screen, partition table will be displayed, cross verify the partitions size, file system type and mount point. + + + +Click on Continue to proceed further, + +In the next screen, choose “yes” to write changes to disk, + + + +Click on Continue to proceed with installation, + +### Step:7) Debian 10 Installation Started + +In this step, Installation of Debian 10 has been started and is in progress, + + + +During the installation, installer will prompt you to scan CD/DVD for configuring package manager, Choose No and then click on Continue + + + +In the next screen choose “yes” if you want to configure Package Manager based on Network but for this to work, make sure your system is connected to Internet, else Choose No + + + +Click on continue to configure package manager based on your location, In next couple of screens you will be prompted to choose location and Debian package repository URL, then you will get below screen + + + +Choose “No” to skip package survey step and then click on Continue + + + +In the next window, you will be prompted to choose Desktop environment and other packages, in my case I am selecting **Gnome Desktop**, **SSH Server** and **Standard System utilities** + + + +Click on Continue to proceed with Installation, + +Choose the option “yes” to install Grub Boot Loader + + + +Click on Continue to proceed further, then in the next window choose the disk (/dev/sda) on which bootloader will be installed + + + +Click on Continue to proceed with installation, Once the installation is completed then installer will prompt us to reboot the system, + + + +Click on Continue to reboot your system and don’t forget to change boot medium from Bios settings so that system boots up with hard disk on which we have installed Debian 10 OS. + +### Step:8) Boot your newly installed system with Debian 10 + +Once we reboot the system after the successful installation we will get below bootloader screen + + + +Choose the first option “**Debian GNU/Linux**” and hit enter, + +Once the system boots up, use the same local user and its password that we have created during the installation, + + + +Following will be Desktop screen after successful login, + + + +This confirms that Debian 10 has been installed successfully, that’s all from this article, explore this exciting Linux Distribution and have fun 😊 +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/debian-10-buster-installation-guide/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 From 7ffb50e6e690e7f11aa547307ea2f24883a93349 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 9 Jul 2019 00:53:32 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190709=20Clear=20?= =?UTF-8?q?is=20better=20than=20clever?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20190709 Clear is better than clever.md --- .../20190709 Clear is better than clever.md | 298 ++++++++++++++++++ 1 file changed, 298 insertions(+) create mode 100644 sources/tech/20190709 Clear is better than clever.md diff --git a/sources/tech/20190709 Clear is better than clever.md b/sources/tech/20190709 Clear is better than clever.md new file mode 100644 index 0000000000..7fca05416b --- /dev/null +++ b/sources/tech/20190709 Clear is better than clever.md @@ -0,0 +1,298 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Clear is better than clever) +[#]: via: (https://dave.cheney.net/2019/07/09/clear-is-better-than-clever) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Clear is better than clever +====== + +_This article is based on my_ [_GopherCon Singapore 2019_][1] _presentation. In the presentation I referenced material from my post [on declaring variables][2] and my [GolangUK 2017 presentation on SOLID design][3]. For brevity those parts of the talk have been elided from this article. If you prefer, you can [watch the recording of the talk][4]._ + +* * * + +Readability is often cited as one of Go’s core tenets, I disagree. In this article I’ll discuss the differences between clarity and readability, show you what I mean by clarity and how it applies to Go code, and argue that Go programmers should strive for clarity–not just readability–in their programs. + +### Why would I read your code? + +Before I pick apart the difference between clarity and readability, perhaps the question to ask is, “why would I read your code?” To be clear, when I say _I_, I don’t mean me, I mean you. And when I say _your code_ I also mean you, but in the third person. So really what I’m asking is, “why would _you read_ another person’s code?” + +I think Russ Cox, paraphrasing Titus Winters, put it best: + +> Software engineering is what happens to programming when you add time and other programmers. + +*–*Russ Cox, GopherCon Singapore 2018 + +The answer to the question, “why would I read your code” is, because we have to work together. Maybe we don’t work in the same office, or live in the same city, maybe we don’t even work at the same company, but we do collaborate on a piece of software, or more likely consume it as a dependency. + +This is the essence of Russ and Titus’ quote; software engineering is the collaboration of software engineers over time. I have to read your code, and you read mine, so that I can understand it, so that you can maintain it, and in short, so that any programmer can change it. + +Russ is making the distinction between software programming and software engineering. The former is a program you write for yourself, the latter is a program—​a project, a service, a product—​that many people will contribute to over time. Engineers will come and go, teams will grow and shrink, requirements will change, features will be added and bugs fixed. This is the nature of software engineering. + +### We don’t read code, we decode it + +> It was sometime after that presentation that I finally realized the obvious: Code is not literature. We don’t read code, we _decode_ it. + +_–_[Peter Seibel][5] + +The author Peter Seibel suggests that programs are not read, but are instead decoded. In hindsight this is obvious, after all we call it source code, not source literature. The source code of a program is an intermediary form, somewhere between our concept — what’s inside our heads — and the computer’s executable notation. + +In my experience, the most common complaint when faced with a foreign codebase written by someone, or some team, is the code is unreadable. Perhaps you agree with me? + +But readability as a concept is subjective. Readability is nit picking about line length and variable names. Readability is holy wars about brace position. Readability is the hand to hand combat of style guides and code review guidelines that regulate the use of whitespace. + +### Clarity ≠ Readability + +Clarity, on the other hand, is the property of the code on the page. Clear code is independent of the low level details of function names and indentation because clear code is concerned with what the code is doing, not just how it is written down. + +When you or I say that a foreign codebase is unreadable, what I think what we really mean is, _I don’t understand it_. For the remainder of this article I want to try to explore the difference between clear code and code that is simply readable, because the goal is not how quickly you can read a piece of code, but how quickly you can grasp its meaning. + +### Keep to the left + +Go programs are traditionally written in a style that favours guard clauses and preconditions. This encourages the success path to proceed down the page, rather than indented inside a conditional block. Mat Ryer calls this [line of sight coding][6], because, the active part of your function is not at risk of sliding out of sight beyond the right hand margin of your screen. + +By keeping conditional blocks short, and for the exceptional condition, we avoid nested blocks and potentially complex value shadowing. The successful flow of control continues down the page. At every point in the sequence of instructions, if you’ve arrived at that point, you are confident that a growing set of preconditions holds true. + +``` +func ReadConfig(path string) (*Config, error) { +       f, err := os.Open(path) + if err != nil { + return nil, err + } + defer f.Close() +        // ... + } +``` + +The canonical example of this is the classic error check idiom; `if err != nil` then return it to the caller, else continue with the function. We can generalise this pattern a little and in pseudocode we have: + +``` +if some condition { + // true: cleanup + return + } + // false: continue +``` + +If _some condition_ is true, then return to the caller, else continue onwards towards the end of the function.  + +This form holds true for all preconditions, error checks, map lookups, length checks, and so forth. The exact form of the precondition’s check changes, but the pattern is always the same; the cleanup code is inside the block, terminating with a return, the success condition lies outside the block, and is only reachable if the precondition is false. + +Even if you are unsure what the preceding and succeeding code does, how the precondition is formed, and how the cleanup code works, it is clear to the reader that this is a guard clause. + +### Structured programming + +Here we have a `comp` function that takes two `int`s and returns an `int`; + +``` +func comp(a, b int) int { + if a < b { + return -1 + } + if a > b { +               return 1 +        } +        return 0 +} +``` + +The `comp` function is written in a similar form to guard clauses from earlier. If `a` is less than `b`, the return -1 path is taken. If `a` is greater than `b`, the return 1 path is taken. Else, `a` and `b` are by induction equal, so the final return 0 path is taken. + +``` +func comp(a, b int) int { + if condition A { + body A + } +        if condition B { +                 body B +        } +        return 0 +} +``` + +The problem with `comp` as written is, unlike the guard clause, someone maintaining this function has to read all of it. To understand when 0 is returned, we have to read the conditions _and the body_ of each clause. This is reasonable when you’re dealing with functions which fit on a slide, but in the real world complicated functions–​the ones we’re paid for our expertise to maintain–are rarely slide sized, and their conditions and bodies are rarely simple. + +Let’s address the problem of making it clear under which condition 0 will be returned: + +``` +func comp(a, b int) int { + if a < b { + return -1 + } else if a > b { +                return 1 +        } else { +                return 0 +        } +} +``` + +Now, although this code is not what anyone would argue is readable–​long chains of `if else if` statements are broadly discouraged in Go–​it is clearer to the reader that zero is only returned if none of the conditions are met. + +How do we know this? The Go spec declares that each function that returns a value must end in a terminating statement. This means that the body of all conditions must return a value. Thus, this does not compile: + +``` +func comp(a, b int) int { +        if a > b { +                a = b // does not compile +        } else if a < b { +               return 1 +       } else { +               return 0 +        } +} +``` + +Now it is clear to the reader that this code isn’t actually a series of conditions, instead this is an example of selection. Only one path can be taken regardless of the operation of the condition blocks. Based on the inputs one of -1, 0, or 1 will always be returned.  + +``` +func comp(a, b int) int { +       if a < b { +               return -1 +       } else if a > b { +               return 1 +       } else { +               return 0 +       } +} +``` + +However this code is hard to read as each of the conditions is written differently, the first is a simple `if a < b`, the second is the unusual `else if a > b`, and the last conditional is actually unconditional. + +But it turns out there is a statement which we can use to make our intention much clearer to the reader; `switch`. + +``` +func comp(a, b int) int { +        switch { +        case a < b: +                return -1 +        case a > b: +                return 1 +        default: +                return 0 +        } +} +``` + +Now it is clear to the reader that this is a selection. Each of the selection conditions are documented in their own case statement, rather than varying `else` or `else if` clauses. + +By moving the default condition inside the switch, the reader only has to consider the cases that match their condition, as none of the cases can fall out of the switch block because if the default clause.1 + +> Structured programming submerges _structure_ and emphasises _behaviour_ + +*–Richard Bircher, *[_The limits of software_][7] + +I found this quote recently and I think it is apt. My arguments for clarity are in truth arguments to emphasise the behaviour of the code, rather than be side tracked by minutiae of the structure itself. Said another way, what is the code is trying to do, _not how it is trying to do it_. + +### Guiding principles + +I opened this article with a discussion of readability vs clarity and hinted that there were other principles of well written Go code. It seems fitting to close on a discussion of those other principles. + +Last year [Bryan Cantrill gave a wonderful presentation on operating system principles][8], wherein he highlighted that different operating systems focus on different principles. It is not that they ignore the principles that differ between their competitors, just that when the chips are down, they prioritise a core set. So what is that core set of principles for Go? + +#### Clarity + +If you were going to say readability, hopefully I’ve provided you with an alternative. + +> Programs must be written for people to read, and only incidentally for machines to execute. + +_–Hal Abelson and Gerald Sussman_. _Structure and Interpretation of Computer Programs_ + +Code is read many more times than it is written. A single piece of code will, over its lifetime, be read hundreds, maybe thousands of times. It will be read those hundreds or thousands of times because it must be understood. Clarity is important because all software, not just Go programs, is written by people to be read by other people. The fact that software is also consumed by machines is secondary. + +> The most important skill for a programmer is the ability to effectively communicate ideas. + +_–Gastón Jorquera_ + +Legal documents are double spaced to aide the reader, but to the layperson that does nothing to help them comprehend what they just read. Readability is a property of how easy it was to read the words on the screen. On the other hand, clarity is the answer to the question “did you understand what you just read?”. + +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. + +The first step towards writing maintainable code is making sure intent of the code is clear. + +#### Simplicity + +The next principle is obviously simplicity. Some might argue the most important principle for any programming language, perhaps the most important principle full stop. + +Why should we strive for simplicity? Why is important that Go programs be simple? + +> The ability to simplify means to eliminate the unnecessary so that the necessary may speak + +_–Hans Hofmann_ + +We’ve all been in a situation where you say “I can’t understand this code”. We’ve all worked on programs we were scared to make a change because we were worried it’ll break another part of the program; a part you don’t understand and don’t know how to fix.  + +This is complexity. Complexity turns reliable software in unreliable software. Complexity is what kills software projects. Clarity and simplicity are interlocking forces that lead to maintainable software. + +#### Productivity + +The last Go principle I want to highlight is productivity. Developer productivity boils down to this; how much time do you spend doing useful work verses waiting for your tools or hopelessly lost in a foreign code-base. Go programmers should feel that they can get a lot done with Go. + +> “I started another compilation, turned my chair around to face Robert, and started asking pointed questions. Before the compilation was done, we’d roped Ken in and had decided to do something.” + +_–Rob Pike, [Less is Exponentially more][9]_ [][9] + +The joke goes that Go was designed while waiting for a C++ program to compile. Fast compilation is a key feature of Go and a key recruiting tool to attract new developers. While compilation speed remains a constant battleground, it is fair to say that compilations which take minutes in other languages, take seconds in Go. This helps Go developers feel as productive as their counterparts working in dynamic languages without the maintenance issues inherent in those languages. + +> Design is the art of arranging code to work _today_, and be changeable  _forever._ + +_–Sandi Metz_ + +More fundamental to the question of developer productivity, Go programmers realise that code is written to be read and so place the act of reading code above the act of writing it. Go goes so far as to enforce, via tooling and custom, that all code be formatted in a specific style. This removes the friction of learning a project specific dialect and helps spot mistakes because they just look incorrect. + +Go programmers don’t spend days debugging inscrutable compile errors. They don’t waste days with complicated build scripts or deploying code to production. And most importantly they don’t spend their time trying to understand what their coworker wrote. + +> Complexity is anything that makes software hard to understand or to modify. + +_–John Ousterhout_, [A Philosophy of Software Design][10] + +Something I know about each of you reading this post is you will eventually leave your current employer. Maybe you’ll be moving on to a new role, or perhaps a promotion, perhaps you’ll move cities, or follow your partner overseas. Whatever the reason, we must all consider the succession of the maintainership of the programs we create. + +If we strive to write programs that are clear, programs that are simple, and to focus on the productivity of those working with us that will set all Go programmers in good stead. + +Because if we don’t, then as we move from job to job we’ll leave behind programs which cannot be maintained. Programs which cannot be changed. Programs which are too hard to onboard new developers, and programs which feel like career digression for those that work on them. + +If software cannot be maintained, then it will be rewritten; and that could be the last time your company invests in Go. + + 1. The `fallthrough` keyword complicates this analysis, hence the general disapproval of `fallthrough` in switch statements. + + + +#### Related posts: + + 1. [Accidental method value][11] + 2. [Unhelpful abstractions][12] + 3. [What is the zero value, and why is it useful?][13] + 4. [Let’s talk about logging][14] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/07/09/clear-is-better-than-clever + +作者:[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://2019.gophercon.sg/ +[2]: https://dave.cheney.net/2014/05/24/on-declaring-variables +[3]: https://dave.cheney.net/2016/08/20/solid-go-design +[4]: https://www.youtube.com/watch?v=NwEuRO_w8HE +[5]: http://www.gigamonkeys.com/code-reading/ +[6]: https://medium.com/@matryer/line-of-sight-in-code-186dd7cdea88 +[7]: https://www.amazon.com/Limits-Software-People-Projects-Perspectives/dp/0201433230 +[8]: https://www.slideshare.net/bcantrill/platform-values-rust-and-the-implications-for-system-software +[9]: https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html +[10]: https://www.amazon.com/Philosophy-Software-Design-John-Ousterhout/dp/1732102201/ref=sr_1_3?ie=UTF8&qid=1524677319&sr=8-3&keywords=john+ousterhout +[11]: https://dave.cheney.net/2014/05/19/accidental-method-value (Accidental method value) +[12]: https://dave.cheney.net/2016/02/06/unhelpful-abstractions (Unhelpful abstractions) +[13]: https://dave.cheney.net/2013/01/19/what-is-the-zero-value-and-why-is-it-useful (What is the zero value, and why is it useful?) +[14]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging (Let’s talk about logging) From 2078d9667aa5a74733e9d54133424fa1f7e059da Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 9 Jul 2019 00:54:39 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190708=2010=20way?= =?UTF-8?q?s=20to=20get=20started=20with=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20190708 10 ways to get started with Linux.md --- ...90708 10 ways to get started with Linux.md | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 sources/tech/20190708 10 ways to get started with Linux.md diff --git a/sources/tech/20190708 10 ways to get started with Linux.md b/sources/tech/20190708 10 ways to get started with Linux.md new file mode 100644 index 0000000000..a01b2548de --- /dev/null +++ b/sources/tech/20190708 10 ways to get started with Linux.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 ways to get started with Linux) +[#]: via: (https://opensource.com/article/19/7/ways-get-started-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/don-watkins) + +10 ways to get started with Linux +====== +Ready to dive in and learn Linux? Try these 10 ways to get started. +![Penguins gathered together in the Artic][1] + +The article _[What is a Linux user?][2]_ by Anderson Silva made it clear that these days people are as likely to use Linux (in some way) as they are to use Windows, as long as your definition of "using Linux" is sufficiently broad. Still, if you don't have enough Linux in your life, now is a great time to try Linux in a way you've never tried before. + +Here are 10 ways to get started with Linux. Try one or try them all. + +### 1\. Join a free shell + +![Free shell screenshot][3] + +There are a lot of people running Linux with more Linux servers than they know what to do with (keep in mind that a "Linux server" can be anything from the latest supercomputer to a discarded 12-year-old laptop). To put excess computers to good use, many administrators open their spare boxes up for free shell accounts. + +If you want to log time in a Linux terminal to learn commands, shell scripting, Python, and the basics of web development, a free shell account is an easy, no-cost way to get started. Here's a short list to try: + + * [Freeshell.de][4] is a public access Linux system that's been online since 2002. You get SSH access (to experiment in a Linux shell), IPv6, and OpenSSL, and you can request a MySQL database. + * [Blinkenshell][5] provides a Linux shell to learn Unix, use IRC, host simple websites, and share files. It's been online since 2006. + * [SDF Public Access Unix System][6] was established in 1987 to offer free NetBSD accounts. NetBSD isn't Linux, of course, but it's open source Unix, so it offers a similar experience. It also has several homebrewed applications, so it straddles the line between old-school BBS and plain-old free shell. + + + +Free shell accounts are subject to a lot of abuse, so the more you demonstrate trustworthiness and willingness to participate in the goings-on of the collective, the better your experience. You can often gain access (through a special request or a small donation to demonstrate goodwill) to database engines, compilers, and advanced programming languages. You can also ask for additional software or libraries to be installed, subject to administrator approval. + +#### How to use it + +Public access shell accounts are a great way to try out a real Linux system. The fact that you don't get root access means you get to learn local software management without having to mow your own lawn or fix leaky faucets. You can do just enough real-life activities to make them viable for getting real work done, although they're not reliable enough to be mission critical. + +### 2\. Try Linux on Windows with WSL 2 + +Believe it or not, Microsoft started shipping Linux with Windows as of June 2019, meaning you can run Linux applications from Windows as the second iteration of the [Windows Subsystem for Linux][7] (WSL 2). While it's primarily aimed at developers, Windows users will find WSL 2 to be a Linux environment from the comfort of a familiar desktop without any virtualization taking up extra resources. This is Linux running as a process on your Windows machine. At this time, it's still a new initiative and a work in progress, so it's subject to change. If you try to push it too far too soon, you're likely to encounter a bug or two, but if you're just looking to get started with Linux, learn some commands, and get a feel for getting serious work done in a text-based environment, WSL 2 may be exactly what you need. + +#### How to use it + +WSL doesn't yet have a clear pathway or purpose, but it provides a Linux environment on your Windows machine. You get root access and can run Linux distributions and applications, so it's an easy and seamless way to learn. However, even though WSL _is Linux_, it's not exactly a typical Linux experience. It's Linux provided by Windows, and that's not what you're likely to encounter in the real world. WSL is a development and educational tool, but if it's available to you, then you should use it. + +### 3\. Carry Linux on a bootable thumb drive + +![Porteus Linux][8] + +Carry Linux, installed to a USB thumb drive, everywhere you go, and boot any computer you encounter from that thumb drive. You get a personalized Linux desktop, and you don't have to worry about the data on the host computer you've booted from. The computer doesn't touch your Linux OS, and your Linux OS doesn't affect the computer. It's ideal for public computers at hotel business centers, libraries, schools, or just to give yourself an excuse to boot into Linux from time to time. + +Unlike many other quick hacks to get to a Linux shell, this method offers you a full and robust Linux system, complete with a desktop, access to whatever software you need, and persistent data storage. + +The system never changes. Any data you want to save is written into a compressed filesystem, which is then applied as an overlay to the system when you boot. This flexibility allows you to choose whether to boot in persistent mode, saving all data back to the thumb drive, or in an ephemeral mode, so everything you do disappears once you power down. In other words, you can use this as a secure kiosk on an untrusted computer or as your portable OS on computers you trust. + +There are many [thumb drive distributions][9] you can try, some with minimal desktop environments for low-powered computers and others with a full desktop. I'm partial to [Porteus][10] Linux. I've carried it on my keychain every day for the past eight years, using it as my primary computing platform during business travel as well as a utility disk if computer problems strike at work or home. It's a reliable and stable operating system that's fun and easy to use. + +On Mac or Windows, download the [Fedora Media Writer][11] to create a bootable thumb drive of whatever portable distribution you download. + +#### How to use it + +Booting a "live Linux" from a USB thumb drive provides a complete Linux distribution. While data storage is done a little differently from a system you install to a hard drive, everything else is as you'd expect from a Linux desktop. There's little you can't do on a portable Linux OS, so install one on your keychain to unlock the full potential of every computer you encounter. + +### 4\. Take an online tour + +![Linux tour screenshot][12] + +Somebody over at Ubuntu thought up the brilliant idea of hosting an Ubuntu GNOME desktop in the browser. To try it out for yourself, open a web browser and navigate to [tour.ubuntu.com][13]. You can select which activity you want demonstrated, or you can skip individual lessons and click the Show Yourself Around button. + +Even if you're new to the Linux desktop, you might find showing yourself around is more familiar than you might expect. From the online tour, you can look around, see what applications are available, and view what a typical default Linux desktop is like. You can't adjust settings or launch another tour in Firefox (it was the first thing I tried, naturally), and while you can go through the motions of installing applications, you can't launch them. But if you've never used a Linux desktop before and you want to see what all the fuss is about, this is the whirlwind tour. + +#### How to use it + +An online tour is truly just a tour. If you've never seen a Linux desktop in action, this is an opportunity to get a glimpse of what it's like. Not intended for serious work, this is an attractive display to entice passers-by. + +### 5\. Run Linux in the browser with JavaScript + +![JSLinux][14] + +Not so long ago, virtualization used to be computationally expensive, limited to users with premium hardware. Now virtualization has been optimized to the point that it can be performed by a JavaScript engine, thanks to Fabrice Bellard, the creator of the excellent and open source [QEMU][15] machine emulator and virtualizer. + +Bellard also started the JSLinux project, which allows you to run Linux and other operating systems in a browser, in his spare time for fun. It's still an experimental project, but it's a technical marvel. Open a web browser to the [JSLinux][16] page, and you can boot a text-based Linux shell or a minimal graphical Linux environment. You can upload and download files to your JSLinux host or (theoretically) send your files to a network backup location, because JSLinux has access to the internet through a VPN socket (although at capped speeds, dependent upon the VPN service). + +#### How to use it + +You won't be doing serious work on JSLinux anytime soon, and the environment is arguably too unusual to learn broad lessons about how Linux normally works. If, however, you're bored of running Linux on a plain old PC and would like to try Linux on a truly distinctive platform, JSLinux is in a class all its own. + +### 6\. Read about it + +Not every Linux experience happens on the computer. Maybe you're the sort of person who likes to keep your distance, observe, and do your research before jumping into something new, or maybe you're just not clear yet on what "Linux" encompasses, or maybe you love full immersion. There's a wealth of information to read about how Linux works, what it's like to run Linux, and what's happening in the Linux world. + +The more you get familiar with the world of open source, the easier it is to understand the common lingo and to separate urban myth from actual experience. We publish [book lists][17] from time to time, but one of my favorites is [_The Charm of Linux_][18] by Hazel Russman. It's a tour through Linux from many different angles, written by an independent author out of excitement over discovering Linux. + +#### How to use it + +Nothing beats kicking back with a good book. This is the least traditional method of experiencing Linux, but for people who love the printed word, it's both comforting and effective. + +### 7\. Get a Raspberry Pi + +![Raspberry Pi 4][19] + +If you're using a [Raspberry Pi][20], you're running Linux. It's that easy to get started with Linux and low-powered computing. The great thing about the Pi, aside from it costing well under $100, is that its [website][21] is designed for education. You can learn all about what the Pi does, and while you're at it, all about what Linux can do for you. + +#### How to use it + +The Pi is, by design, a low-powered computer. That means you can't do as much multitasking as you might be used to, but that's a convenient way to keep yourself from getting overwhelmed. The Raspberry Pi is a great way to learn Linux and all of the possibilities that come with it, and it's a fun way to discover the power of eco-friendly, small-form-factor, simplified computing. And be sure to stay tuned to Opensource.com—especially during Pi Week every March—for [tips][22] and [tricks][23] and [fun][24] [activities][25]. + +### 8\. Climb aboard the container craze + +If you work near the back end of the mythical [cloud][26], then you've heard about the container craze. While you can run Docker and Kubernetes on Windows, Azure, Mac, and Linux, you may not know that the containers themselves are Linux. Cloud computing apps and infrastructure are literally minimal Linux systems that run partly virtualized and partly on bare metal. If you launch a container, you are launching a miniature, hyper-specific Linux distribution. + +Containers are [different][27] than virtual machines or physical servers. They're not intended to be used as a general-purpose operating system. However, if you are developing in a container, you might want to pause and have a look around. You'll get a glimpse of how a Linux system is structured, where important files are kept, and which commands are the most common. You can even [try a container online][28], and you can read all about how they work in my article about going [behind the scenes with Linux containers][29]. + +#### How to use it + +Containers are, by design, specific to a single task, but they're Linux, so they're extremely flexible. You can use them as they're intended, or you can build a container out into a mostly complete system for your Linux experiments. It's not a desktop Linux experience, but it's a full Linux experience. + +### 9\. Install Linux as a VM + +Virtualization is the easy way to try an operating system, and [VirtualBox][30] is a great open source way to virtualize. VirtualBox runs on Windows and Mac, so you can install Linux as a virtual machine (VM) and use it almost as if it were just another application. If you're not accustomed to installing an operating system, VirtualBox is also a very safe way to try Linux without accidentally installing it over your usual OS. + +#### How to use it + +Running Linux as a VM is convenient and easy, either as a trial run or an alternative to dual-booting or rebooting when you need a Linux environment. It's full-featured and, because it uses virtual hardware, the host operating system drives your peripherals. The only disadvantage to running Linux as a virtual machine is primarily psychological. If you intend to use Linux as your main OS, but end up defaulting to the host OS for all but the most Linux-specific tasks, then the VM has failed you. Otherwise, a VM is a triumph of modern technology, and using Linux in VirtualBox provides you with all the best features Linux has to offer. + +### 10\. Install it + +![Fedora Silverblue][31] + +When in doubt, there's always the traditional route. If you want to give Linux the attention it deserves, you can download Linux, burn the installer to a thumb drive (or a DVD, if you prefer optical media), and install it on your computer. Linux is open source, so it can be distributed by anyone who wants to take the time to bundle Linux—and all the bits and pieces that make it usable—into what is commonly called a _distribution_ (or "distro") for short. Ask any Linux user, and you're bound to get a different answer for which distribution is "best" (mostly because the term "best" is often left undefined). Most people admit that you should use the Linux distribution that works for you, meaning that you should test a few popular distros and settle on the one that makes your computer behave as you expect it to behave. This is a pragmatic and functional approach. For example, should a distribution fail to recognize your webcam and you want your webcam to work, then use a distribution that recognizes your webcam. + +If you've never installed an operating system before, you'll find most Linux distributions include a friendly and easy installer. Just download a distribution (they are delivered as ISO files), and download the [Fedora Media Writer][11] to create a bootable installation thumb drive. + +#### How to use it + +Installing Linux and using it as an operating system is a step toward becoming familiar and familial with it. There's no wrong way to use it. You might discover must-have features you never knew you needed, you might learn more about computers than you ever imagined you could, and you may shift in your worldview. Or you might use a Linux desktop because it was easy to download and install, or because you want to cut out the middleman of some corporate overlord, or because it helps you get your work done. + +Whatever your reason, just give Linux a try with any (or all) of these options. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/ways-get-started-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/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png?itok=p7cWyQv9 (Penguins gathered together in the Artic) +[2]: https://opensource.com/article/19/6/what-linux-user +[3]: https://opensource.com/sites/default/files/uploads/freeshell.png (Free shell screenshot) +[4]: https://freeshell.de +[5]: https://blinkenshell.org/wiki/Start +[6]: https://sdf.org/ +[7]: https://devblogs.microsoft.com/commandline/wsl-2-is-now-available-in-windows-insiders/ +[8]: https://opensource.com/sites/default/files/uploads/porteus.jpg (Porteus Linux) +[9]: https://opensource.com/article/19/6/tiny-linux-distros-you-have-try +[10]: http://porteus.org +[11]: https://getfedora.org/en/workstation/download/ +[12]: https://opensource.com/sites/default/files/uploads/linux_tour.jpg (Linux tour screenshot) +[13]: http://tour.ubuntu.com/en/# +[14]: https://opensource.com/sites/default/files/uploads/jslinux.jpg (JSLinux) +[15]: https://www.qemu.org +[16]: https://bellard.org/jslinux/ +[17]: https://opensource.com/article/19/1/tech-books-new-skils +[18]: http://www.lulu.com/shop/hazel-russman/the-charm-of-linux/paperback/product-21229401.html +[19]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4-case.jpg (Raspberry Pi 4) +[20]: https://opensource.com/resources/raspberry-pi +[21]: https://www.raspberrypi.org/ +[22]: https://opensource.com/article/19/3/raspberry-pi-projects +[23]: https://opensource.com/article/19/3/piflash +[24]: https://opensource.com/article/19/3/gamepad-raspberry-pi +[25]: https://opensource.com/life/16/3/make-music-raspberry-pi-milkytracker +[26]: https://opensource.com/resources/cloud +[27]: https://opensource.com/article/19/6/how-ssh-running-container +[28]: https://linuxcontainers.org/lxd/try-it/ +[29]: https://opensource.com/article/18/11/behind-scenes-linux-containers +[30]: https://virtualbox.org +[31]: https://opensource.com/sites/default/files/uploads/fedora-silverblue.png (Fedora Silverblue) From cc0065652d28f768144f883989a996213512415e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 9 Jul 2019 00:55:27 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190708=20The=20ca?= =?UTF-8?q?se=20for=20making=20the=20transition=20from=20sysadmin=20to=20D?= =?UTF-8?q?evOps=20engineer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20190708 The case for making the transition from sysadmin to DevOps engineer.md --- ...sition from sysadmin to DevOps engineer.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20190708 The case for making the transition from sysadmin to DevOps engineer.md diff --git a/sources/tech/20190708 The case for making the transition from sysadmin to DevOps engineer.md b/sources/tech/20190708 The case for making the transition from sysadmin to DevOps engineer.md new file mode 100644 index 0000000000..a786b77797 --- /dev/null +++ b/sources/tech/20190708 The case for making the transition from sysadmin to DevOps engineer.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The case for making the transition from sysadmin to DevOps engineer) +[#]: via: (https://opensource.com/article/19/7/devops-vs-sysadmin) +[#]: author: (Taz Brown https://opensource.com/users/heronthecli) + +The case for making the transition from sysadmin to DevOps engineer +====== +There's a learning curve, but there's no time like the present to get +started. +![Different color butterflies][1] + +The year is 2019, and [DevOps][2] is the hot topic. The day of the system administrator (sysadmin) has gone the way of mainframes if you will—but really, has it? The landscape has shifted as it so often does in technology. There is now this thing called DevOps, which can’t exist without Ops. + +I considered myself on the Ops side of the aisle prior to the evolution of DevOps as we know today. As a system administrator or engineer, it feels like you are stuck in a time warp, with a small tinge of fear because what you knew and must learn varies greatly, and is now much more time-sensitive than you might have anticipated. + +![Sysadmin/DevOps workstation][3] + +Why is this situation a problem? Well, it is not so much a problem as it is a bit of a barrier, at first. Web-scale products are built on Linux and other open source software, and the market for skilled professionals to maintain them is drying up. The demand has surpassed the available pool of talent. As a system administrator, you can no longer continue to operate at your current skill level. You need automation skills to manage large server/node environments, as well as to understand how everything works so you know what’s going wrong, and when and how to heal said environments. + +The path you must follow to get to DevOps is paved with many twists and turns as you learn the new technologies and tools needed to support the ever-changing environments the new DevOps way. So what is it like, or how can one transition from the system administrator mentality and world to the way of DevOps? Not surprisingly, this process begins with your thinking. It is not easy to change the way you have been doing things the last 10 or 20 years, but it’s mandatory. + +To start, embrace the idea that DevOps is not a position, but a set of practices. These practices lead to cohesion, breaking down silos, mitigating mistakes and bugs, more frequent and timely software life cycles, better communication between Dev and Ops, and constant testing and retesting for not only the code but the whole [continuous integration and delivery (CI/CD)][4] process. + +Along with changing your mindset comes acquiring the necessary skills in order to sustain and support your infrastructure, and ensure its reliability and availability to continuously integrate and deliver applications, services, and software. + +One area that you, as an Ops person, may be lacking is programming or coding skills. The way that sysadmins script as part of automating server patching, managing user accounts and files, and troubleshooting and documenting problems, is considered somewhat antiquated. Though scripting is still used on a smaller scale today, DevOps is about large-scale implementation, testing, building, and deploying. + +When you address automation, you have to address your probable weaknesses, which can be intimidating with the evolution of DevOps and [infrastructure automation][5] requiring that you be programmatic when you are not a developer. + +What’s the solution? You have to learn at least one programming language—such as Python—in order to stay relevant and competitive. It can be hard as an Ops professional, though, to shake the feeling that programming is for developers, and while you don’t have to acquire expert programming knowledge, it’s advantageous to know how to script, whether it be in Python, Bash, or even [Powershell][6]. + +Learning some programming so you aren’t in the weeds when working with the developers on the DevOps team, or with a client as a consultant, will demand your time and attention. Whether it’s 30 minutes or an hour a day, learning this skill has to become a priority. + +While there are common tasks among sysadmins and DevOps, there are some vital differences. Some have argued that a _sysadmin_ is more focused on configuring, maintaining, and keeping servers computer systems up and that while a _DevOps_-principled engineer can do everything a _sysadmin_ does, a _sysadmin_ cannot do everything a _DevOps_-principled engineer does. + +Does this opinion hold water? + +### System administration: One is the loneliest number + +While this article discusses the differences and similarities between system administration and DevOps, my belief is that there are really no major differences between them. System administrators have always performed the functions that DevOps have; they just didn’t call it DevOps back then. I think it’s important not to differentiate things for the sake of differentiating when it’s not entirely called for at all. You have to remember that DevOps is not a job title or position as a system administrator is, but a descriptor. + +I have to mention this because it would do DevOps and system administration a disservice not to point this out: System administration, in its traditional sense, involves possessing a certain set of skills and a focus on differing infrastructures. Not a one glove fits all proposition, but there are many common functional tasks carried out by sysadmins. + +Some of the traditional sysadmin tasks include being a handyman or woman of sorts, with no specialization. You might be the only sysadmin in your organization, so you are a Jack or Jill of all trades. You do everything from maintaining the printers and copy machines to performing network-related tasks like configuring and managing routers and switches, as well as setting firewall policies and rules. + +You are also responsible for upgrading hardware, checking and analyzing logs, security auditing, patching servers, troubleshooting, performing root cause analysis, and automating—usually through PowerShell scripting, Python, or Bash scripting. One example of [scripting][7] is with user and group account management. Creating users and setting permissions can be a tedious task since users come and go almost every day. Scripting means freeing up more time for larger scale infrastructure projects like switch and server refreshes, and other revenue-generating projects, though IT is often perceived to be a cost center. + +The goal of a sysadmin is not to waste time, and to save money any and every way possible. There are also sysadmins that work as part of a larger team with, say, Linux admins, Windows admins, database admins, storage admins, and so on. You might be on a traditional follow-the-sun schedule, or maybe a traditional 9 to 5 schedule, or maybe you work in a 24-hour datacenter. + +Sysadmins have had to evolve their state of mind over the years and think more strategically, considering the business in unison with their day-to-day responsibilities. The teams and departments they work with are challenged by lack of resources while trying to constantly stay aligned with the day-to-day business parameters. + +### DevOps: Development and operations are one + +[DevOps][8] is considered to be a philosophy in which IT, operations (Ops), and development is done. This way of looking at things is arguably the biggest game-changer to IT. Under the umbrella of DevOps are a team of software developers on one side of the aisle, and a team of operations folks on the other. Huddled in the same area are likely a product management team, a QA team, and a UX design team. These teams combine strengths to streamline and stabilize operations for rolling out new apps, and update the code to support and improve the whole business. + +At the core of DevOps is the software lifecycle development process. As operations is responsible for supporting developers, developers are tasked with knowing more than just the APIs that execute on the systems and their operating systems. They must also understand what’s under the hood and running their software—the hardware and operating system(s)—so they can better handle bug issues, solve problems, and communicate with operations. + +Sysadmins have the ability to transition to a DevOps team, as long as they are willing to learn current and emerging technologies, and are open to innovative ideas and solutions. These sysadmins don’t have to be full-blown programmers if they come from a traditional operations background, but learning a programming language like Ruby, Python, or Go will help to galvanize their place on the DevOps team. While sysadmins have traditionally been more alone in their day-to-day work and often thought of as loners, this is the complete opposite experience needed for an agile team applying DevOps principles. + +The topic of automation has become more and more important. Both sysadmins and DevOps are interested in scaling quickly, reducing errors, and finding and resolving existing errors fast. So automation is a similarity among these two fields. Sysadmins are responsible for cloud services like AWS, Azure, and Google Cloud Platform. They have to understand CI/CD pipelines and how to carry them out by using [Jenkins][9], for instance. + +Also, sysadmins need to use configuration and orchestration tools like [Ansible][10], which is used to deploy ten or twenty servers in parallel. The premise is [Infrastructure as Code][11]. Everything is software, and software is everything. Essentially, some rethinking is necessary if the sysadmin of the future is to remain relevant. SysAdmins come from the Ops side and have to be able to effectively work with developers and vice versa. Two heads are definitely better than one. + +One last important piece of the puzzle is [Git][12]. Git has not traditionally been a part of a sysadmin's day-to-day responsibilities. This version control management system is used heavily by software engineering teams, DevOps, development teams, agile teams, and more. If you are working within the software lifecycle development process, you will work with it. + +Git is vast. You might never learn every Git command, but you will come to understand that this tool is the nucleus of collaboration, communication, and software production. Having a fundamental knowledge of Git will be important if you are on a DevOps team. + +If you are a sysadmin, you will need to level up your Git knowledge, understand the psychology of version control, and learn those common commands like **git status**, **git commit -m**, **git add**, **git pull**, **git push**, **git rebase**, **git branch**, **git diff**, and beyond. There are plenty of online training courses and books on the subject so that you can go from a novice to a pro with some dedicated focus. There are also [Git cheat sheets][13] out there as well so you don’t have to remember every command, but the more you use Git the better for you. + +### Conclusion + +Ultimately, it's up to you whether you want to remain a sysadmin or transition to DevOps. As you can see, there's a learning curve, but there's no time like the present to get started. Pick a programming language to learn, and while you're learning it, take advantage of the chance to [learn Git][14], a CI/CD tool like [Jenkins][15], and a Configuration and IT Automation tool like [Ansible][16]. Whatever you decide, make sure to always be learning and labbing. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/devops-vs-sysadmin + +作者:[Taz 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/heronthecli +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion.png?itok=msS3ceW4 (Different color butterflies) +[2]: https://opensource.com/resources/devops +[3]: https://opensource.com/sites/default/files/uploads/sysadmindevopsworkstation_600px.png (Sysadmin/DevOps workstation) +[4]: https://en.wikipedia.org/wiki/CI/CD +[5]: https://www.ibm.com/developerworks/library/a-devops2/index.html +[6]: https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-6 +[7]: https://www.geeksforgeeks.org/introduction-to-scripting-languages/ +[8]: https://devops.com/ +[9]: https://jenkins.io/ +[10]: https://en.wikipedia.org/wiki/Ansible_(software) +[11]: https://en.wikipedia.org/wiki/Infrastructure_as_code +[12]: https://git-scm.com/ +[13]: https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf +[14]: https://opensource.com/life/16/7/stumbling-git +[15]: https://opensource.com/article/18/11/getting-started-jenkins-x +[16]: https://opensource.com/article/19/2/quickstart-guide-ansible From 4e6092d3b5c739bf8db8861242aefdeff54c2c16 Mon Sep 17 00:00:00 2001 From: Beini Gu Date: Mon, 8 Jul 2019 13:42:21 -0400 Subject: [PATCH 09/15] Update 20190510 Learn to change history with git rebase.md --- .../tech/20190510 Learn to change history with git rebase.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6652a67875..4d46fef81f 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 @@ -2,7 +2,7 @@ Translating by Scoutydren.... [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Scoutydren) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From eca989fd101177832de12eaa7adfb1eb56faf3b8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 9 Jul 2019 08:52:10 +0800 Subject: [PATCH 10/15] translated --- ...te at the Linux command line with xclip.md | 99 ------------------- ...te at the Linux command line with xclip.md | 99 +++++++++++++++++++ 2 files changed, 99 insertions(+), 99 deletions(-) delete mode 100644 sources/tech/20190705 Copy and paste at the Linux command line with xclip.md create mode 100644 translated/tech/20190705 Copy and paste at the Linux command line with xclip.md diff --git a/sources/tech/20190705 Copy and paste at the Linux command line with xclip.md b/sources/tech/20190705 Copy and paste at the Linux command line with xclip.md deleted file mode 100644 index f13bfe6479..0000000000 --- a/sources/tech/20190705 Copy and paste at the Linux command line with xclip.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Copy and paste at the Linux command line with xclip) -[#]: via: (https://opensource.com/article/19/7/xclip) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Copy and paste at the Linux command line with xclip -====== -Learn how to get started with the Linux xclip utility. -![Green paperclips][1] - -How do you usually copy all or part of a text file when working on the Linux desktop? Chances are you open the file in a text editor, select all or just the text you want to copy, and paste it somewhere else. - -That works. But you can do the job a bit more efficiently at the command line using the [xclip][2] utility. xclip provides a conduit between commands you run in a terminal window and the clipboard in a Linux graphical desktop environment. - -### Installing xclip - -xclip isn't standard kit with many Linux distributions. To see if it's installed on your computer, open a terminal window and type **which xclip**. If that command returns output like _/usr/bin/xclip_, then you're ready to go. Otherwise, you need to install xclip. - -To do that, use your distribution's package manager. Or, if you're adventurous, [grab the source code][2] from GitHub and compile it yourself. - -### Doing the basics - -Let's say you want to copy the contents of a file to the clipboard. There are two ways to do that with xclip. Type either: - - -``` -`xclip file_name` -``` - -or - - -``` -`xclip -sel clip file_name` -``` - -What's the difference between the two commands (aside from the second one being longer)? The first command works if you use the middle button on the mouse to paste text. However, not everyone does. Many people are conditioned to use a right-click menu or to press Ctrl+V to paste text. If you're one of those people (I am!), using the **-sel clip** option ensures you can paste what you want to paste. - -### Using xclip with other applications - -Copying the contents of a file directly to the clipboard is a neat parlor trick. Chances are, you won't be doing that very often. There are other ways you can use xclip, and those involve pairing it with another command-line application. - -That pairing is done with a _pipe_ (|). The pipe redirects the output of one command line application to another. Doing that opens several possibilities. Let's take a look at three of them. - -Say you're a system administrator and you need to copy the last 30 lines of a log file into a bug report. Opening the file in a text editor, scrolling down to the end, and copying and pasting is a bit of work. Why not use xclip and the [tail][3] utility to quickly and easily do the deed? Run this command to copy those last 30 lines: - - -``` -`tail -n 30 logfile.log | xclip -sel clip` -``` - -Quite a bit of my writing goes into some content management system (CMS) or another for publishing on the web. However, I never use a CMS's WYSIWYG editor to write—I write offline in [plain text][4] formatted with [Markdown][5]. That said, many of those editors have an HTML mode. By using this command, I can convert a Markdown-formatted file to HTML using [Pandoc][6] and copy it to the clipboard in one fell swoop: - - -``` -`pandoc -t html file.md | xclip -sel clip` -``` - -From there, I paste away. - -Two of my websites are hosted using [GitLab Pages][7]. I generate the HTTPS certificates for those sites using a tool called [Certbot][8], and I need to copy the certificate for each site to GitLab whenever I renew it. Combining the [cat][9] command and xclip is faster and more efficient than using an editor. For example: - - -``` -`cat /etc/letsencrypt/live/website/fullchain.pem | xclip -sel clip` -``` - -Is that all you can do with xclip? Definitely not. I'm sure you can find more uses to fit your needs. - -### Final thoughts - -Not everyone will use xclip. That's fine. It is, however, one of those little utilities that really comes in handy when you need it. And, as I've discovered on a few occasions, you don't know when you'll need it. When that time comes, you'll be glad xclip is there. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/xclip - -作者:[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/life_paperclips.png?itok=j48op49T (Green paperclips) -[2]: https://github.com/astrand/xclip -[3]: https://en.wikipedia.org/wiki/Tail_(Unix) -[4]: https://plaintextproject.online -[5]: https://gumroad.com/l/learnmarkdown -[6]: https://pandoc.org -[7]: https://docs.gitlab.com/ee/user/project/pages/ -[8]: https://certbot.eff.org/ -[9]: https://en.wikipedia.org/wiki/Cat_(Unix) diff --git a/translated/tech/20190705 Copy and paste at the Linux command line with xclip.md b/translated/tech/20190705 Copy and paste at the Linux command line with xclip.md new file mode 100644 index 0000000000..e96ab6311a --- /dev/null +++ b/translated/tech/20190705 Copy and paste at the Linux command line with xclip.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Copy and paste at the Linux command line with xclip) +[#]: via: (https://opensource.com/article/19/7/xclip) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +使用 xclip 在 Linux 命令行中复制粘贴 +====== +了解如何在 Linux 中使用 xclip。 +![Green paperclips][1] + +在使用 Linux 桌面工作时,你通常如何复制全部或部分文本?你可能会在文本编辑器中打开文件,选择全部或仅选择要复制的文本,然后将其粘贴到其他位置。 + +这样没问题。但是你可以使用 [xclip][2] 在命令行中更有效地完成工作。xclip 提供了在终端窗口中运行的命令与 Linux 图形桌面环境中的剪贴板之间的管道。 + +### 安装 xclip + +xclip 并不是许多 Linux 发行版的标准套件。要查看它是否已安装在你的计算机上,请打开终端窗口并输入 **which xclip**。如果该命令返回像 _/usr/bin/xclip_ 这样的输出,那么你可以开始使用了。否则,你需要安装 xclip。 + +为此,请使用你的发行版的包管理器。如果你喜欢冒险,你可以[从 GitHub 获取源代码][2]并自己编译。 + +### 基础使用 + +假设你要将文件的内容复制到剪贴板。在 xclip 中可以使用两种方法。输入: + + +``` +`xclip file_name` +``` + +或者 + + +``` +`xclip -sel clip file_name` +``` + +两个命令之间有什么区别(除了第二个命令更长)?第一个命令在你如果使用鼠标中键粘贴的情况下有效。但是,不是每个人都这样做。许多人习惯使用右键单击菜单或按 Ctrl+V 粘贴文本。如果你时其中之一(我就是!),使用 **-sel clip** 选项可确保你可以粘贴要粘贴的内容。 + +### 将 xclip 与其他应用一起使用 + +将文件内容直接复制到剪贴板是个巧妙的技巧。很可能你不会经常这样做。还有其他方法可以使用 xclip,其中包括将其与另一个命令行程序结合。 + +结合是用_管道_(|)完成的。管道将一个命令行程序的输出重定向到另一个命令行程序。这样我们就会有更多的可能性,我们来看看其中的三个。 + +假设你是系统管理员,你需要将日志文件的最后 30 行复制到 bug 报告中。在文本编辑器中打开文件,向下滚动到最后,复制和粘贴有一点工作量。为什么不使用 xclip 和 [tail][3] 来快速轻松地完成?运行此命令以复制最后 30 行: + + +``` +`tail -n 30 logfile.log | xclip -sel clip` +``` + +我的写作有相当一部分用于内容管理系统 (CMS) 或者在其他网络中发布。但是,我从不使用 CMS 的 WYSIWYG 编辑器来编写 - 我离线采用 [Markdown][5] 格式编写[纯文本][4]。也就是说,许多编辑器都有 HTML 模式。通过使用此命令,我可以使用 [Pandoc][6] 将 Markdown 格式的文件转换为 HTML 并将其一次性复制到剪贴板: + + +``` +`pandoc -t html file.md | xclip -sel clip` +``` + +在其他地方,我粘贴完成。 + +我的两个网站使用 [GitLab Pages][7 ]托管。我使用名为 [Certbot][8] 的工具为这些站点生成 HTTPS 证书,每当我更新它时,我需要将每个站点的证书复制到 GitLab。结合 [cat][9] 命令和 xclip 比使用编辑器更快,更有效。例如: + + +``` +`cat /etc/letsencrypt/live/website/fullchain.pem | xclip -sel clip` +``` + +这就是全部可以用 xclip 做的事么?当然不是。我相信你可以找到更多用途来满足你的需求。 + +### 最后总结 + +不是每个人都会使用 xclip。没关系。然而,它是一个在你需要它时非常方便的一个小工具。而且,正如我几次发现的那样,你不知道什么时候需要它。等到时候,你会很高兴 xclip 在那里。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/xclip + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_paperclips.png?itok=j48op49T (Green paperclips) +[2]: https://github.com/astrand/xclip +[3]: https://en.wikipedia.org/wiki/Tail_(Unix) +[4]: https://plaintextproject.online +[5]: https://gumroad.com/l/learnmarkdown +[6]: https://pandoc.org +[7]: https://docs.gitlab.com/ee/user/project/pages/ +[8]: https://certbot.eff.org/ +[9]: https://en.wikipedia.org/wiki/Cat_(Unix) From 588a8bdda993c8e0cc121238ecc01fd12b163780 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 9 Jul 2019 09:04:00 +0800 Subject: [PATCH 11/15] translating --- ...ormance Boost for AMD GPUs Thanks to Valve-s New Compiler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190708 Linux Games Get A Performance Boost for AMD GPUs Thanks to Valve-s New Compiler.md b/sources/tech/20190708 Linux Games Get A Performance Boost for AMD GPUs Thanks to Valve-s New Compiler.md index be3aa49c65..0fa5882385 100644 --- a/sources/tech/20190708 Linux Games Get A Performance Boost for AMD GPUs Thanks to Valve-s New Compiler.md +++ b/sources/tech/20190708 Linux Games Get A Performance Boost for AMD GPUs Thanks to Valve-s New Compiler.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9569c73a488ec9fa6ac0a3d81601ded7ba2b738f Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 9 Jul 2019 09:57:50 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190630=20Data=20S?= =?UTF-8?q?till=20Dominates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20190630 Data Still Dominates.md --- sources/talk/20190630 Data Still Dominates.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/talk/20190630 Data Still Dominates.md diff --git a/sources/talk/20190630 Data Still Dominates.md b/sources/talk/20190630 Data Still Dominates.md new file mode 100644 index 0000000000..e9a86acf68 --- /dev/null +++ b/sources/talk/20190630 Data Still Dominates.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data Still Dominates) +[#]: via: (https://theartofmachinery.com/2019/06/30/data_still_dominates.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Data Still Dominates +====== + +Here’s [a quote from Linus Torvalds in 2006][1]: + +> I’m a huge proponent of designing your code around the data, rather than the other way around, and I think it’s one of the reasons git has been fairly successful… I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships. + +Which sounds a lot like [Eric Raymond’s “Rule of Representation” from 2003][2]: + +> Fold knowledge into data, so program logic can be stupid and robust. + +Which was just his summary of ideas like [this one from Rob Pike in 1989][3]: + +> Data dominates. If you’ve chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming. + +Which cites [Fred Brooks from 1975][4]: + +> ### Representation is the Essence of Programming +> +> Beyond craftmanship lies invention, and it is here that lean, spare, fast programs are born. Almost always these are the result of strategic breakthrough rather than tactical cleverness. Sometimes the strategic breakthrough will be a new algorithm, such as the Cooley-Tukey Fast Fourier Transform or the substitution of an n log n sort for an n2 set of comparisons. +> +> Much more often, strategic breakthrough will come from redoing the representation of the data or tables. This is where the heart of your program lies. Show me your flowcharts and conceal your tables, and I shall be continued to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious. + +So, smart people have been saying this again and again for nearly half a century: focus on the data first. But sometimes it feels like the most famous piece of smart programming advice that everyone forgets. + +Let me give some real examples. + +### The Highly Scalable System that Couldn’t + +This system was designed from the start to handle CPU-intensive loads with incredible scalability. Nothing was synchronous. Everything was done with callbacks, task queues and worker pools. + +But there were two problems: The first was that the “CPU-intensive load” turned out not to be that CPU-intensive after all — a single task took a few milliseconds at worst. So most of the architecture was doing more harm than good. The second problem was that although it sounded like a highly scalable distributed system, it wasn’t one — it only ran on one machine. Why? Because all communication between asynchronous components was done using files on the local filesystem, which was now the bottleneck for any scaling. The original design didn’t say much about data at all, except to advocate local files in the name of “simplicity”. Most of the document was about all the extra architecture that was “obviously” needed to handle the “CPU-intensiveness” of the load. + +### The Service-Oriented Architecture that was Still Data-Oriented + +This system followed a microservices design, made up of single-purpose apps with REST-style APIs. One component was a database that stored documents (basically responses to standard forms, and other electronic paperwork). Naturally it exposed an API for basic storage and retrieval, but pretty quickly there was a need for more complex search functionality. The designers felt that adding this search functionality to the existing document API would have gone against the principles of microservices design. They could talk about “search” as being a different kind of service from “get/put”, so their architecture shouldn’t couple them together. Besides, the tool they were planning to use for search indexing was separate from the database itself, so creating a new service made sense for implementation, too. + +In the end, a search API was created containing a search index that was essentially a duplicate of the data in the main database. This data was being updated dynamically, so any component that mutated document data through the main database API had to also update the search API. It’s impossible to do this with REST APIs without race conditions, so the two sets of data kept going out of sync every now and then, anyway. + +Despite what the architecture diagram promised, the two APIs were tightly coupled through their data dependencies. Later on it was recognised that the search index should be an implementation detail of a unified document service, and this made the system much more maintainable. “Do one thing” works at the data level, not the verb level. + +### The Fantastically Modular and Configurable Ball of Mud + +This system was a kind of automated deployment pipeline. The original designers wanted to make a tool that was flexible enough to solve deployment problems across the company. It was written as a set of pluggable components, with a configuration file system that not only configured the components, but acted as a [DSL][5] for programming how the components fitted into the pipeline. + +Fast forward a few years and it’s turned into “that program”. There was a long list of known bugs that no one was ever fixing. No one wanted to touch the code out of fear of breaking things. No one used any of the flexibility of the DSL. Everyone who used the program copy-pasted the same known-working configuration that everyone else used. + +What had gone wrong? Although the original design document used words like “modular”, “decoupled”, “extensible” and “configurable” a lot, it never said anything about data. So, data dependencies between components ended up being handled in an ad-hoc way using a globally shared blob of JSON. Over time, components made more and more undocumented assumptions about what was in or not in the JSON blob. Sure, the DSL allowed rearranging components into any order, but most configurations didn’t work. + +### Lessons + +I chose these three examples because they’re easy to explain, not to pick on others. I once tried to build a website, and failed trying to instead build some cringe-worthy XML database that didn’t even solve the data problems I had. Then there’s the project that turned into a broken mockery of half the functionality of `make`, again because I didn’t think about what I really needed. I wrote a post before based on a time I wrote [a castle-in-the-sky OOP class hierarchy that should have been encoded in data instead][6]. + +Update: + +Apparently many people still thought I wrote this to make fun of others. People who’ve actually worked with me will know I’m much more interested in the things I’m fixing than in blaming the people who did most of the work building them, but, okay, here’s what I think of the engineers involved. + +Honestly, the first example obviously happened because the designer was more interested in bringing a science project to work than in solving the problem at hand. Most of us have done that (mea culpa), but it’s really annoying to our colleagues who’ll probably have to help maintain them when we’re bored of them. If this sounds like you, please don’t get offended; please just stop. (I’d still rather work on the single-node distributed system than anything built around my “XML database”.) + +There’s nothing personal in the second example. Sometimes it feels like everyone is talking about how wonderful it is to split up services, but no one is talking about exactly when not to. People are learning the hard way all the time. + +The third example was actually from some of the smartest people I’ve ever had the chance to work with. + +(End update.) + +“Does this talk about the problems created by data?” turns out to be a pretty useful litmus test for good systems design. It’s also pretty handy for detecting false expert advice. The hard, messy systems design problems are data problems, so false experts love to ignore them. They’ll show you a wonderfully beautiful architecture, but without talking about what kind of data it’s appropriate for, and (crucially) what kind of data it isn’t. + +For example, a false expert might tell you that you should use a pub/sub system because pub/sub systems are loosely coupled, and loosely coupled components are more maintainable. That sounds nice and results in pretty diagrams, but it’s backwards thinking. Pub/sub doesn’t _make_ your components loosely coupled; pub/sub _is_ loosely coupled, which may or may not match your data needs. + +On the flip side, a well-designed data-oriented architecture goes a long way. Functional programming, service meshes, RPCs, design patterns, event loops, whatever, all have their merits, but personally I’ve seen tools like [boring old databases][7] be responsible for a lot more successfully shipped software. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2019/06/30/data_still_dominates.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://lwn.net/Articles/193245/ +[2]: http://www.catb.org/~esr/writings/taoup/html/ch01s06.html +[3]: http://doc.cat-v.org/bell_labs/pikestyle +[4]: https://archive.org/stream/mythicalmanmonth00fred/mythicalmanmonth00fred_djvu.txt +[5]: https://martinfowler.com/books/dsl.html +[6]: https://theartofmachinery.com/2016/06/21/code_vs_data.html +[7]: https://theartofmachinery.com/2017/10/28/rdbs_considered_useful.html From 6ba7de6c34bbf0d40fe1485184d04fb353038058 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 9 Jul 2019 10:00:41 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190625=20The=20co?= =?UTF-8?q?st=20of=20JavaScript=20in=202019=20=C2=B7=20V8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20190625 The cost of JavaScript in 2019 - V8.md --- ...625 The cost of JavaScript in 2019 - V8.md | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 sources/tech/20190625 The cost of JavaScript in 2019 - V8.md diff --git a/sources/tech/20190625 The cost of JavaScript in 2019 - V8.md b/sources/tech/20190625 The cost of JavaScript in 2019 - V8.md new file mode 100644 index 0000000000..e21eefd5ad --- /dev/null +++ b/sources/tech/20190625 The cost of JavaScript in 2019 - V8.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The cost of JavaScript in 2019 · V8) +[#]: via: (https://v8.dev/blog/cost-of-javascript-2019) +[#]: author: (Addy Osmani https://twitter.com/addyosmani) + +The cost of JavaScript in 2019 · V8 +====== +**Note:** If you prefer watching a presentation over reading articles, then enjoy the video below! If not, skip the video and read on. + +[“The cost of JavaScript”][1] as presented by Addy Osmani at #PerfMatters Conference 2019. + +One large change to [the cost of JavaScript][2] over the last few years has been an improvement in how fast browsers can parse and compile script. **In 2019, the dominant costs of processing scripts are now download and CPU execution time.** + +User interaction can be delayed if the browser’s main thread is busy executing JavaScript, so optimizing bottlenecks with script execution time and network can be impactful. + +### Actionable high-level guidance # + +What does this mean for web developers? Parse & compile costs are **no longer as slow** as we once thought. The three things to focus on for JavaScript bundles are: + + * **Improve download time** + * Keep your JavaScript bundles small, especially for mobile devices. Small bundles improve download speeds, lower memory usage, and reduce CPU costs. + * Avoid having just a single large bundle; if a bundle exceeds ~50–100 kB, split it up into separate smaller bundles. (With HTTP/2 multiplexing, multiple request and response messages can be in flight at the same time, reducing the overhead of additional requests.) + * On mobile you’ll want to ship much less especially because of network speeds, but also to keep plain memory usage low. + * **Improve execution time** + * Avoid [Long Tasks][3] that can keep the main thread busy and can push out how soon pages are interactive. Post-download, script execution time is now a dominant cost. + * **Avoid large inline scripts** (as they’re still parsed and compiled on the main thread). A good rule of thumb is: if the script is over 1 kB, avoid inlining it (also because 1 kB is when [code caching][4] kicks in for external scripts). + + + +### Why does download and execution time matter? # + +Why is it important to optimize download and execution times? Download times are critical for low-end networks. Despite the growth in 4G (and even 5G) across the world, our [effective connection types][5] remain inconsistent with many of us running into speeds that feel like 3G (or worse) when we’re on the go. + +JavaScript execution time is important for phones with slow CPUs. Due to differences in CPU, GPU, and thermal throttling, there are huge disparities between the performance of high-end and low-end phones. This matters for the performance of JavaScript, as execution is CPU-bound. + +In fact, of the total time a page spends loading in a browser like Chrome, anywhere up to 30% of that time can be spent in JavaScript execution. Below is a page load from a site with a pretty typical workload (Reddit.com) on a high-end desktop machine:![][6]JavaScript processing represents 10–30% of time spent in V8 during page load. + +On mobile, it takes 3–4× longer for a median phone (Moto G4) to execute Reddit’s JavaScript compared to a high-end device (Pixel 3), and over 6× as long on a low-end device (the <$100 Alcatel 1X):![][7]The cost of Reddit’s JavaScript across a few different device classes (low-end, average, and high-end) + +**Note:** Reddit has different experiences for desktop and mobile web, and so the MacBook Pro results cannot be compared to the other results. + +When you’re trying to optimize JavaScript execution time, keep an eye out for [Long Tasks][8] that might be monopolizing the UI thread for long periods of time. These can block critical tasks from executing even if the page looks visually ready. Break these up into smaller tasks. By splitting up your code and prioritizing the order in which it is loaded, you can get pages interactive faster and hopefully have lower input latency.![][9]Long tasks monopolize the main thread. You should break them up. + +### What has V8 done to improve parse/compile? # + +Raw JavaScript parsing speed in V8 has increased 2× since Chrome 60. At the same time, raw parse (and compile) cost has become less visible/important due to other optimization work in Chrome that parallelizes it. + +V8 has reduced the amount of parsing and compilation work on the main thread by an average of 40% (e.g. 46% on Facebook, 62% on Pinterest) with the highest improvement being 81% (YouTube), by parsing and compiling on a worker thread. This is in addition to the existing off-main-thread streaming parse/compile.![][10]V8 parse times across different versions + +We can also visualize the CPU time impact of these changes across different versions of V8 across Chrome releases. In the same amount of time it took Chrome 61 to parse Facebook’s JS, Chrome 75 can now parse both Facebook’s JS AND 6 times Twitter’s JS.![][11]In the time it took Chrome 61 to parse Facebook’s JS, Chrome 75 can now parse both Facebook’s JS and 6 times Twitter’s JS. + +Let’s dive into how these changes were unlocked. In short, script resources can be streaming-parsed and-compiled on a worker thread, meaning: + + * V8 can parse+compile JavaScript without blocking the main thread. + * Streaming starts once the full HTML parser encounters a `